1 /*
2  * Copyright (C) 2015-2020 Alibaba Group Holding Limited
3  */
4 #ifndef __HAL_PWM_H__
5 #define __HAL_PWM_H__
6 
7 #ifdef __cplusplus
8 extern "C" {
9 #endif
10 
11 #include "stdint.h"
12 #include "stdbool.h"
13 #include "hal_cmu.h"
14 
15 #define MAX_PWM_VALUE 0xFFFF
16 
17 struct HAL_PWM_CFG_T {
18     uint32_t freq;
19     uint32_t ratio;
20     bool inv;
21     bool sleep_on;
22 };
23 
24 int hal_pwm_set_ratio_max(uint32_t max);
25 
26 int hal_pwm_enable(enum HAL_PWM_ID_T id, const struct HAL_PWM_CFG_T *cfg);
27 
28 int hal_pwm_disable(enum HAL_PWM_ID_T id);
29 
30 #ifdef __cplusplus
31 }
32 #endif
33 
34 #endif
35 
36