Revision cf1f756b periphALtypes.h
periphALtypes.h | ||
---|---|---|
23 | 23 |
/* DEPENDENCIES */ |
24 | 24 |
/*============================================================================*/ |
25 | 25 |
|
26 |
#include <alldconf.h> |
|
26 | 27 |
#include <stdint.h> |
27 | 28 |
|
28 | 29 |
/*============================================================================*/ |
... | ... | |
32 | 33 |
/** |
33 | 34 |
* @brief Time measurement type (in microseconds). |
34 | 35 |
*/ |
35 |
typedef uint64_t apalTime_t; |
|
36 |
#if !defined(AMIROLLD_CFG_TIME_SIZE) |
|
37 |
#error "AMIROLLD_CFG_TIME_SIZE not defined in alldconf.h" |
|
38 |
#elif (AMIROLLD_CFG_TIME_SIZE == 8) |
|
39 |
typedef uint8_t apalTime_t; |
|
40 |
#elif (AMIROLLD_CFG_TIME_SIZE == 16) |
|
41 |
typedef uint16_t apalTime_t; |
|
42 |
#elif (AMIROLLD_CFG_TIME_SIZE == 32) |
|
43 |
typedef uint32_t apalTime_t; |
|
44 |
#elif (AMIROLLD_CFG_TIME_SIZE == 64) |
|
45 |
typedef uint64_t apalTime_t; |
|
46 |
#else |
|
47 |
#error "AMIROLLD_CFG_TIME_SIZE must be 8, 16, 32 or 64!" |
|
48 |
#endif |
|
36 | 49 |
|
37 | 50 |
/** |
38 | 51 |
* @brief Status values used as return value for all (or most) function calls. |
... | ... | |
84 | 97 |
} apalGpioActive_t; |
85 | 98 |
|
86 | 99 |
/** |
100 |
* @brief Signal direction for the control GPIO. |
|
101 |
*/ |
|
102 |
typedef enum { |
|
103 |
APAL_GPIO_DIRECTION_UNDEFINED = 0x00, /**< Signal direction is undefined. */ |
|
104 |
APAL_GPIO_DIRECTION_INPUT = 0x01, /**< Signal direction is input only. */ |
|
105 |
APAL_GPIO_DIRECTION_OUTPUT = 0x02, /**< Signal direction is output only */ |
|
106 |
APAL_GPIO_DIRECTION_BIDIRECTIONAL = 0x03, /**< Signal direction is bidirectional. */ |
|
107 |
} apalGpioDirection_t; |
|
108 |
|
|
109 |
/** |
|
87 | 110 |
* @brief Informative signal edge for input control GPIOs. |
88 | 111 |
*/ |
89 | 112 |
typedef enum { |
... | ... | |
94 | 117 |
} apalGpioEdge_t; |
95 | 118 |
|
96 | 119 |
/** |
97 |
* @brief Signal direction for the control GPIO. |
|
120 |
* @brief Inverts the value of the informative signal edge for interrupts. |
|
121 |
* @details Rising edge is inverted to falling and vice versa. |
|
122 |
* If none or both edges are enabled, the identical value is returned. |
|
98 | 123 |
*/ |
99 |
typedef enum { |
|
100 |
APAL_GPIO_DIRECTION_UNDEFINED = 0x00, /**< Signal direction is undefined. */ |
|
101 |
APAL_GPIO_DIRECTION_INPUT = 0x01, /**< Signal direction is input only. */ |
|
102 |
APAL_GPIO_DIRECTION_OUTPUT = 0x02, /**< Signal direction is output only */ |
|
103 |
APAL_GPIO_DIRECTION_BIDIRECTIONAL = 0x03, /**< Signal direction is bidirectional. */ |
|
104 |
} apalGpioDirection_t; |
|
124 |
#define APAL_GPIO_EDGE_INVERT(edge) \ |
|
125 |
((edge == APAL_GPIO_EDGE_RISING) ? APAL_GPIO_EDGE_FALLING : \ |
|
126 |
(edge == APAL_GPIO_EDGE_FALLING) ? APAL_GPIO_EDGE_RISING : edge) \ |
|
105 | 127 |
|
106 | 128 |
/** |
107 | 129 |
* @brief Control GPIO meta information |
108 | 130 |
*/ |
109 | 131 |
typedef struct { |
132 |
apalGpioDirection_t direction : 2; /**< Direction configuration for according signals */ |
|
110 | 133 |
apalGpioActive_t active : 1; /**< Active state of the GPIO */ |
111 | 134 |
apalGpioEdge_t edge : 2; /**< Edge configuration for according signals */ |
112 |
apalGpioDirection_t direction : 2; /**< Direction configuration for according signals */ |
|
113 | 135 |
} apalGpioMeta_t; |
114 | 136 |
|
115 | 137 |
/** |
Also available in: Unified diff