#ifndef BU91R65_PORTING_H__
#define BU91R65_PORTING_H__

#include "TYW_stdint.h"
#include "GPIO.h"

#define PowerEN             GPIO_OUT_PORT08_PIN00
#define SCREEN_1356         //第1356块屏 如需输出24块屏屏蔽词条宏定义
/**************screen1****************/
#define LCD_INHB            GPIO_OUT_APORT00_PIN10

#define BU91R65_CHIP0_SD 	GPIO_OUT_APORT00_PIN13  
#define BU91R65_CHIP0_CSB	GPIO_OUT_APORT00_PIN15 
#define BU91R65_CHIP0_SCL	GPIO_OUT_APORT00_PIN14 

#define BU91R65_CHIP1_SD 	GPIO_OUT_APORT00_PIN07
#define BU91R65_CHIP1_CSB	GPIO_OUT_APORT00_PIN09
#define BU91R65_CHIP1_SCL	GPIO_OUT_APORT00_PIN08
/**************screen2****************/
#define LCD_INHBb           GPIO_OUT_PORT09_PIN01

#define BU91R65_CHIP0_SDb 	GPIO_OUT_PORT08_PIN10
#define BU91R65_CHIP0_CSBb	GPIO_OUT_PORT08_PIN12
#define BU91R65_CHIP0_SCLb	GPIO_OUT_PORT08_PIN11 

#define BU91R65_CHIP1_SDb 	GPIO_OUT_PORT09_PIN04
#define BU91R65_CHIP1_CSBb	GPIO_OUT_PORT09_PIN02
#define BU91R65_CHIP1_SCLb	GPIO_OUT_PORT09_PIN03
/**************screen3****************/
#ifdef SCREEN_1356 
#define LCD_INHBa        	GPIO_OUT_PORT10_PIN12

#define BU91R65_CHIP0_SDa 	GPIO_OUT_PORT10_PIN09
#define BU91R65_CHIP0_CSBa	GPIO_OUT_PORT10_PIN06
#define BU91R65_CHIP0_SCLa	GPIO_OUT_PORT10_PIN07 

#define BU91R65_CHIP1_SDa 	GPIO_OUT_PORT11_PIN01
#define BU91R65_CHIP1_CSBa	GPIO_OUT_PORT10_PIN13
#define BU91R65_CHIP1_SCLa	GPIO_OUT_PORT10_PIN14
#else
#define LCD_INHBa        	GPIO_OUT_PORT10_PIN13

#define BU91R65_CHIP0_SDa 	GPIO_OUT_PORT10_PIN10
#define BU91R65_CHIP0_CSBa	GPIO_OUT_PORT10_PIN07
#define BU91R65_CHIP0_SCLa	GPIO_OUT_PORT10_PIN08

#define BU91R65_CHIP1_SDa 	GPIO_OUT_PORT11_PIN02
#define BU91R65_CHIP1_CSBa	GPIO_OUT_PORT10_PIN14
#define BU91R65_CHIP1_SCLa	GPIO_OUT_PORT10_PIN15
#endif
// /**************screen4****************/
// #define LCD_INHBc        	GPIO_OUT_PORT10_PIN01

// #define BU91R65_CHIP0_SDc 	GPIO_OUT_PORT11_PIN06
// #define BU91R65_CHIP0_CSBc	GPIO_OUT_PORT11_PIN04
// #define BU91R65_CHIP0_SCLc	GPIO_OUT_PORT11_PIN05 

// #define BU91R65_CHIP1_SDc 	GPIO_OUT_PORT10_PIN15
// #define BU91R65_CHIP1_CSBc	GPIO_OUT_PORT10_PIN04
// #define BU91R65_CHIP1_SCLc	GPIO_OUT_PORT10_PIN05
// /**************screen5****************/
// #define LCD_INHBd        	GPIO_OUT_PORT00_PIN06

