mirror of
https://github.com/micropython/micropython.git
synced 2025-12-16 01:40:14 +01:00
rp2/machine_pin: Add mp_hal_pin_interrupt C interface.
So C can can easily configure a pin interrupt and callback. Signed-off-by: Andrew Leech <andrew@alelec.net>
This commit is contained in:
committed by
Damien George
parent
9bd6169b72
commit
05f927b624
@@ -126,4 +126,14 @@ static inline void mp_hal_pin_high(mp_hal_pin_obj_t pin) {
|
||||
gpio_set_mask(1 << pin);
|
||||
}
|
||||
|
||||
enum mp_hal_pin_interrupt_trigger {
|
||||
MP_HAL_PIN_TRIGGER_NONE,
|
||||
MP_HAL_PIN_TRIGGER_LOW = GPIO_IRQ_LEVEL_LOW,
|
||||
MP_HAL_PIN_TRIGGER_HIGH = GPIO_IRQ_LEVEL_HIGH,
|
||||
MP_HAL_PIN_TRIGGER_FALL = GPIO_IRQ_EDGE_FALL,
|
||||
MP_HAL_PIN_TRIGGER_RISE = GPIO_IRQ_EDGE_RISE,
|
||||
};
|
||||
|
||||
void mp_hal_pin_interrupt(mp_hal_pin_obj_t pin, mp_obj_t handler, mp_uint_t trigger, bool hard);
|
||||
|
||||
#endif // MICROPY_INCLUDED_RP2_MPHALPORT_H
|
||||
|
||||
Reference in New Issue
Block a user