Skip to content
Browse files

Merge branch 'master' into newsite

  • Loading branch information...
2 parents bd116fa + 7b58d26 commit e51f4b9a3327e50a8389f6c25ff574ed45cb5304 @jsnyder jsnyder committed Dec 2, 2011
Showing with 8 additions and 8 deletions.
  1. +3 −3 src/platform/avr32/platform.c
  2. +3 −3 src/platform/stm32/platform.c
  3. +2 −2 src/platform/str9/platform.c
View
6 src/platform/avr32/platform.c
@@ -587,21 +587,21 @@ timer_data_type platform_s_timer_op( unsigned id, int op, timer_data_type data )
int platform_s_timer_set_match_int( unsigned id, timer_data_type period_us, int type )
{
volatile avr32_tc_t *tc = &AVR32_TC;
- u32 final;
+ u64 final;
if( period_us == 0 )
{
tc->channel[ id ].CMR.waveform.wavsel = TC_WAVEFORM_SEL_UP_MODE;
return PLATFORM_TIMER_INT_OK;
}
- final = ( u32 )( ( u64 )( platform_timer_get_clock( id ) * period_us ) / 1000000 );
+ final = ( u64 )platform_timer_get_clock( id ) * period_us / 1000000;
if( final == 0 )
return PLATFORM_TIMER_INT_TOO_SHORT;
if( final > 0xFFFF )
return PLATFORM_TIMER_INT_TOO_LONG;
tc_stop( tc, id );
tc->channel[ id ].CMR.waveform.wavsel = TC_WAVEFORM_SEL_UP_MODE_RC_TRIGGER;
- tc->channel[ id ].rc = final;
+ tc->channel[ id ].rc = ( u32 )final;
avr32_timer_int_periodic_flag[ id ] = type;
tc_start( tc, id );
return PLATFORM_TIMER_INT_OK;
View
6 src/platform/stm32/platform.c
@@ -804,7 +804,7 @@ int platform_s_timer_set_match_int( unsigned id, timer_data_type period_us, int
{
TIM_TypeDef* base = ( TIM_TypeDef* )timer[ id ];
u32 period, prescaler, freq;
- timer_data_type final;
+ u64 final;
TIM_OCInitTypeDef TIM_OCInitStructure;
if( period_us == 0 )
@@ -834,12 +834,12 @@ int platform_s_timer_set_match_int( unsigned id, timer_data_type period_us, int
TIM_OCStructInit( &TIM_OCInitStructure );
TIM_OCInitStructure.TIM_OCMode = TIM_OCMode_Timing;
TIM_OCInitStructure.TIM_OutputState = TIM_OutputState_Enable;
- TIM_OCInitStructure.TIM_Pulse = final;
+ TIM_OCInitStructure.TIM_Pulse = ( u16 )final;
TIM_OCInitStructure.TIM_OCPolarity = TIM_OCPolarity_High;
TIM_OC1Init( base, &TIM_OCInitStructure );
// Patch timer configuration to reload when period is reached
- TIM_SetAutoreload( base, final );
+ TIM_SetAutoreload( base, ( u16 )final );
TIM_OC1PreloadConfig( base, TIM_OCPreload_Enable );
View
4 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;

0 comments on commit e51f4b9

Please sign in to comment.
Something went wrong with that request. Please try again.