
#include <stddef.h>
// #include "RTE.h"
#include "BU91R65.h"
// #include "RTE_GPIO_R7F7016843.h"

BU91R65_Handler_st_t g_stBU91R65Chip0;
// uint8_t g_u8BU91R65Chip0Buffer[BU91R65_BUFFER_SIZE];
BU91R65DDRAMUnion g_stBU91R65Chip0Seg;

BU91R65_Handler_st_t g_stBU91R65Chip1;
// uint8_t g_u8BU91R65Chip1Buffer[BU91R65_BUFFER_SIZE];
BU91R65DDRAMUnion g_stBU91R65Chip1Seg;

BU91R65_Handler_st_t g_stBU91R65Chip2;
// uint8_t g_u8BU91R65Chip0Buffer[BU91R65_BUFFER_SIZE];
BU91R65DDRAMUnion g_stBU91R65Chip2Seg;

BU91R65_Handler_st_t g_stBU91R65Chip3;
// uint8_t g_u8BU91R65Chip1Buffer[BU91R65_BUFFER_SIZE];
BU91R65DDRAMUnion g_stBU91R65Chip3Seg;

BU91R65_Handler_st_t g_stBU91R65Chip4;
// uint8_t g_u8BU91R65Chip1Buffer[BU91R65_BUFFER_SIZE];
BU91R65DDRAMUnion g_stBU91R65Chip4Seg;

BU91R65_Handler_st_t g_stBU91R65Chip5;
// uint8_t g_u8BU91R65Chip1Buffer[BU91R65_BUFFER_SIZE];
BU91R65DDRAMUnion g_stBU91R65Chip5Seg;

BU91R65_Handler_st_t g_stBU91R65Chip6;
// uint8_t g_u8BU91R65Chip1Buffer[BU91R65_BUFFER_SIZE];
BU91R65DDRAMUnion g_stBU91R65Chip6Seg;

BU91R65_Handler_st_t g_stBU91R65Chip7;
// uint8_t g_u8BU91R65Chip1Buffer[BU91R65_BUFFER_SIZE];
BU91R65DDRAMUnion g_stBU91R65Chip7Seg;

BU91R65_Handler_st_t g_stBU91R65Chip8;
// uint8_t g_u8BU91R65Chip1Buffer[BU91R65_BUFFER_SIZE];
BU91R65DDRAMUnion g_stBU91R65Chip8Seg;

BU91R65_Handler_st_t g_stBU91R65Chip9;
// uint8_t g_u8BU91R65Chip1Buffer[BU91R65_BUFFER_SIZE];
BU91R65DDRAMUnion g_stBU91R65Chip9Seg;

// BU91R65_Handler_st_t g_stBU98R10Chip2;
// uint8_t g_u8BU98R10Chip2Buffer[BU91R65_BUFFER_SIZE];
// BU91R65DDRAMUnion g_stBU98R10Chip2Seg;

