1 /* 2 * Copyright (c) 2021 Bestechnic (Shanghai) Co., Ltd. All rights reserved. 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 #ifndef __HAL_TIMER_USER_IRQ_H__ 16 #define __HAL_TIMER_USER_IRQ_H__ 17 18 #ifdef __cplusplus 19 extern "C" { 20 #endif 21 22 #include "hal_timer.h" 23 24 void hal_user_timer0_setup(enum HAL_TIMER_TYPE_T type, HAL_TIMER_IRQ_HANDLER_T handler); 25 26 void hal_user_timer0_start(uint32_t load); 27 28 void hal_user_timer0_stop(void); 29 30 void hal_user_timer0_continue(void); 31 32 int hal_user_timer0_is_enabled(void); 33 34 void hal_user_timer0_reload(uint32_t load); 35 36 uint32_t hal_user_timer0_get_raw_value(void); 37 38 int hal_user_timer0_irq_active(void); 39 40 int hal_user_timer0_irq_pending(void); 41 42 uint32_t hal_user_timer0_get_elapsed_time(void); 43 44 void hal_user_timer1_setup(enum HAL_TIMER_TYPE_T type, HAL_TIMER_IRQ_HANDLER_T handler); 45 46 void hal_user_timer1_start(uint32_t load); 47 48 void hal_user_timer1_stop(void); 49 50 void hal_user_timer1_continue(void); 51 52 int hal_user_timer1_is_enabled(void); 53 54 void hal_user_timer1_reload(uint32_t load); 55 56 uint32_t hal_user_timer1_get_raw_value(void); 57 58 int hal_user_timer1_irq_active(void); 59 60 int hal_user_timer1_irq_pending(void); 61 62 uint32_t hal_user_timer1_get_elapsed_time(void); 63 64 #ifdef __cplusplus 65 } 66 #endif 67 68 #endif 69