// #define BU91R65_CHIP0_SDd 	GPIO_OUT_PORT00_PIN03
// #define BU91R65_CHIP0_CSBd	GPIO_OUT_PORT00_PIN01
// #define BU91R65_CHIP0_SCLd	GPIO_OUT_PORT00_PIN02 

// #define BU91R65_CHIP1_SDd 	GPIO_OUT_PORT00_PIN13
// #define BU91R65_CHIP1_CSBd	GPIO_OUT_PORT00_PIN11
// #define BU91R65_CHIP1_SCLd	GPIO_OUT_PORT00_PIN12

typedef void (*pfunBU91R65_Set_nCS)(uint8_t u8Level);
typedef void (*pfunBU91R65_Set_SCLK)(uint8_t u8Level);
typedef void (*pfunBU91R65_Set_SD)(uint8_t u8Level);
typedef struct 
{
    pfunBU91R65_Set_nCS  u16PinCS;        /**< Number of CSB pin */
    pfunBU91R65_Set_SCLK u16PinSCLK;      /**< Number of SCL pin */
    pfunBU91R65_Set_SD   u16PinSD;        /**< Number of SD pin */
    uint16_t u16Rsvd;
}BU91R65_Pin_Map_st_t;

#define   BU91R65_NOT_USED_PIN               (0xFFFFU)

extern int32_t BU91R65_GPIO_Init(BU91R65_Pin_Map_st_t *pstPinMap);
extern void BU91R65_Chip0_Set_nCS(uint8_t u8Level);
extern void BU91R65_Chip0_Set_SCLK(uint8_t u8Level);
extern void BU91R65_Chip0_Set_SD(uint8_t u8Level);
extern void BU91R65_Chip1_Set_nCS(uint8_t u8Level);
extern void BU91R65_Chip1_Set_SCLK(uint8_t u8Level);
extern void BU91R65_Chip1_Set_SD(uint8_t u8Level);

extern void BU91R65_Chip0_Set_nCSb(uint8_t u8Level);
extern void BU91R65_Chip0_Set_SCLKb(uint8_t u8Level);
extern void BU91R65_Chip0_Set_SDb(uint8_t u8Level);
extern void BU91R65_Chip1_Set_nCSb(uint8_t u8Level);
extern void BU91R65_Chip1_Set_SCLKb(uint8_t u8Level);
extern void BU91R65_Chip1_Set_SDb(uint8_t u8Level);

extern void BU91R65_Chip0_Set_nCSa(uint8_t u8Level);
extern void BU91R65_Chip0_Set_SCLKa(uint8_t u8Level);
extern void BU91R65_Chip0_Set_SDa(uint8_t u8Level);
extern void BU91R65_Chip1_Set_nCSa(uint8_t u8Level);
extern void BU91R65_Chip1_Set_SCLKa(uint8_t u8Level);
extern void BU91R65_Chip1_Set_SDa(uint8_t u8Level);

extern void BU91R65_Chip0_Set_nCSc(uint8_t u8Level);
extern void BU91R65_Chip0_Set_SCLKc(uint8_t u8Level);
extern void BU91R65_Chip0_Set_SDc(uint8_t u8Level);
extern void BU91R65_Chip1_Set_nCSc(uint8_t u8Level);
extern void BU91R65_Chip1_Set_SCLKc(uint8_t u8Level);
extern void BU91R65_Chip1_Set_SDc(uint8_t u8Level);

extern void BU91R65_Chip0_Set_nCSd(uint8_t u8Level);
extern void BU91R65_Chip0_Set_SCLKd(uint8_t u8Level);
extern void BU91R65_Chip0_Set_SDd(uint8_t u8Level);
extern void BU91R65_Chip1_Set_nCSd(uint8_t u8Level);
extern void BU91R65_Chip1_Set_SCLKd(uint8_t u8Level);
extern void BU91R65_Chip1_Set_SDd(uint8_t u8Level);
#endif /* BU98R10_PORTING_H__ */
