2 changed files with 590 additions and 27 deletions
-
28app/main.c
-
589app/main.hardtest.c
@ -0,0 +1,589 @@ |
|||||
|
#include "basic/zble_module.h" |
||||
|
#include "basic/zdatachannel_service.h" |
||||
|
#include "znordic.h" |
||||
|
// |
||||
|
|
||||
|
#include <stdarg.h> |
||||
|
#include <stdio.h> |
||||
|
#include <stdlib.h> |
||||
|
#include <string.h> |
||||
|
// |
||||
|
#include "app_uart.h" |
||||
|
#include "basic/ssd1306/driver_ssd1306_basic.h" |
||||
|
#include "basic\zdatachannel_service.h" |
||||
|
#include "one_conduction/one_conduction_board.h" |
||||
|
#include "three_lead\three_lead_board.h" |
||||
|
#if defined(UART_PRESENT) |
||||
|
#include "nrf_uart.h" |
||||
|
#endif |
||||
|
#if defined(UARTE_PRESENT) |
||||
|
#include "nrf_uarte.h" |
||||
|
#endif |
||||
|
|
||||
|
#if 0 |
||||
|
static void test_tx_timer_cb(void* p_context) { |
||||
|
static uint32_t data; |
||||
|
data++; |
||||
|
ZLOGI("tim cb %d", data); |
||||
|
// ThreeLeadECG_sdcard_connect2_ext_usb_sdcard_driver_ic_reset(); |
||||
|
} |
||||
|
|
||||
|
extern uint32_t g_nrf_log_tx_pin; |
||||
|
APP_TIMER_DEF(m_test_tx_timer); |
||||
|
|
||||
|
void main() { |
||||
|
APP_SCHED_INIT(APP_TIMER_SCHED_EVENT_DATA_SIZE, 20); |
||||
|
|
||||
|
ThreeLeadECG_beep_init(); |
||||
|
|
||||
|
ThreeLeadECG_sdcard_base_init(); |
||||
|
znordic_init(); |
||||
|
|
||||
|
NRF_LOG_INFO("compile time :%s %d", __TIME__, APP_TIMER_TICKS(100)); |
||||
|
ZERROR_CHECK(app_timer_create(&m_test_tx_timer, APP_TIMER_MODE_REPEATED, test_tx_timer_cb)); |
||||
|
ZERROR_CHECK(app_timer_start(m_test_tx_timer, APP_TIMER_TICKS(3000), NULL)); |
||||
|
znordic_loop(); |
||||
|
} |
||||
|
#endif |
||||
|
|
||||
|
// EEPROM_TEST |
||||
|
#if 0 |
||||
|
static void test_tx_timer_cb(void* p_context) { |
||||
|
static uint32_t data; |
||||
|
data++; |
||||
|
// ZLOGI("test_tx_timer_cb %d", data); |
||||
|
|
||||
|
static uint8_t eepromw_test_data[256]; |
||||
|
static uint8_t eepromw_rx_data[256]; |
||||
|
for (size_t i = 0; i < 256; i++) { |
||||
|
eepromw_test_data[i] = i; |
||||
|
} |
||||
|
// SingleLeadECG_eeprom_write(0, eepromw_test_data, 256); |
||||
|
|
||||
|
SingleLeadECG_eeprom_read(0, eepromw_rx_data, 256); |
||||
|
// for (size_t i = 0; i < 256; i++) { |
||||
|
// ZLOGI("eepromw_rx_data[%d] = %d", i, eepromw_rx_data[i]); |
||||
|
// NRF_LOG_INTERNAL_FLUSH(); |
||||
|
// } |
||||
|
} |
||||
|
|
||||
|
extern uint32_t g_nrf_log_tx_pin; |
||||
|
APP_TIMER_DEF(m_test_tx_timer); |
||||
|
|
||||
|
void main() { |
||||
|
APP_SCHED_INIT(APP_TIMER_SCHED_EVENT_DATA_SIZE, 20); |
||||
|
znordic_init(); |
||||
|
|
||||
|
// SingleLeadECG_beep_init(); |
||||
|
// SingleLeadECG_beep_set_state(false); |
||||
|
NRF_LOG_INFO("compile time :%s %d", __TIME__, APP_TIMER_TICKS(100)); |
||||
|
NRF_LOG_INTERNAL_FLUSH(); |
||||
|
|
||||
|
SingleLeadECG_eeprom_init(); |
||||
|
|
||||
|
// nrf_delay_ms(20); |
||||
|
// SingleLeadECG_eeprom_read(0, eepromw_rx_data, 256); |
||||
|
// for (size_t i = 0; i < 256; i++) { |
||||
|
// ZLOGI("eepromw_rx_data[%d] = %d", i, eepromw_rx_data[i]); |
||||
|
// NRF_LOG_INTERNAL_FLUSH(); |
||||
|
// } |
||||
|
|
||||
|
ZERROR_CHECK(app_timer_create(&m_test_tx_timer, APP_TIMER_MODE_REPEATED, test_tx_timer_cb)); |
||||
|
ZERROR_CHECK(app_timer_start(m_test_tx_timer, APP_TIMER_TICKS(100), NULL)); |
||||
|
znordic_loop(); |
||||
|
} |
||||
|
#endif |
||||
|
|
||||
|
/******************************************************************************* |
||||
|
* 屏幕测试+LED测试 * |
||||
|
*******************************************************************************/ |
||||
|
#if 0 |
||||
|
static void test_tx_timer_cb(void* p_context) { |
||||
|
static uint32_t data; |
||||
|
data++; |
||||
|
ZLOGI("test_tx_timer_cb %d", data); |
||||
|
|
||||
|
SingleLeadECG_led_green_set_state(data % 2 == 0); |
||||
|
SingleLeadECG_led_blue_set_state(data % 3 == 0); |
||||
|
} |
||||
|
|
||||
|
extern uint32_t g_nrf_log_tx_pin; |
||||
|
APP_TIMER_DEF(m_test_tx_timer); |
||||
|
|
||||
|
void main() { |
||||
|
APP_SCHED_INIT(APP_TIMER_SCHED_EVENT_DATA_SIZE, 20); |
||||
|
znordic_init(); |
||||
|
|
||||
|
NRF_LOG_INFO("compile time :%s %d", __TIME__, APP_TIMER_TICKS(100)); |
||||
|
NRF_LOG_INTERNAL_FLUSH(); |
||||
|
|
||||
|
SingleLeadECG_screen_init(); |
||||
|
ssd1306_basic_init(SSD1306_INTERFACE_SPI, SSD1306_ADDR_SA0_0); |
||||
|
ssd1306_basic_display_on(); |
||||
|
ssd1306_basic_string(0, 0, "123456789123456789123", 21, 0, SSD1306_FONT_12); |
||||
|
ssd1306_basic_string(0, 16, "123456789123456789123", 21, 0, SSD1306_FONT_12); |
||||
|
ssd1306_basic_string(0, 32, "123456789123456789123", 21, 0, SSD1306_FONT_12); |
||||
|
ssd1306_basic_string(0, 48, "123456789123456789123", 21, 0, SSD1306_FONT_12); |
||||
|
|
||||
|
SingleLeadECG_led_init(); |
||||
|
|
||||
|
ZERROR_CHECK(app_timer_create(&m_test_tx_timer, APP_TIMER_MODE_REPEATED, test_tx_timer_cb)); |
||||
|
ZERROR_CHECK(app_timer_start(m_test_tx_timer, APP_TIMER_TICKS(100), NULL)); |
||||
|
znordic_loop(); |
||||
|
} |
||||
|
#endif |
||||
|
|
||||
|
/******************************************************************************* |
||||
|
* ECG * |
||||
|
*******************************************************************************/ |
||||
|
|
||||
|
#if 0 |
||||
|
#define UART_TX_BUF_SIZE 256 /**< UART TX buffer size. */ |
||||
|
#define UART_RX_BUF_SIZE 256 /**< UART RX buffer size. */ |
||||
|
uint32_t err_code; |
||||
|
app_uart_comm_params_t const comm_params = // |
||||
|
{ |
||||
|
.rx_pin_no = UART_PIN_DISCONNECTED, |
||||
|
.tx_pin_no = 41, |
||||
|
.rts_pin_no = UART_PIN_DISCONNECTED, |
||||
|
.cts_pin_no = UART_PIN_DISCONNECTED, |
||||
|
.flow_control = APP_UART_FLOW_CONTROL_DISABLED, |
||||
|
.use_parity = false, |
||||
|
.baud_rate = NRF_UARTE_BAUDRATE_921600, |
||||
|
}; |
||||
|
|
||||
|
void uart_error_handle(app_uart_evt_t* p_event) {} |
||||
|
|
||||
|
void uartinit() { |
||||
|
APP_UART_FIFO_INIT(&comm_params, UART_RX_BUF_SIZE, UART_TX_BUF_SIZE, uart_error_handle, APP_IRQ_PRIORITY_LOWEST, err_code); |
||||
|
APP_ERROR_CHECK(err_code); |
||||
|
} |
||||
|
|
||||
|
void zchip_log(const char* fmt, ...) { |
||||
|
static char tx[256] = {0}; |
||||
|
va_list args; |
||||
|
va_start(args, fmt); |
||||
|
|
||||
|
vsprintf(tx, fmt, args); |
||||
|
for (size_t i = 0; i < strlen(tx); i++) { |
||||
|
app_uart_put(tx[i]); |
||||
|
} |
||||
|
|
||||
|
va_end(args); |
||||
|
} |
||||
|
|
||||
|
static void test_tx_timer_cb(void* p_context) { |
||||
|
static uint32_t data; |
||||
|
data++; |
||||
|
// SingleLeadECG_ecg_nlod_get_connected_state(); |
||||
|
// SingleLeadECG_ecg_plod_get_connected_state(); |
||||
|
// SingleLeadECG_ecg_plod_get_ecg_val(); |
||||
|
// ZLOGI("%d nlod %d plod %d ecg:%d", data, SingleLeadECG_ecg_nlod_get_connected_state(), SingleLeadECG_ecg_plod_get_connected_state(), SingleLeadECG_ecg_plod_get_ecg_val()); |
||||
|
// ZLOGI("%d,%d,%d", SingleLeadECG_ecg_nlod_get_connected_state(), SingleLeadECG_ecg_plod_get_connected_state(), SingleLeadECG_ecg_plod_get_ecg_val()); |
||||
|
|
||||
|
zchip_log("%d,%d,%d\n", SingleLeadECG_ecg_nlod_get_connected_state(), SingleLeadECG_ecg_plod_get_connected_state(), SingleLeadECG_ecg_plod_get_ecg_val()); |
||||
|
// app_uart_put('c'); |
||||
|
// app_uart_put('c'); |
||||
|
// app_uart_put('c'); |
||||
|
// app_uart_put('c'); |
||||
|
// app_uart_put('c'); |
||||
|
// NRF_LOG_INFO("......"); |
||||
|
} |
||||
|
|
||||
|
extern uint32_t g_nrf_log_tx_pin; |
||||
|
APP_TIMER_DEF(m_test_tx_timer); |
||||
|
|
||||
|
void main() { |
||||
|
// g_nrf_log_tx_pin = 41; |
||||
|
APP_SCHED_INIT(APP_TIMER_SCHED_EVENT_DATA_SIZE, 20); |
||||
|
znordic_init(); |
||||
|
SingleLeadECG_adc_module_init(); |
||||
|
|
||||
|
uartinit(); |
||||
|
|
||||
|
NRF_LOG_INFO("compile time :%s %d", __TIME__, APP_TIMER_TICKS(100)); |
||||
|
NRF_LOG_INTERNAL_FLUSH(); |
||||
|
|
||||
|
SingleLeadECG_ecg_init(); |
||||
|
|
||||
|
ZERROR_CHECK(app_timer_create(&m_test_tx_timer, APP_TIMER_MODE_REPEATED, test_tx_timer_cb)); |
||||
|
ZERROR_CHECK(app_timer_start(m_test_tx_timer, APP_TIMER_TICKS(5), NULL)); |
||||
|
znordic_loop(); |
||||
|
} |
||||
|
#endif |
||||
|
/******************************************************************************* |
||||
|
* 蓝牙测试 * |
||||
|
*******************************************************************************/ |
||||
|
#if 0 |
||||
|
extern uint32_t g_nrf_log_tx_pin; |
||||
|
APP_TIMER_DEF(m_test_tx_timer); |
||||
|
|
||||
|
ZDATACHANNEL_DEF(m_zhrs, 2 /*回调事件优先级*/, 1 /*client num*/); |
||||
|
static const char* hex2str(const uint8_t* data, int32_t len) { |
||||
|
static char rx[64] = {0}; |
||||
|
memset(rx, 0, sizeof(rx)); |
||||
|
for (int32_t i = 0; i < len; i++) { |
||||
|
sprintf(rx + i * 2, "%02X", data[i]); |
||||
|
} |
||||
|
return rx; |
||||
|
} |
||||
|
|
||||
|
static void zdatachannel_data_handler(zdatachannel_evt_t* p_evt) { |
||||
|
/** |
||||
|
* @brief 接收到指令数据 |
||||
|
*/ |
||||
|
if (p_evt->type == ZDATACHANNEL_EVT_RX_DATA) { |
||||
|
ZLOGI("rx:%s", hex2str(p_evt->params.rx_data.p_data, p_evt->params.rx_data.length)); |
||||
|
} |
||||
|
} |
||||
|
static void on_service_init(void) { |
||||
|
/** |
||||
|
* @brief 数据通道初始化 |
||||
|
*/ |
||||
|
ZLOGI("init zdatachannel service"); |
||||
|
zdatachannel_init_t zdatachannle_init; |
||||
|
memset(&zdatachannle_init, 0, sizeof(zdatachannle_init)); |
||||
|
zdatachannle_init.data_handler = zdatachannel_data_handler; |
||||
|
ZERROR_CHECK(zdatachannel_init(&m_zhrs, &zdatachannle_init)); |
||||
|
} |
||||
|
|
||||
|
void main() { |
||||
|
APP_SCHED_INIT(APP_TIMER_SCHED_EVENT_DATA_SIZE, 20); |
||||
|
|
||||
|
ThreeLeadECG_sdcard_base_init(); |
||||
|
|
||||
|
znordic_init(0, 20); |
||||
|
NRF_LOG_INFO("compile time :%s", __TIME__); |
||||
|
NRF_LOG_INFO("Version :%d", VERSION); |
||||
|
NRF_LOG_INFO("Manufacturer :%s", MANUFACTURER_NAME); |
||||
|
|
||||
|
static zble_module_cfg_t cfg = // |
||||
|
{ |
||||
|
.deviceName = BLE_NAME, |
||||
|
.on_service_init = on_service_init, |
||||
|
}; |
||||
|
zble_module_init(&cfg); |
||||
|
|
||||
|
zble_module_start_adv(); |
||||
|
znordic_loop(); |
||||
|
} |
||||
|
#endif |
||||
|
#if 0 |
||||
|
/******************************************************************************* |
||||
|
* ADCTEST * |
||||
|
*******************************************************************************/ |
||||
|
static void test_tx_timer_cb(void* p_context) { |
||||
|
static uint32_t data; |
||||
|
data++; |
||||
|
// ZLOGI("test_tx_timer_cb %d", data); |
||||
|
|
||||
|
static uint8_t eepromw_test_data[256]; |
||||
|
static uint8_t eepromw_rx_data[256]; |
||||
|
for (size_t i = 0; i < 256; i++) { |
||||
|
eepromw_test_data[i] = i; |
||||
|
} |
||||
|
|
||||
|
int16_t adc = SingleLeadECG_battery_get_adc_val(); |
||||
|
int16_t mv = adc * 1.0 / 4096 * 3.6 * 1000 / 2.0 * 3; |
||||
|
ZLOGI("battery:%d", mv); |
||||
|
} |
||||
|
|
||||
|
extern uint32_t g_nrf_log_tx_pin; |
||||
|
APP_TIMER_DEF(m_test_tx_timer); |
||||
|
|
||||
|
void main() { |
||||
|
APP_SCHED_INIT(APP_TIMER_SCHED_EVENT_DATA_SIZE, 20); |
||||
|
znordic_init(); |
||||
|
SingleLeadECG_adc_module_init(); |
||||
|
SingleLeadECG_battery_init(); |
||||
|
|
||||
|
// SingleLeadECG_beep_init(); |
||||
|
// SingleLeadECG_beep_set_state(false); |
||||
|
NRF_LOG_INFO("compile time :%s %d", __TIME__, APP_TIMER_TICKS(100)); |
||||
|
NRF_LOG_INTERNAL_FLUSH(); |
||||
|
|
||||
|
// nrf_delay_ms(20); |
||||
|
// SingleLeadECG_eeprom_read(0, eepromw_rx_data, 256); |
||||
|
// for (size_t i = 0; i < 256; i++) { |
||||
|
// ZLOGI("eepromw_rx_data[%d] = %d", i, eepromw_rx_data[i]); |
||||
|
// NRF_LOG_INTERNAL_FLUSH(); |
||||
|
// } |
||||
|
|
||||
|
ZERROR_CHECK(app_timer_create(&m_test_tx_timer, APP_TIMER_MODE_REPEATED, test_tx_timer_cb)); |
||||
|
ZERROR_CHECK(app_timer_start(m_test_tx_timer, APP_TIMER_TICKS(100), NULL)); |
||||
|
znordic_loop(); |
||||
|
} |
||||
|
#endif |
||||
|
#if 0 |
||||
|
/******************************************************************************* |
||||
|
* 3导联-ADS1293-测试 * |
||||
|
*******************************************************************************/ |
||||
|
|
||||
|
extern uint32_t g_nrf_log_tx_pin; |
||||
|
APP_TIMER_DEF(m_test_tx_timer); |
||||
|
|
||||
|
static void zdatachanel_send_log(const char* fmt, ...) { |
||||
|
static char tx[256] = {0}; |
||||
|
static uint16_t len = 0; |
||||
|
va_list args; |
||||
|
va_start(args, fmt); |
||||
|
|
||||
|
len = vsprintf(tx, fmt, args); |
||||
|
zdatachannel_data_send((uint8_t*)tx, &len); |
||||
|
va_end(args); |
||||
|
} |
||||
|
|
||||
|
static const char* dumplodstate(uint16_t lodstate) { |
||||
|
static char buf[64]; |
||||
|
memset(buf, 0, sizeof(buf)); |
||||
|
/** |
||||
|
* @brief |
||||
|
* 1111_0000_0000_0000 |
||||
|
*/ |
||||
|
|
||||
|
sprintf(buf, "%d%d%d%d_%d%d%d%d_%d%d%d%d_%d%d%d%d", // |
||||
|
lodstate >> 15 & 0x1, lodstate >> 14 & 0x1, lodstate >> 13 & 0x1, lodstate >> 12 & 0x1, // |
||||
|
lodstate >> 11 & 0x1, lodstate >> 10 & 0x1, lodstate >> 9 & 0x1, lodstate >> 8 & 0x1, // |
||||
|
lodstate >> 7 & 0x1, lodstate >> 6 & 0x1, lodstate >> 5 & 0x1, lodstate >> 4 & 0x1, // |
||||
|
lodstate >> 3 & 0x1, lodstate >> 2 & 0x1, lodstate >> 1 & 0x1, lodstate >> 0 & 0x1); |
||||
|
return buf; |
||||
|
} |
||||
|
|
||||
|
static void test_tx_timer_cb(void* p_context) { |
||||
|
static uint32_t data; |
||||
|
data++; |
||||
|
uint16_t val; |
||||
|
ThreeLeadECG_ads1293_get_lod_state(&val); |
||||
|
#if 0 |
||||
|
uint32_t sample0; |
||||
|
uint32_t sample1; |
||||
|
uint32_t sample2; |
||||
|
ThreeLeadECG_ads1293_sample(&sample0, &sample1, &sample2); |
||||
|
zdatachanel_send_log("%d,%d,%d\n", sample0, sample1, sample2); |
||||
|
#endif |
||||
|
|
||||
|
uint32_t sample0; |
||||
|
uint32_t sample1; |
||||
|
uint32_t sample2; |
||||
|
uint32_t sample10; |
||||
|
uint32_t sample11; |
||||
|
uint32_t sample12; |
||||
|
|
||||
|
ThreeLeadECG_ads1293_sample_all(&sample0, &sample1, &sample2, &sample10, &sample11, &sample12); |
||||
|
|
||||
|
zdatachanel_send_log("%d,%d,%d,%d,%d,%d\n", sample0, sample1, sample2, sample10, sample11, sample12); |
||||
|
|
||||
|
// zdatachanel_send_log("%d,%d,%d\n", data, data, data); |
||||
|
// zdatachanel_send_log("%d %d %s\n", ThreeLeadECG_ready_pin_state_get(), ThreeLeadECG_LineInputDet_get_state(), dumplodstate(val)); |
||||
|
|
||||
|
// zdatachannel_data_send(tx, &p_length); |
||||
|
} |
||||
|
|
||||
|
ZDATACHANNEL_DEF(m_zhrs, 2 /*回调事件优先级*/, 1 /*client num*/); |
||||
|
static const char* hex2str(const uint8_t* data, int32_t len) { |
||||
|
static char rx[64] = {0}; |
||||
|
memset(rx, 0, sizeof(rx)); |
||||
|
for (int32_t i = 0; i < len; i++) { |
||||
|
sprintf(rx + i * 2, "%02X", data[i]); |
||||
|
} |
||||
|
return rx; |
||||
|
} |
||||
|
|
||||
|
// void cmd_remove_note(char* input, int inputlen) { |
||||
|
// bool detect_note = false; |
||||
|
// for (int i = 0; i < inputlen; i++) { |
||||
|
// if (!detect_note && input[i] == '#') { |
||||
|
// detect_note = true; |
||||
|
// } |
||||
|
// if (detect_note) { |
||||
|
// input[i] = 0; |
||||
|
// } |
||||
|
// } |
||||
|
// } |
||||
|
// void cmd_prase_cmd(char* input, int inputlen, int32_t* argc, char* argv[]) { |
||||
|
// for (int i = 0; input[i] == 0 || i < inputlen; i++) { |
||||
|
// if (input[i] == ' ' || input[i] == '\r' || input[i] == '\n') { |
||||
|
// input[i] = 0; |
||||
|
// } |
||||
|
// } |
||||
|
// int j = 0; |
||||
|
// for (int i = 0; input[i] == 0 || i < inputlen; i++) { |
||||
|
// if (input[i] != 0 && j == 0) { |
||||
|
// argv[*argc] = &input[i]; |
||||
|
// j = 1; |
||||
|
// *argc = *argc + 1; |
||||
|
// continue; |
||||
|
// } |
||||
|
|
||||
|
// if (input[i] == 0 && j == 1) { |
||||
|
// j = 0; |
||||
|
// continue; |
||||
|
// } |
||||
|
// } |
||||
|
// } |
||||
|
char cmdcache[256] = {0}; |
||||
|
static void zdatachannel_data_handler(zdatachannel_evt_t* p_evt) { |
||||
|
/** |
||||
|
* @brief 接收到指令数据 |
||||
|
*/ |
||||
|
if (p_evt->type == ZDATACHANNEL_EVT_RX_DATA) { |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
static void on_service_init(void) { |
||||
|
/** |
||||
|
* @brief 数据通道初始化 |
||||
|
*/ |
||||
|
ZLOGI("init zdatachannel service"); |
||||
|
zdatachannel_init_t zdatachannle_init; |
||||
|
memset(&zdatachannle_init, 0, sizeof(zdatachannle_init)); |
||||
|
zdatachannle_init.data_handler = zdatachannel_data_handler; |
||||
|
ZERROR_CHECK(zdatachannel_init(&m_zhrs, &zdatachannle_init)); |
||||
|
} |
||||
|
|
||||
|
void main() { |
||||
|
APP_SCHED_INIT(APP_TIMER_SCHED_EVENT_DATA_SIZE, 20); |
||||
|
|
||||
|
ThreeLeadECG_sdcard_base_init(); |
||||
|
|
||||
|
znordic_init(0, 20); |
||||
|
NRF_LOG_INFO("compile time :%s", __TIME__); |
||||
|
NRF_LOG_INFO("Version :%d", VERSION); |
||||
|
NRF_LOG_INFO("Manufacturer :%s", MANUFACTURER_NAME); |
||||
|
|
||||
|
static zble_module_cfg_t cfg = // |
||||
|
{ |
||||
|
.deviceName = BLE_NAME, |
||||
|
.on_service_init = on_service_init, |
||||
|
}; |
||||
|
zble_module_init(&cfg); |
||||
|
|
||||
|
ThreeLeadECG_ecg_init(); |
||||
|
ThreeLeadECG_LineInputDet_init(); |
||||
|
|
||||
|
ZERROR_CHECK(app_timer_create(&m_test_tx_timer, APP_TIMER_MODE_REPEATED, test_tx_timer_cb)); |
||||
|
ZERROR_CHECK(app_timer_start(m_test_tx_timer, APP_TIMER_TICKS(5), NULL)); |
||||
|
|
||||
|
zble_module_start_adv(); |
||||
|
znordic_loop(); |
||||
|
} |
||||
|
|
||||
|
#endif |
||||
|
#if 0 |
||||
|
/******************************************************************************* |
||||
|
* 3导联-led测试 * |
||||
|
*******************************************************************************/ |
||||
|
static void test_tx_timer_cb(void* p_context) { |
||||
|
static uint32_t data; |
||||
|
data++; |
||||
|
ZLOGI("test_tx_timer_cb %d", data); |
||||
|
|
||||
|
ThreeLeadECG_led_green_set_state(data % 2 == 0); |
||||
|
} |
||||
|
|
||||
|
extern uint32_t g_nrf_log_tx_pin; |
||||
|
APP_TIMER_DEF(m_test_tx_timer); |
||||
|
|
||||
|
void main() { |
||||
|
APP_SCHED_INIT(APP_TIMER_SCHED_EVENT_DATA_SIZE, 20); |
||||
|
znordic_init(); |
||||
|
|
||||
|
NRF_LOG_INFO("compile time :%s %d", __TIME__, APP_TIMER_TICKS(100)); |
||||
|
NRF_LOG_INTERNAL_FLUSH(); |
||||
|
|
||||
|
ThreeLeadECG_led_init(); |
||||
|
|
||||
|
ZERROR_CHECK(app_timer_create(&m_test_tx_timer, APP_TIMER_MODE_REPEATED, test_tx_timer_cb)); |
||||
|
ZERROR_CHECK(app_timer_start(m_test_tx_timer, APP_TIMER_TICKS(100), NULL)); |
||||
|
znordic_loop(); |
||||
|
} |
||||
|
#endif |
||||
|
#if 0 |
||||
|
/******************************************************************************* |
||||
|
* 3导联-电池电量测试 * |
||||
|
*******************************************************************************/ |
||||
|
static void test_tx_timer_cb(void* p_context) { |
||||
|
static uint32_t data; |
||||
|
data++; |
||||
|
int16_t mv = ThreeLeadECG_battery_get_adc_val() * 1.0 / 4096 * 3.3 * 1000 / 2.0 * 3; |
||||
|
ZLOGI("battery:%d", mv); |
||||
|
} |
||||
|
|
||||
|
extern uint32_t g_nrf_log_tx_pin; |
||||
|
APP_TIMER_DEF(m_test_tx_timer); |
||||
|
|
||||
|
void main() { |
||||
|
APP_SCHED_INIT(APP_TIMER_SCHED_EVENT_DATA_SIZE, 20); |
||||
|
znordic_init(); |
||||
|
|
||||
|
NRF_LOG_INFO("compile time :%s %d", __TIME__, APP_TIMER_TICKS(100)); |
||||
|
NRF_LOG_INTERNAL_FLUSH(); |
||||
|
|
||||
|
ThreeLeadECG_adc_module_init(); |
||||
|
ThreeLeadECG_battery_init(); |
||||
|
|
||||
|
ZERROR_CHECK(app_timer_create(&m_test_tx_timer, APP_TIMER_MODE_REPEATED, test_tx_timer_cb)); |
||||
|
ZERROR_CHECK(app_timer_start(m_test_tx_timer, APP_TIMER_TICKS(100), NULL)); |
||||
|
znordic_loop(); |
||||
|
} |
||||
|
#endif |
||||
|
|
||||
|
#if 0 |
||||
|
/******************************************************************************* |
||||
|
* 3导联-flash测试 * |
||||
|
*******************************************************************************/ |
||||
|
static void test_tx_timer_cb(void* p_context) { |
||||
|
static uint32_t data; |
||||
|
data++; |
||||
|
} |
||||
|
|
||||
|
extern uint32_t g_nrf_log_tx_pin; |
||||
|
APP_TIMER_DEF(m_test_tx_timer); |
||||
|
|
||||
|
void main() { |
||||
|
APP_SCHED_INIT(APP_TIMER_SCHED_EVENT_DATA_SIZE, 20); |
||||
|
znordic_init(); |
||||
|
|
||||
|
NRF_LOG_INFO("compile time :%s %d", __TIME__, APP_TIMER_TICKS(100)); |
||||
|
NRF_LOG_INTERNAL_FLUSH(); |
||||
|
|
||||
|
ThreeLeadECG_sdcard_base_init(); |
||||
|
ThreeLeadECG_sdcard_mount(); |
||||
|
ThreeLeadECG_sdcard_umount(); |
||||
|
ThreeLeadECG_sdcard_mount(); |
||||
|
ThreeLeadECG_sdcard_umount(); |
||||
|
|
||||
|
|
||||
|
ZERROR_CHECK(app_timer_create(&m_test_tx_timer, APP_TIMER_MODE_REPEATED, test_tx_timer_cb)); |
||||
|
ZERROR_CHECK(app_timer_start(m_test_tx_timer, APP_TIMER_TICKS(100), NULL)); |
||||
|
znordic_loop(); |
||||
|
} |
||||
|
#endif |
||||
|
|
||||
|
#if 0 |
||||
|
/******************************************************************************* |
||||
|
* 3导联-flash测试 * |
||||
|
*******************************************************************************/ |
||||
|
static void test_tx_timer_cb(void* p_context) { |
||||
|
static uint32_t data; |
||||
|
data++; |
||||
|
ZLOGI("button %d", ThreeLeadECG_button_get_state()); |
||||
|
} |
||||
|
|
||||
|
extern uint32_t g_nrf_log_tx_pin; |
||||
|
APP_TIMER_DEF(m_test_tx_timer); |
||||
|
|
||||
|
void main() { |
||||
|
APP_SCHED_INIT(APP_TIMER_SCHED_EVENT_DATA_SIZE, 20); |
||||
|
znordic_init(); |
||||
|
|
||||
|
NRF_LOG_INFO("compile time :%s %d", __TIME__, APP_TIMER_TICKS(100)); |
||||
|
NRF_LOG_INTERNAL_FLUSH(); |
||||
|
|
||||
|
ThreeLeadECG_button_init(); |
||||
|
|
||||
|
ZERROR_CHECK(app_timer_create(&m_test_tx_timer, APP_TIMER_MODE_REPEATED, test_tx_timer_cb)); |
||||
|
ZERROR_CHECK(app_timer_start(m_test_tx_timer, APP_TIMER_TICKS(300), NULL)); |
||||
|
znordic_loop(); |
||||
|
} |
||||
|
#endif |
Write
Preview
Loading…
Cancel
Save
Reference in new issue