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:
Piotr Esden-Tempski
2011-01-31 13:28:54 -08:00
parent a0091f18c7
commit dd0018ffdf
3 changed files with 229 additions and 18 deletions

View File

@@ -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;
}