IR RX simple app (#218)

* split falling and rising ir rx events
* fix irda
* simple irda rx function for app
* add extern timer
* fix timer num for f2
This commit is contained in:
DrZlo13
2020-11-11 10:36:27 +03:00
committed by GitHub
parent f05ffddbde
commit 9d8c36810e
11 changed files with 79 additions and 10 deletions

View File

@@ -49,9 +49,9 @@ void hal_pwmn_stop(TIM_HandleTypeDef* tim, uint32_t channel) {
}
void irda_pwm_set(float value, float freq){
hal_pwmn_set(value, freq, &IRDA_TIM, IRDA_CH);
hal_pwmn_set(value, freq, &IRDA_TX_TIM, IRDA_TX_CH);
}
void irda_pwm_stop(){
hal_pwmn_stop(&IRDA_TIM, IRDA_CH);
hal_pwmn_stop(&IRDA_TX_TIM, IRDA_TX_CH);
}

View File

@@ -0,0 +1,8 @@
#include "cmsis_os.h"
#include "api-hal-tim.h"
void tim_irda_rx_init(void) {
HAL_NVIC_SetPriority(TIM2_IRQn, 5, 0);
HAL_TIM_IC_Start_IT(&htim2, TIM_CHANNEL_1);
HAL_TIM_IC_Start_IT(&htim2, TIM_CHANNEL_2);
}

View File

@@ -0,0 +1,4 @@
#pragma once
#include "main.h"
void tim_irda_rx_init(void);

View File

@@ -4,3 +4,4 @@
#include "api-hal-delay.h"
#include "api-hal-pwm.h"
#include "api-hal-task.h"
#include "api-hal-tim.h"