You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

74 lines
2.0 KiB

1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
  1. #include "board.h"
  2. #include "nrf_delay.h"
  3. #include "project_cfg.h"
  4. #include "sys.h"
  5. #include "version.h"
  6. #include "zble_service.h"
  7. zble_service_cfg_t cfg = {.deviceName = "iflytop"};
  8. #if 0
  9. void developer_test(void) {
  10. // 测试LED
  11. debug_light_init(DEBUG_LIGHT_IO_INDEX);
  12. // 测试BUTTON
  13. uint8_t io_index[] = {11, 12, 24};
  14. zbsp_gpio_state_monitor(1000, (uint8_t*)io_index, ZARRAY_SIZE(io_index));
  15. // 测试睡眠唤醒
  16. zbsp_enter_sleep(3000, 11, true);
  17. }
  18. #endif
  19. // #define BUTTON_1
  20. // #define BUTTON_2
  21. void qingfengboard_test(void) {
  22. // 测试LED
  23. debug_light_init(15);
  24. // 测试BUTTON
  25. static uint8_t io_index[] = {ZPIN(0, 5), ZPIN(1, 9)};
  26. zbsp_gpio_state_monitor(1000, (uint8_t*)io_index, ZARRAY_SIZE(io_index));
  27. // 测试睡眠唤醒
  28. zbsp_enter_sleep(3000, 5, true);
  29. }
  30. int main(void) {
  31. // zsys_init();
  32. // NRF_LOG_INFO("compile time :%s", __TIME__);
  33. // NRF_LOG_INFO("Version :%d", VERSION);
  34. // NRF_LOG_INFO("Manufacturer :%s", MANUFACTURER_NAME);
  35. /*******************************************************************************
  36. * *
  37. *******************************************************************************/
  38. // qingfengboard_test();
  39. // ret_code_t err_code = NRF_LOG_INIT(NULL);
  40. // APP_ERROR_CHECK(err_code);
  41. // NRF_LOG_DEFAULT_BACKENDS_INIT();
  42. nrf_pwr_mgmt_init();
  43. nrf_gpio_cfg(15, //
  44. NRF_GPIO_PIN_DIR_OUTPUT, //
  45. NRF_GPIO_PIN_INPUT_DISCONNECT, //
  46. NRF_GPIO_PIN_PULLUP, //
  47. NRF_GPIO_PIN_S0S1, //
  48. NRF_GPIO_PIN_NOSENSE);
  49. nrf_delay_ms(1000);
  50. for (size_t i = 0; i < 3; i++) {
  51. nrf_gpio_pin_set(15);
  52. nrf_delay_ms(300);
  53. nrf_gpio_pin_clear(15);
  54. nrf_delay_ms(300);
  55. }
  56. sd_power_system_off();
  57. for (size_t i = 0; i < 3; i++) {
  58. nrf_gpio_pin_set(15);
  59. nrf_delay_ms(100);
  60. nrf_gpio_pin_clear(15);
  61. nrf_delay_ms(100);
  62. }
  63. zsys_loop();
  64. }