mbed library sources
Dependents: frdm_kl05z_gpio_test
Fork of mbed-src by
Diff: targets/hal/TARGET_STM/TARGET_DISCO_F051R8/us_ticker.c
- Revision:
- 304:89b9c3a9a045
- Parent:
- 240:9a7c54113eaf
diff -r 78e31413b129 -r 89b9c3a9a045 targets/hal/TARGET_STM/TARGET_DISCO_F051R8/us_ticker.c --- a/targets/hal/TARGET_STM/TARGET_DISCO_F051R8/us_ticker.c Fri Aug 29 11:45:07 2014 +0100 +++ b/targets/hal/TARGET_STM/TARGET_DISCO_F051R8/us_ticker.c Fri Aug 29 17:15:07 2014 +0100 @@ -90,7 +90,7 @@ // Configure time base TIM_TimeBaseStructInit(&TIM_TimeBaseStructure); TIM_TimeBaseStructure.TIM_Period = 0xFFFF; - TIM_TimeBaseStructure.TIM_Prescaler = (uint16_t)(SystemCoreClock / 1000000) - 1; // 1 µs tick + TIM_TimeBaseStructure.TIM_Prescaler = (uint16_t)(SystemCoreClock / 1000000) - 1; // 1 �s tick TIM_TimeBaseStructure.TIM_ClockDivision = 0; TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up; TIM_TimeBaseInit(TIM_MST, &TIM_TimeBaseStructure); @@ -131,8 +131,8 @@ return counter2; } -void us_ticker_set_interrupt(unsigned int timestamp) { - int delta = (int)(timestamp - us_ticker_read()); +void us_ticker_set_interrupt(timestamp_t timestamp) { + int delta = (int)((uint32_t)timestamp - us_ticker_read()); uint16_t cval = TIM_MST->CNT; if (delta <= 0) { // This event was in the past