tao_z
2021-06-14 99203cece60f744daa34e8646e40ff45ab74523f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#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