From ea05037258993adc5707333696255da0bf9e40ad Mon Sep 17 00:00:00 2001 From: Luke Hoersten Date: Sun, 30 May 2021 11:00:27 -0500 Subject: Doorbell interrupts working. GPIO cannot do both ADC and ISR so split the pins. --- main/src/led.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'main/src/led.c') diff --git a/main/src/led.c b/main/src/led.c index 714e0f7..63513f6 100644 --- a/main/src/led.c +++ b/main/src/led.c @@ -7,30 +7,31 @@ #include #include +#define LED_ON 1 +#define LED_OFF 0 + int intercom_led_identify(hap_acc_t *ha) { ESP_LOGI(TAG, "Accessory identified"); for (int i = 0; i < 3; i++) { - gpio_set_level(CONFIG_HOMEKIT_INTERCOM_LED_GPIO_PIN, 1); + gpio_set_level(GPIO_NUM_13, LED_ON); vTaskDelay(pdMS_TO_TICKS(500)); - gpio_set_level(CONFIG_HOMEKIT_INTERCOM_LED_GPIO_PIN, 0); + gpio_set_level(GPIO_NUM_13, LED_OFF); vTaskDelay(pdMS_TO_TICKS(500)); } return HAP_SUCCESS; } -void intercom_led_init(uint32_t key_gpio_pin) +void intercom_led_init() { gpio_config_t io_conf; - io_conf.intr_type = GPIO_INTR_DISABLE; /* Interrupt for falling edge */ - io_conf.pin_bit_mask = 1ULL << key_gpio_pin; /* Bit mask of the pins */ + io_conf.pin_bit_mask = GPIO_SEL_13; /* Bit mask of the pins */ io_conf.mode = GPIO_MODE_OUTPUT; /* Set as input mode */ io_conf.pull_up_en = GPIO_PULLUP_DISABLE; /* Disable internal pull-up */ io_conf.pull_down_en = GPIO_PULLDOWN_ENABLE; /* Enable internal pull-down */ - - gpio_config(&io_conf); /* Set the GPIO configuration */ + gpio_config(&io_conf); /* Set the GPIO configuration */ } \ No newline at end of file -- cgit v1.2.3