diff --git a/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_K20D50M/us_ticker.c b/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_K20D50M/us_ticker.c index c0666ccd16..4d62e8d37a 100644 --- a/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_K20D50M/us_ticker.c +++ b/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_K20D50M/us_ticker.c @@ -135,8 +135,8 @@ static void ticker_isr(void) { } } -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()); if (delta <= 0) { // This event was in the past: us_ticker_irq_handler(); diff --git a/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_KLXX/us_ticker.c b/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_KLXX/us_ticker.c index 756a936797..5e70002649 100644 --- a/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_KLXX/us_ticker.c +++ b/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_KLXX/us_ticker.c @@ -167,8 +167,8 @@ static void lptmr_isr(void) { } } -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()); if (delta <= 0) { // This event was in the past: us_ticker_irq_handler(); diff --git a/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_K64F/us_ticker.c b/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_K64F/us_ticker.c index 9cd3545e5f..eeaa6af257 100644 --- a/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_K64F/us_ticker.c +++ b/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_K64F/us_ticker.c @@ -133,8 +133,8 @@ static void lptmr_isr(void) { } } -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()); if (delta <= 0) { // This event was in the past: us_ticker_irq_handler(); diff --git a/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC11U6X/us_ticker.c b/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC11U6X/us_ticker.c index 5ce7098cee..a38df4d5ce 100644 --- a/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC11U6X/us_ticker.c +++ b/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC11U6X/us_ticker.c @@ -46,9 +46,9 @@ uint32_t us_ticker_read() { return US_TICKER_TIMER->TC; } -void us_ticker_set_interrupt(unsigned int timestamp) { +void us_ticker_set_interrupt(timestamp_t timestamp) { // set match value - US_TICKER_TIMER->MR0 = timestamp; + US_TICKER_TIMER->MR0 = (uint32_t)timestamp; // enable match interrupt US_TICKER_TIMER->MCR |= 1; } diff --git a/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC11UXX/us_ticker.c b/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC11UXX/us_ticker.c index 2e41c09220..059b272233 100644 --- a/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC11UXX/us_ticker.c +++ b/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC11UXX/us_ticker.c @@ -46,9 +46,9 @@ uint32_t us_ticker_read() { return US_TICKER_TIMER->TC; } -void us_ticker_set_interrupt(unsigned int timestamp) { +void us_ticker_set_interrupt(timestamp_t timestamp) { // set match value - US_TICKER_TIMER->MR0 = timestamp; + US_TICKER_TIMER->MR0 = (uint32_t)timestamp; // enable match interrupt US_TICKER_TIMER->MCR |= 1; } diff --git a/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC11XX_11CXX/us_ticker.c b/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC11XX_11CXX/us_ticker.c index 32b7f0d66f..909263782b 100644 --- a/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC11XX_11CXX/us_ticker.c +++ b/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC11XX_11CXX/us_ticker.c @@ -46,9 +46,9 @@ uint32_t us_ticker_read() { return US_TICKER_TIMER->TC; } -void us_ticker_set_interrupt(unsigned int timestamp) { +void us_ticker_set_interrupt(timestamp_t timestamp) { // set match value - US_TICKER_TIMER->MR0 = timestamp; + US_TICKER_TIMER->MR0 = (uint32_t)timestamp; // enable match interrupt US_TICKER_TIMER->MCR |= 1; } diff --git a/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC13XX/us_ticker.c b/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC13XX/us_ticker.c index 05ba2c80e6..d77495d03c 100644 --- a/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC13XX/us_ticker.c +++ b/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC13XX/us_ticker.c @@ -46,9 +46,9 @@ uint32_t us_ticker_read() { return US_TICKER_TIMER->TC; } -void us_ticker_set_interrupt(unsigned int timestamp) { +void us_ticker_set_interrupt(timestamp_t timestamp) { // set match value - US_TICKER_TIMER->MR0 = timestamp; + US_TICKER_TIMER->MR0 = (uint32_t)timestamp; // enable match interrupt US_TICKER_TIMER->MCR |= 1; } diff --git a/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC15XX/us_ticker.c b/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC15XX/us_ticker.c index 005188578b..a4ad2d0039 100644 --- a/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC15XX/us_ticker.c +++ b/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC15XX/us_ticker.c @@ -58,7 +58,7 @@ uint32_t us_ticker_read() { return (uint32_t)temp; } -void us_ticker_set_interrupt(unsigned int timestamp) { +void us_ticker_set_interrupt(timestamp_t timestamp) { uint64_t temp = ((uint64_t)timestamp * (SystemCoreClock/1000000)); LPC_RIT->COMPVAL = (temp & 0xFFFFFFFFL); LPC_RIT->COMPVAL_H = ((temp >> 32)& 0x0000FFFFL); diff --git a/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC176X/us_ticker.c b/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC176X/us_ticker.c index 651e38eb9b..b46d75e6bc 100644 --- a/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC176X/us_ticker.c +++ b/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC176X/us_ticker.c @@ -48,9 +48,9 @@ uint32_t us_ticker_read() { return US_TICKER_TIMER->TC; } -void us_ticker_set_interrupt(unsigned int timestamp) { +void us_ticker_set_interrupt(timestamp_t timestamp) { // set match value - US_TICKER_TIMER->MR0 = timestamp; + US_TICKER_TIMER->MR0 = (uint32_t)timestamp; // enable match interrupt US_TICKER_TIMER->MCR |= 1; } diff --git a/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC23XX/us_ticker.c b/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC23XX/us_ticker.c index 651e38eb9b..b46d75e6bc 100644 --- a/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC23XX/us_ticker.c +++ b/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC23XX/us_ticker.c @@ -48,9 +48,9 @@ uint32_t us_ticker_read() { return US_TICKER_TIMER->TC; } -void us_ticker_set_interrupt(unsigned int timestamp) { +void us_ticker_set_interrupt(timestamp_t timestamp) { // set match value - US_TICKER_TIMER->MR0 = timestamp; + US_TICKER_TIMER->MR0 = (uint32_t)timestamp; // enable match interrupt US_TICKER_TIMER->MCR |= 1; } diff --git a/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC408X/us_ticker.c b/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC408X/us_ticker.c index cda516dca4..c7075b3c88 100644 --- a/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC408X/us_ticker.c +++ b/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC408X/us_ticker.c @@ -48,9 +48,9 @@ uint32_t us_ticker_read() { return US_TICKER_TIMER->TC; } -void us_ticker_set_interrupt(unsigned int timestamp) { +void us_ticker_set_interrupt(timestamp_t timestamp) { // set match value - US_TICKER_TIMER->MR0 = timestamp; + US_TICKER_TIMER->MR0 = (uint32_t)timestamp; // enable match interrupt US_TICKER_TIMER->MCR |= 1; } diff --git a/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC43XX/us_ticker.c b/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC43XX/us_ticker.c index 9cc936a6e5..73eaf775f4 100644 --- a/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC43XX/us_ticker.c +++ b/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC43XX/us_ticker.c @@ -48,9 +48,9 @@ uint32_t us_ticker_read() { return US_TICKER_TIMER->TC; } -void us_ticker_set_interrupt(unsigned int timestamp) { +void us_ticker_set_interrupt(timestamp_t timestamp) { // set match value - US_TICKER_TIMER->MR[0] = timestamp; + US_TICKER_TIMER->MR[3] = (uint32_t)timestamp; // enable match interrupt US_TICKER_TIMER->MCR |= 1; } diff --git a/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC81X/us_ticker.c b/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC81X/us_ticker.c index cf03fc931a..c1d1a1c10e 100644 --- a/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC81X/us_ticker.c +++ b/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC81X/us_ticker.c @@ -55,13 +55,13 @@ uint32_t us_ticker_read() { return LPC_SCT->COUNT_U; } -void us_ticker_set_interrupt(unsigned int timestamp) { +void us_ticker_set_interrupt(timestamp_t timestamp) { // halt the counter: // - setting bit 2 of the CTRL register LPC_SCT->CTRL_L |= (1 << 2); // set timestamp in compare register - LPC_SCT->MATCH[0].U = timestamp; + LPC_SCT->MATCH[0].U = (uint32_t)timestamp; // unhalt the counter: // - clearing bit 2 of the CTRL register diff --git a/libraries/mbed/targets/hal/TARGET_STM/TARGET_DISCO_F051R8/us_ticker.c b/libraries/mbed/targets/hal/TARGET_STM/TARGET_DISCO_F051R8/us_ticker.c index 24b7225436..79de93ac7c 100644 --- a/libraries/mbed/targets/hal/TARGET_STM/TARGET_DISCO_F051R8/us_ticker.c +++ b/libraries/mbed/targets/hal/TARGET_STM/TARGET_DISCO_F051R8/us_ticker.c @@ -90,7 +90,7 @@ void us_ticker_init(void) { // 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 @@ uint32_t us_ticker_read() { 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 diff --git a/libraries/mbed/targets/hal/TARGET_STM/TARGET_DISCO_F100RB/us_ticker.c b/libraries/mbed/targets/hal/TARGET_STM/TARGET_DISCO_F100RB/us_ticker.c index 0875681abe..7fdf4752c3 100644 --- a/libraries/mbed/targets/hal/TARGET_STM/TARGET_DISCO_F100RB/us_ticker.c +++ b/libraries/mbed/targets/hal/TARGET_STM/TARGET_DISCO_F100RB/us_ticker.c @@ -92,7 +92,7 @@ void us_ticker_init(void) { // 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); @@ -133,8 +133,8 @@ uint32_t us_ticker_read() { 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 diff --git a/libraries/mbed/targets/hal/TARGET_STM/TARGET_DISCO_F303VC/us_ticker.c b/libraries/mbed/targets/hal/TARGET_STM/TARGET_DISCO_F303VC/us_ticker.c index 9487baea3d..dcf2339a67 100644 --- a/libraries/mbed/targets/hal/TARGET_STM/TARGET_DISCO_F303VC/us_ticker.c +++ b/libraries/mbed/targets/hal/TARGET_STM/TARGET_DISCO_F303VC/us_ticker.c @@ -48,7 +48,7 @@ void us_ticker_init(void) { // Configure time base TIM_TimeBaseStructInit(&TIM_TimeBaseStructure); TIM_TimeBaseStructure.TIM_Period = 0xFFFFFFFF; - 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); @@ -65,9 +65,9 @@ uint32_t us_ticker_read() { return TIM_MST->CNT; } -void us_ticker_set_interrupt(unsigned int timestamp) { +void us_ticker_set_interrupt(timestamp_t timestamp) { // Set new output compare value - TIM_SetCompare1(TIM_MST, timestamp); + TIM_SetCompare1(TIM_MST, (uint32_t)timestamp); // Enable IT TIM_ITConfig(TIM_MST, TIM_IT_CC1, ENABLE); } diff --git a/libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_F030R8/us_ticker.c b/libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_F030R8/us_ticker.c index 09bd402ed4..3d380185a9 100644 --- a/libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_F030R8/us_ticker.c +++ b/libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_F030R8/us_ticker.c @@ -90,7 +90,7 @@ void us_ticker_init(void) { // 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 @@ uint32_t us_ticker_read() { 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 diff --git a/libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_F072RB/us_ticker.c b/libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_F072RB/us_ticker.c index dd887fa1cb..2970ff4879 100644 --- a/libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_F072RB/us_ticker.c +++ b/libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_F072RB/us_ticker.c @@ -50,7 +50,7 @@ void us_ticker_init(void) { // Configure time base TimMasterHandle.Instance = TIM_MST; TimMasterHandle.Init.Period = 0xFFFFFFFF; - TimMasterHandle.Init.Prescaler = (uint32_t)(SystemCoreClock / 1000000) - 1; // 1 µs tick + TimMasterHandle.Init.Prescaler = (uint32_t)(SystemCoreClock / 1000000) - 1; // 1 �s tick TimMasterHandle.Init.ClockDivision = 0; TimMasterHandle.Init.CounterMode = TIM_COUNTERMODE_UP; TimMasterHandle.Init.RepetitionCounter = 0; @@ -68,9 +68,9 @@ uint32_t us_ticker_read() { return TIM_MST->CNT; } -void us_ticker_set_interrupt(unsigned int timestamp) { +void us_ticker_set_interrupt(timestamp_t timestamp) { // Set new output compare value - __HAL_TIM_SetCompare(&TimMasterHandle, TIM_CHANNEL_1, timestamp); + __HAL_TIM_SetCompare(&TimMasterHandle, TIM_CHANNEL_1, (uint32_t)timestamp); // Enable IT __HAL_TIM_ENABLE_IT(&TimMasterHandle, TIM_IT_CC1); } diff --git a/libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_F103RB/us_ticker.c b/libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_F103RB/us_ticker.c index 2b10e4cfd1..bfb8db2e84 100644 --- a/libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_F103RB/us_ticker.c +++ b/libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_F103RB/us_ticker.c @@ -83,7 +83,7 @@ void us_ticker_init(void) { // 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); @@ -121,8 +121,8 @@ uint32_t us_ticker_read() { 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 diff --git a/libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_F302R8/us_ticker.c b/libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_F302R8/us_ticker.c index e2ffaeb3c3..7fffc3bccd 100644 --- a/libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_F302R8/us_ticker.c +++ b/libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_F302R8/us_ticker.c @@ -48,7 +48,7 @@ void us_ticker_init(void) { // Configure time base TIM_TimeBaseStructInit(&TIM_TimeBaseStructure); TIM_TimeBaseStructure.TIM_Period = 0xFFFFFFFF; - 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); @@ -65,9 +65,9 @@ uint32_t us_ticker_read() { return TIM_MST->CNT; } -void us_ticker_set_interrupt(unsigned int timestamp) { +void us_ticker_set_interrupt(timestamp_t timestamp) { // Set new output compare value - TIM_SetCompare1(TIM_MST, timestamp); + TIM_SetCompare1(TIM_MST, (uint32_t)timestamp); // Enable IT TIM_ITConfig(TIM_MST, TIM_IT_CC1, ENABLE); } diff --git a/libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_F334R8/us_ticker.c b/libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_F334R8/us_ticker.c index 1deccaa0f2..dd649a9a34 100644 --- a/libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_F334R8/us_ticker.c +++ b/libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_F334R8/us_ticker.c @@ -51,7 +51,7 @@ void us_ticker_init(void) // Configure time base TimMasterHandle.Instance = TIM_MST; TimMasterHandle.Init.Period = 0xFFFFFFFF; - TimMasterHandle.Init.Prescaler = (uint32_t)(SystemCoreClock / 1000000) - 1; // 1 µs tick + TimMasterHandle.Init.Prescaler = (uint32_t)(SystemCoreClock / 1000000) - 1; // 1 �s tick TimMasterHandle.Init.ClockDivision = 0; TimMasterHandle.Init.CounterMode = TIM_COUNTERMODE_UP; TimMasterHandle.Init.RepetitionCounter = 0; @@ -70,10 +70,10 @@ uint32_t us_ticker_read() return TIM_MST->CNT; } -void us_ticker_set_interrupt(unsigned int timestamp) +void us_ticker_set_interrupt(timestamp_t timestamp) { // Set new output compare value - __HAL_TIM_SetCompare(&TimMasterHandle, TIM_CHANNEL_1, timestamp); + __HAL_TIM_SetCompare(&TimMasterHandle, TIM_CHANNEL_1, (uint32_t)timestamp); // Enable IT __HAL_TIM_ENABLE_IT(&TimMasterHandle, TIM_IT_CC1); } diff --git a/libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_F401RE/us_ticker.c b/libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_F401RE/us_ticker.c index 8ef83ba041..3a80ddcede 100644 --- a/libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_F401RE/us_ticker.c +++ b/libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_F401RE/us_ticker.c @@ -48,9 +48,9 @@ uint32_t us_ticker_read() { return TIM_MST->CNT; } -void us_ticker_set_interrupt(unsigned int timestamp) { +void us_ticker_set_interrupt(timestamp_t timestamp) { // Set new output compare value - __HAL_TIM_SetCompare(&TimMasterHandle, TIM_CHANNEL_1, timestamp); + __HAL_TIM_SetCompare(&TimMasterHandle, TIM_CHANNEL_1, (uint32_t)timestamp); // Enable IT __HAL_TIM_ENABLE_IT(&TimMasterHandle, TIM_IT_CC1); } diff --git a/libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_F411RE/us_ticker.c b/libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_F411RE/us_ticker.c index 6e9eaa07ab..be44198992 100644 --- a/libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_F411RE/us_ticker.c +++ b/libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_F411RE/us_ticker.c @@ -50,10 +50,10 @@ uint32_t us_ticker_read() return TIM_MST->CNT; } -void us_ticker_set_interrupt(unsigned int timestamp) +void us_ticker_set_interrupt(timestamp_t timestamp) { // Set new output compare value - __HAL_TIM_SetCompare(&TimMasterHandle, TIM_CHANNEL_1, timestamp); + __HAL_TIM_SetCompare(&TimMasterHandle, TIM_CHANNEL_1, (uint32_t)timestamp); // Enable IT __HAL_TIM_ENABLE_IT(&TimMasterHandle, TIM_IT_CC1); } diff --git a/libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_L053R8/us_ticker.c b/libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_L053R8/us_ticker.c index 4af44e3e3a..1b7f996166 100644 --- a/libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_L053R8/us_ticker.c +++ b/libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_L053R8/us_ticker.c @@ -85,7 +85,7 @@ void us_ticker_init(void) { // Configure time base TimMasterHandle.Instance = TIM_MST; TimMasterHandle.Init.Period = 0xFFFF; - TimMasterHandle.Init.Prescaler = (uint32_t)(SystemCoreClock / 1000000) - 1; // 1 µs tick + TimMasterHandle.Init.Prescaler = (uint32_t)(SystemCoreClock / 1000000) - 1; // 1 �s tick TimMasterHandle.Init.ClockDivision = 0; TimMasterHandle.Init.CounterMode = TIM_COUNTERMODE_UP; HAL_TIM_Base_Init(&TimMasterHandle); @@ -123,8 +123,8 @@ uint32_t us_ticker_read() { 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 diff --git a/libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_L152RE/us_ticker.c b/libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_L152RE/us_ticker.c index 29dd9d8298..3fbfac24a7 100644 --- a/libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_L152RE/us_ticker.c +++ b/libraries/mbed/targets/hal/TARGET_STM/TARGET_NUCLEO_L152RE/us_ticker.c @@ -48,7 +48,7 @@ void us_ticker_init(void) { // Configure time base TIM_TimeBaseStructInit(&TIM_TimeBaseStructure); TIM_TimeBaseStructure.TIM_Period = 0xFFFFFFFF; - 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); @@ -65,9 +65,9 @@ uint32_t us_ticker_read() { return TIM_MST->CNT; } -void us_ticker_set_interrupt(unsigned int timestamp) { +void us_ticker_set_interrupt(timestamp_t timestamp) { // Set new output compare value - TIM_SetCompare1(TIM_MST, timestamp); + TIM_SetCompare1(TIM_MST, (uint32_t)timestamp); // Enable IT TIM_ITConfig(TIM_MST, TIM_IT_CC1, ENABLE); } diff --git a/libraries/mbed/targets/hal/TARGET_STM/TARGET_STM32F3XX/us_ticker.c b/libraries/mbed/targets/hal/TARGET_STM/TARGET_STM32F3XX/us_ticker.c index e2ffaeb3c3..7fffc3bccd 100644 --- a/libraries/mbed/targets/hal/TARGET_STM/TARGET_STM32F3XX/us_ticker.c +++ b/libraries/mbed/targets/hal/TARGET_STM/TARGET_STM32F3XX/us_ticker.c @@ -48,7 +48,7 @@ void us_ticker_init(void) { // Configure time base TIM_TimeBaseStructInit(&TIM_TimeBaseStructure); TIM_TimeBaseStructure.TIM_Period = 0xFFFFFFFF; - 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); @@ -65,9 +65,9 @@ uint32_t us_ticker_read() { return TIM_MST->CNT; } -void us_ticker_set_interrupt(unsigned int timestamp) { +void us_ticker_set_interrupt(timestamp_t timestamp) { // Set new output compare value - TIM_SetCompare1(TIM_MST, timestamp); + TIM_SetCompare1(TIM_MST, (uint32_t)timestamp); // Enable IT TIM_ITConfig(TIM_MST, TIM_IT_CC1, ENABLE); } diff --git a/libraries/mbed/targets/hal/TARGET_STM/TARGET_STM32F407VG/us_ticker.c b/libraries/mbed/targets/hal/TARGET_STM/TARGET_STM32F407VG/us_ticker.c index 8f8b32ec4d..8c2ec6933f 100644 --- a/libraries/mbed/targets/hal/TARGET_STM/TARGET_STM32F407VG/us_ticker.c +++ b/libraries/mbed/targets/hal/TARGET_STM/TARGET_STM32F407VG/us_ticker.c @@ -48,9 +48,9 @@ uint32_t us_ticker_read() { return TIM_MST->CNT; } -void us_ticker_set_interrupt(unsigned int timestamp) { +void us_ticker_set_interrupt(timestamp_t timestamp) { // Set new output compare value - __HAL_TIM_SetCompare(&TimMasterHandle, TIM_CHANNEL_1, timestamp); + __HAL_TIM_SetCompare(&TimMasterHandle, TIM_CHANNEL_1, (uint32_t)timestamp); // Enable IT __HAL_TIM_ENABLE_IT(&TimMasterHandle, TIM_IT_CC1); } diff --git a/libraries/mbed/targets/hal/TARGET_STM/TARGET_STM32F4XX/us_ticker.c b/libraries/mbed/targets/hal/TARGET_STM/TARGET_STM32F4XX/us_ticker.c index c80c2a505f..287768030d 100644 --- a/libraries/mbed/targets/hal/TARGET_STM/TARGET_STM32F4XX/us_ticker.c +++ b/libraries/mbed/targets/hal/TARGET_STM/TARGET_STM32F4XX/us_ticker.c @@ -47,9 +47,9 @@ uint32_t us_ticker_read() { return US_TICKER_TIMER->CNT; } -void us_ticker_set_interrupt(unsigned int timestamp) { +void us_ticker_set_interrupt(timestamp_t timestamp) { // set match value - US_TICKER_TIMER->CCR1 = timestamp; + US_TICKER_TIMER->CCR1 = (uint32_t)timestamp; // enable compare interrupt US_TICKER_TIMER->DIER |= TIM_DIER_CC1IE; }