ioexpander: Honor C89 standard

This commit is contained in:
Nathan Hartman 2022-08-14 16:47:03 -04:00 committed by Xiang Xiao
parent 585ca7d028
commit 9d5a91c41a
2 changed files with 18 additions and 14 deletions

View File

@ -98,21 +98,21 @@ static const struct gpio_operations_s g_gplh_ops =
gplh_setpintype, gplh_setpintype,
}; };
/* REVISIT: The following violates the NuttX coding standard requirement /* Identifies the type of the GPIO pin */
* for C89 compatibility.
*/
static const uint32_t g_gplh_inttype[] = static const uint32_t g_gplh_inttype[GPIO_NPINTYPES] =
{ {
[GPIO_INPUT_PIN] = IOEXPANDER_VAL_DISABLE, IOEXPANDER_VAL_DISABLE, /* GPIO_INPUT_PIN */
[GPIO_INPUT_PIN_PULLUP] = IOEXPANDER_VAL_DISABLE, IOEXPANDER_VAL_DISABLE, /* GPIO_INPUT_PIN_PULLUP */
[GPIO_INPUT_PIN_PULLDOWN] = IOEXPANDER_VAL_DISABLE, IOEXPANDER_VAL_DISABLE, /* GPIO_INPUT_PIN_PULLDOWN */
[GPIO_INTERRUPT_PIN] = CONFIG_GPIO_LOWER_HALF_INTTYPE, IOEXPANDER_VAL_DISABLE, /* GPIO_OUTPUT_PIN */
[GPIO_INTERRUPT_HIGH_PIN] = IOEXPANDER_VAL_HIGH, IOEXPANDER_VAL_DISABLE, /* GPIO_OUTPUT_PIN_OPENDRAIN */
[GPIO_INTERRUPT_LOW_PIN] = IOEXPANDER_VAL_LOW, CONFIG_GPIO_LOWER_HALF_INTTYPE, /* GPIO_INTERRUPT_PIN */
[GPIO_INTERRUPT_RISING_PIN] = IOEXPANDER_VAL_RISING, IOEXPANDER_VAL_HIGH, /* GPIO_INTERRUPT_HIGH_PIN */
[GPIO_INTERRUPT_FALLING_PIN] = IOEXPANDER_VAL_FALLING, IOEXPANDER_VAL_LOW, /* GPIO_INTERRUPT_LOW_PIN */
[GPIO_INTERRUPT_BOTH_PIN] = IOEXPANDER_VAL_BOTH, IOEXPANDER_VAL_RISING, /* GPIO_INTERRUPT_RISING_PIN */
IOEXPANDER_VAL_FALLING, /* GPIO_INTERRUPT_FALLING_PIN */
IOEXPANDER_VAL_BOTH, /* GPIO_INTERRUPT_BOTH_PIN */
}; };
/**************************************************************************** /****************************************************************************

View File

@ -81,7 +81,11 @@
* Public Types * Public Types
****************************************************************************/ ****************************************************************************/
/* Identifies the type of the GPIO pin */ /* Identifies the type of the GPIO pin
*
* Note: If this enum is modified, g_gplh_inttype array in
* drivers/ioexpander/gpio_lower_half.c must be updated accordingly.
*/
enum gpio_pintype_e enum gpio_pintype_e
{ {