64 |
64 |
*
|
65 |
65 |
* @param[in] c The condition to check.
|
66 |
66 |
*/
|
67 |
|
#define apalDbgAssert(c) \
|
68 |
|
_apalDbgAssertMsg(c, "%s(%u): apalDbgAssert failed", __FILE__, __LINE__);
|
|
67 |
#define apalDbgAssert(c) _apalDbgAssertMsg(c, "%s(%u): apalDbgAssert failed", __FILE__, __LINE__)
|
|
68 |
|
69 |
69 |
|
70 |
70 |
#else /* (AMIROOS_CFG_DBG != true) */
|
71 |
71 |
|
... | ... | |
84 |
84 |
*
|
85 |
85 |
* @param[in] us Time to sleep until execution continues in microseconds.
|
86 |
86 |
*/
|
87 |
|
static inline void usleep(apalTime_t us)
|
|
87 |
static inline void apalSleep(apalTime_t us)
|
88 |
88 |
{
|
89 |
89 |
// check if the specified time can be represented by the system
|
90 |
90 |
apalDbgAssert(us <= chTimeI2US(TIME_INFINITE));
|
... | ... | |
165 |
165 |
}
|
166 |
166 |
|
167 |
167 |
/**
|
|
168 |
* @brief Return the interrupt enable status of the GPIO.
|
|
169 |
*
|
|
170 |
* @param[in] gpio GPIO to check.
|
|
171 |
* @param[out] enabled Flag, indicating whether interrupt is enabled for the GPIO.
|
|
172 |
*
|
|
173 |
* @return The status indicates whether the function call was successful.
|
|
174 |
*/
|
|
175 |
static inline apalExitStatus_t apalGpioIsInterruptEnabled(apalGpio_t* gpio, bool* const enabled)
|
|
176 |
{
|
|
177 |
apalDbgAssert(gpio != NULL);
|
|
178 |
apalDbgAssert(enabled != NULL);
|
|
179 |
|
|
180 |
*enabled = palIsLineEventEnabledX(gpio->line);
|
|
181 |
return APAL_STATUS_OK;
|
|
182 |
}
|
|
183 |
|
|
184 |
/**
|
168 |
185 |
* @brief Get the current on/off state of a control GPIO.
|
169 |
186 |
*
|
170 |
187 |
* @param[in] gpio Control GPIO to read.
|
... | ... | |
212 |
229 |
(edge == APAL_GPIO_EDGE_BOTH) ? PAL_EVENT_MODE_BOTH_EDGES : \
|
213 |
230 |
PAL_EVENT_MODE_DISABLED)
|
214 |
231 |
|
|
232 |
/**
|
|
233 |
* @brief Enable or disable the interrupt event functionality.
|
|
234 |
*
|
|
235 |
* @param[in] cgpio Control GPIO to set.
|
|
236 |
* @param[in] enable Flag, indicating whether the interrupt shall be activated (true) or deactivated (false).
|
|
237 |
*
|
|
238 |
* @return The status indicates whether the function call was successful.
|
|
239 |
*/
|
|
240 |
static inline apalExitStatus_t apalControlGpioSetInterrupt(const apalControlGpio_t* const cgpio, const bool enable)
|
|
241 |
{
|
|
242 |
apalDbgAssert(cgpio != NULL);
|
|
243 |
apalDbgAssert(cgpio->gpio != NULL);
|
|
244 |
|
|
245 |
if (enable) {
|
|
246 |
apalDbgAssert(pal_lld_get_line_event(cgpio->gpio->line) != NULL);
|
|
247 |
palEnableLineEvent(cgpio->gpio->line, APAL2CH_EDGE(cgpio->meta.edge));
|
|
248 |
} else {
|
|
249 |
palDisableLineEvent(cgpio->gpio->line);
|
|
250 |
}
|
|
251 |
|
|
252 |
return APAL_STATUS_OK;
|
|
253 |
}
|
|
254 |
|
215 |
255 |
#endif /* (HAL_USE_PAL == TRUE) */
|
216 |
256 |
|
217 |
257 |
/*============================================================================*/
|