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.
17 #ifndef __PERIPHERAL_INTERFACE_PWM_H__
18 #define __PERIPHERAL_INTERFACE_PWM_H__
20 #include "peripheral_interface_common.h"
23 * @brief pwm_close() deinit pwm pin.
25 * @param[in] chip pwm chip number
26 * @param[in] pin pwm pin number
27 * @return On success, 0 is returned. On failure, a negative value is returned.
29 int peripheral_interface_pwm_close(peripheral_pwm_h pwm);
32 * @brief pwm_set_period() sets the pwm period.
34 * @param[in] chip pwm chip number
35 * @param[in] pin pwm pin number
36 * @param[in] period pwm period
37 * @return On success, 0 is returned. On failure, a negative value is returned.
39 int peripheral_interface_pwm_set_period(peripheral_pwm_h pwm, uint32_t period);
42 * @brief pwm_set_duty_cycle() sets the pwm duty cycle.
44 * @param[in] chip pwm chip number
45 * @param[in] pin pwm pin number
46 * @param[in] duty_cycle pwm duty cycle
47 * @return On success, 0 is returned. On failure, a negative value is returned.
49 int peripheral_interface_pwm_set_duty_cycle(peripheral_pwm_h pwm, uint32_t duty_cycle);
52 * @brief pwm_set_polarity() sets the pwm polarity.
54 * @param[in] chip pwm chip number
55 * @param[in] pin pwm pin number
56 * @param[in] polarity pwm polarity
57 * @return On success, 0 is returned. On failure, a negative value is returned.
59 int peripheral_interface_pwm_set_polarity(peripheral_pwm_h pwm, peripheral_pwm_polarity_e polarity);
62 * @brief pwm_set_enable() sets the pwm state.
64 * @param[in] chip pwm chip number
65 * @param[in] pin pwm pin number
66 * @param[in] enable pwm enable/disabled state value
67 * @return On success, 0 is returned. On failure, a negative value is returned.
69 int peripheral_interface_pwm_set_enable(peripheral_pwm_h pwm, bool enable);
71 #endif /* __PERIPHERAL_INTERFACE_PWM_H__ */