|
|
@ -12,6 +12,7 @@ |
|
|
|
#include "zble_module.h" |
|
|
|
// |
|
|
|
#include "ble_data_processer_utils.h" |
|
|
|
#include "board/board.h" |
|
|
|
#include "nrf_fstorage.h" |
|
|
|
#include "nrf_fstorage_sd.h" |
|
|
|
|
|
|
@ -22,6 +23,26 @@ |
|
|
|
static bool m_poweron_flag; |
|
|
|
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(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(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(NRF_DBG_LED1, 0); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/******************************************************************************* |
|
|
|
* UTILS * |
|
|
|
*******************************************************************************/ |
|
|
@ -72,7 +93,11 @@ 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", p_event->eventType) |
|
|
|
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)); |
|
|
|
|
|
|
|
static int cnt = 0; |
|
|
|
cnt++; |
|
|
|
testlight_state(cnt); |
|
|
|
} |
|
|
|
|
|
|
|
/*********************************************************************************************************************** |
|
|
@ -105,6 +130,19 @@ void one_conduction_main() { |
|
|
|
zapp_state_machine_reg_state_change_listener(on_state_change); |
|
|
|
zble_module_reglistener(on_zble_event); |
|
|
|
|
|
|
|
// 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_output(LEDR); |
|
|
|
nrf_gpio_cfg_output(LEDG); |
|
|
|
nrf_gpio_cfg_output(LEDB); |
|
|
|
nrf_gpio_cfg_output(NRF_DBG_LED1); |
|
|
|
|
|
|
|
|
|
|
|
// adc_mgr_init(); |
|
|
|
// hardware_power_mgr_init(); |
|
|
|
|
|
|
|