Mercurial > public > ostc4
diff 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 |
line wrap: on
line diff
--- a/Small_CPU/Inc/scheduler.h Sun Mar 31 15:44:56 2019 +0200 +++ b/Small_CPU/Inc/scheduler.h Sun Mar 31 15:49:47 2019 +0200 @@ -37,6 +37,9 @@ #define SPI_SYNC_METHOD_SOFT (2u) /* Scheduler shall reset adjust counters to 100ms SPI data exchange cycle */ #define SPI_SYNC_METHOD_INVALID (4u) +#define SCHEDULER_TICK_EXE1SEC (980u) /* tick count based on cycle start which is used to trigger functions which */ + /* shall be executed once in a second (20ms before cycle restarts) */ + typedef struct { uint8_t mode; @@ -82,6 +85,7 @@ uint8_t counterPressure100msec; uint8_t counterCompass100msec; uint8_t counterAmbientLight100msec; + uint32_t tick_execute1second; uint32_t tickstart; } SScheduleCtrl;