Browse Source

update

hardware_test_b
zhaohe 1 year ago
parent
commit
56b4b14c03
  1. 8
      app/src/app_basic_service/device_version_info_mgr.c
  2. 24
      app/src/board/board.h
  3. 34
      app/src/one_conduction_main.c

8
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) { void device_info_read_sn(sn_t *sn) {
uint32_t lot = NRF_UICR->CUSTOMER[0]; uint32_t lot = NRF_UICR->CUSTOMER[0];
uint32_t id = NRF_UICR->CUSTOMER[1]; 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) { 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 { } 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)); memcpy(sn->sn, sn_str, sizeof(sn->sn));
} }
const char *device_info_read_sn_str() { 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); device_info_read_sn((sn_t *)sn_str);
return sn_str; return sn_str;
} }

24
app/src/board/board.h

@ -7,10 +7,20 @@
// P0.17 KEY2 ·´×ª°´¼ü µÍÓÐЧ // P0.17 KEY2 ·´×ª°´¼ü µÍÓÐЧ
// P0.05 BATADC µçÁ¿ Vadc=Vbat // 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
#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 //

34
app/src/one_conduction_main.c

@ -26,19 +26,19 @@ static uint16_t m_capture_prepare_progress = 0;
static void testlight_state(int val) { static void testlight_state(int val) {
int effect = val % 3; int effect = val % 3;
if (effect == 0) { 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); nrf_gpio_pin_write(NRF_DBG_LED1, 1);
} else if (effect == 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); nrf_gpio_pin_write(NRF_DBG_LED1, 0);
} else if (effect == 2) { } 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); 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) { void on_zapp_ebus_event(void* p_event_data, uint16_t event_size) {
if (!p_event_data) return; if (!p_event_data) return;
app_event_t* p_event = (app_event_t*)p_event_data; 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; static int cnt = 0;
cnt++; cnt++;
@ -133,14 +134,15 @@ void one_conduction_main() {
// ADD_ACID_KEY // ADD_ACID_KEY
// REVERSE_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(); // adc_mgr_init();

Loading…
Cancel
Save