mraa  1.8.0
Low Level Skeleton Library for Communication on GNU/Linux platforms
 All Data Structures Namespaces Files Functions Variables 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 
49 typedef struct _pwm* mraa_pwm_context;
50 
57 mraa_pwm_context mraa_pwm_init(int pin);
58 
66 mraa_pwm_context mraa_pwm_init_raw(int chipid, int pin);
67 
77 mraa_result_t mraa_pwm_write(mraa_pwm_context dev, float percentage);
78 
87 float mraa_pwm_read(mraa_pwm_context dev);
88 
96 mraa_result_t mraa_pwm_period(mraa_pwm_context dev, float seconds);
97 
105 mraa_result_t mraa_pwm_period_ms(mraa_pwm_context dev, int ms);
106 
114 mraa_result_t mraa_pwm_period_us(mraa_pwm_context dev, int us);
115 
123 mraa_result_t mraa_pwm_pulsewidth(mraa_pwm_context dev, float seconds);
124 
132 mraa_result_t mraa_pwm_pulsewidth_ms(mraa_pwm_context dev, int ms);
133 
141 mraa_result_t mraa_pwm_pulsewidth_us(mraa_pwm_context dev, int us);
142 
151 mraa_result_t mraa_pwm_enable(mraa_pwm_context dev, int enable);
152 
160 mraa_result_t mraa_pwm_owner(mraa_pwm_context dev, mraa_boolean_t owner);
161 
168 mraa_result_t mraa_pwm_close(mraa_pwm_context dev);
169 
176 int mraa_pwm_get_max_period(mraa_pwm_context dev);
177 
184 int mraa_pwm_get_min_period(mraa_pwm_context dev);
185 
186 #ifdef __cplusplus
187 }
188 #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:67
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:206
mraa_result_t mraa_pwm_close(mraa_pwm_context dev)
struct _pwm * mraa_pwm_context
Definition: pwm.h:49
mraa_result_t mraa_pwm_owner(mraa_pwm_context dev, mraa_boolean_t owner)