comparison Small_CPU/Inc/scheduler.h @ 220:e524a824d8f2 Improve_IPC_Sync

Added schedule point for functions executed once in a second SPI communication takes place every 100ms triggered by the master (main). Synchronisation is done using the SPI RX complete callback which is called ~4ms after communication was started. In the previous implementation this could happen in parallel to usage of data. To solve this potential problem the execution of functions called once a second was moved from 1000ms to 980ms giving a 20ms window for execution.
author ideenmodellierer
date Sun, 31 Mar 2019 15:49:47 +0200
parents b95741467355
children e4207f0aaa4b
comparison
equal deleted inserted replaced
219:f9b17e898a7a 220:e524a824d8f2
34 34
35 #define SPI_SYNC_METHOD_NONE (0u) 35 #define SPI_SYNC_METHOD_NONE (0u)
36 #define SPI_SYNC_METHOD_HARD (1u) /* Scheduler shall reset all counters to 0 */ 36 #define SPI_SYNC_METHOD_HARD (1u) /* Scheduler shall reset all counters to 0 */
37 #define SPI_SYNC_METHOD_SOFT (2u) /* Scheduler shall reset adjust counters to 100ms SPI data exchange cycle */ 37 #define SPI_SYNC_METHOD_SOFT (2u) /* Scheduler shall reset adjust counters to 100ms SPI data exchange cycle */
38 #define SPI_SYNC_METHOD_INVALID (4u) 38 #define SPI_SYNC_METHOD_INVALID (4u)
39
40 #define SCHEDULER_TICK_EXE1SEC (980u) /* tick count based on cycle start which is used to trigger functions which */
41 /* shall be executed once in a second (20ms before cycle restarts) */
39 42
40 typedef struct 43 typedef struct
41 { 44 {
42 uint8_t mode; 45 uint8_t mode;
43 short conservatism; 46 short conservatism;
80 { 83 {
81 uint8_t counterSPIdata100msec; 84 uint8_t counterSPIdata100msec;
82 uint8_t counterPressure100msec; 85 uint8_t counterPressure100msec;
83 uint8_t counterCompass100msec; 86 uint8_t counterCompass100msec;
84 uint8_t counterAmbientLight100msec; 87 uint8_t counterAmbientLight100msec;
88 uint32_t tick_execute1second;
85 uint32_t tickstart; 89 uint32_t tickstart;
86 } SScheduleCtrl; 90 } SScheduleCtrl;
87 91
88 92
89 /* Variables ---------------------------------------------------------*/ 93 /* Variables ---------------------------------------------------------*/