amiro-blt / Target / Source / helper.h @ d5a2a7ce
History | View | Annotate | Download (1.888 KB)
| 1 | 69661903 | Thomas Schöpping | #ifndef HELPER_H
|
|---|---|---|---|
| 2 | #define HELPER_H
|
||
| 3 | |||
| 4 | #include <stdint.h> |
||
| 5 | 2d379838 | Thomas Schöpping | #include <iodef.h> |
| 6 | 69661903 | Thomas Schöpping | |
| 7 | /****************************************************************************************
|
||
| 8 | * Standalone timer, that does not use any static variables.
|
||
| 9 | * Except for the static counter variable, this timer is identical to the OpenBLT timer.h
|
||
| 10 | * implementation. With the standalone timer, this variable must be stored externally and
|
||
| 11 | * must be given to the saTimerUpdate() function as argument.
|
||
| 12 | ****************************************************************************************/
|
||
| 13 | void saTimerInit(void); |
||
| 14 | void saTimerUpdate(uint32_t *millisecond_counter);
|
||
| 15 | void saTimerReset(void); |
||
| 16 | /***************************************************************************************/
|
||
| 17 | |||
| 18 | /****************************************************************************************
|
||
| 19 | * Helper functions that implement a actively polling loop until a specific event occurs.
|
||
| 20 | ****************************************************************************************/
|
||
| 21 | void msleep(uint32_t ms);
|
||
| 22 | void waitForSignal(GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin, BitAction state);
|
||
| 23 | uint8_t waitForSignalTimeout(GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin, BitAction state, uint32_t timeout_ms); |
||
| 24 | /***************************************************************************************/
|
||
| 25 | |||
| 26 | /****************************************************************************************
|
||
| 27 | * Helper functions that use the LED to signal some states or visualize data.
|
||
| 28 | ****************************************************************************************/
|
||
| 29 | void setLed(uint8_t on);
|
||
| 30 | void blinkSOS(uint32_t loops);
|
||
| 31 | void blinkSOSinf(void); |
||
| 32 | void blinkOK(uint32_t loops);
|
||
| 33 | void blinkOKinf(void); |
||
| 34 | void visualizeData(uint8_t* data, uint32_t bytes, uint32_t loops);
|
||
| 35 | void visualizeByte(uint8_t byte, uint32_t loops);
|
||
| 36 | /***************************************************************************************/
|
||
| 37 | |||
| 38 | #endif // HELPER_H |