2 * Copyright (C) 2017 C-SKY Microsystems Co., Ltd. All rights reserved.
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.
16 /******************************************************************************
18 * @brief header file for pwm driver
21 ******************************************************************************/
30 #include <drv_common.h>
33 /// definition for pwm handle.
34 typedef void *pwm_handle_t;
36 /****** PWM specific error codes *****/
38 EDRV_PWM_MODE = (EDRV_SPECIFIC + 1), ///< Specified Mode not supported
43 \brief Initialize PWM Interface. 1. Initializes the resources needed for the PWM interface 2.registers event callback function
44 \param[in] pwm_pin pin name of pwm
45 \return handle pwm handle to operate.
47 pwm_handle_t drv_pwm_initialize(pin_t pwm_pin);
50 \brief De-initialize PWM Interface. stops operation and releases the software resources used by the interface
51 \param[in] handle pwm handle to operate.
54 int32_t drv_pwm_uninitialize(pwm_handle_t handle);
57 \brief config pwm mode.
58 \param[in] handle pwm handle to operate.
59 \param[in] sysclk configured system clock.
60 \param[in] period_us the PWM period in us
61 \param[in] duty the PMW duty. ( 0 - 10000 represents 0% - 100% ,other values are invalid)
64 int32_t drv_pwm_config(pwm_handle_t handle,
70 \brief start generate pwm signal.
71 \param[in] handle pwm handle to operate.
74 int32_t drv_pwm_start(pwm_handle_t handle);
77 \brief Stop generate pwm signal.
78 \param[in] handle pwm handle to operate.
81 int32_t drv_pwm_stop(pwm_handle_t handle);
84 \brief Get PWM status.
85 \param[in] handle pwm handle to operate.
86 \return PWM status \ref pwm_status_t
87 pwm_status_t drv_pwm_get_status(pwm_handle_t handle);
94 #endif /* _CSI_PWM_H_ */