void BU91R65_Register(void)
{
    BU91R65_Config_st_t stConfig;

    /* Power on */
    //BU98R10_GPIO_Request(RTE_GPIO_PORT06_PIN02);/*不一定需要*/

    BU91R65_Init(1UL);//Trim到200-400khz

    stConfig.u8DefaultVal           = 0x00U;
    stConfig.u8FrameFreq            = BU98R10_FRAME_FREQ_120_0_Hz;
    stConfig.u16PinCS               = BU91R65_Chip0_Set_nCS;
    stConfig.u16PinSCLK             = BU91R65_Chip0_Set_SCLK;
    stConfig.u16PinSD               = BU91R65_Chip0_Set_SD;
    // stConfig.stColorSetting.u8SRR   = 7U;
    // stConfig.stColorSetting.u8SRF   = 0U;
    // stConfig.stColorSetting.u8SGR   = 7U;
    // stConfig.stColorSetting.u8SGF   = 0U;
    // stConfig.stColorSetting.u8SBR   = 7U;
    // stConfig.stColorSetting.u8SBF   = 0U;
    // stConfig.stColorSetting.u8LRS   = 0U;
    // stConfig.stColorSetting.u8LRW   = 47U;
    // stConfig.stColorSetting.u8LGS   = 0U;
    // stConfig.stColorSetting.u8LGW   = 47U;
    // stConfig.stColorSetting.u8LBS   = 0U;
    // stConfig.stColorSetting.u8LBW   = 47U;
    stConfig.pu8Buffer              = &g_stBU91R65Chip0Seg;
    
    BU91R65_Add(&g_stBU91R65Chip0, &stConfig);
    
    stConfig.u16PinCS               = BU91R65_Chip1_Set_nCS;
    stConfig.u16PinSCLK             = BU91R65_Chip1_Set_SCLK;
    stConfig.u16PinSD               = BU91R65_Chip1_Set_SD;
    stConfig.pu8Buffer              = &g_stBU91R65Chip1Seg;
    BU91R65_Add(&g_stBU91R65Chip1, &stConfig);



    stConfig.u8DefaultVal           = 0x00U;
    stConfig.u8FrameFreq            = BU98R10_FRAME_FREQ_120_0_Hz;
    stConfig.u16PinCS               = BU91R65_Chip0_Set_nCSb;
    stConfig.u16PinSCLK             = BU91R65_Chip0_Set_SCLKb;
    stConfig.u16PinSD               = BU91R65_Chip0_Set_SDb;
    stConfig.pu8Buffer              = &g_stBU91R65Chip2Seg;
    BU91R65_Add(&g_stBU91R65Chip2, &stConfig);

    stConfig.u16PinCS               = BU91R65_Chip1_Set_nCSb;
    stConfig.u16PinSCLK             = BU91R65_Chip1_Set_SCLKb;
    stConfig.u16PinSD               = BU91R65_Chip1_Set_SDb;
    stConfig.pu8Buffer              = &g_stBU91R65Chip3Seg;
    BU91R65_Add(&g_stBU91R65Chip3, &stConfig);


    
    stConfig.u8DefaultVal           = 0x00U;
    stConfig.u8FrameFreq            = BU98R10_FRAME_FREQ_120_0_Hz;
    stConfig.u16PinCS               = BU91R65_Chip0_Set_nCSa;
    stConfig.u16PinSCLK             = BU91R65_Chip0_Set_SCLKa;
    stConfig.u16PinSD               = BU91R65_Chip0_Set_SDa;
    stConfig.pu8Buffer              = &g_stBU91R65Chip4Seg;
    BU91R65_Add(&g_stBU91R65Chip4, &stConfig);

    stConfig.u16PinCS               = BU91R65_Chip1_Set_nCSa;
    stConfig.u16PinSCLK             = BU91R65_Chip1_Set_SCLKa;
    stConfig.u16PinSD               = BU91R65_Chip1_Set_SDa;
    stConfig.pu8Buffer              = &g_stBU91R65Chip5Seg;
    BU91R65_Add(&g_stBU91R65Chip5, &stConfig);



    stConfig.u8DefaultVal           = 0x00U;
    stConfig.u8FrameFreq            = BU98R10_FRAME_FREQ_120_0_Hz;
    stConfig.u16PinCS               = BU91R65_Chip0_Set_nCSc;
    stConfig.u16PinSCLK             = BU91R65_Chip0_Set_SCLKc;
    stConfig.u16PinSD               = BU91R65_Chip0_Set_SDc;
    stConfig.pu8Buffer              = &g_stBU91R65Chip6Seg;
    BU91R65_Add(&g_stBU91R65Chip6, &stConfig);

    stConfig.u16PinCS               = BU91R65_Chip1_Set_nCSc;
    stConfig.u16PinSCLK             = BU91R65_Chip1_Set_SCLKc;
    stConfig.u16PinSD               = BU91R65_Chip1_Set_SDc;
    stConfig.pu8Buffer              = &g_stBU91R65Chip7Seg;
    BU91R65_Add(&g_stBU91R65Chip7, &stConfig);


    stConfig.u8DefaultVal           = 0x00U;
    stConfig.u8FrameFreq            = BU98R10_FRAME_FREQ_120_0_Hz;
    stConfig.u16PinCS               = BU91R65_Chip0_Set_nCSd;
    stConfig.u16PinSCLK             = BU91R65_Chip0_Set_SCLKd;
    stConfig.u16PinSD               = BU91R65_Chip0_Set_SDd;
    stConfig.pu8Buffer              = &g_stBU91R65Chip8Seg;
    BU91R65_Add(&g_stBU91R65Chip8, &stConfig);

    stConfig.u16PinCS               = BU91R65_Chip1_Set_nCSd;
    stConfig.u16PinSCLK             = BU91R65_Chip1_Set_SCLKd;
    stConfig.u16PinSD               = BU91R65_Chip1_Set_SDd;
    stConfig.pu8Buffer              = &g_stBU91R65Chip9Seg;
    BU91R65_Add(&g_stBU91R65Chip9, &stConfig);

    // stConfig.u16PinCS               = RTE_GPIO_PORT11_PIN07;
    // stConfig.u16PinSCLK             = RTE_GPIO_PORT11_PIN04;
    // stConfig.u16PinSD               = RTE_GPIO_PORT10_PIN10;
    // stConfig.pu8Buffer              = &g_stBU98R10Chip2Seg;
    // BU91R65_Add(&g_stBU98R10Chip2, &stConfig);
}




