Cleanup debugging ifdefs no longer needed

This commit is contained in:
Musa Mahmood 2025-04-19 15:10:13 -04:00
parent 0fcbbf06bf
commit a54f15bf5f
2 changed files with 5 additions and 43 deletions

44
main.c
View File

@ -36,7 +36,7 @@ static enum recording_mode_t recording_mode = RECORDING_MODE_DISABLED;
ads1298_info_t m_info; ads1298_info_t m_info;
#endif #endif
// #TEMP! // #TEMP: This should be generated dynamically maybe?
char g_Peripheral_Info[] = "ADS1298|"; char g_Peripheral_Info[] = "ADS1298|";
char g_WhoAmI[] = "multimodal_cv_dev0_ecg"; char g_WhoAmI[] = "multimodal_cv_dev0_ecg";
uint8_t g_HWFW_Ver[] = {1,0,0,1}; // HW Maj, HW Min, FW Maj, FW Min uint8_t g_HWFW_Ver[] = {1,0,0,1}; // HW Maj, HW Min, FW Maj, FW Min
@ -436,22 +436,8 @@ int main(void) {
// #TEMP: application_timers_start // #TEMP: application_timers_start
application_timers_start(); application_timers_start();
#if AUTO_START_ADS1298 // for debugging
ads1298_stop_rdatac();
NRF_LOG_INFO("Writing new ADS1298 registers:");
uint8_t new_registers[] = {0xC5,0x00,0xCE,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x00,0x00,0x00,0x00,0x00};
memcpy(m_info.registers, new_registers, ADS1298_REGISTER_COUNT);
ads1298_update_registers(&m_info);
ads1298_set_data_buffer_length(&m_info);
ads1298_start_rdatac();
ads1298_wakeup();
recording_mode = RECORDING_MODE_ALL;
#endif
while (true) { while (true) {
#if !DISABLE_USBD_IN_MAIN_LOOP
while (app_usbd_event_queue_process()) { /* Nothing to do */ } while (app_usbd_event_queue_process()) { /* Nothing to do */ }
#endif
if (recording_mode == RECORDING_MODE_ALL) { if (recording_mode == RECORDING_MODE_ALL) {
// if (recording_mode & drdy_flag) { // may be faster if we're just using ADS1298 // if (recording_mode & drdy_flag) { // may be faster if we're just using ADS1298
@ -469,28 +455,13 @@ int main(void) {
// :ADS1298_FAST_PATH // :ADS1298_FAST_PATH
ads1298_get_data_fast(&m_info); ads1298_get_data_fast(&m_info);
// switch (m_info.nChs) {
// case 4:
// ads1294_get_data(&m_info);
// break;
// case 6:
// ads1296_get_data(&m_info);
// break;
// case 8:
// ads1298_get_data(&m_info);
// break;
// default:
// break;
// }
if (m_info.usb_buffer_count >= m_info.usb_buffer_size_max) { if (m_info.usb_buffer_count >= m_info.usb_buffer_size_max) {
m_info.usb_buffer_count = ADS1298_PACKET_OFFSET; m_info.usb_buffer_count = ADS1298_PACKET_OFFSET;
#if !DISABLE_USBD_IN_MAIN_LOOP
app_usbd_cdc_acm_write(&m_app_cdc_acm, m_info.usb_buffer, m_info.usb_buffer_size_max); app_usbd_cdc_acm_write(&m_app_cdc_acm, m_info.usb_buffer, m_info.usb_buffer_size_max);
#if ADS1298_STATS #if ADS1298_STATS
m_info.bytes_sent_usb += m_info.usb_buffer_size_max; m_info.bytes_sent_usb += m_info.usb_buffer_size_max;
#endif #endif
#endif
increment_packet(m_info.usb_buffer); increment_packet(m_info.usb_buffer);
// NRF_LOG_INFO("Current time tick: %lu", app_timer_cnt_get()); // NRF_LOG_INFO("Current time tick: %lu", app_timer_cnt_get());
@ -498,19 +469,14 @@ int main(void) {
} }
#endif #endif
} }
#if !DISABLE_USBD_IN_MAIN_LOOP
if (run_throughput_test) { if (run_throughput_test) {
/*ret = */app_usbd_cdc_acm_write(&m_app_cdc_acm, usb_send_buffer, NRF_DRV_USBD_EPSIZE); app_usbd_cdc_acm_write(&m_app_cdc_acm, usb_send_buffer, NRF_DRV_USBD_EPSIZE);
} }
#endif
UNUSED_RETURN_VALUE(NRF_LOG_PROCESS()); UNUSED_RETURN_VALUE(NRF_LOG_PROCESS());
/* Sleep CPU only if there was no interrupt since last loop processing */ /* Sleep CPU only if there was no interrupt since last loop processing */
#if !DISABLE_USBD_IN_MAIN_LOOP
__WFE(); __WFE();
#endif
} }
} }
/** @} */
// size_t size = sprintf(m_tx_buffer, "Hello USB CDC FA demo: %u\r\n", frame_counter);

View File

@ -4,13 +4,9 @@
#define NRF52840_BREAKOUT_BOARD 1 #define NRF52840_BREAKOUT_BOARD 1
#define ADS1298 1 #define ADS1298 1
#if ADS1298 #if ADS1298
#define AUTO_START_ADS1298 0
#define ADS1298_STATS 0 #define ADS1298_STATS 0
#endif #endif
// Debugging flags
#define DISABLE_USBD_IN_MAIN_LOOP 0
// Testing with nRF52840: // Testing with nRF52840:
#if NRF52840_BREAKOUT_BOARD #if NRF52840_BREAKOUT_BOARD
#define ADS1298_DRDY_PIN 11 #define ADS1298_DRDY_PIN 11