mirror of
https://github.com/mytechnotalent/Embedded-Hacking.git
synced 2026-07-09 14:08:11 +02:00
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:
@@ -169,6 +169,7 @@ typedef struct
|
|||||||
#define PADS_BANK0_IE_SHIFT 6U
|
#define PADS_BANK0_IE_SHIFT 6U
|
||||||
#define PADS_BANK0_ISO_SHIFT 8U
|
#define PADS_BANK0_ISO_SHIFT 8U
|
||||||
#define PADS_BANK0_PUE_SHIFT 3U
|
#define PADS_BANK0_PUE_SHIFT 3U
|
||||||
|
#define PADS_BANK0_PDE_SHIFT 2U
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief SIO GPIO register offsets (word indices from SIO_BASE)
|
* @brief SIO GPIO register offsets (word indices from SIO_BASE)
|
||||||
|
|||||||
@@ -189,6 +189,7 @@ static void _configure_pad(void)
|
|||||||
value &= ~(1U << PADS_BANK0_OD_SHIFT);
|
value &= ~(1U << PADS_BANK0_OD_SHIFT);
|
||||||
value |= (1U << PADS_BANK0_IE_SHIFT);
|
value |= (1U << PADS_BANK0_IE_SHIFT);
|
||||||
value |= (1U << PADS_BANK0_PUE_SHIFT);
|
value |= (1U << PADS_BANK0_PUE_SHIFT);
|
||||||
|
value &= ~(1U << PADS_BANK0_PDE_SHIFT);
|
||||||
value &= ~(1U << PADS_BANK0_ISO_SHIFT);
|
value &= ~(1U << PADS_BANK0_ISO_SHIFT);
|
||||||
PADS_BANK0->GPIO[IR_PIN] = value;
|
PADS_BANK0->GPIO[IR_PIN] = value;
|
||||||
}
|
}
|
||||||
@@ -237,5 +238,8 @@ int ir_getkey(void)
|
|||||||
return -1;
|
return -1;
|
||||||
if (!_read_32_bits(data))
|
if (!_read_32_bits(data))
|
||||||
return -1;
|
return -1;
|
||||||
return _validate_nec_frame(data);
|
int result = _validate_nec_frame(data);
|
||||||
|
if (result < 0)
|
||||||
|
return -1;
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user