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 STM32L1xx 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 Timer Option
37
38Set timer options register on TIM2 or TIM3, used for trigger remapping.
39
40@param[in] timer_peripheral Unsigned int32. Timer register address base
41@param[in] option Desired option @ref tim2_opt_trigger_remap and @ref tim3_opt_trigger_remap
42*/
43
44void timer_set_option(uint32_t timer_peripheral, uint32_t option)
45{
46 if (timer_peripheral == TIM2) {
47 TIM_OR(timer_peripheral) &= ~TIM2_OR_ITR1_RMP_MASK;
48 TIM_OR(timer_peripheral) |= option;
49 } else if (timer_peripheral == TIM3) {
50 TIM_OR(timer_peripheral) &= ~TIM3_OR_ITR2_RMP_MASK;
51 TIM_OR(timer_peripheral) |= option;
52 }
53}
54
55/**@}*/
56
#define TIM2
#define TIM3
#define TIM_OR(tim_base)
Definition: l1/timer.h:46
void timer_set_option(uint32_t timer_peripheral, uint32_t option)
Set Timer Option.
Definition: timer.c:44