generated from hulk/gd32e23x_template_cmake_vscode
add(actuator):添加推杆的驱动函数已经验证OK。
This commit is contained in:
+54
-17
@@ -1,12 +1,15 @@
|
||||
#ifndef BOARD_CONFIG_H
|
||||
#define BOARD_CONFIG_H
|
||||
|
||||
#ifndef DISABLE
|
||||
#define DISABLE 0
|
||||
#include "gd32e23x.h"
|
||||
#include "stdbool.h"
|
||||
|
||||
#ifndef CFG_DISABLE
|
||||
#define CFG_DISABLE 0
|
||||
#endif
|
||||
|
||||
#ifndef ENABLE
|
||||
#define ENABLE 1
|
||||
#ifndef CFG_ENABLE
|
||||
#define CFG_ENABLE 1
|
||||
#endif
|
||||
|
||||
#define GD32E23XF4 0x10
|
||||
@@ -19,25 +22,25 @@
|
||||
|
||||
/* >>>>>>>>>>>>>>>>>>>>[IIC TYPE DEFINE]<<<<<<<<<<<<<<<<<<<< */
|
||||
|
||||
#define SOFTWARE_IIC DISABLE // DISABLE: Hardware IIC; ENABLE: Software IIC
|
||||
#define SOFTWARE_IIC CFG_DISABLE // CFG_DISABLE: Hardware IIC; CFG_ENABLE: Software IIC
|
||||
|
||||
/* >>>>>>>>>>>>>>>>>>>>[DEBUG MODE]<<<<<<<<<<<<<<<<<<<< */
|
||||
|
||||
#define DEBUG_MODE DISABLE // DISABLE: Release Mode; ENABLE: Debug Mode
|
||||
#define DEBUG_MODE CFG_DISABLE // CFG_DISABLE: Release Mode; CFG_ENABLE: Debug Mode
|
||||
|
||||
/* >>>>>>>>>>>>>>>>>>>>[COMMAND DEBUG]<<<<<<<<<<<<<<<<<<<< */
|
||||
|
||||
#define COM_DEBUG DISABLE // DISABLE: Command debug off; ENABLE: Command debug on
|
||||
#define COM_DEBUG CFG_DISABLE // CFG_DISABLE: Command debug off; CFG_ENABLE: Command debug on
|
||||
|
||||
/* >>>>>>>>>>>>>>>>>>>>[DEBUG ASSERTIONS DEFINE]<<<<<<<<<<<<<<<<<<<< */
|
||||
|
||||
#define DEBUG_VERBOSE DISABLE // DISABLE: Verbose debug off; ENABLE: Verbose debug on
|
||||
#define DEBUG_VERBOSE CFG_DISABLE // CFG_DISABLE: Verbose debug off; CFG_ENABLE: Verbose debug on
|
||||
|
||||
/* >>>>>>>>>>>>>>>>>>>>[SEGGER RTT DETECTION]<<<<<<<<<<<<<<<<<<<< */
|
||||
|
||||
#define SEGGER_RTT_DETECTION ENABLE // DISABLE: SEGGER RTT off; ENABLE: SEGGER RTT on
|
||||
#define SEGGER_RTT_DETECTION CFG_ENABLE // CFG_DISABLE: SEGGER RTT off; CFG_ENABLE: SEGGER RTT on
|
||||
|
||||
#if SEGGER_RTT_DETECTION == ENABLE
|
||||
#if SEGGER_RTT_DETECTION == CFG_ENABLE
|
||||
#include "SEGGER_RTT.h"
|
||||
#define RTT_printf(ch, ...) SEGGER_RTT_printf(ch, __VA_ARGS__)
|
||||
#define RTT_WriteString(ch, s) SEGGER_RTT_WriteString(ch, s)
|
||||
@@ -67,13 +70,13 @@ void usart1_irq_handler(void);
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
#define RCU_GPIO_I2C RCU_GPIOF
|
||||
#define RCU_I2C RCU_I2C0
|
||||
#define I2C_SCL_PORT GPIOF
|
||||
#define I2C_SCL_PIN GPIO_PIN_1
|
||||
#define I2C_SDA_PORT GPIOF
|
||||
#define I2C_SDA_PIN GPIO_PIN_0
|
||||
#define I2C_GPIO_AF GPIO_AF_1
|
||||
// #define RCU_GPIO_I2C RCU_GPIOF
|
||||
// #define RCU_I2C RCU_I2C0
|
||||
// #define I2C_SCL_PORT GPIOF
|
||||
// #define I2C_SCL_PIN GPIO_PIN_1
|
||||
// #define I2C_SDA_PORT GPIOF
|
||||
// #define I2C_SDA_PIN GPIO_PIN_0
|
||||
// #define I2C_GPIO_AF GPIO_AF_1
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
@@ -83,6 +86,40 @@ void usart1_irq_handler(void);
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
typedef enum {
|
||||
ACTUATOR_CH1 = 0,
|
||||
ACTUATOR_CH2
|
||||
} actuator_channel_t;
|
||||
|
||||
typedef enum {
|
||||
DIRECTION_PUSH = 0, // 推动方向
|
||||
DIRECTION_PULL // 拉动方向
|
||||
} actuator_direction_t;
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
#define ACTUATOR_CH1_PWM_RCU RCU_GPIOA
|
||||
#define ACTUATOR_CH1_PWM_PORT GPIOA
|
||||
#define ACTUATOR_CH1_PWM_PIN GPIO_PIN_10
|
||||
#define ACTUATOR_CH1_GPIO_RCU RCU_GPIOF
|
||||
#define ACTUATOR_CH1_GPIO_PORT GPIOF
|
||||
#define ACTUATOR_CH1_GPIO_PIN GPIO_PIN_0
|
||||
|
||||
#define ACTUATOR_CH2_PWM_RCU RCU_GPIOA
|
||||
#define ACTUATOR_CH2_PWM_PORT GPIOA
|
||||
#define ACTUATOR_CH2_PWM_PIN GPIO_PIN_9
|
||||
#define ACTUATOR_CH2_GPIO_RCU RCU_GPIOF
|
||||
#define ACTUATOR_CH2_GPIO_PORT GPIOF
|
||||
#define ACTUATOR_CH2_GPIO_PIN GPIO_PIN_1
|
||||
|
||||
#define ACTUATOR_PWM_TIMER_RCU RCU_TIMER0
|
||||
#define ACTUATOR_PWM_TIMER TIMER0
|
||||
|
||||
#define ACTUATOR_CH1_PWM_TIMER_CH TIMER_CH_2
|
||||
#define ACTUATOR_CH2_PWM_TIMER_CH TIMER_CH_1
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
#define UART_RCU (g_usart_config.rcu_usart)
|
||||
#define UART_PHY (g_usart_config.usart_periph)
|
||||
#define UART_IRQ (g_usart_config.irq_type)
|
||||
|
||||
Reference in New Issue
Block a user