From 56b4b14c032c0e6cb73417e8a1f4e2fafe49d9d9 Mon Sep 17 00:00:00 2001 From: zhaohe Date: Sat, 29 Jun 2024 14:06:03 +0800 Subject: [PATCH] update --- .../app_basic_service/device_version_info_mgr.c | 8 ++--- app/src/board/board.h | 24 ++++++++++----- app/src/one_conduction_main.c | 34 ++++++++++++---------- 3 files changed, 39 insertions(+), 27 deletions(-) diff --git a/app/src/app_basic_service/device_version_info_mgr.c b/app/src/app_basic_service/device_version_info_mgr.c index aed7131..5075b12 100644 --- a/app/src/app_basic_service/device_version_info_mgr.c +++ b/app/src/app_basic_service/device_version_info_mgr.c @@ -52,18 +52,18 @@ void device_info_init() { void device_info_read_sn(sn_t *sn) { uint32_t lot = NRF_UICR->CUSTOMER[0]; uint32_t id = NRF_UICR->CUSTOMER[1]; - static char sn_str[15]; + static char sn_str[20]; if ((lot == 0 && id == 0) || lot == 0xffffffff || id == 0xffffffff) { - sprintf(sn_str, "HandAcid%02d%03d", 0, 0); + sprintf(sn_str, "HAA-M%02d%03d", 0, 0); } else { - sprintf(sn_str, "HandAcid%02d%03d", lot, id); + sprintf(sn_str, "HAA-M%02d%03d", lot, id); } memcpy(sn->sn, sn_str, sizeof(sn->sn)); } const char *device_info_read_sn_str() { - static char sn_str[15]; + static char sn_str[20]; device_info_read_sn((sn_t *)sn_str); return sn_str; } diff --git a/app/src/board/board.h b/app/src/board/board.h index 2e2f056..ce6cee4 100644 --- a/app/src/board/board.h +++ b/app/src/board/board.h @@ -7,10 +7,20 @@ // P0.17 KEY2 反转按键 低有效 // P0.05 BATADC 电量 Vadc=Vbat -#define NRF_DBG_LED1 28 // Debug LED -#define LEDR 31 // Tri-color LED High effective -#define LEDG 30 // -#define LEDB 29 // -#define ADD_ACID_KEY 15 // Add Acid Key Low effective -#define REVERSE_KEY 17 // Reverse Key Low effective -#define BATADC 5 // Battery Voltage Vadc=Vbat \ No newline at end of file +#define NRF_DBG_LED1 1 // Debug LED + +// P1.09 TXD +// P0.01 NRF_DBG_LED1 +// P0.04 USART3_TX +// P0.05 USART3_RX +// P0.31 IO0 // +// P0.30 IO1 // +// P0.29 IO2 // +// P0.28 IO3 // +// P0.02 IO4 // +// P0.03 IO5 // +// P0.15 IO6 // +// P0.17 IO7 // +// P0.20 IO8 // +// P0.11 IO9 // + diff --git a/app/src/one_conduction_main.c b/app/src/one_conduction_main.c index 3bd642b..8018580 100644 --- a/app/src/one_conduction_main.c +++ b/app/src/one_conduction_main.c @@ -26,19 +26,19 @@ static uint16_t m_capture_prepare_progress = 0; static void testlight_state(int val) { int effect = val % 3; if (effect == 0) { - nrf_gpio_pin_write(LEDR, 1); - nrf_gpio_pin_write(LEDG, 0); - nrf_gpio_pin_write(LEDB, 0); + // nrf_gpio_pin_write(LEDR, 1); + // nrf_gpio_pin_write(LEDG, 0); + // nrf_gpio_pin_write(LEDB, 0); nrf_gpio_pin_write(NRF_DBG_LED1, 1); } else if (effect == 1) { - nrf_gpio_pin_write(LEDR, 0); - nrf_gpio_pin_write(LEDG, 1); - nrf_gpio_pin_write(LEDB, 0); + // nrf_gpio_pin_write(LEDR, 0); + // nrf_gpio_pin_write(LEDG, 1); + // nrf_gpio_pin_write(LEDB, 0); nrf_gpio_pin_write(NRF_DBG_LED1, 0); } else if (effect == 2) { - nrf_gpio_pin_write(LEDR, 0); - nrf_gpio_pin_write(LEDG, 0); - nrf_gpio_pin_write(LEDB, 1); + // nrf_gpio_pin_write(LEDR, 0); + // nrf_gpio_pin_write(LEDG, 0); + // nrf_gpio_pin_write(LEDB, 1); nrf_gpio_pin_write(NRF_DBG_LED1, 0); } } @@ -93,7 +93,8 @@ static void process_on_disconnect(void* arg) { ZLOGI("ble disconnected"); } void on_zapp_ebus_event(void* p_event_data, uint16_t event_size) { if (!p_event_data) return; app_event_t* p_event = (app_event_t*)p_event_data; - ZLOGI("event:%d add_acid_key:%d reverse_key:%d", p_event->eventType, nrf_gpio_pin_read(ADD_ACID_KEY), nrf_gpio_pin_read(REVERSE_KEY)); + // ZLOGI("event:%d add_acid_key:%d reverse_key:%d", p_event->eventType, nrf_gpio_pin_read(ADD_ACID_KEY), nrf_gpio_pin_read(REVERSE_KEY)); + ZLOGI("event:%d", p_event->eventType); static int cnt = 0; cnt++; @@ -133,14 +134,15 @@ void one_conduction_main() { // ADD_ACID_KEY // REVERSE_KEY - nrf_gpio_cfg_input(ADD_ACID_KEY, NRF_GPIO_PIN_NOPULL); - nrf_gpio_cfg_input(REVERSE_KEY, NRF_GPIO_PIN_NOPULL); + // nrf_gpio_cfg_input(ADD_ACID_KEY, NRF_GPIO_PIN_NOPULL); + // nrf_gpio_cfg_input(REVERSE_KEY, NRF_GPIO_PIN_NOPULL); - nrf_gpio_cfg_output(LEDR); - nrf_gpio_cfg_output(LEDG); - nrf_gpio_cfg_output(LEDB); - nrf_gpio_cfg_output(NRF_DBG_LED1); + // nrf_gpio_cfg_output(LEDR); + // nrf_gpio_cfg_output(LEDG); + // nrf_gpio_cfg_output(LEDB); + // nrf_gpio_cfg_output(NRF_DBG_LED1); + znrf_gpio_cfg_output(NRF_DBG_LED1, NRF_GPIO_PIN_PULLUP); // adc_mgr_init();