Tizen RT Public API  v1.1 D4
iotbus_pwm.h
Go to the documentation of this file.
1 /****************************************************************************
2  *
3  * Copyright 2016 Samsung Electronics All Rights Reserved.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing,
12  * software distributed under the License is distributed on an
13  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
14  * either express or implied. See the License for the specific
15  * language governing permissions and limitations under the License.
16  *
17  ****************************************************************************/
18 
31 #ifndef IOTBUS_PWM_H_
32 #define IOTBUS_PWM_H_
33 
34 /*
35  * public types
36  */
37 struct _iotbus_pwm_s;
38 
42 typedef struct _iotbus_pwm_s *iotbus_pwm_context_h;
43 
51 typedef enum {
52  IOTBUS_PWM_DISABLE = 0,
53  IOTBUS_PWM_ENABLE,
55 
61 typedef uint8_t percent_t;
62 
63 /*
64  * Public Function
65  */
66 #ifdef __cplusplus
67 extern "C" {
68 #endif
69 
79 iotbus_pwm_context_h iotbus_pwm_open(int device, int channel);
80 
90 
101 
111 int iotbus_pwm_set_period(iotbus_pwm_context_h pwm, uint32_t period);
112 
123 
133 
143 
153 
154 #ifdef __cplusplus
155 }
156 #endif
157 
158 #endif /* IOTBUS_PWM_H_ */
159  // end of PWM group
int iotbus_pwm_set_duty_cycle(iotbus_pwm_context_h pwm, percent_t duty_cycle)
sets the pwm duty cycle.
int iotbus_pwm_is_enabled(iotbus_pwm_context_h pwm)
checks if pwm state is enabled.
int iotbus_pwm_set_period(iotbus_pwm_context_h pwm, uint32_t period)
sets the pwm period.
int iotbus_pwm_get_duty_cycle(iotbus_pwm_context_h pwm)
gets the pwm duty cycle.
iotbus_pwm_context_h iotbus_pwm_open(int device, int channel)
closes the pwm_context.
struct _iotbus_pwm_s * iotbus_pwm_context_h
Pointer definition to the internal struct _iotbus_pwm_s.
Definition: iotbus_pwm.h:42
iotbus_pwm_state_e
Enumeration of PWM state.
Definition: iotbus_pwm.h:51
int iotbus_pwm_close(iotbus_pwm_context_h pwm)
closes the pwm_context.
int iotbus_pwm_get_period(iotbus_pwm_context_h pwm)
gets the pwm period.
uint8_t percent_t
Type of pwm duty cycle.
Definition: iotbus_pwm.h:61
int iotbus_pwm_set_enabled(iotbus_pwm_context_h pwm, iotbus_pwm_state_e enable)
sets the pwm state.