Browse Source

update

3lead_uart_test_ok_version
zhaohe 1 year ago
parent
commit
e83a58a32c
  1. 4
      README.md
  2. 2
      app/app.uvoptx
  3. 36
      app/main.c
  4. 10
      app/src/board.c

4
README.md

@ -22,4 +22,8 @@ https://iflytop1.feishu.cn/wiki/Fp0fwciUEibtm4kaUeXcraOCneg
sdk\components\boards\pca10100.h
清风开发板
```

2
app/app.uvoptx

@ -253,7 +253,7 @@
<LExpSel>0</LExpSel>
</OPTXL>
<OPTFL>
<tvExp>1</tvExp>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<IsCurrentTarget>0</IsCurrentTarget>
</OPTFL>

36
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();
}

10
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) {

Loading…
Cancel
Save