11 switch (match_reg.
which)
14 timer->MR0 = match_reg.
match;
17 timer->MR1 = match_reg.
match;
20 timer->MR2 = match_reg.
match;
23 timer->MR3 = match_reg.
match;
27 timer->MCR |= match_reg.
actions << (3 * match_reg.
which);
32 switch (match_reg.
which)
48 timer->MCR &= ~(match_reg.
actions << (3 * match_reg.
which));
76 LPC_TIM0->PR = prescaler;
78 NVIC_EnableIRQ(TIMER0_IRQn);
81 NVIC_SetPriority(TIMER0_IRQn, int_priority);
87 LPC_TIM1->PR = prescaler;
89 NVIC_EnableIRQ(TIMER1_IRQn);
92 NVIC_SetPriority(TIMER1_IRQn, int_priority);
98 LPC_TIM2->PR = prescaler;
100 NVIC_EnableIRQ(TIMER2_IRQn);
103 NVIC_SetPriority(TIMER2_IRQn, int_priority);
109 LPC_TIM3->PR = prescaler;
111 NVIC_EnableIRQ(TIMER3_IRQn);
114 NVIC_SetPriority(TIMER3_IRQn, int_priority);
120 timer->
which = which;
136 NVIC_DisableIRQ(TIMER0_IRQn);
143 NVIC_DisableIRQ(TIMER1_IRQn);
150 NVIC_DisableIRQ(TIMER2_IRQn);
157 NVIC_DisableIRQ(TIMER3_IRQn);
void POWER_TurnOffPeripheral(u8 bit)
Turns off a peripheral.
void POWER_TurnOnPeripheral(u8 bit)
Turns on a peripheral.
_PRIVATE void unset_match_reg(LPC_TIM_TypeDef *const timer, const TIMER_MatchRegister match_reg)
void TIMER_UnsetMatch(TIMER timer, TIMER_MatchRegister match_reg)
Unsets a match register of a TIMER peripheral.
void TIMER_Reset(TIMER timer)
Resets a TIMER peripheral without deconfiguring it.
u32 TIMER_ReadValue(TIMER timer)
Reads the current value of a TIMER peripheral.
void TIMER_Init(TIMER *timer, u8 which, u32 prescaler, u8 int_priority)
Initializes a TIMER peripheral.
void TIMER_Disable(TIMER timer)
Disables a TIMER peripheral.
void TIMER_Enable(TIMER timer)
Enables a TIMER peripheral.
_PRIVATE void clear_match_regs(LPC_TIM_TypeDef *const timer)
bool TIMER_IsEnabled(TIMER timer)
Checks if a TIMER peripheral is enabled.
_PRIVATE void set_match_reg(LPC_TIM_TypeDef *const timer, const TIMER_MatchRegister match_reg)
void TIMER_Deinit(TIMER timer)
Deconfigures a TIMER peripheral (also match registers).
void TIMER_SetMatch(TIMER timer, TIMER_MatchRegister match_reg)
Sets the match value for a match register of a TIMER peripheral.
#define IS_BIT_SET(reg, bit)
#define CLR_BIT(reg, bit)
#define IS_NO_PRESCALER(presc)
#define SET_BIT(reg, bit)
#define IS_DEF_PRIORITY(prio)
#define IS_BETWEEN_EQ(value, low, hi)