nrf5/modules/machine: Updating Pin module to register a IRQ callback upon GPIO polarity change events.
This commit is contained in:
parent
81aaf6e906
commit
1e79bdf0b4
|
@ -95,10 +95,15 @@
|
||||||
// Pin class variables
|
// Pin class variables
|
||||||
STATIC bool pin_class_debug;
|
STATIC bool pin_class_debug;
|
||||||
|
|
||||||
|
// Forward declare function
|
||||||
|
void gpio_irq_event_callback(hal_gpio_event_channel_t channel);
|
||||||
|
|
||||||
void pin_init0(void) {
|
void pin_init0(void) {
|
||||||
MP_STATE_PORT(pin_class_mapper) = mp_const_none;
|
MP_STATE_PORT(pin_class_mapper) = mp_const_none;
|
||||||
MP_STATE_PORT(pin_class_map_dict) = mp_const_none;
|
MP_STATE_PORT(pin_class_map_dict) = mp_const_none;
|
||||||
pin_class_debug = false;
|
pin_class_debug = false;
|
||||||
|
|
||||||
|
hal_gpio_register_callback(gpio_irq_event_callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
// C API used to convert a user-supplied pin name into an ordinal pin number.
|
// C API used to convert a user-supplied pin name into an ordinal pin number.
|
||||||
|
@ -636,6 +641,10 @@ const mp_obj_type_t pin_af_type = {
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
// Pin IRQ object
|
// Pin IRQ object
|
||||||
|
|
||||||
|
void gpio_irq_event_callback(hal_gpio_event_channel_t channel) {
|
||||||
|
// printf("### gpio irq received on channel %d\n", (uint16_t)channel);
|
||||||
|
}
|
||||||
|
|
||||||
typedef struct _pin_irq_obj_t {
|
typedef struct _pin_irq_obj_t {
|
||||||
mp_obj_base_t base;
|
mp_obj_base_t base;
|
||||||
pin_obj_t pin;
|
pin_obj_t pin;
|
||||||
|
|
Loading…
Reference in New Issue