@@ -28,6 +28,13 @@
|
||||
.timerx = 2, \
|
||||
}
|
||||
|
||||
#define CAPTURE12_CONFIG \
|
||||
{ \
|
||||
.timer.Instance = TIM12, \
|
||||
.iqrn = TIM8_BRK_TIM12_IRQn, \
|
||||
.timerx = 12, \
|
||||
}
|
||||
|
||||
#define LOG_TAG "drv.tcap"
|
||||
#include <drv_log.h>
|
||||
|
||||
@@ -93,6 +100,12 @@ enum
|
||||
#ifdef BSP_USING_CAPTURE10
|
||||
CAPTURE10_INDEX,
|
||||
#endif
|
||||
#ifdef BSP_USING_CAPTURE11
|
||||
CAPTURE11_INDEX,
|
||||
#endif
|
||||
#ifdef BSP_USING_CAPTURE12
|
||||
CAPTURE12_INDEX,
|
||||
#endif
|
||||
};
|
||||
|
||||
static struct stm32_capture stm32_capture_obj[] =
|
||||
@@ -127,6 +140,12 @@ static struct stm32_capture stm32_capture_obj[] =
|
||||
#ifdef BSP_USING_CAPTURE10
|
||||
CAPTURE10_CONFIG,
|
||||
#endif
|
||||
#ifdef BSP_USING_CAPTURE11
|
||||
CAPTURE11_CONFIG,
|
||||
#endif
|
||||
#ifdef BSP_USING_CAPTURE12
|
||||
CAPTURE12_CONFIG,
|
||||
#endif
|
||||
};
|
||||
|
||||
struct stm32_capture_device
|
||||
@@ -261,6 +280,12 @@ static struct stm32_capture_device stm32_capture_devices[] =
|
||||
#ifdef BSP_USING_CAPTURE10_CH4
|
||||
{{0}, &stm32_capture_obj[CAPTURE10_INDEX], 4, {0}},
|
||||
#endif
|
||||
#ifdef BSP_USING_CAPTURE12_CH1
|
||||
{{0}, &stm32_capture_obj[CAPTURE12_INDEX], 1, {0}},
|
||||
#endif
|
||||
#ifdef BSP_USING_CAPTURE12_CH2
|
||||
{{0}, &stm32_capture_obj[CAPTURE12_INDEX], 2, {0}},
|
||||
#endif
|
||||
};
|
||||
|
||||
static rt_uint64_t get_timer_clock(TIM_HandleTypeDef *htim)
|
||||
@@ -437,6 +462,15 @@ void TIM1_CC_IRQHandler(void)
|
||||
rt_interrupt_leave();
|
||||
}
|
||||
|
||||
void TIM8_BRK_TIM12_IRQHandler(void)
|
||||
{
|
||||
/* enter interrupt */
|
||||
rt_interrupt_enter();
|
||||
HAL_TIM_IRQHandler(&stm32_capture_obj[CAPTURE12_INDEX].timer);
|
||||
/* leave interrupt */
|
||||
rt_interrupt_leave();
|
||||
}
|
||||
|
||||
void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim)
|
||||
{
|
||||
int i = 0;
|
||||
|
Reference in New Issue
Block a user