comparison 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
comparison
equal deleted inserted replaced
1035:5b913cdaa9dc 1036:5865f0aeb438
26 #include "demo.h" 26 #include "demo.h"
27 #include "base.h" // for BUTTON_BACK, ... 27 #include "base.h" // for BUTTON_BACK, ...
28 #include "data_exchange_main.h" // for time_elapsed_ms() 28 #include "data_exchange_main.h" // for time_elapsed_ms()
29 #include "settings.h" 29 #include "settings.h"
30 #include "ostc.h" 30 #include "ostc.h"
31 #include "tInfoLogger.h"
32 #include <string.h>
31 33
32 #ifndef DEMOMODE 34 #ifndef DEMOMODE
33 35
34 /* Exported functions --------------------------------------------------------*/ 36 /* Exported functions --------------------------------------------------------*/
35 37
423 /* Private functions ---------------------------------------------------------*/ 425 /* Private functions ---------------------------------------------------------*/
424 426
425 427
426 #endif // DEMO 428 #endif // DEMO
427 429
430 #ifdef ENABLE_USART_RADIO /* debug function to check receiption of radio data */
431 void demo_HandleData(void)
432 {
433 static uint8_t comStarted = 0;
434 static uint8_t text[50];
435 static uint8_t index = 0;
436 static uint32_t startTick = 0;
437 static uint8_t firstData = 1;
438 uint8_t data = 0;
439
440 switch(comStarted)
441 {
442 case 0: startTick = HAL_GetTick();
443 comStarted++;
444 break;
445 case 1: if(time_elapsed_ms(startTick, HAL_GetTick()) > 5000)
446 {
447 MX_UART_RADIO_Init_DMA();
448 UART_StartDMARxRadio();
449 comStarted++;
450 sprintf((char*)text,"RadioStarted");
451 InfoLogger_writeLine(text,strlen((char*)text),1);
452 }
453 break;
454 case 2: data = UART_getChar();
455 if(data != 0)
456 {
457 if(firstData)
458 {
459 firstData = 0;
460 sprintf((char*)text,"FirstData");
461 InfoLogger_writeLine(text,strlen((char*)text),1);
462 }
463 if((index == 50) || (data =='r') || (data =='n'))
464 {
465 if(index > 0)
466 {
467 InfoLogger_writeLine(text,index,0);
468 index = 0;
469 }
470 }
471 else
472 {
473 text[index++] = data;
474 }
475 }
476 break;
477 default:
478 break;
479 }
480
481
482 {
483 }
484 }
485 #endif
486
428 487
429 /************************ (C) COPYRIGHT heinrichs weikamp *****END OF FILE****/ 488 /************************ (C) COPYRIGHT heinrichs weikamp *****END OF FILE****/