2014-05-26 11:55 AM
Is there some way to turn off a pull up input for some time and later turn it on on a certain frequency?
The pull up pin drain too much current.2014-05-27 12:15 AM
you can use a timer interrupt handler to turn pull up on and off at a certain frequency
2014-05-27 03:55 AM
How can i do that? Can you send me an axample?
2014-05-27 05:10 AM
for example, you config one of your timers like this
void TIM1_Config(void) { TIM1_DeInit (); TIM1_TimeBaseInit (TIM1_PRESCALER, TIM1_COUNTERMODE_UP, TIM1_PERIOD, 0); TIM1_ITConfig (TIM1_IT_UPDATE, ENABLE); TIM1_ARRPreloadConfig (ENABLE); TIM1_Cmd (ENABLE); }and in interrupt handler you can do like this, flag_pull_up must be defined as a global variable
INTERRUPT_HANDLER (TIM1_UPD_OVF_TRG_BRK_IRQHandler, 11) { if (flag_GPIO_pull_up) { GPIO_Init ( GPIOx, GPIO_Pin, GPIO_MODE_IN_FL_NO_IT ); } else{
GPIO_Init ( GPIOx, GPIO_Pin, GPIO_MODE_IN_PU_NO_IT )// write your routine
}flag_GPIO_pull_up
= !flag_GPIO_pull_up
; TIM1_ClearFlag(TIM1_FLAG_UPDATE); }