ESP8266_RTOS_SDK v1.4.0

- Main Page
- Modules
- Data Structures
- Files

- File List

pwm.h
1 /*
2 * ESPRSSIF MIT License
3 *
4 * Copyright (c) 2015 <ESPRESSIF SYSTEMS (SHANGHAI) PTE LTD>
5 *
6 * Permission is hereby granted for use on ESPRESSIF SYSTEMS ESP8266 only, in which case,
7 * it is free of charge, to any person obtaining a copy of this software and associated
8 * documentation files (the "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the Software is furnished
11 * to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in all copies or
14 * substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
18 * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
19 * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
20 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 *
23 */
24
25 #ifndef __PWM_H__
26 #define __PWM_H__
27
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31
48 struct pwm_param {
49 uint32 period;
50 uint32 freq;
51 uint32 duty[8];
52 };
53
54 #define PWM_DEPTH 1023
55
70 void pwm_init(uint32 period, uint32 *duty, uint32 pwm_channel_num, uint32(*pin_info_list)[3]);
71
86 void pwm_set_duty(uint32 duty, uint8 channel);
87
95 uint32 pwm_get_duty(uint8 channel);
96
108 void pwm_set_period(uint32 period);
109
117 uint32 pwm_get_period(void);
118
128 void pwm_start(void);
129
138 #ifdef __cplusplus
139 }
140 #endif
141
142 #endif
pwm_param::freq
uint32 freq
Definition: pwm.h:50
pwm_param::period
uint32 period
Definition: pwm.h:49
pwm_param::duty
uint32 duty[8]
Definition: pwm.h:51
pwm_get_period
uint32 pwm_get_period(void)
Get PWM period, unit : us.
pwm_set_period
void pwm_set_period(uint32 period)
Set PWM period, unit : us.
pwm_set_duty
void pwm_set_duty(uint32 duty, uint8 channel)
Set the duty cycle of a PWM channel.
pwm_init
void pwm_init(uint32 period, uint32 *duty, uint32 pwm_channel_num, uint32(*pin_info_list)[3])
PWM function initialization, including GPIO, frequency and duty cycle.
pwm_get_duty
uint32 pwm_get_duty(uint8 channel)
Get the duty cycle of a PWM channel.
pwm_param
Definition: pwm.h:48
pwm_start
void pwm_start(void)
Starts PWM.