Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim)
- {
- counter++; //ZMIENNA PODPIĘTA POD SysTick_Handler();
- if(i==BLINKWITHVALUES){ //TRYB MRUGANIA DIODA GDY PODALIŚMY WARTOŚCI
- if(counter>=pomoc){
- if(pulse_direction==UP){
- pulse_direction=DOWN;
- __HAL_TIM_SET_COMPARE(&htim1,TIM_CHANNEL_1,0);
- }
- else{
- pulse_direction=UP;
- __HAL_TIM_SET_COMPARE(&htim1,TIM_CHANNEL_1,65535);
- mrug--;
- }
- if(pomoc==wl){
- pomoc=wyl;
- }
- else{
- pomoc=wl;
- }
- counter=0;
- if(mrug==0){
- i=OFF;
- }
- }
- }
- if(i==DEFAULTBLINK&&counter>=1000){ //DOMYŚLNY TRYB MRUGANIA BEZ PODANYCH WARTOSCI
- if(pulse_direction==UP){
- pulse=65535;
- pulse_direction=DOWN;
- }
- else{
- pulse=0;
- pulse_direction=UP;
- }
- __HAL_TIM_SET_COMPARE(&htim1,TIM_CHANNEL_1,pulse);
- counter=0;
- }
- if(i==PULSE){ //TRYB PULSOWANIA DIODĄ
- __HAL_TIM_SET_COMPARE(&htim1,TIM_CHANNEL_1,pulse);
- f(pulse_direction==UP){
- if(pulse>=65535)
- pulse_direction=DOWN;
- else
- pulse+=65.535;
- }
- else{
- if(pulse<=0)
- pulse_direction=UP;
- else
- pulse-=65.535;
- }
- }
- IWDG_Refresh(); //ODŚWIEŻENIE WATCHDOG’A
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement