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