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构建系统
46 lines
1.3 KiB
C
46 lines
1.3 KiB
C
#ifndef CONFIG_H__
|
|
#define CONFIG_H__
|
|
|
|
#define DEBUG_ENABLED 1
|
|
|
|
#define F_CPU 72000000UL
|
|
#define SYSTICK_RELOAD_VAL (F_CPU / 1000)
|
|
|
|
#define USART1_RS485_ENABLED 1
|
|
#define USART1_RS485_DIR_PORT GPIOA
|
|
#define USART1_RS485_DIR_PIN 3
|
|
|
|
#define USART1_ENABLED 1
|
|
#define LPUART1_ENABLED 1
|
|
|
|
#define I2C1_ENABLED 1
|
|
#define I2C1_SPEED 100000
|
|
|
|
#define ADC1_ENABLED 1
|
|
|
|
#define TIM1_PWM_ENABLED 1
|
|
#define TIM1_PWM_FREQ 20000
|
|
|
|
#define LED_ENABLED 1
|
|
#define KEY_ENABLED 1
|
|
#define EEPROM_ENABLED 1
|
|
|
|
#define LIMIT_SWITCH_ENABLED 1
|
|
#define PGA_ENABLED 1
|
|
|
|
#define DI_MAX_PORT GPIOA
|
|
#define DI_MAX_PIN 8
|
|
#define DI_MIN_PORT GPIOB
|
|
#define DI_MIN_PIN 2
|
|
|
|
#define ID_PORT GPIOB
|
|
#define ID_PIN_1 5
|
|
#define ID_PIN_2 6
|
|
#define ID_PIN_3 7
|
|
#define ID_PIN_4 8
|
|
|
|
#define LED_PORT GPIOA
|
|
#define LED_PIN 6
|
|
|
|
#endif
|