1 // Copyright 2016-2017 Espressif Systems (Shanghai) PTE LTD 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 #pragma once 16 17 #include <stdint.h> 18 #include "esp_err.h" 19 #include "esp_intr_alloc.h" 20 21 #ifdef __cplusplus 22 extern "C" { 23 #endif 24 25 /** 26 * @brief Register a handler for specific RTC_CNTL interrupts 27 * 28 * Multiple handlers can be registered using this function. Whenever an 29 * RTC interrupt happens, all handlers with matching rtc_intr_mask values 30 * will be called. 31 * 32 * @param handler handler function to call 33 * @param handler_arg argument to be passed to the handler 34 * @param rtc_intr_mask combination of RTC_CNTL_*_INT_ENA bits indicating the 35 * sources to call the handler for 36 * @return 37 * - ESP_OK on success 38 * - ESP_ERR_NO_MEM not enough memory to allocate handler structure 39 * - other errors returned by esp_intr_alloc 40 */ 41 esp_err_t rtc_isr_register(intr_handler_t handler, void* handler_arg, 42 uint32_t rtc_intr_mask); 43 /** 44 * @brief Deregister the handler previously registered using rtc_isr_register 45 * @param handler handler function to call (as passed to rtc_isr_register) 46 * @param handler_arg argument of the handler (as passed to rtc_isr_register) 47 * @return 48 * - ESP_OK on success 49 * - ESP_ERR_INVALID_STATE if a handler matching both handler and 50 * handler_arg isn't registered 51 */ 52 esp_err_t rtc_isr_deregister(intr_handler_t handler, void* handler_arg); 53 54 #ifdef __cplusplus 55 } 56 #endif 57