fix comment

This commit is contained in:
King Kévin 2016-10-15 16:41:05 +02:00
parent c5ba314c68
commit 37e9c01596
1 changed files with 2 additions and 2 deletions

View File

@ -156,13 +156,13 @@ void sensor_sdm120_setup(uint32_t baudrate)
timer_reset(TIM(SENSOR_SDM120_TIMER)); // reset timer state
timer_set_mode(TIM(SENSOR_SDM120_TIMER), TIM_CR1_CKD_CK_INT, TIM_CR1_CMS_EDGE, TIM_CR1_DIR_UP); // set timer mode, use undivided timer clock,edge alignment (simple count), and count up
timer_one_shot_mode(TIM(SENSOR_SDM120_TIMER)); // stop counter after update event (we only need to count down once)
timer_set_prescaler(TIM(SENSOR_SDM120_TIMER), 80-1); // set the prescaler so this 16 bits timer allows to wait for 60 ms ( 1/(72E6/66/(2**16))=60.07ms )
timer_set_prescaler(TIM(SENSOR_SDM120_TIMER), 66-1); // set the prescaler so this 16 bits timer allows to wait for 60 ms ( 1/(72E6/66/(2**16))=60.07ms )
timeout_times[TIMEOUT_BEGIN] = (rcc_ahb_frequency/(TIM_PSC(TIM(SENSOR_SDM120_TIMER))+1))/baudrate/8/2.5; // wait at least 2.5 characters before sending data
timeout_times[TIMEOUT_END] = (rcc_ahb_frequency/(TIM_PSC(TIM(SENSOR_SDM120_TIMER))+1))/baudrate/8/2.5; // wait at least 2.5 characters after sending data
timeout_times[TIMEOUT_BETWEEN] = 0.06*(rcc_ahb_frequency/(TIM_PSC(TIM(SENSOR_SDM120_TIMER))+1)); // wait at least 60 ms before sending the next message
timer_clear_flag(TIM(SENSOR_SDM120_TIMER), TIM_SR_UIF); // clear flag
timer_enable_irq(TIM(SENSOR_SDM120_TIMER), TIM_DIER_UIE); // enable update interrupt for timer
nvic_enable_irq(NVIC_TIM_IRQ(SENSOR_SDM120_TIMER)); // allow interrupt for timer just to wake up
nvic_enable_irq(NVIC_TIM_IRQ(SENSOR_SDM120_TIMER)); // catch interrupt in service routine
// reset states
tx_used = 0;