#ifndef GPIO_H
|
#define GPIO_H
|
#include "gd32e23x_gpio.h"
|
/*
|
* ¿ª¹ØÊäÈë
|
*/
|
#define SW_IN_PORT GPIOF
|
#define SW_IN_PIN GPIO_PIN_0
|
/**
|
* @brief SDH2136ʹÄÜÒý½Å¶¨Òå
|
* ¸ßµçƽÓÐЧ
|
*/
|
#define SDH2136_EN_PORT GPIOA
|
#define SDH2136_EN_PIN GPIO_PIN_6
|
|
#define SDH2136_FAULT_PORT GPIOA
|
#define SDH2136_FAULT_PIN GPIO_PIN_0
|
/*
|
LEDÒý½Å¿ØÖƶ¨Òå
|
L active
|
*/
|
#define LED_PORT GPIOA
|
#define LED_PIN GPIO_PIN_11
|
|
#define HALL_SENSOR_A_PORT GPIOB
|
#define HALL_SENSOR_A_PIN GPIO_PIN_4
|
#define HALL_SENSOR_B_PORT GPIOB
|
#define HALL_SENSOR_B_PIN GPIO_PIN_5
|
#define HALL_SENSOR_C_PORT GPIOA
|
#define HALL_SENSOR_C_PIN GPIO_PIN_15
|
|
//¶¨ÒåADCÒý½Å
|
#define CURRENT_AI_PORT GPIOA
|
#define CURRENT_AI_PIN GPIO_PIN_1
|
#define VOLTAGE_AI_PORT GPIOA
|
#define VOLTAGE_AI_PIN GPIO_PIN_2
|
#define ADC_CURRENT_CH (ADC_CHANNEL_2)
|
#define ADC_PRESSURE_CH (ADC_CHANNEL_1)
|
//¶¨Òå´®¿ÚÒý½Å
|
#define UART_TX_PORT GPIOB
|
#define UART_RX_PORT GPIOB
|
#define UART_TX_PIN GPIO_PIN_6
|
#define UART_RX_PIN GPIO_PIN_7
|
//¶¨ÒåPWMͨµÀÒý½Å
|
//TIME0 CH2
|
#define PWM_HIN1_PORT GPIOA
|
#define PWM_HIN1_PIN GPIO_PIN_10
|
//TIME0 CH1
|
#define PWM_HIN2_PORT GPIOA
|
#define PWM_HIN2_PIN GPIO_PIN_9
|
//TIME0 CH0
|
#define PWM_HIN3_PORT GPIOA
|
#define PWM_HIN3_PIN GPIO_PIN_8
|
|
//TIME0 CH2_N
|
#define PWM_LIN1_PORT GPIOB
|
#define PWM_LIN1_PIN GPIO_PIN_1
|
//TIME0 CH1_N
|
#define PWM_LIN2_PORT GPIOB
|
#define PWM_LIN2_PIN GPIO_PIN_0
|
//TIME0 CH0_N
|
#define PWM_LIN3_PORT GPIOA
|
#define PWM_LIN3_PIN GPIO_PIN_7
|
|
typedef enum HallChannel
|
{
|
HALL_A_CH,
|
HALL_B_CH,
|
HALL_C_CH,
|
HALL_CH_MAX
|
} HallChannel_t;
|
typedef enum PinActive
|
{
|
PIN_Inactive = 0,
|
PIN_Active
|
} PinActive_t;
|
/*********************************************************************/
|
extern void GPIO_Init(void);
|
extern void Set_LedOn(void);
|
extern void Set_LedOff(void);
|
extern void Set_SDH2136_Enable(void);
|
extern void Set_SDH2136_Disable(void);
|
extern uint8_t Get_SDH2136FaultState(void);
|
extern uint8_t Get_SwitchInputState(void);
|
extern uint8_t Get_HallSensorA_State(void);
|
extern uint8_t Get_HallSensorB_State(void);
|
extern uint8_t Get_HallSensorC_State(void);
|
|
#endif
|