Commit 78caace0 authored by 戴荣's avatar 戴荣 🎨

feat:比亚乔检测台最终版

parent 68178d89
...@@ -58,6 +58,11 @@ ...@@ -58,6 +58,11 @@
"C_Cpp_Runner.msvcSecureNoWarnings": false, "C_Cpp_Runner.msvcSecureNoWarnings": false,
"files.associations": { "files.associations": {
"api_rs485.h": "c", "api_rs485.h": "c",
"tyw_stdint.h": "c" "tyw_stdint.h": "c",
"bu91r65_access.h": "c",
"gpio.h": "c",
"bu91r65.h": "c",
"bu91r65_user.h": "c",
"bu91r65_porting.h": "c"
} }
} }
\ No newline at end of file
...@@ -64,3 +64,8 @@ Key.h ...@@ -64,3 +64,8 @@ Key.h
app_lsdn.c app_lsdn.c
app_lsdn.h app_lsdn.h
BU91R65_User.c
BU91R65_User.h
SEG_Display.c
SEG_Display.h
\ No newline at end of file
...@@ -23,4 +23,9 @@ UART\UART.h ...@@ -23,4 +23,9 @@ UART\UART.h
.\GPIO\Simulated_8080.c .\GPIO\Simulated_8080.c
.\GPIO\TFT_LCD.c .\GPIO\TFT_LCD.c
.\GPIO\TM035HFZGZx.c .\GPIO\TM035HFZGZx.c
.\BU91R65\BU91R65.c
.\BU91R65\BU91R65.h
.\BU91R65\BU91R65_Access.c
.\BU91R65\BU91R65_Access.h
.\BU91R65\BU91R65_Porting.c
.\BU91R65\BU91R65_Porting.h
...@@ -31,6 +31,7 @@ primaryTarget=v800_standalone.tgt ...@@ -31,6 +31,7 @@ primaryTarget=v800_standalone.tgt
-I..\source\Driver\Analog_Signals -I..\source\Driver\Analog_Signals
-I..\source\Driver\CAN -I..\source\Driver\CAN
-I..\source\Driver\GPIO -I..\source\Driver\GPIO
-I..\source\Driver\BU91R65
-I..\source\System -I..\source\System
-I..\source\Appliciation -I..\source\Appliciation
-I..\source\FCL -I..\source\FCL
......
This diff is collapsed.
#ifndef _BU91R65_USER_H_
#define _BU91R65_USER_H_
#include "TYW_stdint.h"
#define BU91R65SEGMAX 160 /* 段码段码最大值 */
#define SEG_7_MAX 7
#define SEG_16_MAX 16
// #define BU91R65NUMBERMAX 7 /* 数字段数最大值 */
typedef enum
{
BU91R65_NUMBER_SEG_7 = 0,
BU91R65_NUMBER_SEG_16,
BU91R65_NUMBER_SEG_MAX,
} BU91R65_Number_SEG_en_t; /* 段码段 */
typedef enum
{
BU91R65_CHANNEL_1 = 0,
BU91R65_CHANNEL_2,
BU91R65_CHANNEL_MAX,
} BU91R65_Channel_en_t; /* 段码通道 */
typedef enum
{
BU91R65_COM_0 = 0,
BU91R65_COM_1,
BU91R65_COM_2,
BU91R65_COM_3,
BU91R65_COM_MAX,
} BU91R65_COM_en_t; /* 段码通道 */
typedef enum
{
BU91R65_Disable = 0,
BU91R65_Enable,
} BU91R65_Enable_en_t; /* 段码点亮等级 */
typedef enum
{
BU91R65DIS_NUMBLE_0 = 0,
BU91R65DIS_NUMBLE_1,
BU91R65DIS_NUMBLE_2,
BU91R65DIS_NUMBLE_3,
BU91R65DIS_NUMBLE_4,
BU91R65DIS_NUMBLE_5,
BU91R65DIS_NUMBLE_6,
BU91R65DIS_NUMBLE_7,
BU91R65DIS_NUMBLE_8,
BU91R65DIS_NUMBLE_9,
BU91R65DIS_ALPHABET_A,
BU91R65DIS_ALPHABET_B,
BU91R65DIS_ALPHABET_C,
BU91R65DIS_ALPHABET_D,
BU91R65DIS_ALPHABET_E,
BU91R65DIS_ALPHABET_F,
BU91R65DIS_ALPHABET_U,
BU91R65DIS_ALPHABET_P,
BU91R65DIS_ALPHABET_L,
BU91R65DIS_ALPHABET_H,
BU91R65DIS_NUMBLE_LINE,
BU91R65DIS_NUMBLE_NULL,
BU91R65DIS_MAX_7,
} BU91R65_Numble7_Mask_en_t; /* 段码掩码(7段适用) */
typedef enum
{
BU91R65DIS16_NUMBLE_0 = 0,
BU91R65DIS16_NUMBLE_1,
BU91R65DIS16_NUMBLE_2,
BU91R65DIS16_NUMBLE_3,
BU91R65DIS16_NUMBLE_4,
BU91R65DIS16_NUMBLE_5,
BU91R65DIS16_NUMBLE_6,
BU91R65DIS16_NUMBLE_7,
BU91R65DIS16_NUMBLE_8,
BU91R65DIS16_NUMBLE_9,
BU91R65DIS16_ALPHABET_A,
BU91R65DIS16_ALPHABET_B,
BU91R65DIS16_ALPHABET_C,
BU91R65DIS16_ALPHABET_D,
BU91R65DIS16_ALPHABET_E,
BU91R65DIS16_ALPHABET_F,
BU91R65DIS16_ALPHABET_G,
BU91R65DIS16_ALPHABET_H,
BU91R65DIS16_ALPHABET_I,
BU91R65DIS16_ALPHABET_J,
BU91R65DIS16_ALPHABET_K,
BU91R65DIS16_ALPHABET_L,
BU91R65DIS16_ALPHABET_M,
BU91R65DIS16_ALPHABET_N,
BU91R65DIS16_ALPHABET_O,
BU91R65DIS16_ALPHABET_P,
BU91R65DIS16_ALPHABET_Q,
BU91R65DIS16_ALPHABET_R,
BU91R65DIS16_ALPHABET_S,
BU91R65DIS16_ALPHABET_T,
BU91R65DIS16_ALPHABET_U,
BU91R65DIS16_ALPHABET_V,
BU91R65DIS16_ALPHABET_W,
BU91R65DIS16_ALPHABET_X,
BU91R65DIS16_ALPHABET_Y,
BU91R65DIS16_ALPHABET_Z,
BU91R65DIS16_NUMBLE_mul,//乘 x
BU91R65DIS16_NUMBLE_add,//加 +
BU91R65DIS16_NUMBLE_sub,//减 -
BU91R65DIS16_NUMBLE_exc,//除 /
BU91R65DIS16_NUMBLE_LMPar,//左中括号 [
BU91R65DIS16_NUMBLE_RMPar,//右中括号 ]
BU91R65DIS16_NUMBLE_LSPar,//左小括号 (
BU91R65DIS16_NUMBLE_RSPar,//右小括号 )
BU91R65DIS16_NUMBLE_equal,//等于 =
BU91R65DIS16_NUMBLE_degrees,//度 °
BU91R65DIS16_NUMBLE__, //下划线 _
BU91R65DIS16_NUMBLE_NULL,//空
BU91R65DIS16_MAX_16,
} BU91R65_Numble16_Mask_en_t; /* 段码掩码(16段适用) */
typedef struct
{
BU91R65_Channel_en_t enBU91R65Channel; /* 选择第几片段码 */
uint8_t u8BU91R65_COM; /* 需显示的COM */
uint8_t u8BU91R65_Seg; /* 需显示的SEG值 */
} BU91R65_USER_st_t;
/**
* @brief 设置段码显示数字或字母显示
* @param pBU91R65User 传入BU91R65_USER_st_t指针
* @param enBU91R65Value 需要显示的内容 数字或者字母详见BU91R65_Numble7_Mask_en_t BU91R65_Numble27_Mask_en_t BU91R65_Numble25_Mask_en_t BU91R65_Numble23_Mask_en_t
* @param enBU91R65SEGNum 需要显示的段码段数 详见 BU91R65_Number_SEG_en_t 以及示例图 若没有可以联系作者补上掩码
* @param Enable 是否点亮
* @return 0:正确 1 传入关闭等级错误 2 传入空指针 3 传入SEG错误或设置段码通道错误 或传入enBU91R65Value错误
*/
extern uint8_t BU91R65_Set_Numble(const BU91R65_USER_st_t* pBU91R65User, uint8_t enBU91R65Value, BU91R65_Number_SEG_en_t enBU91R65SEGNum, uint8_t Enable);
void Clear_All_BU91R65(void);
// void BU91R65_DSIP(void);
#define LIBERTY_STRING_LENTH 17
void Liberty_String_Display(const uint8_t f_blank_num, const uint8_t *dat);
void BU91R65_Clear_NUM_7(const BU91R65_USER_st_t* pBU91R65User);
void Liberty_String_Display_Init(void );
#endif
...@@ -4,6 +4,40 @@ ...@@ -4,6 +4,40 @@
#include "TYW_stdint.h" #include "TYW_stdint.h"
#include "GPIO.h" #include "GPIO.h"
#define LCD_CSB1 GPIO_OUT_PORT08_PIN07
#define LCD_CSB2 GPIO_OUT_PORT10_PIN01
#define LCD_CSB1_DIR GPIO_DIR_PORT08_PIN07
#define LCD_CSB2_DIR GPIO_DIR_PORT10_PIN01
#define LCD_SCK1 GPIO_OUT_PORT10_PIN11
#define LCD_SCK2 GPIO_OUT_PORT10_PIN00
#define LCD_SCK1_DIR GPIO_DIR_PORT10_PIN11
#define LCD_SCK2_DIR GPIO_DIR_PORT10_PIN00
#define LCD_SDI1_OUT GPIO_OUT_PORT10_PIN09
#define LCD_SDI1_INPUT GPIO_IN_PORT10_PIN09
#define LCD_SDI1_DIR GPIO_DIR_PORT10_PIN09
#define LCD_SDI2_OUT GPIO_OUT_PORT08_PIN09
#define LCD_SDI2_INPUT GPIO_IN_PORT08_PIN09
#define LCD_SDI2_DIR GPIO_DIR_PORT08_PIN09
#define LCD_SDO1_OUT GPIO_OUT_PORT10_PIN10
#define LCD_SDO1_INPUT GPIO_IN_PORT10_PIN10
#define LCD_SDO1_DIR GPIO_DIR_PORT10_PIN10
#define LCD_SDO2_OUT GPIO_OUT_PORT08_PIN10
#define LCD_SDO2_INPUT GPIO_IN_PORT08_PIN10
#define LCD_SDO2_DIR GPIO_DIR_PORT08_PIN10
#define LCD_ERROUT1_OUT GPIO_OUT_PORT08_PIN08
#define LCD_ERROUT1_INPUT GPIO_IN_PORT08_PIN08
#define LCD_ERROUT1_DIR GPIO_DIR_PORT08_PIN08
#define LCD_ERROUT2_OUT GPIO_OUT_PORT11_PIN02
#define LCD_ERROUT2_INPUT GPIO_IN_PORT11_PIN02
#define LCD_ERROUT2_DIR GPIO_DIR_PORT11_PIN02
#define LCD_INHB_DIR GPIO_DIR_PORT11_PIN03
#define LCD_INHB_INPUT GPIO_IN_PORT11_PIN03
#define LCD_INHB_OUT GPIO_OUT_PORT11_PIN03
#define LINE_OUT_NEG_09 GPIO_OUT_PORT10_PIN04 //485_RE #define LINE_OUT_NEG_09 GPIO_OUT_PORT10_PIN04 //485_RE
......
#include "SEG_Display.h"
#include "BU91R65.h"
#define MODULE_DISPLAY_ON 1U
#define MODULE_DISPLAY_OFF 0U
SEGDiaplay_Control_Struct g_stSEGDisplay_Control;
void Check_SEG_Display(void)
{
static uint8_t display_state = 0;
if (g_stSEGDisplay_Control.u16SEGDisplay_Count++ >= 10u)
{
g_stSEGDisplay_Control.u16SEGDisplay_Count = 0u;
switch (display_state)
{
case 0: // 偶数
for (uint8_t i = 0; i < BU91R65_BUFFER_SIZE; i++)
{
BU91R65_Write_Buffer(BU91R65_CHIP0, i, 0x0F);
BU91R65_Write_Buffer(BU91R65_CHIP1, i, 0x0F);
}
for (uint8_t i = 0; i < BU91R65_BUFFER_SIZE; i++)
{
BU91R65_Write_Buffer(BU91R65_CHIP0, i, 0xF0);
BU91R65_Write_Buffer(BU91R65_CHIP1, i, 0xF0);
}
break;
case 1: // 奇数
for (uint8_t i = 0; i < BU91R65_BUFFER_SIZE; i++)
{
BU91R65_Write_Buffer(BU91R65_CHIP0, i, 0xF0);
BU91R65_Write_Buffer(BU91R65_CHIP1, i, 0xF0);
}
for (uint8_t i = 0; i < BU91R65_BUFFER_SIZE; i++)
{
BU91R65_Write_Buffer(BU91R65_CHIP0, i, 0x0F);
BU91R65_Write_Buffer(BU91R65_CHIP1, i, 0x0F);
}
break;
case 2: // 全亮
for (uint8_t i = 0; i < BU91R65_BUFFER_SIZE; i++)
{
BU91R65_Write_Buffer(BU91R65_CHIP0, i, 0xFF);
BU91R65_Write_Buffer(BU91R65_CHIP1, i, 0xFF);
}
break;
default:
for (uint8_t i = 0; i < BU91R65_BUFFER_SIZE; i++)
{
BU91R65_Write_Buffer(BU91R65_CHIP0, i, 0x00);
BU91R65_Write_Buffer(BU91R65_CHIP1, i, 0x00);
}
}
CHIP2_SEG(0, 99) = 0u;
CHIP2_SEG(1, 99) = 0u;
CHIP2_SEG(0, 100) = 0u;
CHIP2_SEG(1, 100) = 0u;
CHIP2_SEG(0, 102) = 0u;
CHIP2_SEG(1, 102) = 0u;
CHIP2_SEG(1, 103) = 0u;
CHIP2_SEG(0, 103) = 0u;
CHIP2_SEG(1, 104) = 0u;
CHIP2_SEG(0, 101) = 0u;
CHIP2_SEG(1, 101) = 0u;
CHIP2_SEG(0, 105) = 0u;
CHIP2_SEG(1, 105) = 0u;
CHIP2_SEG(0, 106) = 0u;
CHIP2_SEG(1, 106) = 0u;
CHIP2_SEG(0, 107) = 0u;
CHIP2_SEG(1, 107) = 0u;
CHIP2_SEG(0, 104) = 0u;
CHIP2_SEG(1, 108) = 0u;
CHIP2_SEG(0, 108) = 0u;
CHIP2_SEG(0, 109) = 0u;
CHIP2_SEG(0, 110) = 0u;
CHIP2_SEG(1, 110) = 0u;
CHIP2_SEG(1, 111) = 0u;
CHIP2_SEG(0, 111) = 0u;
CHIP2_SEG(1, 112) = 0u;
CHIP2_SEG(0, 112) = 0u;
CHIP2_SEG(1, 113) = 0u;
CHIP2_SEG(0, 113) = 0u;
CHIP2_SEG(1, 114) = 0u;
CHIP2_SEG(0, 114) = 0u;
CHIP2_SEG(1, 57) = 0u;
CHIP2_SEG(0, 115) = 0u;
CHIP2_SEG(0, 116) = 0u;
CHIP2_SEG(1, 136) = 0u;
display_state = (display_state + 1) % 3;
}
}
#ifndef _SEG_DISPLAY_H_
#define _SEG_DISPLAY_H_
#include "TYW_stdint.h"
#include "BU91R65_User.h"
typedef struct
{
uint8_t u8SelfCheck_Status;
uint16_t u16SelfCheck_Count;
}SelfCheck_Control_Struct;
typedef struct
{
uint8_t u8SEGDisplay_Status;
uint16_t u16SEGDisplay_Count;
}SEGDiaplay_Control_Struct;
typedef struct
{
uint8_t SEGReset_Status;
uint16_t SEGReset_Count;//控制时间
}SEGReset_Control_Struct;
#define IC_SEG_OFF 0u
#define IC_SEG_ON 1u
// #define IC_SEG_GREY 0x01u
extern const BU91R65_USER_st_t HEATGRIPNUM[];
void Check_SEG_Display(void);
#endif
\ No newline at end of file
...@@ -20,6 +20,12 @@ ...@@ -20,6 +20,12 @@
#include "string.h" #include "string.h"
#include "api_RS485.h" #include "api_RS485.h"
#include "R485_Communication_Matrix.h" #include "R485_Communication_Matrix.h"
#include "SEG_Display.h"
#include "BU91R65_Access.h"
#include "BU91R65.h"
#include "BU91R65_Porting.h"
#include "BU91R65_User.h"
/******************************************************************************* /*******************************************************************************
* * * *
* ϵͳ��������ģʽ(SYS_MODE_OFF / SYS_MODE_ON / SYS_MODE_STANDBY )�����б� * * ϵͳ��������ģʽ(SYS_MODE_OFF / SYS_MODE_ON / SYS_MODE_STANDBY )�����б� *
...@@ -46,7 +52,7 @@ void Sys_Run_Mode_Pseudo_Real_Time_Tasks(void) ...@@ -46,7 +52,7 @@ void Sys_Run_Mode_Pseudo_Real_Time_Tasks(void)
{ {
UDS_Server_Application_Service( ); UDS_Server_Application_Service( );
} }
BU91R65_Communication_Service();
TFT_LCD_Display_Update_Service( ); TFT_LCD_Display_Update_Service( );
Fre_In_Service(FRE_VEHICLE); Fre_In_Service(FRE_VEHICLE);
//Fre_In_Service(FRE_ENGINE); //Fre_In_Service(FRE_ENGINE);
...@@ -235,7 +241,7 @@ void Sys_Run_Mode_20ms_Tasks_Group0(void) ...@@ -235,7 +241,7 @@ void Sys_Run_Mode_20ms_Tasks_Group0(void)
// uint8_t data[8] = {0}; // uint8_t data[8] = {0};
// uint32_t SpdN = 0; // uint32_t SpdN = 0;
// _CAN_Msg canMag; // _CAN_Msg canMag;
BU91R65_Refresh_Service();
// //Total_Check( ); // //Total_Check( );
// canMag.MsgID = 0x8FFF00B; // canMag.MsgID = 0x8FFF00B;
// FT_VehSpeedCalc_Main(FT_CurVehSpeed, &SpdN, SPEED_TO_CANMESSAGE); // FT_VehSpeedCalc_Main(FT_CurVehSpeed, &SpdN, SPEED_TO_CANMESSAGE);
...@@ -274,8 +280,6 @@ void Sys_Run_Mode_50ms_Tasks_Group(void) ...@@ -274,8 +280,6 @@ void Sys_Run_Mode_50ms_Tasks_Group(void)
timerms++; timerms++;
} }
// if ( timer_100ms >= 500 ) // if ( timer_100ms >= 500 )
// { // {
// if(powerstu == 0) // if(powerstu == 0)
...@@ -336,7 +340,7 @@ void Sys_Run_Mode_100ms_Tasks_Group(void) ...@@ -336,7 +340,7 @@ void Sys_Run_Mode_100ms_Tasks_Group(void)
// Recv_Byte1(); // Recv_Byte1();
// } // }
Display_PageNum(); Display_PageNum();
Check_SEG_Display();
if(CHECK_Ctrl_delay < 200) if(CHECK_Ctrl_delay < 200)
{ {
......
#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_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.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);
}
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
#ifndef BU91R65_ACCESS_H__
#define BU91R65_ACCESS_H__
#include "BU91R65_Porting.h"
#define BU91R65_BUFFER_SIZE (80U) /**< Buffer size = 90 (90 * 2 = 180 SEGs) */
/** @struct BU98R10_Reg_Val_st_t
* @brief BU98R10寄存器数据存储结构 \n
* 存储BU98R10配置相关的寄存器数值
*/
// typedef struct
// {
// uint8_t u8Freq;
// uint8_t u8SegR;
// uint8_t u8SegG;
// uint8_t u8SegB;
// uint8_t u8LRS;
// uint8_t u8LGS;
// uint8_t u8LBS;
// uint8_t u8LRW;
// uint8_t u8LGW;
// uint8_t u8LBW;
// uint8_t u8Rsvd[2];
// }BU98R10_Reg_Val_st_t;
typedef struct stBU98R10Handler
{
uint8_t u8Step;/*目前只有一步,应该可以不要了*/
uint8_t u8Counter;
uint8_t u8Freq;
BU91R65_Pin_Map_st_t stPinMap;
uint8_t u8BkupBuffer[BU91R65_BUFFER_SIZE];
uint8_t *pu8UserBuffer;
// BU98R10_Reg_Val_st_t stRegVal; /**< 寄存器设置值 */
struct stBU98R10Handler *pstNext;
}BU91R65_Handler_st_t;
/** @struct BU98R10_Color_Setting_st_t
* @brief BU98R10 color setting parameters,please refer to the data sheet for details
*/
// typedef struct
// {
// uint8_t u8SRR;
// uint8_t u8SRF;
// uint8_t u8SGR;
// uint8_t u8SGF;
// uint8_t u8SBR;
// uint8_t u8SBF;
// uint8_t u8LRS;
// uint8_t u8LRW;
// uint8_t u8LGS;
// uint8_t u8LGW;
// uint8_t u8LBS;
// uint8_t u8LBW;
// }BU98R10_Color_Setting_st_t;
// 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
{
uint8_t u8DefaultVal; /**< Default value 0 ~ 7 */
uint8_t u8FrameFreq; /**< Frame frequency */
pfunBU91R65_Set_nCS u16PinCS; /**< Number of CSB pin */
pfunBU91R65_Set_SCLK u16PinSCLK; /**< Number of SCL pin */
pfunBU91R65_Set_SD u16PinSD; /**< Number of SD pin */
// BU98R10_Color_Setting_st_t stColorSetting; /**< Color setting */
uint8_t u16Rsvd[3];
uint8_t *pu8Buffer; /**< Data buffer */
}BU91R65_Config_st_t;
#define BU98R10_FRAME_FREQ_50_0_Hz (0x00U) /**< Frame frequency = 50.0Hz */
#define BU98R10_FRAME_FREQ_60_0_Hz (0x01U) /**< Frame frequency = 60.0Hz */
#define BU98R10_FRAME_FREQ_69_3_Hz (0x02U) /**< Frame frequency = 69.3Hz */
#define BU98R10_FRAME_FREQ_75_0_Hz (0x03U) /**< Frame frequency = 75.0Hz */
#define BU98R10_FRAME_FREQ_81_8_Hz (0x04U) /**< Frame frequency = 81.8Hz */
#define BU98R10_FRAME_FREQ_90_0_Hz (0x05U) /**< Frame frequency = 90.0Hz */
#define BU98R10_FRAME_FREQ_100_0_Hz (0x06U) /**< Frame frequency = 100.0Hz */
#define BU98R10_FRAME_FREQ_112_5_Hz (0x07U) /**< Frame frequency = 112.5Hz */
#define BU98R10_FRAME_FREQ_120_0_Hz (0x08U) /**< Frame frequency = 120.0Hz */
#define BU98R10_FRAME_FREQ_128_6_Hz (0x09U) /**< Frame frequency = 128.6Hz */
#define BU98R10_FRAME_FREQ_138_5_Hz (0x0AU) /**< Frame frequency = 138.5Hz */
#define BU98R10_FRAME_FREQ_150_0_Hz (0x0BU) /**< Frame frequency = 150.0Hz */
#define BU98R10_FRAME_FREQ_163_6_Hz (0x0CU) /**< Frame frequency = 163.6Hz */
#define BU98R10_FRAME_FREQ_180_0_Hz (0x0EU) /**< Frame frequency = 180.0Hz */
#define BU98R10_FRAME_FREQ_200_0_Hz (0x0FU) /**< Frame frequency = 200.0Hz */
#define BU98R10_STATUS_RUN (0x01U) /**< Running flag */
/******************************************************************************
STARTUP PROCEDURE
1. Call BU91R65_Init() to create a runtime environment.
2. Use BU91R65_Add() to register chips,
all chips on the segment screen need to be registered one by one.
3. When the chip is registered, its bus will be idle.
Delay a few ms to wait for the chip to be ready to work.
(During this time, initialization for other devices can be performed)
4. Call BU98R10_Setup() to initialize all chips.
If Open/Short detection is enabled, go to step 5,
otherwise go to step 6 directly.
5. Open/Short detection takes some time,
please delay for a while to wait for the detection to complete.
Typically, waiting 600 ms is reliable. Or at least
(1000*u8ShortChkPulse)+(2*u8OpenChkPulse) when startup timing is tight.
(During this time, initialization for other devices can be performed)
6. Call BU98R10_Display_On(), all chips start to display.
******************************************************************************/
/******************************************************************************
SHUTDOWN PROCEDURE
1. Remove all chips from the registration list by calling BU91R65_Del().
2. Call BU91R65_DeInit() to clear runtime environment.
******************************************************************************/
extern void BU91R65_Init(uint32_t u32SpeedTrim);
extern void BU91R65_DeInit(void);
extern int32_t BU91R65_Add(BU91R65_Handler_st_t *pHandler, BU91R65_Config_st_t *pstCfg);
extern int32_t BU91R65_Del(BU91R65_Handler_st_t *pHandler);
extern void BU91R65_Refresh_Service(void);
extern void BU91R65_Communication_Service(void);
extern int32_t BU91R65_Write_Buffer(BU91R65_Handler_st_t *pHandler, uint8_t u8Index, uint8_t u8Val);
extern int32_t BU91R65_Write_SEG(BU91R65_Handler_st_t *pHandler, uint8_t u8Index, uint8_t u8Val);
#endif /* BU98R10_ACCESS_H__ */
#include <stddef.h>
// #include "RTE.h"
#include "BU91R65_Porting.h"
#include "RTE_GPIO.h"
int32_t BU91R65_GPIO_Init(BU91R65_Pin_Map_st_t *pstPinMap)
{
int32_t i32Result;
i32Result = -1;
if (pstPinMap != NULL)
{
i32Result = 0;
/* CSB = 1 */
// if (i32Result == 0)
// {
// RTE_GPIO_Set_GPIO_Mode(pstPinMap->u16PinCS);
// RTE_GPIO_Set_Direction(pstPinMap->u16PinCS, RTE_GPIO_DIR_OUT);
// RTE_GPIO_Set_Level(pstPinMap->u16PinCS, GPIO_Level_High);
BU91R65_CHIP0_CSB = GPIO_Level_High;
BU91R65_CHIP1_CSB = GPIO_Level_High;
// }
/* SCLK = 1 */
// if (i32Result == 0)
// {
// RTE_GPIO_Set_GPIO_Mode(pstPinMap->u16PinSCLK);
// RTE_GPIO_Set_Direction(pstPinMap->u16PinSCLK, RTE_GPIO_DIR_OUT);
// RTE_GPIO_Set_Level(pstPinMap->u16PinSCLK, GPIO_Level_Low);
BU91R65_CHIP0_SCL = GPIO_Level_High;
BU91R65_CHIP1_SCL = GPIO_Level_High;
// }
/* SD = 0 */
// if (i32Result == 0)/*Note: SD = 1*/
// {
// RTE_GPIO_Set_GPIO_Mode(pstPinMap->u16PinSD);
// RTE_GPIO_Set_Direction(pstPinMap->u16PinSD, RTE_GPIO_DIR_OUT);
// RTE_GPIO_Set_Level(pstPinMap->u16PinSD, GPIO_Level_Low);
BU91R65_CHIP0_SD = GPIO_Level_Low;
BU91R65_CHIP1_SD = GPIO_Level_Low;
// }
}
return i32Result;
}
void BU91R65_Chip0_Set_nCS(uint8_t u8Level)
{
BU91R65_CHIP0_CSB = u8Level;
}
void BU91R65_Chip0_Set_SCLK(uint8_t u8Level)
{
BU91R65_CHIP0_SCL = u8Level;
}
void BU91R65_Chip0_Set_SD(uint8_t u8Level)
{
BU91R65_CHIP0_SD = u8Level;
}
void BU91R65_Chip1_Set_nCS(uint8_t u8Level)
{
BU91R65_CHIP1_CSB = u8Level;
}
void BU91R65_Chip1_Set_SCLK(uint8_t u8Level)
{
BU91R65_CHIP1_SCL = u8Level;
}
void BU91R65_Chip1_Set_SD(uint8_t u8Level)
{
BU91R65_CHIP1_SD = u8Level;
}
#ifndef BU91R65_PORTING_H__
#define BU91R65_PORTING_H__
#include "TYW_stdint.h"
#include "GPIO.h"
#define BU91R65_CHIP0_SD LCD_SDI1_OUT
#define BU91R65_CHIP0_CSB LCD_CSB1
#define BU91R65_CHIP0_SCL LCD_SCK1
#define BU91R65_CHIP1_SD LCD_SDI2_OUT
#define BU91R65_CHIP1_CSB LCD_CSB2
#define BU91R65_CHIP1_SCL LCD_SCK2
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);
#endif /* BU98R10_PORTING_H__ */
...@@ -41,47 +41,45 @@ const uint16_t g_u16GPIOConfigArray[56U][2U] = ...@@ -41,47 +41,45 @@ const uint16_t g_u16GPIOConfigArray[56U][2U] =
{0x0000u, 0x0000u}, {0x0000u, 0x0000u},
{0x0000u, 0x0000u}, {0x0000u, 0x0000u},
{0x0000u, 0x0000u}, {0x0000u, 0x0000u},
{0x000Cu, 0x0000u},
{0x0020u, 0x0000u},
{0x0620u, 0x0600u},
{0x0000u, 0x0000u}, {0x0000u, 0x0000u},
{0x0000u, 0x0000u}, {0x0000u, 0x0000u},
{0x063Cu, 0x0630u}, {0x0600u, 0x0600u},
{0x1A6Bu, 0x1A6Fu},
{0x79C3u, 0x79CFu},
{0x0000u, 0x0000u}, {0x0000u, 0x0000u},
{0x0008u, 0x0080u},
{0x0600u, 0x0600u},
{0x0200u, 0x0208u},
{0x79FFu, 0x79FFu},
{0x0000u, 0x0000u}, {0x0000u, 0x0000u},
{0x0000u, 0x0000u}, {0x0000u, 0x0000u},
{0x0000u, 0x0000u}, {0x0000u, 0x0000u},
{0x0000u, 0x0000u}, {0x0000u, 0x0000u},
{0x0000u, 0x0008u},
{0x0000u, 0x0000u}, {0x0000u, 0x0000u},
{0x0000u, 0x0003u},
{0x0000u, 0x0008u},
{0x0108u, 0x0308u},
{0x1FFFu, 0x1FF7u},
{0x0000u, 0x0000u}, {0x0000u, 0x0000u},
{0x0000u, 0x0000u}, {0x0000u, 0x0000u},
{0x0000u, 0x0000u}, {0x0000u, 0x0000u},
{0x1FFFu, 0x1FFFu},
{0x0000u, 0x0000u}, {0x0000u, 0x0000u},
{0x0000u, 0x0000u}, {0x0000u, 0x0000u},
{0x0000u, 0x0000u}, {0x0000u, 0x0000u},
{0x0000u, 0x0000u}, {0x0000u, 0x0000u},
{0x0000u, 0x0000u}, {0x0000u, 0x0000u},
{0x0000u, 0x0000u}, {0x0003u, 0x0003u},
{0x0002u, 0x0000u},
{0x0000u, 0x0000u},
{0x0001u, 0x0001u},
{0x007Fu, 0x007Fu}, {0x007Fu, 0x007Fu},
{0x0000u, 0x0000u}, {0x0000u, 0x0000u},
{0x0000u, 0x0000u}, {0x0000u, 0x0000u},
{0x0000u, 0x0000u}, {0x0000u, 0x0000u},
{0x1800u, 0x1000u}, {0x3000u, 0x0000u},
{0x0000u, 0x0800u}, {0x3000u, 0x0000u},
{0x0000u, 0x0800u},
{0x0000u, 0x0000u}, {0x0000u, 0x0000u},
{0x0002u, 0x0200u},
{0x1800u, 0x1800u},
{0x0A60u, 0x0A60u},
{0xE7FFu, 0xE7FFu},
{0x0000u, 0x0000u}, {0x0000u, 0x0000u},
{0x8000u, 0x000Cu},
{0x3000u, 0x0000u},
{0x0000u, 0x0000u}, {0x0000u, 0x0000u},
{0xCFFFu, 0xFFFFu},
{0x0000u, 0x0000u}, {0x0000u, 0x0000u},
{0x0000u, 0x0000u}, {0x0000u, 0x0000u},
{0x0000u, 0x0000u}, {0x0000u, 0x0000u},
...@@ -89,10 +87,12 @@ const uint16_t g_u16GPIOConfigArray[56U][2U] = ...@@ -89,10 +87,12 @@ const uint16_t g_u16GPIOConfigArray[56U][2U] =
{0x0000u, 0x0000u}, {0x0000u, 0x0000u},
{0x0000u, 0x0000u}, {0x0000u, 0x0000u},
{0x0000u, 0x0000u}, {0x0000u, 0x0000u},
{0x0089u, 0x0080u},
{0x0000u, 0x0000u}, {0x0000u, 0x0000u},
{0x0004u, 0x000Du},
{0x00FFu, 0x00FFu}, {0x00FFu, 0x00FFu},
{0x0200u, 0x0000u}, {0xB000u, 0x0000u},
{0xC07Fu, 0xC07Fu}, {0x023Fu, 0x023Fu},
{0xFFFFu, 0xFFFFu}, {0xFFFFu, 0xFFFFu},
}; };
static void GPIO_PIN_Init(GPIO_Config_Mode_en_t enGPIOConfigMode) static void GPIO_PIN_Init(GPIO_Config_Mode_en_t enGPIOConfigMode)
......
...@@ -39,6 +39,7 @@ ...@@ -39,6 +39,7 @@
#include "Display_Info.h" #include "Display_Info.h"
#include "FreIn_User.h" #include "FreIn_User.h"
#include "../UART/UART.h" #include "../UART/UART.h"
#include "BU91R65.h"
/* Private typedef -----------------------------------------------------------*/ /* Private typedef -----------------------------------------------------------*/
/* Private define ------------------------------------------------------------*/ /* Private define ------------------------------------------------------------*/
/* Private macro -------------------------------------------------------------*/ /* Private macro -------------------------------------------------------------*/
...@@ -111,6 +112,8 @@ void Sys_Startup_Init(void) ...@@ -111,6 +112,8 @@ void Sys_Startup_Init(void)
loc_config.pfnUARTConfirmCallBack = 0; loc_config.pfnUARTConfirmCallBack = 0;
loc_config.pfnUARTErrHandleCallBack = 0; loc_config.pfnUARTErrHandleCallBack = 0;
loc_config.pfnUARTReadMsgCallBack = UART_Put1; loc_config.pfnUARTReadMsgCallBack = UART_Put1;
BU91R65_Register();
// UART_Init(UART_RLIN31, &loc_config); // UART_Init(UART_RLIN31, &loc_config);
// Auto_ONOFF = 1; // Auto_ONOFF = 1;
// AutoFlag = 1; // AutoFlag = 1;
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment