diff --git a/README.md b/README.md index 948aef6..d446a89 100644 --- a/README.md +++ b/README.md @@ -22,4 +22,8 @@ https://iflytop1.feishu.cn/wiki/Fp0fwciUEibtm4kaUeXcraOCneg sdk\components\boards\pca10100.h +清风开发板 + + + ``` \ No newline at end of file diff --git a/app/app.uvoptx b/app/app.uvoptx index ed3dfe2..3b0a333 100644 --- a/app/app.uvoptx +++ b/app/app.uvoptx @@ -253,7 +253,7 @@ 0 - 1 + 0 0 0 diff --git a/app/main.c b/app/main.c index d24b0a3..d8796f7 100644 --- a/app/main.c +++ b/app/main.c @@ -6,17 +6,43 @@ zble_service_cfg_t cfg = {.deviceName = "iflytop"}; +#if 0 +void developer_test(void) { + // 测试LED + debug_light_init(DEBUG_LIGHT_IO_INDEX); + + // 测试BUTTON + uint8_t io_index[] = {11, 12, 24}; + zbsp_gpio_state_monitor(1000, (uint8_t*)io_index, ZARRAY_SIZE(io_index)); + + // 测试睡眠唤醒 + zbsp_enter_sleep(3000, 11, true); +} +#endif +// #define BUTTON_1 +// #define BUTTON_2 +void qingfengboard_test(void) { + // 测试LED + debug_light_init(15); + + // 测试BUTTON + static uint8_t io_index[] = {ZPIN(0, 5), ZPIN(1, 9)}; + zbsp_gpio_state_monitor(1000, (uint8_t*)io_index, ZARRAY_SIZE(io_index)); + + // 测试睡眠唤醒 + // zbsp_enter_sleep(3000, 5, true); +} + int main(void) { zsys_init(); - debug_light_init(DEBUG_LIGHT_IO_INDEX); // - NRF_LOG_INFO("compile time :%s", __TIME__); NRF_LOG_INFO("Version :%d", VERSION); NRF_LOG_INFO("Manufacturer :%s", MANUFACTURER_NAME); - uint8_t io_index[] = {11, 12, 24}; - zbsp_gpio_state_monitor(1000, (uint8_t*)io_index, ZARRAY_SIZE(io_index)); - + /******************************************************************************* + * 开发板测试 * + *******************************************************************************/ + qingfengboard_test(); zsys_loop(); } diff --git a/app/src/board.c b/app/src/board.c index 252b54c..389bc2d 100644 --- a/app/src/board.c +++ b/app/src/board.c @@ -25,7 +25,7 @@ void debug_light_init(int io_index) { nrf_gpio_cfg(m_debug_light_io_index, // NRF_GPIO_PIN_DIR_OUTPUT, // NRF_GPIO_PIN_INPUT_DISCONNECT, // - NRF_GPIO_PIN_NOPULL, // + NRF_GPIO_PIN_PULLUP, // NRF_GPIO_PIN_S0S1, // NRF_GPIO_PIN_NOSENSE); @@ -45,9 +45,11 @@ static void enter_sleep_tmr_cb(void* p_context) { ZLOGI("enter sleep mode, wakeup io index: %d", m_wakeup_io_index); if (m_wakeup_io_mirror) { - nrf_gpio_cfg_sense_input(m_wakeup_io_index, BUTTON_PULL, NRF_GPIO_PIN_SENSE_LOW); + nrf_gpio_cfg_sense_input(m_wakeup_io_index, NRF_GPIO_PIN_PULLUP, NRF_GPIO_PIN_SENSE_LOW); + nrf_gpio_cfg_sense_set(m_wakeup_io_index, NRF_GPIO_PIN_SENSE_LOW); } else { - nrf_gpio_cfg_sense_input(m_wakeup_io_index, BUTTON_PULL, NRF_GPIO_PIN_SENSE_HIGH); + nrf_gpio_cfg_sense_input(m_wakeup_io_index, NRF_GPIO_PIN_PULLUP, NRF_GPIO_PIN_SENSE_HIGH); + nrf_gpio_cfg_sense_set(m_wakeup_io_index, NRF_GPIO_PIN_SENSE_HIGH); } // Go to system-off mode (this function will not return; wakeup will cause a reset). @@ -80,7 +82,7 @@ static void gpio_io_state_monitor_tmr_cb(void* p_context) { ZLOGI("iostate %d:%d %d:%d %d:%d", m_io_index[0], nrf_gpio_pin_read(m_io_index[0]), // m_io_index[1], nrf_gpio_pin_read(m_io_index[1]), // m_io_index[2], nrf_gpio_pin_read(m_io_index[2])); - } + } } void zbsp_gpio_state_monitor_without_initio(int dumpstate_period, uint8_t* io_index, int32_t nio) {