libopencm3
A free/libre/open-source firmware library for various ARM Cortex-M3 microcontrollers.
timer.c
Go to the documentation of this file.
1/** @defgroup timer_file TIMER peripheral API
2@ingroup peripheral_apis
3@brief <b>libopencm3 STM32F1xx Timers</b>
4
5@version 1.0.0
6
7@date 18 August 2012
8
9*/
10
11/*
12 * This file is part of the libopencm3 project.
13 *
14 * Copyright (C) 2010 Edward Cheeseman <evbuilder@users.sourceforge.org>
15 * Copyright (C) 2011 Stephen Caudle <scaudle@doceme.com>
16 *
17 * This library is free software: you can redistribute it and/or modify
18 * it under the terms of the GNU Lesser General Public License as published by
19 * the Free Software Foundation, either version 3 of the License, or
20 * (at your option) any later version.
21 *
22 * This library is distributed in the hope that it will be useful,
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 * GNU Lesser General Public License for more details.
26 *
27 * You should have received a copy of the GNU Lesser General Public License
28 * along with this library. If not, see <http://www.gnu.org/licenses/>.
29 */
30
32
33/**@{*/
34
35/*---------------------------------------------------------------------------*/
36/** @brief Set Input Polarity
37
38@param[in] timer_peripheral Unsigned int32. Timer register address base
39@param[in] ic ::tim_ic_id. Input Capture channel designator.
40@param[in] pol ::tim_ic_pol. Input Capture polarity.
41*/
42
43void timer_ic_set_polarity(uint32_t timer_peripheral, enum tim_ic_id ic,
44 enum tim_ic_pol pol)
45{
46 if (pol) {
47 TIM_CCER(timer_peripheral) |= (0x2 << (ic * 4));
48 } else {
49 TIM_CCER(timer_peripheral) &= ~(0x2 << (ic * 4));
50 }
51}
52
53/**@}*/
tim_ic_pol
Input Capture input polarity.
Definition: f1/timer.h:40
#define TIM_CCER(tim_base)
tim_ic_id
Input Capture channel designators.
void timer_ic_set_polarity(uint32_t timer_peripheral, enum tim_ic_id ic, enum tim_ic_pol pol)
Set Input Polarity.
Definition: timer.c:43