HAL_*_TIMER_RATE => *_TIMER_RATE
This commit is contained in:
@ -33,7 +33,7 @@
|
||||
|
||||
void HAL_timer_init(void) {
|
||||
SBI(LPC_SC->PCONP, SBIT_TIMER0); // Power ON Timer 0
|
||||
LPC_TIM0->PR = (HAL_TIMER_RATE) / (HAL_STEPPER_TIMER_RATE) - 1; // Use prescaler to set frequency if needed
|
||||
LPC_TIM0->PR = (HAL_TIMER_RATE) / (STEPPER_TIMER_RATE) - 1; // Use prescaler to set frequency if needed
|
||||
|
||||
SBI(LPC_SC->PCONP, SBIT_TIMER1); // Power ON Timer 1
|
||||
LPC_TIM1->PR = (HAL_TIMER_RATE) / 1000000 - 1;
|
||||
@ -43,7 +43,7 @@ void HAL_timer_start(const uint8_t timer_num, const uint32_t frequency) {
|
||||
switch (timer_num) {
|
||||
case 0:
|
||||
LPC_TIM0->MCR = _BV(SBIT_MR0I) | _BV(SBIT_MR0R); // Match on MR0, reset on MR0, interrupts when NVIC enables them
|
||||
LPC_TIM0->MR0 = uint32_t(HAL_STEPPER_TIMER_RATE) / frequency; // Match value (period) to set frequency
|
||||
LPC_TIM0->MR0 = uint32_t(STEPPER_TIMER_RATE) / frequency; // Match value (period) to set frequency
|
||||
LPC_TIM0->TCR = _BV(SBIT_CNTEN); // Counter Enable
|
||||
|
||||
NVIC_SetPriority(TIMER0_IRQn, NVIC_EncodePriority(0, 1, 0));
|
||||
@ -52,7 +52,7 @@ void HAL_timer_start(const uint8_t timer_num, const uint32_t frequency) {
|
||||
|
||||
case 1:
|
||||
LPC_TIM1->MCR = _BV(SBIT_MR0I) | _BV(SBIT_MR0R); // Match on MR0, reset on MR0, interrupts when NVIC enables them
|
||||
LPC_TIM1->MR0 = uint32_t(HAL_TEMP_TIMER_RATE) / frequency;
|
||||
LPC_TIM1->MR0 = uint32_t(TEMP_TIMER_RATE) / frequency;
|
||||
LPC_TIM1->TCR = _BV(SBIT_CNTEN); // Counter Enable
|
||||
|
||||
NVIC_SetPriority(TIMER1_IRQn, NVIC_EncodePriority(0, 2, 0));
|
||||
|
Reference in New Issue
Block a user