[FL-1367] fix rfid on f6 target (#500)
* RFID hal: fix gpio setup * timers hal: crutch for HAL * RFID hal: fix gpio setup
This commit is contained in:
		
							parent
							
								
									7e6a97c3a3
								
							
						
					
					
						commit
						a93f21dfbe
					
				| @ -27,7 +27,7 @@ void api_hal_rfid_pins_emulate() { | |||||||
| 
 | 
 | ||||||
|     // pull pin to timer out
 |     // pull pin to timer out
 | ||||||
|     hal_gpio_init_ex( |     hal_gpio_init_ex( | ||||||
|         &gpio_rfid_pull, GpioModeOutputPushPull, GpioSpeedLow, GpioPullNo, GpioAltFn1TIM1); |         &gpio_rfid_pull, GpioModeAltFunctionPushPull, GpioSpeedLow, GpioPullNo, GpioAltFn1TIM2); | ||||||
| 
 | 
 | ||||||
|     // pull rfid antenna from carrier side
 |     // pull rfid antenna from carrier side
 | ||||||
|     hal_gpio_init(&gpio_rfid_carrier_out, GpioModeOutputPushPull, GpioSpeedLow, GpioPullNo); |     hal_gpio_init(&gpio_rfid_carrier_out, GpioModeOutputPushPull, GpioSpeedLow, GpioPullNo); | ||||||
| @ -45,7 +45,7 @@ void api_hal_rfid_pins_read() { | |||||||
| 
 | 
 | ||||||
|     // carrier pin to timer out
 |     // carrier pin to timer out
 | ||||||
|     hal_gpio_init_ex( |     hal_gpio_init_ex( | ||||||
|         &gpio_rfid_carrier_out, GpioModeOutputPushPull, GpioSpeedLow, GpioPullNo, GpioAltFn1TIM1); |         &gpio_rfid_carrier_out, GpioModeAltFunctionPushPull, GpioSpeedLow, GpioPullNo, GpioAltFn1TIM1); | ||||||
| 
 | 
 | ||||||
|     // comparator in
 |     // comparator in
 | ||||||
|     hal_gpio_init(&gpio_rfid_data_in, GpioModeAnalog, GpioSpeedLow, GpioPullNo); |     hal_gpio_init(&gpio_rfid_data_in, GpioModeAnalog, GpioSpeedLow, GpioPullNo); | ||||||
|  | |||||||
| @ -3,44 +3,43 @@ | |||||||
| #include <stm32wbxx_ll_tim.h> | #include <stm32wbxx_ll_tim.h> | ||||||
| #include <furi.h> | #include <furi.h> | ||||||
| 
 | 
 | ||||||
| 
 | void TIM2_IRQHandler(void) { | ||||||
| void TIM2_IRQHandler(void) |  | ||||||
| { |  | ||||||
|     bool consumed = false; |     bool consumed = false; | ||||||
| 
 | 
 | ||||||
|     if(LL_TIM_IsActiveFlag_CC1(TIM2) == 1) { |     if(LL_TIM_IsActiveFlag_CC1(TIM2) == 1) { | ||||||
|         if (LL_TIM_IsEnabledIT_CC1(TIM2)) { |         if(LL_TIM_IsEnabledIT_CC1(TIM2)) { | ||||||
|             LL_TIM_ClearFlag_CC1(TIM2); |             LL_TIM_ClearFlag_CC1(TIM2); | ||||||
| 
 | 
 | ||||||
|             if (READ_BIT(TIM2->CCMR1, TIM_CCMR1_CC1S)) { |             if(READ_BIT(TIM2->CCMR1, TIM_CCMR1_CC1S)) { | ||||||
|                 // input capture
 |                 // input capture
 | ||||||
|                 api_hal_irda_tim_isr(TimerIRQSourceCCI1); |                 api_hal_irda_tim_isr(TimerIRQSourceCCI1); | ||||||
|                 consumed = true; |                 consumed = true; | ||||||
|             } |             } else { | ||||||
|             else { |  | ||||||
|                 // output compare
 |                 // output compare
 | ||||||
|             //  HAL_TIM_OC_DelayElapsedCallback(htim);
 |                 //  HAL_TIM_OC_DelayElapsedCallback(htim);
 | ||||||
|             //  HAL_TIM_PWM_PulseFinishedCallback(htim);
 |                 //  HAL_TIM_PWM_PulseFinishedCallback(htim);
 | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|     if(LL_TIM_IsActiveFlag_CC2(TIM2) == 1) { |     if(LL_TIM_IsActiveFlag_CC2(TIM2) == 1) { | ||||||
|         if (LL_TIM_IsEnabledIT_CC2(TIM2)) { |         if(LL_TIM_IsEnabledIT_CC2(TIM2)) { | ||||||
|             LL_TIM_ClearFlag_CC2(TIM2); |             LL_TIM_ClearFlag_CC2(TIM2); | ||||||
| 
 | 
 | ||||||
|             if (READ_BIT(TIM2->CCMR1, TIM_CCMR1_CC2S)) { |             if(READ_BIT(TIM2->CCMR1, TIM_CCMR1_CC2S)) { | ||||||
|                 // input capture
 |                 // input capture
 | ||||||
|                 api_hal_irda_tim_isr(TimerIRQSourceCCI2); |                 api_hal_irda_tim_isr(TimerIRQSourceCCI2); | ||||||
|                 consumed = true; |                 consumed = true; | ||||||
|             } |             } else { | ||||||
|             else { |  | ||||||
|                 // output compare
 |                 // output compare
 | ||||||
|             //  HAL_TIM_OC_DelayElapsedCallback(htim);
 |                 //  HAL_TIM_OC_DelayElapsedCallback(htim);
 | ||||||
|             //  HAL_TIM_PWM_PulseFinishedCallback(htim);
 |                 //  HAL_TIM_PWM_PulseFinishedCallback(htim);
 | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     furi_check(consumed); |     // TODO move all timers on LL hal
 | ||||||
|  |     if(!consumed) { | ||||||
|  |         // currently backed up with a crutch, we need more bicycles
 | ||||||
|  |         HAL_TIM_IRQHandler(&htim2); | ||||||
|  |     } | ||||||
| } | } | ||||||
| 
 |  | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 SG
						SG