mraa  1.5.1
Low Level Skeleton Library for Communication on GNU/Linux platforms
 All Data Structures Namespaces Files Functions Typedefs Enumerations Enumerator Macros Pages
pwm.h
Go to the documentation of this file.
1 /*
2  * Author: Thomas Ingleby <thomas.c.ingleby@intel.com>
3  * Copyright (c) 2014 Intel Corporation.
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining
6  * a copy of this software and associated documentation files (the
7  * "Software"), to deal in the Software without restriction, including
8  * without limitation the rights to use, copy, modify, merge, publish,
9  * distribute, sublicense, and/or sell copies of the Software, and to
10  * permit persons to whom the Software is furnished to do so, subject to
11  * the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be
14  * included in all copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23  */
24 
25 #pragma once
26 
39 #ifdef __cplusplus
40 extern "C" {
41 #endif
42 
43 #include <stdio.h>
44 #include <fcntl.h>
45 
46 #include "common.h"
47 
48 typedef struct _pwm* mraa_pwm_context;
49 
56 mraa_pwm_context mraa_pwm_init(int pin);
57 
65 mraa_pwm_context mraa_pwm_init_raw(int chipid, int pin);
66 
76 mraa_result_t mraa_pwm_write(mraa_pwm_context dev, float percentage);
77 
86 float mraa_pwm_read(mraa_pwm_context dev);
87 
95 mraa_result_t mraa_pwm_period(mraa_pwm_context dev, float seconds);
96 
104 mraa_result_t mraa_pwm_period_ms(mraa_pwm_context dev, int ms);
105 
113 mraa_result_t mraa_pwm_period_us(mraa_pwm_context dev, int us);
114 
122 mraa_result_t mraa_pwm_pulsewidth(mraa_pwm_context dev, float seconds);
123 
131 mraa_result_t mraa_pwm_pulsewidth_ms(mraa_pwm_context dev, int ms);
132 
140 mraa_result_t mraa_pwm_pulsewidth_us(mraa_pwm_context dev, int us);
141 
150 mraa_result_t mraa_pwm_enable(mraa_pwm_context dev, int enable);
151 
159 mraa_result_t mraa_pwm_owner(mraa_pwm_context dev, mraa_boolean_t owner);
160 
167 mraa_result_t mraa_pwm_close(mraa_pwm_context dev);
168 
175 int mraa_pwm_get_max_period(mraa_pwm_context dev);
176 
183 int mraa_pwm_get_min_period(mraa_pwm_context dev);
184 
185 #ifdef __cplusplus
186 }
187 #endif
mraa_result_t mraa_pwm_period(mraa_pwm_context dev, float seconds)
mraa_pwm_context mraa_pwm_init(int pin)
mraa_pwm_context mraa_pwm_init_raw(int chipid, int pin)
unsigned int mraa_boolean_t
Definition: common.h:61
mraa_result_t mraa_pwm_period_ms(mraa_pwm_context dev, int ms)
int mraa_pwm_get_min_period(mraa_pwm_context dev)
mraa_result_t mraa_pwm_pulsewidth_ms(mraa_pwm_context dev, int ms)
mraa_result_t mraa_pwm_pulsewidth_us(mraa_pwm_context dev, int us)
mraa_result_t mraa_pwm_enable(mraa_pwm_context dev, int enable)
float mraa_pwm_read(mraa_pwm_context dev)
mraa_result_t mraa_pwm_period_us(mraa_pwm_context dev, int us)
mraa_result_t mraa_pwm_write(mraa_pwm_context dev, float percentage)
int mraa_pwm_get_max_period(mraa_pwm_context dev)
mraa_result_t mraa_pwm_pulsewidth(mraa_pwm_context dev, float seconds)
mraa_result_t
Definition: types.h:204
mraa_result_t mraa_pwm_close(mraa_pwm_context dev)
mraa_result_t mraa_pwm_owner(mraa_pwm_context dev, mraa_boolean_t owner)