gpio: Fix ESP32S3 GPIO48 does not support hold function bug

GPIO_HOLD_MASK array was missing the last item

Add __Static_assert to check array sizes for all gpio_periph.c files to prevent same mistake in the future.
This commit is contained in:
songruojing
2022-07-01 15:43:04 +08:00
parent 0c4b9a0101
commit 145454356b
7 changed files with 52 additions and 54 deletions

View File

@@ -6,7 +6,7 @@
#include "soc/gpio_periph.h"
const uint32_t GPIO_PIN_MUX_REG[SOC_GPIO_PIN_COUNT] = {
const uint32_t GPIO_PIN_MUX_REG[] = {
IO_MUX_GPIO0_REG,
IO_MUX_GPIO1_REG,
IO_MUX_GPIO2_REG,
@@ -56,7 +56,9 @@ const uint32_t GPIO_PIN_MUX_REG[SOC_GPIO_PIN_COUNT] = {
IO_MUX_GPIO46_REG,
};
const uint32_t GPIO_HOLD_MASK[SOC_GPIO_PIN_COUNT] = {
_Static_assert(sizeof(GPIO_PIN_MUX_REG) == SOC_GPIO_PIN_COUNT * sizeof(uint32_t), "Invalid size of GPIO_PIN_MUX_REG");
const uint32_t GPIO_HOLD_MASK[] = {
0,
0,
0,
@@ -105,3 +107,5 @@ const uint32_t GPIO_HOLD_MASK[SOC_GPIO_PIN_COUNT] = {
BIT(24),
BIT(25),
};
_Static_assert(sizeof(GPIO_HOLD_MASK) == SOC_GPIO_PIN_COUNT * sizeof(uint32_t), "Invalid size of GPIO_HOLD_MASK");