fix(ir_cbm): clear PDE bit in pad config for proper pull-up input

PADS_BANK0 GPIO5 had PDE (pull-down enable, bit 2) still set to its
reset default. With both PUE and PDE active the pin floated to ~VDD/2,
causing the Schmitt trigger to read LOW permanently. Clear PDE in
_configure_pad() so the pull-up works correctly.

Added PADS_BANK0_PDE_SHIFT define to rp2350.h.
This commit is contained in:
Kevin Thomas
2026-04-06 21:47:48 -04:00
parent 8f20fcde28
commit e2d2b21551
2 changed files with 6 additions and 1 deletions

View File

@@ -169,6 +169,7 @@ typedef struct
#define PADS_BANK0_IE_SHIFT 6U
#define PADS_BANK0_ISO_SHIFT 8U
#define PADS_BANK0_PUE_SHIFT 3U
#define PADS_BANK0_PDE_SHIFT 2U
/**
* @brief SIO GPIO register offsets (word indices from SIO_BASE)

View File

@@ -189,6 +189,7 @@ static void _configure_pad(void)
value &= ~(1U << PADS_BANK0_OD_SHIFT);
value |= (1U << PADS_BANK0_IE_SHIFT);
value |= (1U << PADS_BANK0_PUE_SHIFT);
value &= ~(1U << PADS_BANK0_PDE_SHIFT);
value &= ~(1U << PADS_BANK0_ISO_SHIFT);
PADS_BANK0->GPIO[IR_PIN] = value;
}
@@ -237,5 +238,8 @@ int ir_getkey(void)
return -1;
if (!_read_32_bits(data))
return -1;
return _validate_nec_frame(data);
int result = _validate_nec_frame(data);
if (result < 0)
return -1;
return result;
}