HONGRI_boot/boot_source/code_app/interface/inc/if_gpio.h
2024-11-05 10:08:08 +08:00

151 lines
4.3 KiB
C

/*
*********************************************************************************************************
* File Name : if_gpio.h
* Auther : ADAYO Sam
* Date : 2021.11
* Description :
* Version :
*********************************************************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __gpio_H
#define __gpio_H
/*
*********************************************************************************************************
* INCLUDE FILES
*********************************************************************************************************
*/
/*
*********************************************************************************************************
* MACRO'S
*********************************************************************************************************
*/
/*
*********************************************************************************************************
* LOCAL DATA TYPES
*********************************************************************************************************
*/
/*
*********************************************************************************************************
* GLOBAL VARIABLES
*********************************************************************************************************
*/
/*Defines the Interrupt Numbers definitions*/
typedef enum
{
EXTI_CH_ACC=0,
EXTI_CH_MPU,
EXTI_CH_GSENSOR_INT2,
EXTI_CH_WIFI,
EXTI_CH_BCALL,
EXTI_CH_CANRX0,
EXTI_CH_CANRX1,
EXTI_CH_CANRX2,
EXTI_CH_MAXNUM
}exti_channel_t;
/* GPIO level high and low state. */
typedef enum
{
GPIO_LEVEL_LOW=0,
GPIO_LEVEL_HIGH,
GPIO_LEVEL_INVALID
}gpio_level_t;
typedef enum
{
GPIO_INPUT = 0,
GPIO_OUTPUT,
GPIO_LEVEL_UNSPECIFIED
}gpio_direction_t;
/* GPIO function list */
#if 0
typedef enum
{
IF_GPIO_TFT_RESET=0,//PTD1
IF_GPIO_TFT_SLEEP,//PTE5
IF_GPIO_PWM_A,//PTE8
IF_GPIO_PWM_D,//PTB5
IF_GPIO_PWM_B,//PTB4
IF_GPIO_PWM_C,//PTC3
IF_GPIO_ACC_DET,//PTE11
IF_GPIO_MOTOR_CLOSE,//PTC0
IF_GPIO_VERDET_3,//PTC15
IF_GPIO_VERDET_2,//PTC14
IF_GPIO_VERDET_1,//PTB3
IF_GPIO_VERDET_0,//PTB2
IF_GPIO_LVDS_RESET,//PTE7
IF_GPIO_WARP_IRQ,//PTB13
IF_GPIO_POWER_KEY,//PTD3
IF_GPIO_EEP_WP,//PTC7
IF_GPIO_CAN0_STB,//PTC13
IF_GPIO_CAN1_STB,//PTE6
IF_GPIO_CAN1_EN,//PTE2
IF_GPIO_CAN1_ERR,//PTA11
IF_GPIO_9287_PWDN,//PTA10
IF_GPIO_9287_ERR,//PTE1
IF_GPIO_9287_LOCK,//PTE0
IF_GPIO_MAIN_12V_POWER,//PTC8
IF_GPIO_MAIN_5V_POWER,//PTE14
IF_GPIO_ACC_POWER,//PTC9
IF_GPIO_MPU_RESET,//PTB10
IF_GPIO_TFT_BL,//PTB13
IF_GPIO_MAX_NUMBER
}gpio_num_t;
#else
typedef enum
{
IF_GPIO_CAN0_STB=0,//PTC13
IF_GPIO_CAN0_EN,
IF_GPIO_CAN0_ERR,
IF_GPIO_MAX_NUMBER
}gpio_num_t;
#endif
#define IO_ACC_DET_GPIO PTE
#define ACC_DET_PORT_PIN 11
#define IO_CAN0_RX_GPIO PTE
#define CAN0_RX_PORT_PIN 4
/*
*********************************************************************************************************
* FUNCTION PROTOTYPES
*********************************************************************************************************
*/
extern void IF_GPIO_vInit (void);
extern void IF_GPIO_vDeinit (void);
extern void IF_GPIO_vSetDirection(gpio_num_t GPIO_Number,gpio_direction_t direction);
extern void IF_GPIO_vSetLow(gpio_num_t GPIO_Number);
extern void IF_GPIO_vSetHigh (gpio_num_t GPIO_Number);
extern gpio_level_t IF_GPIO_GetStatus (gpio_num_t GPIO_Number);
extern void IF_GPIO_SleepPinDisable(void);
extern void IF_GPIO_SetCanInt(void);
extern void IF_GPIO_SetAccInt(void);
extern void IF_GPIO_vToggle(gpio_num_t GPIO_Number);
extern void IF_EXTI_vEnable(exti_channel_t irqNumber);
extern void IF_EXTI_vDisable (exti_channel_t irqNumber);
extern void IF_EXTI_vInit (void);
#endif /* End of module include. */
/**********************************************END OF FILE**********************************************/