/******************************************************************************
 * @file      gpio_manager.c
 * @brief     初始化gpio接口配置
 * @version   
 * @copyright    
 ******************************************************************************/
#include "gpio_manager.h"

const GpioArray io_array[kGpioType_End] = 
{
	/*12个DI*/
    kGpioMode_Input_Floating,	kGpioStatus_Low,	GPIO_PORT_PIN(kGpioPort_E, 9),	kGpioPort_E,	kGpioPin_9 ,	//DI1 低电平输入信号检测
	kGpioMode_Input_Floating,	kGpioStatus_Low,	GPIO_PORT_PIN(kGpioPort_C, 8),	kGpioPort_C,	kGpioPin_8 ,	//DI1 低电平输入信号检测
	kGpioMode_Input_Floating,	kGpioStatus_Low,	GPIO_PORT_PIN(kGpioPort_C, 8),	kGpioPort_C,	kGpioPin_8 ,	//DI1 低电平输入信号检测
	kGpioMode_Input_Floating,	kGpioStatus_Low,	GPIO_PORT_PIN(kGpioPort_C, 8),	kGpioPort_C,	kGpioPin_8 ,	//DI1 低电平输入信号检测
	kGpioMode_Input_Floating,	kGpioStatus_Low,	GPIO_PORT_PIN(kGpioPort_C, 8),	kGpioPort_C,	kGpioPin_8 ,	//DI1 低电平输入信号检测
	kGpioMode_Input_Floating,	kGpioStatus_Low,	GPIO_PORT_PIN(kGpioPort_C, 8),	kGpioPort_C,	kGpioPin_8 ,	//DI1 低电平输入信号检测
	kGpioMode_Input_Floating,	kGpioStatus_Low,	GPIO_PORT_PIN(kGpioPort_C, 8),	kGpioPort_C,	kGpioPin_8 ,	//DI1 低电平输入信号检测
	kGpioMode_Input_Floating,	kGpioStatus_Low,	GPIO_PORT_PIN(kGpioPort_C, 8),	kGpioPort_C,	kGpioPin_8 ,	//DI1 低电平输入信号检测
	kGpioMode_Input_Floating,	kGpioStatus_Low,	GPIO_PORT_PIN(kGpioPort_C, 8),	kGpioPort_C,	kGpioPin_8 ,	//DI1 低电平输入信号检测
	kGpioMode_Input_Floating,	kGpioStatus_Low,	GPIO_PORT_PIN(kGpioPort_C, 8),	kGpioPort_C,	kGpioPin_8 ,	//DI1 低电平输入信号检测
	kGpioMode_Input_Floating,	kGpioStatus_Low,	GPIO_PORT_PIN(kGpioPort_C, 8),	kGpioPort_C,	kGpioPin_8 ,	//DI1 低电平输入信号检测
	kGpioMode_Input_Floating,	kGpioStatus_Low,	GPIO_PORT_PIN(kGpioPort_C, 8),	kGpioPort_C,	kGpioPin_8 ,	//DI1 低电平输入信号检测

	/*10个DO*/
	kGpioMode_Output_PP,	kGpioStatus_Low,	GPIO_PORT_PIN(kGpioPort_G, 4),	kGpioPort_G,	kGpioPin_4 ,	    //HSD_Ctrl_1 高边控制1
	kGpioMode_Output_PP,	kGpioStatus_Low,	GPIO_PORT_PIN(kGpioPort_G, 4),	kGpioPort_G,	kGpioPin_4 ,	    //HSD_Ctrl_1 高边控制1
	kGpioMode_Output_PP,	kGpioStatus_Low,	GPIO_PORT_PIN(kGpioPort_G, 4),	kGpioPort_G,	kGpioPin_4 ,	    //HSD_Ctrl_1 高边控制1
	kGpioMode_Output_PP,	kGpioStatus_Low,	GPIO_PORT_PIN(kGpioPort_G, 4),	kGpioPort_G,	kGpioPin_4 ,	    //HSD_Ctrl_1 高边控制1
	kGpioMode_Output_PP,	kGpioStatus_Low,	GPIO_PORT_PIN(kGpioPort_G, 4),	kGpioPort_G,	kGpioPin_4 ,	    //HSD_Ctrl_1 高边控制1
	kGpioMode_Output_PP,	kGpioStatus_Low,	GPIO_PORT_PIN(kGpioPort_G, 4),	kGpioPort_G,	kGpioPin_4 ,	    //HSD_Ctrl_1 高边控制1
	kGpioMode_Output_PP,	kGpioStatus_Low,	GPIO_PORT_PIN(kGpioPort_G, 4),	kGpioPort_G,	kGpioPin_4 ,	    //HSD_Ctrl_1 高边控制1
	kGpioMode_Output_PP,	kGpioStatus_Low,	GPIO_PORT_PIN(kGpioPort_G, 4),	kGpioPort_G,	kGpioPin_4 ,	    //HSD_Ctrl_1 高边控制1
	kGpioMode_Output_PP,	kGpioStatus_Low,	GPIO_PORT_PIN(kGpioPort_G, 4),	kGpioPort_G,	kGpioPin_4 ,	    //LSD_Ctrl_9 低边控制1
	kGpioMode_Output_PP,	kGpioStatus_Low,	GPIO_PORT_PIN(kGpioPort_G, 4),	kGpioPort_G,	kGpioPin_4 ,	    //HSD_Ctrl_10 高边控制1
	
	/*RS485枚举*/
    kGpioMode_Output_PP,	kGpioStatus_Low,	GPIO_PORT_PIN(kGpioPort_G, 11),	kGpioPort_G,	kGpioPin_11 ,	//RS485A 发送使能
	kGpioMode_Output_PP,	kGpioStatus_Low,	GPIO_PORT_PIN(kGpioPort_G, 9),	kGpioPort_G,	kGpioPin_9 ,	//RS485B 发送使能
	kGpioMode_Output_PP,	kGpioStatus_Low,	GPIO_PORT_PIN(kGpioPort_G, 10),	kGpioPort_G,	kGpioPin_10 ,	//RS485C 发送使能
	
	kGpioMode_Comm_Rx,	kGpioStatus_Low,	GPIO_PORT_PIN(kGpioPort_D, 5),	kGpioPort_D, kGpioPin_5 ,  //rs485A Rx(mcu uart1)
	kGpioMode_Comm_Tx,	kGpioStatus_Low,	GPIO_PORT_PIN(kGpioPort_D, 6),	kGpioPort_D, kGpioPin_6 ,  //rs485A Tx(mcu uart1)
	
	kGpioMode_Comm_Rx,	kGpioStatus_Low,	GPIO_PORT_PIN(kGpioPort_D, 9),	kGpioPort_D, kGpioPin_9 ,  //rs485B Rx(mcu uart1)
	kGpioMode_Comm_Tx,	kGpioStatus_Low,	GPIO_PORT_PIN(kGpioPort_D, 8),	kGpioPort_D, kGpioPin_8 ,  //rs485B Tx(mcu uart1)
	
	kGpioMode_Comm_Rx,	kGpioStatus_Low,	GPIO_PORT_PIN(kGpioPort_A, 10),	kGpioPort_A, kGpioPin_10 ,  //rs485C Rx(mcu uart1)
	kGpioMode_Comm_Tx,	kGpioStatus_Low,	GPIO_PORT_PIN(kGpioPort_A, 9),	kGpioPort_A, kGpioPin_9 ,  //rs485C Tx(mcu uart1)
	
	/*CAN枚举*/
	kGpioMode_Comm_Rx,	kGpioStatus_Low,	GPIO_PORT_PIN(kGpioPort_A, 11),	kGpioPort_A, kGpioPin_11 ,	//can1 rx 
	kGpioMode_Comm_Tx,	kGpioStatus_Low,	GPIO_PORT_PIN(kGpioPort_A, 12),	kGpioPort_A, kGpioPin_12 ,	//can1 tx 
	kGpioMode_Comm_Rx,	kGpioStatus_Low,	GPIO_PORT_PIN(kGpioPort_B, 12),	kGpioPort_B, kGpioPin_12 ,	//can2 rx 
	kGpioMode_Comm_Tx,	kGpioStatus_Low,	GPIO_PORT_PIN(kGpioPort_B, 13),	kGpioPort_B, kGpioPin_13 ,	//can2 tx 
	
    /*绝缘监测开关--待确认*/
  	kGpioMode_Output_PP,	kGpioStatus_High,	GPIO_PORT_PIN(kGpioPort_E, 15),	kGpioPort_E, kGpioPin_15 ,  //insu_mos_S1 ISL_EN_MCU 绝缘检测PE开关驱动信号
    kGpioMode_Output_PP,	kGpioStatus_High,	GPIO_PORT_PIN(kGpioPort_E, 14),	kGpioPort_E, kGpioPin_15 ,  	//insu_mos_S2 ISL_HS_MCU 绝缘检测上位开关驱动信号
    kGpioMode_Output_PP,	kGpioStatus_High,	GPIO_PORT_PIN(kGpioPort_E, 13),	kGpioPort_E, kGpioPin_15 ,  	//insu_mos_S3 ISL_LS_MCU 绝缘检测下位开关驱动信号
	
	/*ADC枚举*/
    kGpioMode_Adc,	kGpioStatus_Low,	GPIO_PORT_PIN(kGpioPort_F, 7),	kGpioPort_F, kGpioPin_7 ,	//24 电压采样信号
    kGpioMode_Adc,	kGpioStatus_Low,	GPIO_PORT_PIN(kGpioPort_F, 6),	kGpioPort_F, kGpioPin_6 ,	//板载温度 NTC
    kGpioMode_Adc,	kGpioStatus_Low,	GPIO_PORT_PIN(kGpioPort_F, 9),	kGpioPort_F, kGpioPin_9 ,	//霍尔采集ADC

	/*菊花链采集*/
	kGpioMode_Comm_Tx,		kGpioStatus_High,	GPIO_PORT_PIN(kGpioPort_A, 7),	kGpioPort_A, kGpioPin_7 ,	//LT6820_MOSI   SPI1通讯信号
	kGpioMode_Comm_Rx,		kGpioStatus_High,	GPIO_PORT_PIN(kGpioPort_A, 6),	kGpioPort_A, kGpioPin_6 ,	//LT6820_MISO	SPI1通讯信号
	kGpioMode_Comm_Tx,		kGpioStatus_High,	GPIO_PORT_PIN(kGpioPort_A, 5),	kGpioPort_A, kGpioPin_5 ,	//LT6820_SCK	SPI1通讯信号
	kGpioMode_Output_PP,	kGpioStatus_High,	GPIO_PORT_PIN(kGpioPort_A, 4),	kGpioPort_A, kGpioPin_4 ,	//LT6820 En1
	kGpioMode_Output_PP,	kGpioStatus_High,	GPIO_PORT_PIN(kGpioPort_E, 10),	kGpioPort_E, kGpioPin_10 ,	//LT6820 En2
	
	/*高压采集*/
	kGpioMode_Output_PP,	kGpioStatus_High,	GPIO_PORT_PIN(kGpioPort_G, 13),	kGpioPort_G, kGpioPin_13 ,	//ADC复位信号 低电平
	kGpioMode_Comm_Tx,	kGpioStatus_High,	GPIO_PORT_PIN(kGpioPort_B, 15),		kGpioPort_B, kGpioPin_15 ,	//ADC_MOSI  SPI2通讯信号
	kGpioMode_Comm_Rx,	kGpioStatus_High,	GPIO_PORT_PIN(kGpioPort_B, 14),		kGpioPort_B, kGpioPin_14 ,	//ADC_MISO	 SPI2通讯信号
	kGpioMode_Comm_Tx,	kGpioStatus_Low,	GPIO_PORT_PIN(kGpioPort_B, 10),		kGpioPort_B, kGpioPin_10 ,	//ADC_SCK   SPI2通讯信号
	kGpioMode_Output_PP,	kGpioStatus_High,	GPIO_PORT_PIN(kGpioPort_B, 11),	kGpioPort_B, kGpioPin_11 ,	//ADC_CS    SPI2通讯信号
    
	/*网络采集*/
    kGpioMode_Comm_Tx,	kGpioStatus_High,	GPIO_PORT_PIN(kGpioPort_B, 5),			kGpioPort_B, kGpioPin_5 ,	//W5500_MOSI  
	kGpioMode_Comm_Rx,	kGpioStatus_High,	GPIO_PORT_PIN(kGpioPort_B, 4),			kGpioPort_B, kGpioPin_4 ,	//W5500_MISO
	kGpioMode_Comm_Tx,	kGpioStatus_High,	GPIO_PORT_PIN(kGpioPort_B, 3),			kGpioPort_B, kGpioPin_3 ,	//W5500_SCK
	kGpioMode_Output_PP,	kGpioStatus_High,	GPIO_PORT_PIN(kGpioPort_A, 15),		kGpioPort_A, kGpioPin_15 ,	//W5500_CS
    kGpioMode_Output_PP,	kGpioStatus_Low,	GPIO_PORT_PIN(kGpioPort_G, 14),		kGpioPort_G, kGpioPin_14 ,	//W5500_RST
    kGpioMode_Input_Floating,	kGpioStatus_High,	GPIO_PORT_PIN(kGpioPort_G, 15),	kGpioPort_G, kGpioPin_15 ,	//W5500_INT
};

void bms_init_gpio(void)
{
    drv_gpio_init(io_array, kGpioType_End);
}


