Initial commit - sync AliceRC to Gitea
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
/**
|
||||
* @file pwm.h
|
||||
* @brief 4 路舵机 PWM 输出 (50Hz, 1ms ~ 2ms 脉宽)
|
||||
* 实现方式:定时器 0 中断 (20us 周期) + 软件 PWM 模拟
|
||||
* 精度:20us,SBUS 通道值精度 ≈ 12 SBUS 单位 (≈ 0.6% 行程)
|
||||
*
|
||||
* 周期:20ms = 1000 个 20us 计数
|
||||
* 通道脉宽:1000us ~ 2000us = 50 ~ 100 个 20us 计数
|
||||
*/
|
||||
#ifndef __PWM_H
|
||||
#define __PWM_H
|
||||
|
||||
#include "stc8h.h"
|
||||
#include <stdint.h>
|
||||
|
||||
void pwm_init(void); /* 初始化 PWM 输出 */
|
||||
void pwm_set(uint8_t ch, uint16_t width_us); /* 设置通道脉宽 (us) */
|
||||
void pwm_set_from_sbus(uint8_t ch, uint16_t sbus_val); /* 从 SBUS 值设置 */
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user