2025-05-21 11:31:07 +08:00

58 lines
2.1 KiB
C

/*
* drv_gpio.h
*
* Created on: 2025年4月9日
* Author: 22332
*/
#ifndef DRV_GPIO_H_
#define DRV_GPIO_H_
#include "sdk_project_config.h"
typedef enum {
GPIO_PIN_LEVEL_LOW = 0U, /*!< Pin level low */
GPIO_PIN_LEVEL_HIGH = 1U /*!< Pin level high */
} gpio_pin_level_t;
struct gpio_cfg_out_t{
GPIO_Type* port;
uint32_t pin;
gpio_pin_level_t def;
};
struct gpio_cfg_in_t{
GPIO_Type* port;
uint32_t pin;
};
static struct gpio_cfg_in_t g_pArrayPortIn[] = {
{IN_LVDS_UNLOCK_PORT, IN_LVDS_UNLOCK_PIN},
{IN_WAKEUP_PORT, IN_WAKEUP_PIN},
{IN_TFT_ERR_PORT, IN_TFT_ERR_PIN},
{IN_LDO_1V2_PG_PORT, IN_LDO_1V2_PG_PIN},
{IN_SW_3V3_PG_PORT, IN_SW_3V3_PG_PIN},
{IN_PMIC_FLTB_PORT, IN_PMIC_FLTB_PIN},
{IN_BL_ERR_PORT, IN_BL_ERR_PIN},
};
static struct gpio_cfg_out_t g_pArrayPortOut[] = {
{OUT_BL_PWM_PORT, OUT_BL_PWM_PIN, GPIO_PIN_LEVEL_LOW},
{OUT_BL_EN_PORT, OUT_BL_EN_PIN, GPIO_PIN_LEVEL_LOW},
{OUT_LVDS_PDB_PORT, OUT_LVDS_PDB_PIN, GPIO_PIN_LEVEL_HIGH},
{OUT_PON_HOLD_PORT, OUT_PON_HOLD_PIN, GPIO_PIN_LEVEL_LOW},
{OUT_TFT_BIST_PORT, OUT_TFT_BIST_PIN, GPIO_PIN_LEVEL_LOW},
{OUT_TFT_SYBYB_PORT, OUT_TFT_SYBYB_PIN, GPIO_PIN_LEVEL_LOW},
{OUT_TFT_DISP_PORT, OUT_TFT_DISP_PIN, GPIO_PIN_LEVEL_LOW},
{OUT_TFT_SHLR_PORT, OUT_TFT_SHLR_PIN, GPIO_PIN_LEVEL_LOW},
{OUT_TFT_RST_PORT, OUT_TFT_RST_PIN, GPIO_PIN_LEVEL_LOW},
{OUT_TP_RST_PORT, OUT_TP_RST_PIN, GPIO_PIN_LEVEL_LOW},
{OUT_3V3_TFT_EN_PORT, OUT_3V3_TFT_EN_PIN, GPIO_PIN_LEVEL_LOW},
{OUT_PMIC_EN_PORT, OUT_PMIC_EN_PIN, GPIO_PIN_LEVEL_LOW},
{OUT_MCU_INT_PORT, OUT_MCU_INT_PIN, GPIO_PIN_LEVEL_LOW},
{OUT_LDO_1V2_EN_PORT, OUT_LDO_1V2_EN_PIN, GPIO_PIN_LEVEL_LOW},
};
extern void bsp_gpio_cfg_input(void);
extern void bsp_gpio_cfg_output(void);
extern int bsp_gpio_pin_read(int index);
extern void bsp_gpio_pin_write(int index, gpio_pin_level_t status);
#endif /* DRV_GPIO_H_ */