From c18d019556d885121a420cf584c65cc8e06df4e0 Mon Sep 17 00:00:00 2001 From: Bogdan Marinescu Date: Thu, 1 Dec 2011 00:35:49 +0200 Subject: [PATCH] fixed potential timer match interrupt overflow on STR9 --- src/platform/str9/platform.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/platform/str9/platform.c b/src/platform/str9/platform.c index 17a587f3..7a7100f4 100644 --- a/src/platform/str9/platform.c +++ b/src/platform/str9/platform.c @@ -396,7 +396,7 @@ int platform_s_timer_set_match_int( unsigned id, timer_data_type period_us, int { TIM_TypeDef* base = ( TIM_TypeDef* )str9_timer_data[ id ]; u32 freq; - timer_data_type final; + u64 final; TIM_InitTypeDef TIM_InitStructure; if( period_us == 0 ) @@ -421,7 +421,7 @@ int platform_s_timer_set_match_int( unsigned id, timer_data_type period_us, int TIM_InitStructure.TIM_Clock_Source = TIM_CLK_APB; TIM_InitStructure.TIM_Clock_Edge = TIM_CLK_EDGE_FALLING; TIM_InitStructure.TIM_Prescaler = TIM_GetPrescalerValue( base ); - TIM_InitStructure.TIM_Pulse_Length_1 = final; + TIM_InitStructure.TIM_Pulse_Length_1 = ( u16 )final; TIM_Init( base, &TIM_InitStructure ); str9_timer_int_periodic_flag[ id ] = type;