From 11fa4707e43f892fbc4fd280fac66b4ccf887acc Mon Sep 17 00:00:00 2001 From: zhaohe Date: Wed, 24 Jan 2024 18:33:23 +0800 Subject: [PATCH] update --- app/main.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 46 insertions(+), 2 deletions(-) diff --git a/app/main.c b/app/main.c index e5003ae..5dc788a 100644 --- a/app/main.c +++ b/app/main.c @@ -43,7 +43,7 @@ void main() { #endif // EEPROM_TEST -#if 1 +#if 0 static void test_tx_timer_cb(void* p_context) { static uint32_t data; data++; @@ -261,4 +261,48 @@ void main() { zble_module_start_adv(); znordic_loop(); } -#endif \ No newline at end of file +#endif +/******************************************************************************* + * 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(); +} \ No newline at end of file