aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/ports/STM32/LLD/GPIOv2
diff options
context:
space:
mode:
Diffstat (limited to 'os/hal/ports/STM32/LLD/GPIOv2')
-rw-r--r--os/hal/ports/STM32/LLD/GPIOv2/hal_pal_lld.c30
-rw-r--r--os/hal/ports/STM32/LLD/GPIOv2/hal_pal_lld.h11
2 files changed, 20 insertions, 21 deletions
diff --git a/os/hal/ports/STM32/LLD/GPIOv2/hal_pal_lld.c b/os/hal/ports/STM32/LLD/GPIOv2/hal_pal_lld.c
index 70f769f02..ab6864474 100644
--- a/os/hal/ports/STM32/LLD/GPIOv2/hal_pal_lld.c
+++ b/os/hal/ports/STM32/LLD/GPIOv2/hal_pal_lld.c
@@ -92,6 +92,14 @@ static void initgpio(stm32_gpio_t *gpiop, const stm32_gpio_setup_t *config) {
*/
void _pal_lld_init(const PALConfig *config) {
+#if PAL_USE_CALLBACKS || PAL_USE_WAIT || defined(__DOXYGEN__)
+ unsigned i;
+
+ for (i = 0; i < 16; i++) {
+ _pal_init_event(i);
+ }
+#endif
+
/*
* Enables the GPIO related clocks.
*/
@@ -212,24 +220,20 @@ void _pal_lld_setgroupmode(ioportid_t port,
}
}
+#if PAL_USE_CALLBACKS || PAL_USE_WAIT || defined(__DOXYGEN__)
/**
* @brief Pad event enable.
- * @details This function programs an event callback in the specified mode.
* @note Programming an unknown or unsupported mode is silently ignored.
*
* @param[in] port port identifier
* @param[in] pad pad number within the port
* @param[in] mode pad event mode
- * @param[in] callback event callback function
- * @param[in] arg callback argument
*
* @notapi
*/
void _pal_lld_enablepadevent(ioportid_t port,
iopadid_t pad,
- ioeventmode_t mode,
- palcallback_t callback,
- void *arg) {
+ ioeventmode_t mode) {
uint32_t padmask, cridx, crmask, portidx;
@@ -247,7 +251,7 @@ void _pal_lld_enablepadevent(ioportid_t port,
crmask = ~(0xFU << (((uint32_t)pad & 3U) * 4U));
/* Port index is obtained assuming that GPIO ports are placed at regular
- 0x400 intervalis in memory space. So far this is true for all devices.*/
+ 0x400 intervals in memory space. So far this is true for all devices.*/
portidx = (uint32_t)port >> 10U;
/* Port selection in SYSCFG.*/
@@ -266,9 +270,6 @@ void _pal_lld_enablepadevent(ioportid_t port,
/* Programming interrupt and event registers.*/
EXTI->IMR |= padmask;
EXTI->EMR &= ~padmask;
-
- /* Setting up callback and argument for this event.*/
- _pal_set_event(pad, callback, arg);
}
/**
@@ -298,7 +299,7 @@ void _pal_lld_disablepadevent(ioportid_t port, iopadid_t pad) {
croff = ((uint32_t)pad & 3U) * 4U;
/* Port index is obtained assuming that GPIO ports are placed at regular
- 0x400 intervalis in memory space. So far this is true for all devices.*/
+ 0x400 intervals in memory space. So far this is true for all devices.*/
portidx = (uint32_t)port >> 10U;
crport = (SYSCFG->EXTICR[cridx] >> croff) & 0xFU;
@@ -312,10 +313,13 @@ void _pal_lld_disablepadevent(ioportid_t port, iopadid_t pad) {
EXTI->FTSR = ftsr1 & ~padmask;
EXTI->PR = padmask;
- /* Clearing callback and argument for this event.*/
- _pal_clear_event(pad);
+#if PAL_USE_CALLBACKS || PAL_USE_WAIT
+ /* Callback cleared and/or thread reset.*/
+ _pal_clear_event(pad);
+#endif
}
}
+#endif /* PAL_USE_CALLBACKS || PAL_USE_WAIT */
#endif /* HAL_USE_PAL */
diff --git a/os/hal/ports/STM32/LLD/GPIOv2/hal_pal_lld.h b/os/hal/ports/STM32/LLD/GPIOv2/hal_pal_lld.h
index 4a30a61a5..546c45045 100644
--- a/os/hal/ports/STM32/LLD/GPIOv2/hal_pal_lld.h
+++ b/os/hal/ports/STM32/LLD/GPIOv2/hal_pal_lld.h
@@ -551,19 +551,16 @@ typedef uint32_t iopadid_t;
/**
* @brief Pad event enable.
- * @details This function programs an event callback in the specified mode.
* @note Programming an unknown or unsupported mode is silently ignored.
*
* @param[in] port port identifier
* @param[in] pad pad number within the port
* @param[in] mode pad event mode
- * @param[in] callback event callback function
- * @param[in] arg callback argument
*
* @notapi
*/
-#define pal_lld_enablepadevent(port, pad, mode, callback, arg) \
- _pal_lld_enablepadevent(port, pad, mode, callback, arg)
+#define pal_lld_enablepadevent(port, pad, mode) \
+ _pal_lld_enablepadevent(port, pad, mode)
/**
* @brief Pad event disable.
@@ -612,9 +609,7 @@ extern "C" {
iomode_t mode);
void _pal_lld_enablepadevent(ioportid_t port,
iopadid_t pad,
- ioeventmode_t mode,
- palcallback_t callback,
- void *arg);
+ ioeventmode_t mode);
void _pal_lld_disablepadevent(ioportid_t port, iopadid_t pad);
#ifdef __cplusplus
}