xt-sdk 文档
v1.0.3
xt-sdk 嵌入式 SDK API 参考
Toggle main menu visibility
载入中...
搜索中...
未找到
xt_hal_pwm.h
浏览该文件的文档.
1
12
13
#ifndef __XT_HAL_PWM_H__
14
#define __XT_HAL_PWM_H__
15
16
/* ==================== [Includes] ========================================== */
17
18
#include "
xt_hal_internal.h
"
19
20
#ifdef __cplusplus
21
extern
"C"
{
22
#endif
23
30
31
/* ==================== [Defines] =========================================== */
32
33
#define XT_HAL_PWM_INVALID_ID (0xFFFF)
34
#define XT_HAL_PWM_DUTY_MAX (UINT16_MAX)
35
36
/* ==================== [Typedefs] ========================================== */
37
45
#define XT_HAL_PWM_DUTY(percentage) ((uint16_t)((((uint32_t)(percentage) << 16) - ((uint32_t)(percentage))) / 100UL))
46
47
/* ==================== [Global Prototypes] ================================= */
48
57
xt_err_t
xt_hal_pwm_setup
(uint16_t pwm_id, uint32_t freq, uint16_t duty);
58
65
xt_err_t
xt_hal_pwm_close
(uint16_t pwm_id);
66
73
xt_err_t
xt_hal_pwm_set_duty
(uint16_t pwm_id);
74
81
xt_err_t
xt_hal_pwm_start
(uint16_t pwm_id);
82
89
xt_err_t
xt_hal_pwm_stop
(uint16_t pwm_id);
90
91
/* ==================== [Macros] ============================================ */
92
/* xt_hal_pwm */
94
95
#ifdef __cplusplus
96
}
/* extern "C" */
97
#endif
98
99
#endif
/* __XT_HAL_PWM_H__ */
xt_err_t
int32_t xt_err_t
错误码类型
定义
xt_error.h:38
xt_hal_pwm_stop
xt_err_t xt_hal_pwm_stop(uint16_t pwm_id)
停止 PWM 输出
xt_hal_pwm_set_duty
xt_err_t xt_hal_pwm_set_duty(uint16_t pwm_id)
更新占空比
xt_hal_pwm_setup
xt_err_t xt_hal_pwm_setup(uint16_t pwm_id, uint32_t freq, uint16_t duty)
初始化 PWM
xt_hal_pwm_close
xt_err_t xt_hal_pwm_close(uint16_t pwm_id)
关闭 PWM
xt_hal_pwm_start
xt_err_t xt_hal_pwm_start(uint16_t pwm_id)
启动 PWM 输出
xt_hal_internal.h
XTINY HAL 内部公共头文件
platforms
components
xtiny
xt_hal
xt_hal_pwm.h
生成于
, 为 xt-sdk 文档使用
1.17.0