Mercurial > public > ostc4
diff Discovery/Src/demo.c @ 1036:5865f0aeb438 Puls_Integration
Radio data integration:
Added functionality for displaying radio data as debug message. The USART3 has been configurated for receiption and a function for the visualization of the data has been added to the demo unit (draft implementation). For activation the radio as well as the logger functionality needs to be activated via compile switch. Note that at the moment bluetooth and radio DMA may not be operated in parallel.
| author | Ideenmodellierer |
|---|---|
| date | Sun, 10 Aug 2025 15:28:59 +0200 |
| parents | 5f11787b4f42 |
| children |
line wrap: on
line diff
--- a/Discovery/Src/demo.c Sat Aug 09 16:55:20 2025 +0200 +++ b/Discovery/Src/demo.c Sun Aug 10 15:28:59 2025 +0200 @@ -28,6 +28,8 @@ #include "data_exchange_main.h" // for time_elapsed_ms() #include "settings.h" #include "ostc.h" +#include "tInfoLogger.h" +#include <string.h> #ifndef DEMOMODE @@ -425,5 +427,62 @@ #endif // DEMO +#ifdef ENABLE_USART_RADIO /* debug function to check receiption of radio data */ +void demo_HandleData(void) +{ + static uint8_t comStarted = 0; + static uint8_t text[50]; + static uint8_t index = 0; + static uint32_t startTick = 0; + static uint8_t firstData = 1; + uint8_t data = 0; + + switch(comStarted) + { + case 0: startTick = HAL_GetTick(); + comStarted++; + break; + case 1: if(time_elapsed_ms(startTick, HAL_GetTick()) > 5000) + { + MX_UART_RADIO_Init_DMA(); + UART_StartDMARxRadio(); + comStarted++; + sprintf((char*)text,"RadioStarted"); + InfoLogger_writeLine(text,strlen((char*)text),1); + } + break; + case 2: data = UART_getChar(); + if(data != 0) + { + if(firstData) + { + firstData = 0; + sprintf((char*)text,"FirstData"); + InfoLogger_writeLine(text,strlen((char*)text),1); + } + if((index == 50) || (data =='r') || (data =='n')) + { + if(index > 0) + { + InfoLogger_writeLine(text,index,0); + index = 0; + } + } + else + { + text[index++] = data; + } + } + break; + default: + break; + } + + + { + } +} +#endif + /************************ (C) COPYRIGHT heinrichs weikamp *****END OF FILE****/
