rfLPC
A low level library for using NXP's LPC17xx SoC. Config is given for MBED prototyping board
pwm.h
Go to the documentation of this file.
1 /* This file is part of rflpc. Copyright 2010-2011 Michael Hauspie
2  *
3  * rflpc is free software: you can redistribute it and/or modify
4  * it under the terms of the GNU General Public License as published by
5  * the Free Software Foundation, either version 3 of the License, or
6  * (at your option) any later version.
7  *
8  * rflpc is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with rflpc. If not, see <http://www.gnu.org/licenses/>.
15  */
16 /*
17  * Author: Michael Hauspie <michael.hauspie@univ-lille1.fr>
18  * Created: 2012-12-14
19  * Time-stamp: <2013-03-01 13:51:44 (hauspie)>
20  */
24 #ifndef __RFLPC_PWM_H__
25 #define __RFLPC_PWM_H__
26 
27 #ifdef RFLPC_CONFIG_ENABLE_PWM
28 
29 #include <stdint.h>
30 #include "../pinconf.h"
31 
51 extern int rflpc_pwm_init(rflpc_pin_t pin);
52 
54 extern void rflpc_pwm_start(void);
56 extern void rflpc_pwm_stop(void);
58 extern void rflpc_pwm_reset(void);
59 
65 extern void rflpc_pwm_set_period(uint32_t period);
66 
73 extern void rflpc_pwm_single_edge(rflpc_pin_t pin, uint32_t pulsewidth);
74 
88 extern void rflpc_pwm_double_edge(rflpc_pin_t pin, uint32_t high_edge, uint32_t low_edge);
89 
95 extern void rflpc_pwm_enable(rflpc_pin_t pin);
96 
104 extern void rflpc_pwm_disable(rflpc_pin_t pin);
105 
107 #endif /* ENABLE_PWM */
108 
109 #endif
void rflpc_pwm_double_edge(rflpc_pin_t pin, uint32_t high_edge, uint32_t low_edge)
Sets the pwm parameters to operate on double edge mode.
void rflpc_pwm_single_edge(rflpc_pin_t pin, uint32_t pulsewidth)
Sets the pwm parameters in single edge mode.
void rflpc_pwm_reset(void)
Resets pwm duty cycle (restart at the start of a period.
uint8_t rflpc_pin_t
Represents a pin.
Definition: pinconf.h:44
int rflpc_pwm_init(rflpc_pin_t pin)
Inits the PWM peripheral for use with selected pin.
void rflpc_pwm_disable(rflpc_pin_t pin)
Disable the PWM output on the given pin.
void rflpc_pwm_enable(rflpc_pin_t pin)
Enable the PWM on the given pin (do not reset the timer, only enable PWM output)
void rflpc_pwm_stop(void)
Stops pwm duty cycle.
void rflpc_pwm_set_period(uint32_t period)
Sets the period in micro seconds.
void rflpc_pwm_start(void)
Starts pwm duty cycle.