Mercurial > public > ostc4
diff Discovery/Src/demo.c @ 1037:2af07aa38531 GasConsumption
Merge with external development branches:
Some features have been prepared for integration: Profiles, DMA UART on Firmware part, Bluetooth discovery and messges logging for development phase. All these new function are deactivated by compile switch and may be activated using the configuration.h for testing purpose.
| author | Ideenmodellierer |
|---|---|
| date | Mon, 15 Sep 2025 21:12:44 +0200 |
| parents | 5865f0aeb438 |
| children |
line wrap: on
line diff
--- a/Discovery/Src/demo.c Sun Sep 07 20:44:35 2025 +0200 +++ b/Discovery/Src/demo.c Mon Sep 15 21:12:44 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****/
