1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-15 17:43:51 +01:00

cpu/cc2538: distinguish between GPIO_OD and GPIO_OD_PU

The CC2538 does not support "Open Drain" or "Open Drain with
Pullup" outputs. However problems can arrise from setting both
macros to the same value. This commit sets them to separate
values which are both invalid to avoid conflicts with other
applications.
This commit is contained in:
crasbe 2025-05-14 00:02:46 +02:00
parent a8f9213405
commit ae0beee99e
2 changed files with 3 additions and 3 deletions

View File

@ -153,7 +153,7 @@ typedef enum {
GPIO_IN_PD = ((uint8_t)OVERRIDE_PULLDOWN), /**< input, pull-down */
GPIO_IN_PU = ((uint8_t)OVERRIDE_PULLUP), /**< input, pull-up */
GPIO_OUT = ((uint8_t)OVERRIDE_ENABLE), /**< output */
GPIO_OD = (0xff), /**< not supported */
GPIO_OD = (0xfe), /**< not supported */
GPIO_OD_PU = (0xff) /**< not supported */
} gpio_mode_t;
/** @} */

View File

@ -31,7 +31,7 @@
#define ENABLE_DEBUG 0
#include "debug.h"
#define MODE_NOTSUP (0xff)
#define MODE_NOTSUP (0xf0)
#ifdef MODULE_PERIPH_GPIO_IRQ
static gpio_isr_ctx_t isr_ctx[4][8];
@ -100,7 +100,7 @@ static inline uint8_t _pp_num(gpio_t pin)
int gpio_init(gpio_t pin, gpio_mode_t mode)
{
/* check if mode is valid */
if (mode == MODE_NOTSUP) {
if (mode >= MODE_NOTSUP) {
return -1;
}