Mercurial > public > ostc4
comparison Small_CPU/Src/scheduler.c @ 704:f1b40364b0af
Added protocol functions for UART DiveO2 sensor:
The code has been modified to support the handling of several protocols (including baud rate changes). The data is requested by polling and passed via DMA into a ringbuffer which is then parsed by a cyclic function call in the main loop. At the moment only the O2 values are forwarded but because the sensor send several types of data within a signle message already more is extracted but yet discarded.
| author | Ideenmodellierer |
|---|---|
| date | Fri, 28 Oct 2022 20:49:21 +0200 |
| parents | 52d68cf9994c |
| children | 045ff7800501 |
comparison
equal
deleted
inserted
replaced
| 703:2f457024049b | 704:f1b40364b0af |
|---|---|
| 316 if(((global.dataSendToSlave.data.externalInterface_Cmd & EXT_INTERFACE_ADC_ON) != 0) != externalInterface_isEnabledADC()) | 316 if(((global.dataSendToSlave.data.externalInterface_Cmd & EXT_INTERFACE_ADC_ON) != 0) != externalInterface_isEnabledADC()) |
| 317 { | 317 { |
| 318 externalInterface_SwitchADC(global.dataSendToSlave.data.externalInterface_Cmd && EXT_INTERFACE_ADC_ON); | 318 externalInterface_SwitchADC(global.dataSendToSlave.data.externalInterface_Cmd && EXT_INTERFACE_ADC_ON); |
| 319 } | 319 } |
| 320 | 320 |
| 321 if(((global.dataSendToSlave.data.externalInterface_Cmd >> 8) & 0x0F) != externalInterface_GetUARTProtocol()) | |
| 322 { | |
| 323 externalInterface_SwitchUART((global.dataSendToSlave.data.externalInterface_Cmd >> 8) & 0x0F); | |
| 324 } | |
| 321 | 325 |
| 322 if(global.dataSendToSlave.data.externalInterface_Cmd & 0x00FF) /* lowest nibble for commands */ | 326 if(global.dataSendToSlave.data.externalInterface_Cmd & 0x00FF) /* lowest nibble for commands */ |
| 323 { | 327 { |
| 324 externalInterface_ExecuteCmd(global.dataSendToSlave.data.externalInterface_Cmd); | 328 externalInterface_ExecuteCmd(global.dataSendToSlave.data.externalInterface_Cmd); |
| 325 } | 329 } |
| 521 if(global.dataSendToSlave.data.externalInterface_Cmd & EXT_INTERFACE_UART_SENTINEL) | 525 if(global.dataSendToSlave.data.externalInterface_Cmd & EXT_INTERFACE_UART_SENTINEL) |
| 522 { | 526 { |
| 523 HandleUARTSentinelData(); | 527 HandleUARTSentinelData(); |
| 524 } | 528 } |
| 525 #endif | 529 #endif |
| 526 | 530 if(global.dataSendToSlave.data.externalInterface_Cmd & EXT_INTERFACE_UART_O2) |
| 531 { | |
| 532 HandleUARTDigitalO2(); | |
| 533 } | |
| 527 | 534 |
| 528 if(ticksdiff >= Scheduler.counterSPIdata100msec * 100 + 10) | 535 if(ticksdiff >= Scheduler.counterSPIdata100msec * 100 + 10) |
| 529 { | 536 { |
| 530 if(SPI_Evaluate_RX_Data()!=0) /* did we receive something ? */ | 537 if(SPI_Evaluate_RX_Data()!=0) /* did we receive something ? */ |
| 531 { | 538 { |
| 841 { | 848 { |
| 842 HandleUARTSentinelData(); | 849 HandleUARTSentinelData(); |
| 843 } | 850 } |
| 844 #endif | 851 #endif |
| 845 | 852 |
| 853 if(global.dataSendToSlave.data.externalInterface_Cmd & EXT_INTERFACE_UART_O2) | |
| 854 { | |
| 855 HandleUARTDigitalO2(); | |
| 856 } | |
| 857 | |
| 846 /* Evaluate received data at 10 ms, 110 ms, 210 ms,... duration ~<1ms */ | 858 /* Evaluate received data at 10 ms, 110 ms, 210 ms,... duration ~<1ms */ |
| 847 if(ticksdiff >= Scheduler.counterSPIdata100msec * 100 + 10) | 859 if(ticksdiff >= Scheduler.counterSPIdata100msec * 100 + 10) |
| 848 { | 860 { |
| 849 if(SPI_Evaluate_RX_Data()!=0) /* did we receive something ? */ | 861 if(SPI_Evaluate_RX_Data()!=0) /* did we receive something ? */ |
| 850 { | 862 { |
