b49c9ab0c6
完整实现了以下模块: - 系统数据总线(sys_data_bus)模块间通信 - UART/USART/LPUART驱动 + RS485半双工 - I2C驱动(AS5600角度传感器 + AT24C02 EEPROM) - Modbus RTU从站协议 - 步进电机微步进控制(正弦/余弦换相+S曲线加减速) - 到位开关驱动(DI_MIN/DI_MAX) - PGA+ADC电流检测 - 系统监控任务(内存/串口/传感器/任务状态) - LED/Key外设驱动 - 基于CMake + arm-none-eabi-gcc构建系统
28 lines
717 B
C
28 lines
717 B
C
#ifndef TIMER_DRIVER_H__
|
|
#define TIMER_DRIVER_H__
|
|
|
|
#include "common_types.h"
|
|
#include <stdint.h>
|
|
|
|
typedef enum {
|
|
TIMER_CHANNEL_1 = 0,
|
|
TIMER_CHANNEL_2 = 1,
|
|
TIMER_CHANNEL_3 = 2,
|
|
TIMER_CHANNEL_4 = 3,
|
|
} timer_channel_t;
|
|
|
|
ret_code_t timer_pwm_init(uint32_t freq_hz);
|
|
ret_code_t timer_pwm_set_duty(timer_channel_t ch, uint16_t duty);
|
|
ret_code_t timer_pwm_set_compare(timer_channel_t ch, uint16_t compare);
|
|
ret_code_t timer_pwm_start(void);
|
|
ret_code_t timer_pwm_stop(void);
|
|
ret_code_t timer_pwm_deinit(void);
|
|
|
|
ret_code_t timer_stepper_pwm_init(uint32_t freq_hz, uint16_t resolution);
|
|
|
|
ret_code_t timer_encoder_init(void);
|
|
uint16_t timer_encoder_get_count(void);
|
|
void timer_encoder_clear_count(void);
|
|
|
|
#endif
|