soc: st: stm32: common: fix wakeup off-by-one.
Wakeup pin indices are 1-based, but `LISTIFY` is 0-based. Consequently, the last element of the pin-to-register-bit lookup table was never populated. Signed-off-by: Samuel Coleman <samuel.coleman@rbr-global.com>
This commit is contained in:
parent
18250bd312
commit
5a93b27aa9
2 changed files with 4 additions and 3 deletions
|
@ -107,7 +107,7 @@ static const struct gpio_dt_spec empty_gpio = {.port = NULL, .pin = 0, .dt_flags
|
||||||
/* wkup_pin idx starts from 1 */
|
/* wkup_pin idx starts from 1 */
|
||||||
#define WKUP_PIN_CFG_DT_BY_IDX(idx) WKUP_PIN_CFG_DT(WKUP_PIN_NODE_ID_BY_IDX(idx))
|
#define WKUP_PIN_CFG_DT_BY_IDX(idx) WKUP_PIN_CFG_DT(WKUP_PIN_NODE_ID_BY_IDX(idx))
|
||||||
|
|
||||||
#define PWR_STM32_WKUP_PIN_DEF(i, _) LL_PWR_WAKEUP_PIN##i
|
#define PWR_STM32_WKUP_PIN_LOOKUP_MEMBER(i, _) CONCAT(LL_PWR_WAKEUP_PIN, UTIL_INC(i))
|
||||||
|
|
||||||
#define WKUP_PIN_CFG_DT_COMMA(wkup_pin_id) WKUP_PIN_CFG_DT(wkup_pin_id),
|
#define WKUP_PIN_CFG_DT_COMMA(wkup_pin_id) WKUP_PIN_CFG_DT(wkup_pin_id),
|
||||||
|
|
||||||
|
@ -133,7 +133,9 @@ struct wkup_pin_cfg_t {
|
||||||
* @brief LookUp Table to store LL_PWR_WAKEUP_PINx for each wake-up pin.
|
* @brief LookUp Table to store LL_PWR_WAKEUP_PINx for each wake-up pin.
|
||||||
*/
|
*/
|
||||||
static const uint32_t table_wakeup_pins[PWR_STM32_MAX_NB_WKUP_PINS + 1] = {
|
static const uint32_t table_wakeup_pins[PWR_STM32_MAX_NB_WKUP_PINS + 1] = {
|
||||||
LISTIFY(PWR_STM32_MAX_NB_WKUP_PINS, PWR_STM32_WKUP_PIN_DEF, (,))};
|
0,
|
||||||
|
LISTIFY(PWR_STM32_MAX_NB_WKUP_PINS, PWR_STM32_WKUP_PIN_LOOKUP_MEMBER, (,)),
|
||||||
|
};
|
||||||
|
|
||||||
static struct wkup_pin_dt_cfg_t wkup_pins_cfgs[] = {
|
static struct wkup_pin_dt_cfg_t wkup_pins_cfgs[] = {
|
||||||
DT_FOREACH_CHILD(STM32_PWR_NODE, WKUP_PIN_CFG_DT_COMMA)};
|
DT_FOREACH_CHILD(STM32_PWR_NODE, WKUP_PIN_CFG_DT_COMMA)};
|
||||||
|
|
|
@ -17,7 +17,6 @@ extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Some stm32 devices do not have all the LL_PWR_WAKEUP_PINx */
|
/* Some stm32 devices do not have all the LL_PWR_WAKEUP_PINx */
|
||||||
#define LL_PWR_WAKEUP_PIN0 0
|
|
||||||
#ifndef LL_PWR_WAKEUP_PIN3
|
#ifndef LL_PWR_WAKEUP_PIN3
|
||||||
#define LL_PWR_WAKEUP_PIN3 0
|
#define LL_PWR_WAKEUP_PIN3 0
|
||||||
#endif /* LL_PWR_WAKEUP_PIN3 */
|
#endif /* LL_PWR_WAKEUP_PIN3 */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue