Added interrupt and event generation handling functions to timer. Updated pwm 6step example to use those and commutate on button press using PWM ON scheme.
This commit is contained in:
@@ -27,6 +27,16 @@
|
||||
|
||||
#include <libopencm3/stm32/timer.h>
|
||||
|
||||
void timer_enable_irq(u32 timer_peripheral, u32 irq)
|
||||
{
|
||||
TIM_DIER(timer_peripheral) |= irq;
|
||||
}
|
||||
|
||||
void timer_disable_irq(u32 timer_peripheral, u32 irq)
|
||||
{
|
||||
TIM_DIER(timer_peripheral) &= ~irq;
|
||||
}
|
||||
|
||||
void timer_set_mode(u32 timer_peripheral, u8 clock_div,
|
||||
u8 alignment, u8 direction)
|
||||
{
|
||||
@@ -829,3 +839,8 @@ void timer_set_deadtime(u32 timer_peripheral, u32 deadtime)
|
||||
TIM_BDTR(timer_peripheral) |= deadtime;
|
||||
}
|
||||
}
|
||||
|
||||
void timer_generate_event(u32 timer_peripheral, u32 event)
|
||||
{
|
||||
TIM_EGR(timer_peripheral) |= event;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user