Add gpio_set_irqover to match inover/outover/oeover (fixes #265) (#470)

This commit is contained in:
Luke Wren 2021-06-03 14:37:06 +01:00 committed by GitHub
parent 8d7bdd2006
commit bba0420c76
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 25 additions and 0 deletions

View File

@ -27,6 +27,10 @@ void gpio_set_pulls(uint gpio, bool up, bool down) {
} }
void gpio_set_irqover(uint gpio, uint value) {
}
void gpio_set_outover(uint gpio, uint value) { void gpio_set_outover(uint gpio, uint value) {
} }

View File

@ -61,6 +61,8 @@ void gpio_disable_pulls(uint gpio);
void gpio_set_pulls(uint gpio, bool up, bool down); void gpio_set_pulls(uint gpio, bool up, bool down);
void gpio_set_irqover(uint gpio, uint value);
void gpio_set_outover(uint gpio, uint value); void gpio_set_outover(uint gpio, uint value);
void gpio_set_inover(uint gpio, uint value); void gpio_set_inover(uint gpio, uint value);

View File

@ -57,6 +57,15 @@ void gpio_set_pulls(uint gpio, bool up, bool down) {
); );
} }
// Direct override for per-GPIO IRQ signal
void gpio_set_irqover(uint gpio, uint value) {
invalid_params_if(GPIO, gpio >= NUM_BANK0_GPIOS);
hw_write_masked(&iobank0_hw->io[gpio].ctrl,
value << IO_BANK0_GPIO0_CTRL_IRQOVER_LSB,
IO_BANK0_GPIO0_CTRL_IRQOVER_BITS
);
}
// Direct overrides for pad controls // Direct overrides for pad controls
void gpio_set_inover(uint gpio, uint value) { void gpio_set_inover(uint gpio, uint value) {
invalid_params_if(GPIO, gpio >= NUM_BANK0_GPIOS); invalid_params_if(GPIO, gpio >= NUM_BANK0_GPIOS);

View File

@ -239,6 +239,16 @@ static inline void gpio_disable_pulls(uint gpio) {
gpio_set_pulls(gpio, false, false); gpio_set_pulls(gpio, false, false);
} }
/*! \brief Set GPIO IRQ override
* \ingroup hardware_gpio
*
* Optionally invert a GPIO IRQ signal, or drive it high or low
*
* \param gpio GPIO number
* \param value See \ref gpio_override
*/
void gpio_set_irqover(uint gpio, uint value);
/*! \brief Set GPIO output override /*! \brief Set GPIO output override
* \ingroup hardware_gpio * \ingroup hardware_gpio
* *