2 * Copyright (c) 2016-2017 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
20 #include "peripheral_io.h"
23 * @brief Enumeration for Polarity
26 PWM_POLARITY_NORMAL = 0,
27 PWM_POLARITY_INVERSED,
32 * @brief pwm_close() deinit pwm pin.
34 * @param[in] chip pwm chip number
35 * @param[in] pin pwm pin number
36 * @return On success, 0 is returned. On failure, a negative value is returned.
38 int pwm_close(peripheral_pwm_h pwm);
41 * @brief pwm_set_period() sets the pwm period.
43 * @param[in] chip pwm chip number
44 * @param[in] pin pwm pin number
45 * @param[in] period pwm period
46 * @return On success, 0 is returned. On failure, a negative value is returned.
48 int pwm_set_period(peripheral_pwm_h pwm, int period);
51 * @brief pwm_set_duty_cycle() sets the pwm duty cycle.
53 * @param[in] chip pwm chip number
54 * @param[in] pin pwm pin number
55 * @param[in] duty_cycle pwm duty cycle
56 * @return On success, 0 is returned. On failure, a negative value is returned.
58 int pwm_set_duty_cycle(peripheral_pwm_h pwm, int duty_cycle);
61 * @brief pwm_set_polarity() sets the pwm polarity.
63 * @param[in] chip pwm chip number
64 * @param[in] pin pwm pin number
65 * @param[in] polarity pwm polarity
66 * @return On success, 0 is returned. On failure, a negative value is returned.
68 int pwm_set_polarity(peripheral_pwm_h pwm, pwm_polarity_e polarity);
71 * @brief pwm_set_enable() sets the pwm state.
73 * @param[in] chip pwm chip number
74 * @param[in] pin pwm pin number
75 * @param[in] enable pwm enable/disabled state value
76 * @return On success, 0 is returned. On failure, a negative value is returned.
78 int pwm_set_enable(peripheral_pwm_h pwm, bool enable);
80 #endif /* __PWM_H__ */