1 /* 2 * Copyright (c) 2006-2023, RT-Thread Development Team 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 * 6 * Change Logs: 7 * Date Author Notes 8 * 2018-12-12 zylx first version 9 */ 10 11 #ifndef __TIM_CONFIG_H__ 12 #define __TIM_CONFIG_H__ 13 14 #include <rtthread.h> 15 16 #ifdef __cplusplus 17 extern "C" { 18 #endif 19 20 #ifndef TIM_DEV_INFO_CONFIG 21 #ifdef BSP_USING_TIM2 22 #define TIM_DEV_INFO_CONFIG \ 23 { \ 24 .maxfreq = 1000000, \ 25 .minfreq = 2000, \ 26 .maxcnt = 0xFFFFFFFF, \ 27 .cntmode = HWTIMER_CNTMODE_UP, \ 28 } 29 #else 30 #define TIM_DEV_INFO_CONFIG \ 31 { \ 32 .maxfreq = 1000000, \ 33 .minfreq = 2000, \ 34 .maxcnt = 0xFFFF, \ 35 .cntmode = HWTIMER_CNTMODE_UP, \ 36 } 37 #endif 38 #endif /* TIM_DEV_INFO_CONFIG */ 39 40 #ifdef BSP_USING_TIM2 41 #ifndef TIM2_CONFIG 42 #define TIM2_CONFIG \ 43 { \ 44 .tim_handle.Instance = TIM2, \ 45 .tim_irqn = TIM2_IRQn, \ 46 .name = "timer2", \ 47 } 48 #endif /* TIM2_CONFIG */ 49 #endif /* BSP_USING_TIM2 */ 50 51 #ifdef BSP_USING_TIM15 52 #ifndef TIM15_CONFIG 53 #define TIM15_CONFIG \ 54 { \ 55 .tim_handle.Instance = TIM15, \ 56 .tim_irqn = TIM1_BRK_TIM15_IRQn, \ 57 .name = "timer15", \ 58 } 59 #endif /* TIM15_CONFIG */ 60 #endif /* BSP_USING_TIM15 */ 61 62 #ifdef BSP_USING_TIM16 63 #ifndef TIM16_CONFIG 64 #define TIM16_CONFIG \ 65 { \ 66 .tim_handle.Instance = TIM16, \ 67 .tim_irqn = TIM1_UP_TIM16_IRQn, \ 68 .name = "timer16", \ 69 } 70 #endif /* TIM16_CONFIG */ 71 #endif /* BSP_USING_TIM16 */ 72 73 #ifdef BSP_USING_TIM17 74 #ifndef TIM17_CONFIG 75 #define TIM17_CONFIG \ 76 { \ 77 .tim_handle.Instance = TIM17, \ 78 .tim_irqn = TIM1_TRG_COM_TIM17_IRQn, \ 79 .name = "timer17", \ 80 } 81 #endif /* TIM17_CONFIG */ 82 #endif /* BSP_USING_TIM17 */ 83 84 #ifdef __cplusplus 85 } 86 #endif 87 88 #endif /* __TIM_CONFIG_H__ */ 89