APM:Libraries
stm32_util.c
Go to the documentation of this file.
1 /*
2  * This file is free software: you can redistribute it and/or modify it
3  * under the terms of the GNU General Public License as published by the
4  * Free Software Foundation, either version 3 of the License, or
5  * (at your option) any later version.
6  *
7  * This file is distributed in the hope that it will be useful, but
8  * WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10  * See the GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License along
13  * with this program. If not, see <http://www.gnu.org/licenses/>.
14  */
15 
16 #include "stm32_util.h"
17 
18 void stm32_timer_set_input_filter(stm32_tim_t *tim, uint8_t channel, uint8_t filter_mode)
19 {
20  switch (channel) {
21  case 0:
22  tim->CCMR1 |= STM32_TIM_CCMR1_IC1F(filter_mode);
23  break;
24  case 1:
25  tim->CCMR1 |= STM32_TIM_CCMR1_IC2F(filter_mode);
26  break;
27  case 2:
28  tim->CCMR2 |= STM32_TIM_CCMR2_IC3F(filter_mode);
29  break;
30  case 3:
31  tim->CCMR2 |= STM32_TIM_CCMR2_IC4F(filter_mode);
32  break;
33  }
34 }
void stm32_timer_set_input_filter(stm32_tim_t *tim, uint8_t channel, uint8_t filter_mode)
Definition: stm32_util.c:18