@@ -55,18 +55,18 @@ static void IRAM_ATTR ps2_interrupt_handler(void *self_in);
55
55
static void ps2_set_config (ps2io_ps2_obj_t * self ) {
56
56
// turn on falling edge interrupt
57
57
gpio_set_intr_type (self -> clk_pin , GPIO_INTR_NEGEDGE );
58
- gpio_isr_register ( ps2_interrupt_handler , ( void * ) self , ESP_INTR_FLAG_IRAM , & self -> handle );
59
- gpio_intr_enable (self -> clk_pin );
58
+ gpio_install_isr_service ( ESP_INTR_FLAG_IRAM );
59
+ gpio_isr_handler_add (self -> clk_pin , ps2_interrupt_handler , ( void * ) self );
60
60
}
61
61
62
62
static void disable_interrupt (ps2io_ps2_obj_t * self ) {
63
63
// turn off fallling edge interrupt
64
- gpio_intr_disable (self -> clk_pin );
64
+ gpio_isr_handler_remove (self -> clk_pin );
65
65
}
66
66
67
67
static void resume_interrupt (ps2io_ps2_obj_t * self ) {
68
68
self -> state = STATE_IDLE ;
69
- gpio_intr_enable (self -> clk_pin );
69
+ gpio_isr_handler_add (self -> clk_pin , ps2_interrupt_handler , ( void * ) self );
70
70
}
71
71
72
72
static void clk_hi (ps2io_ps2_obj_t * self ) {
@@ -252,10 +252,7 @@ void common_hal_ps2io_ps2_deinit(ps2io_ps2_obj_t* self) {
252
252
if (common_hal_ps2io_ps2_deinited (self )) {
253
253
return ;
254
254
}
255
- if (self -> handle ) {
256
- esp_intr_free (self -> handle );
257
- self -> handle = NULL ;
258
- }
255
+ gpio_uninstall_isr_service ();
259
256
reset_pin_number (self -> clk_pin );
260
257
reset_pin_number (self -> data_pin );
261
258
self -> clk_pin = GPIO_NUM_MAX ;
0 commit comments