Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
H
HaoJin232
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
时昊
HaoJin232
Commits
ef86c91d
Commit
ef86c91d
authored
Feb 06, 2024
by
高士达
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'gaoshida' into 'dev'
✨
feat:增加BU98驱动,待调式 See merge request
!3
parents
84a8436b
6f94cc8b
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
1359 additions
and
1647 deletions
+1359
-1647
RTE_Components.h
HJ232_Source/RTE/_BAT32G239/RTE_Components.h
+1
-1
BU98R10.H
HJ232_Source/source/Driver/inc/BU98R10.H
+452
-506
BU98R10.C
HJ232_Source/source/Driver/src/BU98R10.C
+906
-1140
No files found.
HJ232_Source/RTE/_BAT32G239/RTE_Components.h
View file @
ef86c91d
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
* Auto generated Run-Time-Environment Configuration File
* Auto generated Run-Time-Environment Configuration File
* *** Do not modify ! ***
* *** Do not modify ! ***
*
*
*
*
Project: 'tim4DelayCounter'
* Target: 'BAT32G239'
* Target: 'BAT32G239'
*/
*/
...
...
HJ232_Source/source/Driver/inc/BU98R10.H
View file @
ef86c91d
/******************************************************************************
�� �� ����BU98R10.c
����������BU98R10����Һ�����������������ͷ�ļ�
�� �ߣ�����
�� ����V1.0
�� �ڣ�2017.4.28
******************************************************************************/
#ifndef _BU98R10_H_
#ifndef _BU98R10_H_
#define _BU98R10_H_
#define _BU98R10_H_
...
@@ -13,112 +6,80 @@
...
@@ -13,112 +6,80 @@
#include "System_Monitor.h"
#include "System_Monitor.h"
/******************************************************************************
BU98R10 оƬɫ�ʵ��ڲ���
******************************************************************************/
#define USE_NEW_COLORFUL_STRATEGY 1
#define LIGHT_LEVEL 4//0
#if(LIGHT_LEVEL == 0)
#define R_LEVEL 63 //must <= 63
#define G_LEVEL 50 //must <= 63
#define B_LEVEL 20 //must <= 63
#elif(LIGHT_LEVEL == 1)
#define R_LEVEL 63 //must <= 63
#define G_LEVEL 47 //must <= 63
#define B_LEVEL 27 //must <= 63
#elif(LIGHT_LEVEL == 2)
#define R_LEVEL 63 //must <= 63
#define G_LEVEL 55 //must <= 63
#define B_LEVEL 31 //must <= 63
#elif(LIGHT_LEVEL == 3)
#define R_LEVEL 63 //must <= 63
#define G_LEVEL 55 //must <= 63
#define B_LEVEL 39 //must <= 63
#elif(LIGHT_LEVEL == 4)
#define R_LEVEL 60 //must <= 63
#define G_LEVEL 60 //must <= 63
#define B_LEVEL 10 //must <= 63
#endif
/******************************************************************************
BU98R10 оƬ0����
******************************************************************************/
/*** оƬʹ�� ***/
#define USE_BU98R10_CHIP_0 1
/*** ������������ ***/
#define USE_BU98R10_CHIP_0 1
//#define BU98R10_0_SD SEG_LCD_SD
//#ifndef BU98R10_0_SD
//#define BU98R10_0_SD PIN_9_P
//#define SEG_LCD_SD_Dir0 PIN_9_D
//
//#endif
//
//
//#ifndef BU98R10_0_SCL
//#define BU98R10_0_SCL PIN_10_P
//#endif
//
//
//#ifndef BU98R10_0_CSB
//#define BU98R10_0_CSB PIN_11_P
//#endif
/*** ����ʱ������ ***/
//#define BU98R10_0_SCL SEG_LCD_SCL
#define USE_BU98R10_CHIP_1 1
/*** оƬѡ������ ***/
//#define BU98R10_0_CSB SEG_LCD_CSB
/******************************************************************************
///#ifndef BU98R10_1_SD
BU98R10 оƬ1����
///#define BU98R10_1_SD PIN_16_P
******************************************************************************/
///#define SEG_LCD_SD_Dir1 PIN_16_D
/*** оƬʹ�� ***/
///#endif
#define USE_BU98R10_CHIP_1 1
///
///
///#ifndef BU98R10_1_SCL
///#define BU98R10_1_SCL PIN_17_P
///#endif
///
///
///#ifndef BU98R10_1_CSB
///#define BU98R10_1_CSB PIN_18_P
///#endif
/*** ������������ ***/
#ifndef BU98R10_1_SD
//#define BU98R10_1_SD SEG_LCD_SD1
#endif
/*** ����ʱ������ ***/
#define BU98R10_SD_SCL_MULTIPLEX 0 //0 - ?????? 1 - ????
#ifndef BU98R10_1_SCL
//#define BU98R10_1_SCL SEG_LCD_SCL1
#endif
/*** оƬѡ������ ***/
#ifndef BU98R10_1_CSB
//#define BU98R10_1_CSB SEG_LCD_CSB1
#endif
/******************************************************************************
BU98R10 ��оƬʱ��/�����߸�������
******************************************************************************/
#define BU98R10_SD_SCL_MULTIPLEX 0 //0 - ������ 1 - ����
/******************************************************************************
#define BU98R10_COLORFUL_LCD_MODE 1 //0 - ????? 1 - ?????
BU98R10 оƬ��������
******************************************************************************/
/***�������� ***/
#define BU98R10_COLORFUL_LCD_MODE 1 //0 - ��ɫģʽ 1 - ��ɫģʽ
#define BU98R10_FRAME_FREQ BU98R10_FRAME_FREQ_120_0_Hz //BU98R10_FRAME_FREQ_180_0_Hz
#define BU98R10_FRAME_FREQ BU98R10_FRAME_FREQ_120_0_Hz //BU98R10_FRAME_FREQ_180_0_Hz
#define BU98R10_DEFAULT_SEG 0 //����Ĭ��״̬�¶�Ӧ������
#define BU98R10_DEFAULT_SEG 0 //???????????????????
/***ɫ������(����ɫģʽ����Ч) ***/
#define BU98R10_SRR 7
#define BU98R10_SRR 10
#define BU98R10_SRF 0
#define BU98R10_SRF 0
#define BU98R10_SGR
10
#define BU98R10_SGR
7
#define BU98R10_SGF 0
#define BU98R10_SGF 0
#define BU98R10_SBR
10
#define BU98R10_SBR
7
#define BU98R10_SBF 0
#define BU98R10_SBF 0
#define BU98R10_LRS 0x3f// 0x3f
#define BU98R10_LRS 0
#define BU98R10_LRW 0 //0 //63
#define BU98R10_LRW 47 //63
#define BU98R10_LGS 0x3f//0x3f //57
#define BU98R10_LGS 0 //57
#define BU98R10_LGW 0//0 //6
#define BU98R10_LGW 47 //6
#define BU98R10_LBS 0x3f//0x3f //23
#define BU98R10_LBS 0 //23
#define BU98R10_LBW 0//0 //40
#define BU98R10_LBW 47 //40
/******************************************************************************
BU98R10 ֡ˢ��Ƶ�ʱ�
******************************************************************************/
#define BU98R10_FRAME_FREQ_50_0_Hz 0x00
#define BU98R10_FRAME_FREQ_50_0_Hz 0x00
#define BU98R10_FRAME_FREQ_60_0_Hz 0x01
#define BU98R10_FRAME_FREQ_60_0_Hz 0x01
#define BU98R10_FRAME_FREQ_69_3_Hz 0x02
#define BU98R10_FRAME_FREQ_69_3_Hz 0x02
...
@@ -135,35 +96,29 @@ BU98R10 ֡ˢ��Ƶ�ʱ�
...
@@ -135,35 +96,29 @@ BU98R10 ֡ˢ��Ƶ�ʱ�
#define BU98R10_FRAME_FREQ_180_0_Hz 0x0E
#define BU98R10_FRAME_FREQ_180_0_Hz 0x0E
#define BU98R10_FRAME_FREQ_200_0_Hz 0x0F
#define BU98R10_FRAME_FREQ_200_0_Hz 0x0F
/******************************************************************************
BU98R10 ��оƬͬʱд��Ԥ����
******************************************************************************/
#if ((USE_BU98R10_CHIP_0) && (USE_BU98R10_CHIP_1) && (BU98R10_SD_SCL_MULTIPLEX == 0))
#if ((USE_BU98R10_CHIP_0) && (USE_BU98R10_CHIP_1) && (BU98R10_SD_SCL_MULTIPLEX == 0))
#define BU98R10_WRITE_AT_SAME_TIME 1
#define BU98R10_WRITE_AT_SAME_TIME 1
#else
#else
#define BU98R10_WRITE_AT_SAME_TIME 0
#define BU98R10_WRITE_AT_SAME_TIME 0
#endif
#endif
/******************************************************************************
BU98R10 �Ĵ���ֵԤ����
#define BU98R10_REG_SEG_R ((uint8_t)BU98R10_SRR << 4 | (uint8_t)BU98R10_SRF) // 0
******************************************************************************/
#define BU98R10_REG_SEG_G ((uint8_t)BU98R10_SGR << 4 | (uint8_t)BU98R10_SGF) // 0XEE
#define BU98R10_REG_SEG_R 60 // ((uint8_t)BU98R10_SRR << 4 | (uint8_t)BU98R10_SRF) // 0
#define BU98R10_REG_SEG_B ((uint8_t)BU98R10_SBR << 4 | (uint8_t)BU98R10_SBF) // 0X55
#define BU98R10_REG_SEG_G 1// ((uint8_t)BU98R10_SGR << 4 | (uint8_t)BU98R10_SGF) // 0XEE
#define BU98R10_REG_SEG_B 40// ((uint8_t)BU98R10_SBR << 4 | (uint8_t)BU98R10_SBF) // 0X55
#if BU98R10_COLORFUL_LCD_MODE
#if BU98R10_COLORFUL_LCD_MODE
#define BU98R10_DEFAULT_BYTE ((uint8_t)BU98R10_DEFAULT_SEG << 4 | (uint8_t)BU98R10_DEFAULT_SEG)
#define BU98R10_DEFAULT_BYTE ((uint8_t)BU98R10_DEFAULT_SEG << 4 | (uint8_t)BU98R10_DEFAULT_SEG)
#else
#else
#if BU98R10_DEFAULT_SEG
#if BU98R10_DEFAULT_SEG
#define BU98R10_DEFAULT_BYTE ((uint8_t)0xFF)
#define BU98R10_DEFAULT_BYTE ((uint8_t)0xFF)
#else
#else
#define BU98R10_DEFAULT_BYTE ((uint8_t)0x00)
#define BU98R10_DEFAULT_BYTE ((uint8_t)0x00)
#endif
#endif
#endif
#endif
/******************************************************************************
BU98R10�����б�
******************************************************************************/
#define BU98R10_CMD_DATRD ((uint8_t)0x09)
#define BU98R10_CMD_DATRD ((uint8_t)0x09)
#define BU98R10_CMD_DATWR ((uint8_t)0x0A)
#define BU98R10_CMD_DATWR ((uint8_t)0x0A)
#define BU98R10_CMD_ADSET ((uint8_t)0x40)
#define BU98R10_CMD_ADSET ((uint8_t)0x40)
...
@@ -186,9 +141,7 @@ BU98R10�����б�
...
@@ -186,9 +141,7 @@ BU98R10�����б�
#define BU98R10_CMD_TEST ((uint8_t)0xF0)
#define BU98R10_CMD_TEST ((uint8_t)0xF0)
#define BU98R10_CMD_SWRST ((uint8_t)0xF9)
#define BU98R10_CMD_SWRST ((uint8_t)0xF9)
/******************************************************************************
�������
******************************************************************************/
#define BU98R10_PAR_ICSET_RGB ((uint8_t)0x00)
#define BU98R10_PAR_ICSET_RGB ((uint8_t)0x00)
#define BU98R10_PAR_ICSET_MONO ((uint8_t)0x01)
#define BU98R10_PAR_ICSET_MONO ((uint8_t)0x01)
#define BU98R10_PAR_ICSET_INTOSC ((uint8_t)0x00)
#define BU98R10_PAR_ICSET_INTOSC ((uint8_t)0x00)
...
@@ -199,9 +152,7 @@ BU98R10�����б�
...
@@ -199,9 +152,7 @@ BU98R10�����б�
#define BU98R10_PAR_DRVCTRL_AP_ON ((uint8_t)0x02)
#define BU98R10_PAR_DRVCTRL_AP_ON ((uint8_t)0x02)
#define BU98R10_PAR_DRVCTRL_INVERSE ((uint8_t)0x03)
#define BU98R10_PAR_DRVCTRL_INVERSE ((uint8_t)0x03)
/******************************************************************************
ˢ�¿��ƽṹ����
******************************************************************************/
typedef
struct
typedef
struct
{
{
uint8_t
En
;
uint8_t
En
;
...
@@ -209,11 +160,9 @@ typedef struct
...
@@ -209,11 +160,9 @@ typedef struct
uint8_t
Step
;
uint8_t
Step
;
uint8_t
Cont
;
uint8_t
Cont
;
uint8_t
Addr
;
uint8_t
Addr
;
}
BU98R10UpdateCtrlStruct
;
}
BU98R10UpdateCtrlStruct
;
/******************************************************************************
����ṹ����
******************************************************************************/
#if BU98R10_COLORFUL_LCD_MODE
#if BU98R10_COLORFUL_LCD_MODE
#define BU98R10_DDRAM_SIZE 90
#define BU98R10_DDRAM_SIZE 90
...
@@ -404,8 +353,8 @@ typedef union
...
@@ -404,8 +353,8 @@ typedef union
uint8_t
Seg178
:
4
;
uint8_t
Seg178
:
4
;
uint8_t
Seg179
:
4
;
uint8_t
Seg179
:
4
;
uint8_t
Seg180
:
4
;
uint8_t
Seg180
:
4
;
}
Bit
;
}
Bit
;
}
BU98R10DDRAMUnion
;
}
BU98R10DDRAMUnion
;
#else
#else
...
@@ -598,13 +547,11 @@ typedef union
...
@@ -598,13 +547,11 @@ typedef union
uint8_t
Seg179
:
1
;
uint8_t
Seg179
:
1
;
uint8_t
Seg180
:
1
;
uint8_t
Seg180
:
1
;
uint8_t
:
4
;
uint8_t
:
4
;
}
Bit
;
}
Bit
;
}
BU98R10DDRAMUnion
;
}
BU98R10DDRAMUnion
;
#endif
#endif
/******************************************************************************
�����б�
******************************************************************************/
#if USE_BU98R10_CHIP_0
#if USE_BU98R10_CHIP_0
extern
volatile
BU98R10DDRAMUnion
BU98R10Chip0DDRAM
;
extern
volatile
BU98R10DDRAMUnion
BU98R10Chip0DDRAM
;
...
@@ -983,16 +930,11 @@ extern volatile BU98R10DDRAMUnion BU98R10Chip1DDRAM;
...
@@ -983,16 +930,11 @@ extern volatile BU98R10DDRAMUnion BU98R10Chip1DDRAM;
#endif
#endif
/******************************************************************************
��������
******************************************************************************/
void
BU98R10_Init
(
void
);
void
BU98R10_Init
(
void
);
void
BU98R10_Shutdown
(
void
);
void
BU98R10_Shutdown
(
void
);
void
BU98R10_Update_Request
(
void
);
void
BU98R10_Update_Request
(
void
);
void
BU98R10_Update_Service
(
void
);
void
BU98R10_Update_Service
(
void
);
uint8_t
Get_BU98R10UpdateEn
(
void
);
void
checkSegTftState
(
void
);
#if USE_BU98R10_CHIP_0
#if USE_BU98R10_CHIP_0
void
BU98R10_0_Command_Write
(
uint8_t
Cmd
);
void
BU98R10_0_Command_Write
(
uint8_t
Cmd
);
...
@@ -1007,6 +949,10 @@ void BU98R10_1_Data_Write(uint8_t Dat);
...
@@ -1007,6 +949,10 @@ void BU98R10_1_Data_Write(uint8_t Dat);
#if BU98R10_WRITE_AT_SAME_TIME
#if BU98R10_WRITE_AT_SAME_TIME
void
BU98R10_All_Command_Write
(
uint8_t
Cmd
);
void
BU98R10_All_Command_Write
(
uint8_t
Cmd
);
void
BU98R10_All_Data_Write
(
uint8_t
Dat0
,
uint8_t
Dat1
);
void
BU98R10_All_Data_Write
(
uint8_t
Dat0
,
uint8_t
Dat1
);
extern
void
checkSegTftState
(
void
);
#endif
#endif
#endif
#endif
HJ232_Source/source/Driver/src/BU98R10.C
View file @
ef86c91d
/******************************************************************************
文 件 名:BU98R10.c
功能描述:BU98R10段码液晶控制器驱动程序库文件
作 者:张暄
版 本:V1.0
日 期:2017.4.28
******************************************************************************/
#include "BU98R10.h"
#include "BU98R10.h"
#include "SEG_LCD.h"
#include "SEG_LCD.h"
#include "IS31FL3236.h"
#include "IS31FL3236.h"
/* 端口寄存器基地址 */
#define Register_Base_Address 0X40040000UL
/* 端口寄存器偏移地址*/
#define Port_0_Offset_Address 0X300UL
#define Port_01_Offset_Address 0X301UL
#define Port_02_Offset_Address 0X302UL
#define Port_03_Offset_Address 0X303UL
#define Port_04_Offset_Address 0X304UL
#define Port_05_Offset_Address 0X305UL
#define Port_06_Offset_Address 0X306UL
#define Port_07_Offset_Address 0X307UL
#define Port_08_Offset_Address 0X308UL
#define Port_10_Offset_Address 0X309UL
#define Port_11_Offset_Address 0X30AUL
#define Port_12_Offset_Address 0X30BUL
#define Port_13_Offset_Address 0X30CUL
#define Port_14_Offset_Address 0X30EUL
#define Port_15_Offset_Address 0X30FUL
/* 选择端口 */
#define Port_0 0UL
#define Port_01 1UL
#define Port_02 2UL
#define Port_03 3UL
#define Port_04 4UL
#define Port_05 5UL
#define Port_06 6UL
#define Port_07 7UL
#define Port_08 8UL
#define Port_10 10UL
#define Port_11 11UL
#define Port_12 12UL
#define Port_13 13UL
#define Port_14 14UL
#define Port_15 15UL
/* 选择端口对应PIN */
#define PIN_0 0
#define PIN_1 1
#define PIN_2 2
#define PIN_3 3
#define PIN_4 4
#define PIN_5 5
#define PIN_6 6
#define PIN_7 7
/* 基地址 + 偏移地址 + 对应Port*/
#define SEG_LCD0_SD Register_Base_Address + Port_0_Offset_Address + Port_0
#define SEG_LCD0_SCL Register_Base_Address + Port_0_Offset_Address + Port_0
#define SEG_LCD0_CS Register_Base_Address + Port_0_Offset_Address + Port_0
#define SEG_LCD1_SD Register_Base_Address + Port_07_Offset_Address + Port_07
#define SEG_LCD1_SCL Register_Base_Address + Port_07_Offset_Address + Port_07
#define SEG_LCD1_CS Register_Base_Address + Port_07_Offset_Address + Port_07
#define SEG_LCD0_SD_PIN PIN_2
#define SEG_LCD0_SCL_PIN PIN_4
#define SEG_LCD0_CS_PIN PIN_3
#define SEG_LCD1_SD_PIN PIN_2
#define SEG_LCD1_SCL_PIN PIN_0
#define SEG_LCD1_CS_PIN PIN_1
#if USE_BU98R10_CHIP_0
#if USE_BU98R10_CHIP_0
volatile
BU98R10DDRAMUnion
BU98R10Chip0DDRAM
;
volatile
BU98R10DDRAMUnion
BU98R10Chip0DDRAM
;
BU98R10DDRAMUnion
BU98R10Chip0DDRAMBackup
;
BU98R10DDRAMUnion
BU98R10Chip0DDRAMBackup
;
...
@@ -20,130 +78,23 @@ BU98R10DDRAMUnion BU98R10Chip1DDRAMBackup;
...
@@ -20,130 +78,23 @@ BU98R10DDRAMUnion BU98R10Chip1DDRAMBackup;
#endif
#endif
BU98R10UpdateCtrlStruct
BU98R10Update
;
BU98R10UpdateCtrlStruct
BU98R10Update
;
uint8_t
BU98R10_InitFlag
=
0u
;
#define SEG_LCD_SD_PORT 1
#define SEG_LCD_SD_PIN 2
#define SEG_LCD_SCL_PORT 1
#define SEG_LCD_SCL_PIN 1
#define SEG_LCD_CS_PORT 1
#define SEG_LCD_CS_PIN 0
#define SEG_LCD_SD1_PORT 5
#define SEG_LCD_SD1_PIN 5
#define SEG_LCD_SCL1_PORT 1
#define SEG_LCD_SCL1_PIN 7
#define SEG_LCD_CS1_PORT 1
#define SEG_LCD_CS1_PIN 3
//色彩设置初始化(注意,未做?芯片兼)
/*
static void BU98R10ColorInit(uint8_t R_GrayLevel,uint8_t G_GrayLevel,uint8_t B_GrayLevel)
{
uint8_t width = 0;
uint8_t wTemp = 0;
uint8_t rGrayLevel = R_GrayLevel;
uint8_t gGrayLevel = G_GrayLevel;
uint8_t bGrayLevel = B_GrayLevel;
if(rGrayLevel > 63)
{
rGrayLevel = 63;
}
if(gGrayLevel > 63)
{
gGrayLevel = 63;
}
if(bGrayLevel > 63)
{
bGrayLevel = 63;
}
BU98R10_0_Command_Write(BU98R10_CMD_LED_CTRL);
BU98R10_0_Data_Write(0x12);
//R
BU98R10_0_Command_Write(0xA0); //SRR-SRF
width = rGrayLevel;
wTemp = (15 - width/4);
wTemp <<= 4;
wTemp |= (15 - width/4);
BU98R10_0_Data_Write(wTemp);
BU98R10_0_Command_Write(0xB8); //LRS
BU98R10_0_Data_Write(63 - width);
BU98R10_0_Command_Write(0xD0); //LRW
BU98R10_0_Data_Write(width);
//G
BU98R10_0_Command_Write(0xA8); //SGR-SGF
width = gGrayLevel;
wTemp = (15 - width/4);
wTemp <<= 4;
wTemp |= (15 - width/4);
BU98R10_0_Data_Write(wTemp);
BU98R10_0_Command_Write(0xC0); //LGS
BU98R10_0_Data_Write(63 - width);
BU98R10_0_Command_Write(0xD8); //LRW
BU98R10_0_Data_Write(width);
//B
BU98R10_0_Command_Write(0xB0); //SBR-SBF
width = bGrayLevel;
wTemp = (15 - width/4);
wTemp <<= 4;
wTemp |= (15 - width/4);
BU98R10_0_Data_Write(wTemp);
BU98R10_0_Command_Write(0xC8); //LBS
BU98R10_0_Data_Write(63 - width);
BU98R10_0_Command_Write(0xE0); //LBW
BU98R10_0_Data_Write(width);
}
*/
/******************************************************************************
函数名:BU98R10_Init
功 能:初始化BU98R10
参 数:无
返回值:无
******************************************************************************/
uint8_t
Get_BU98R10UpdateEn
(
void
)
{
return
BU98R10Update
.
En
;
}
void
BU98R10_Init
(
void
)
void
BU98R10_Init
(
void
)
{
{
uint8_t
i
;
uint8_t
i
;
if
(
BU98R10_InitFlag
==
1
)
{
//return;
}
BU98R10_InitFlag
=
1
;
#if BU98R10_WRITE_AT_SAME_TIME
#if BU98R10_WRITE_AT_SAME_TIME
#if BU98R10_COLORFUL_LCD_MODE
#if BU98R10_COLORFUL_LCD_MODE
//软件复位
BU98R10_All_Command_Write
(
BU98R10_CMD_SWRST
);
BU98R10_All_Command_Write
(
BU98R10_CMD_SWRST
);
//工作模式
BU98R10_All_Command_Write
(
BU98R10_CMD_ICSET
|
BU98R10_PAR_ICSET_RGB
);
BU98R10_All_Command_Write
(
BU98R10_CMD_ICSET
|
BU98R10_PAR_ICSET_RGB
);
//驱动控制
BU98R10_All_Command_Write
(
BU98R10_CMD_DRVCTRL
|
BU98R10_PAR_DRVCTRL_NORMAL
);
BU98R10_All_Command_Write
(
BU98R10_CMD_DRVCTRL
|
BU98R10_PAR_DRVCTRL_NORMAL
);
//帧刷新率
BU98R10_All_Command_Write
(
BU98R10_CMD_FREQ
);
BU98R10_All_Command_Write
(
BU98R10_CMD_FREQ
);
BU98R10_All_Data_Write
(
BU98R10_FRAME_FREQ
,
BU98R10_FRAME_FREQ
);
BU98R10_All_Data_Write
(
BU98R10_FRAME_FREQ
,
BU98R10_FRAME_FREQ
);
//色彩设置
#if(USE_NEW_COLORFUL_STRATEGY == 1)
//色彩设置初始化(注意,未做?芯片兼)
//BU98R10ColorInit(R_LEVEL, G_LEVEL, B_LEVEL);
#else //USE_NEW_COLORFUL_STRATEGY
BU98R10_All_Command_Write
(
BU98R10_CMD_LED_CTRL
);
BU98R10_All_Command_Write
(
BU98R10_CMD_LED_CTRL
);
BU98R10_All_Data_Write
(
0x12
,
0x12
);
BU98R10_All_Data_Write
(
0x12
,
0x12
);
...
@@ -173,18 +124,16 @@ void BU98R10_Init(void)
...
@@ -173,18 +124,16 @@ void BU98R10_Init(void)
BU98R10_All_Command_Write
(
BU98R10_CMD_LED_WIDTHB
);
BU98R10_All_Command_Write
(
BU98R10_CMD_LED_WIDTHB
);
BU98R10_All_Data_Write
(
BU98R10_LBW
,
BU98R10_LBW
);
BU98R10_All_Data_Write
(
BU98R10_LBW
,
BU98R10_LBW
);
#endif //USE_NEW_COLORFUL_STRATEGY
//清除RAM数据
BU98R10_All_Command_Write
(
BU98R10_CMD_ADSET
);
BU98R10_All_Command_Write
(
BU98R10_CMD_ADSET
);
BU98R10_All_Data_Write
(
0x00
,
0x00
);
BU98R10_All_Data_Write
(
0x00
,
0x00
);
BU98R10_All_Command_Write
(
BU98R10_CMD_DATWR
);
BU98R10_All_Command_Write
(
BU98R10_CMD_DATWR
);
for
(
i
=
0
;
i
<
90
;
i
++
)
for
(
i
=
0
;
i
<
90
;
i
++
)
{
BU98R10_All_Data_Write
(
BU98R10_DEFAULT_BYTE
,
BU98R10_DEFAULT_BYTE
);
}
BU98R10_All_Data_Write
(
BU98R10_DEFAULT_BYTE
,
BU98R10_DEFAULT_BYTE
);
for
(
i
=
0
;
i
<
BU98R10_DDRAM_SIZE
;
i
++
)
{
for
(
i
=
0
;
i
<
BU98R10_DDRAM_SIZE
;
i
++
)
{
BU98R10Chip0DDRAM
.
Byte
[
i
]
=
BU98R10_DEFAULT_BYTE
;
BU98R10Chip0DDRAM
.
Byte
[
i
]
=
BU98R10_DEFAULT_BYTE
;
BU98R10Chip0DDRAMBackup
.
Byte
[
i
]
=
BU98R10_DEFAULT_BYTE
;
BU98R10Chip0DDRAMBackup
.
Byte
[
i
]
=
BU98R10_DEFAULT_BYTE
;
...
@@ -192,34 +141,28 @@ void BU98R10_Init(void)
...
@@ -192,34 +141,28 @@ void BU98R10_Init(void)
BU98R10Chip1DDRAMBackup
.
Byte
[
i
]
=
BU98R10_DEFAULT_BYTE
;
BU98R10Chip1DDRAMBackup
.
Byte
[
i
]
=
BU98R10_DEFAULT_BYTE
;
}
}
//开显示
BU98R10_All_Command_Write
(
BU98R10_CMD_DISPON
);
BU98R10_All_Command_Write
(
BU98R10_CMD_DISPON
);
#else
//BU98R10_COLORFUL_LCD_MODE
#else
//软件复位
BU98R10_All_Command_Write
(
BU98R10_CMD_SWRST
);
BU98R10_All_Command_Write
(
BU98R10_CMD_SWRST
);
//工作模式
BU98R10_All_Command_Write
(
BU98R10_CMD_ICSET
|
BU98R10_PAR_ICSET_MONO
);
BU98R10_All_Command_Write
(
BU98R10_CMD_ICSET
|
BU98R10_PAR_ICSET_MONO
);
//驱动控制
BU98R10_All_Command_Write
(
BU98R10_CMD_DRVCTRL
|
BU98R10_PAR_DRVCTRL_NORMAL
);
BU98R10_All_Command_Write
(
BU98R10_CMD_DRVCTRL
|
BU98R10_PAR_DRVCTRL_NORMAL
);
//帧刷新率
BU98R10_All_Command_Write
(
BU98R10_CMD_FREQ
);
BU98R10_All_Command_Write
(
BU98R10_CMD_FREQ
);
BU98R10_All_Data_Write
(
BU98R10_FRAME_FREQ
,
BU98R10_FRAME_FREQ
);
BU98R10_All_Data_Write
(
BU98R10_FRAME_FREQ
,
BU98R10_FRAME_FREQ
);
//清除RAM数据
BU98R10_All_Command_Write
(
BU98R10_CMD_ADSET
);
BU98R10_All_Command_Write
(
BU98R10_CMD_ADSET
);
BU98R10_All_Data_Write
(
0x00
,
0x00
);
BU98R10_All_Data_Write
(
0x00
,
0x00
);
BU98R10_All_Command_Write
(
BU98R10_CMD_DATWR
);
BU98R10_All_Command_Write
(
BU98R10_CMD_DATWR
);
for
(
i
=
0
;
i
<
90
;
i
++
)
for
(
i
=
0
;
i
<
90
;
i
++
)
{
BU98R10_All_Data_Write
(
BU98R10_DEFAULT_BYTE
,
BU98R10_DEFAULT_BYTE
);
}
BU98R10_All_Data_Write
(
BU98R10_DEFAULT_BYTE
,
BU98R10_DEFAULT_BYTE
);
for
(
i
=
0
;
i
<
BU98R10_DDRAM_SIZE
;
i
++
)
{
for
(
i
=
0
;
i
<
BU98R10_DDRAM_SIZE
;
i
++
)
{
BU98R10Chip0DDRAM
.
Byte
[
i
]
=
BU98R10_DEFAULT_BYTE
;
BU98R10Chip0DDRAM
.
Byte
[
i
]
=
BU98R10_DEFAULT_BYTE
;
BU98R10Chip0DDRAMBackup
.
Byte
[
i
]
=
BU98R10_DEFAULT_BYTE
;
BU98R10Chip0DDRAMBackup
.
Byte
[
i
]
=
BU98R10_DEFAULT_BYTE
;
...
@@ -227,33 +170,22 @@ void BU98R10_Init(void)
...
@@ -227,33 +170,22 @@ void BU98R10_Init(void)
BU98R10Chip1DDRAMBackup
.
Byte
[
i
]
=
BU98R10_DEFAULT_BYTE
;
BU98R10Chip1DDRAMBackup
.
Byte
[
i
]
=
BU98R10_DEFAULT_BYTE
;
}
}
//开显示
BU98R10_All_Command_Write
(
BU98R10_CMD_DISPON
);
BU98R10_All_Command_Write
(
BU98R10_CMD_DISPON
);
#endif // BU98R10_COLORFUL_LCD_MODE
#endif
#else
#else //BU98R10_WRITE_AT_SAME_TIME
#if BU98R10_COLORFUL_LCD_MODE
#if BU98R10_COLORFUL_LCD_MODE
#if USE_BU98R10_CHIP_0
#if USE_BU98R10_CHIP_0
//软件复位
BU98R10_0_Command_Write
(
BU98R10_CMD_SWRST
);
BU98R10_0_Command_Write
(
BU98R10_CMD_SWRST
);
//工作模式
BU98R10_0_Command_Write
(
BU98R10_CMD_ICSET
|
BU98R10_PAR_ICSET_RGB
);
BU98R10_0_Command_Write
(
BU98R10_CMD_ICSET
|
BU98R10_PAR_ICSET_RGB
);
//驱动控制
BU98R10_0_Command_Write
(
BU98R10_CMD_DRVCTRL
|
BU98R10_PAR_DRVCTRL_NORMAL
);
BU98R10_0_Command_Write
(
BU98R10_CMD_DRVCTRL
|
BU98R10_PAR_DRVCTRL_NORMAL
);
//帧刷新率
BU98R10_0_Command_Write
(
BU98R10_CMD_FREQ
);
BU98R10_0_Command_Write
(
BU98R10_CMD_FREQ
);
BU98R10_0_Data_Write
(
BU98R10_FRAME_FREQ
);
BU98R10_0_Data_Write
(
BU98R10_FRAME_FREQ
);
//色彩设置
BU98R10_0_Command_Write
(
BU98R10_CMD_LED_CTRL
);
BU98R10_0_Command_Write
(
BU98R10_CMD_LED_CTRL
);
BU98R10_0_Data_Write
(
0x12
);
BU98R10_0_Data_Write
(
0x12
);
...
@@ -284,41 +216,33 @@ void BU98R10_Init(void)
...
@@ -284,41 +216,33 @@ void BU98R10_Init(void)
BU98R10_0_Command_Write
(
BU98R10_CMD_LED_WIDTHB
);
BU98R10_0_Command_Write
(
BU98R10_CMD_LED_WIDTHB
);
BU98R10_0_Data_Write
(
BU98R10_LBW
);
BU98R10_0_Data_Write
(
BU98R10_LBW
);
//清除RAM数据
BU98R10_0_Command_Write
(
BU98R10_CMD_ADSET
);
BU98R10_0_Command_Write
(
BU98R10_CMD_ADSET
);
BU98R10_0_Data_Write
(
0x00
);
BU98R10_0_Data_Write
(
0x00
);
BU98R10_0_Command_Write
(
BU98R10_CMD_DATWR
);
BU98R10_0_Command_Write
(
BU98R10_CMD_DATWR
);
for
(
i
=
0
;
i
<
90
;
i
++
)
for
(
i
=
0
;
i
<
90
;
i
++
)
{
BU98R10_0_Data_Write
(
BU98R10_DEFAULT_BYTE
);
}
BU98R10_0_Data_Write
(
BU98R10_DEFAULT_BYTE
);
for
(
i
=
0
;
i
<
BU98R10_DDRAM_SIZE
;
i
++
)
{
for
(
i
=
0
;
i
<
BU98R10_DDRAM_SIZE
;
i
++
)
{
BU98R10Chip0DDRAM
.
Byte
[
i
]
=
BU98R10_DEFAULT_BYTE
;
BU98R10Chip0DDRAM
.
Byte
[
i
]
=
BU98R10_DEFAULT_BYTE
;
BU98R10Chip0DDRAMBackup
.
Byte
[
i
]
=
BU98R10_DEFAULT_BYTE
;
BU98R10Chip0DDRAMBackup
.
Byte
[
i
]
=
BU98R10_DEFAULT_BYTE
;
}
}
//开显示
BU98R10_0_Command_Write
(
BU98R10_CMD_DISPON
);
BU98R10_0_Command_Write
(
BU98R10_CMD_DISPON
);
#endif //USE_BU98R10_CHIP_0
#endif
#if USE_BU98R10_CHIP_1
#if USE_BU98R10_CHIP_1
//软件复位
BU98R10_1_Command_Write
(
BU98R10_CMD_SWRST
);
BU98R10_1_Command_Write
(
BU98R10_CMD_SWRST
);
//工作模式
BU98R10_1_Command_Write
(
BU98R10_CMD_ICSET
|
BU98R10_PAR_ICSET_RGB
);
BU98R10_1_Command_Write
(
BU98R10_CMD_ICSET
|
BU98R10_PAR_ICSET_RGB
);
//驱动控制
BU98R10_1_Command_Write
(
BU98R10_CMD_DRVCTRL
|
BU98R10_PAR_DRVCTRL_NORMAL
);
BU98R10_1_Command_Write
(
BU98R10_CMD_DRVCTRL
|
BU98R10_PAR_DRVCTRL_NORMAL
);
//帧刷新率
BU98R10_1_Command_Write
(
BU98R10_CMD_FREQ
);
BU98R10_1_Command_Write
(
BU98R10_CMD_FREQ
);
BU98R10_1_Data_Write
(
BU98R10_FRAME_FREQ
);
BU98R10_1_Data_Write
(
BU98R10_FRAME_FREQ
);
//色彩设置
BU98R10_1_Command_Write
(
BU98R10_CMD_LED_CTRL
);
BU98R10_1_Command_Write
(
BU98R10_CMD_LED_CTRL
);
BU98R10_1_Data_Write
(
0x12
);
BU98R10_1_Data_Write
(
0x12
);
...
@@ -349,118 +273,96 @@ void BU98R10_Init(void)
...
@@ -349,118 +273,96 @@ void BU98R10_Init(void)
BU98R10_1_Command_Write
(
BU98R10_CMD_LED_WIDTHB
);
BU98R10_1_Command_Write
(
BU98R10_CMD_LED_WIDTHB
);
BU98R10_1_Data_Write
(
BU98R10_LBW
);
BU98R10_1_Data_Write
(
BU98R10_LBW
);
//清除RAM数据
BU98R10_1_Command_Write
(
BU98R10_CMD_ADSET
);
BU98R10_1_Command_Write
(
BU98R10_CMD_ADSET
);
BU98R10_1_Data_Write
(
0x00
);
BU98R10_1_Data_Write
(
0x00
);
BU98R10_1_Command_Write
(
BU98R10_CMD_DATWR
);
BU98R10_1_Command_Write
(
BU98R10_CMD_DATWR
);
for
(
i
=
0
;
i
<
90
;
i
++
)
for
(
i
=
0
;
i
<
90
;
i
++
)
{
BU98R10_1_Data_Write
(
BU98R10_DEFAULT_BYTE
);
}
BU98R10_1_Data_Write
(
BU98R10_DEFAULT_BYTE
);
for
(
i
=
0
;
i
<
BU98R10_DDRAM_SIZE
;
i
++
)
{
for
(
i
=
0
;
i
<
BU98R10_DDRAM_SIZE
;
i
++
)
{
BU98R10Chip1DDRAM
.
Byte
[
i
]
=
BU98R10_DEFAULT_BYTE
;
BU98R10Chip1DDRAM
.
Byte
[
i
]
=
BU98R10_DEFAULT_BYTE
;
BU98R10Chip1DDRAMBackup
.
Byte
[
i
]
=
BU98R10_DEFAULT_BYTE
;
BU98R10Chip1DDRAMBackup
.
Byte
[
i
]
=
BU98R10_DEFAULT_BYTE
;
}
}
//开显示
BU98R10_1_Command_Write
(
BU98R10_CMD_DISPON
);
BU98R10_1_Command_Write
(
BU98R10_CMD_DISPON
);
#endif //USE_BU98R10_CHIP_1
#endif
#else
#else //BU98R10_COLORFUL_LCD_MODE
#if USE_BU98R10_CHIP_0
#if USE_BU98R10_CHIP_0
//软件复位
BU98R10_0_Command_Write
(
BU98R10_CMD_SWRST
);
BU98R10_0_Command_Write
(
BU98R10_CMD_SWRST
);
//工作模式
BU98R10_0_Command_Write
(
BU98R10_CMD_ICSET
|
BU98R10_PAR_ICSET_MONO
);
BU98R10_0_Command_Write
(
BU98R10_CMD_ICSET
|
BU98R10_PAR_ICSET_MONO
);
//驱动控制
BU98R10_0_Command_Write
(
BU98R10_CMD_DRVCTRL
|
BU98R10_PAR_DRVCTRL_NORMAL
);
BU98R10_0_Command_Write
(
BU98R10_CMD_DRVCTRL
|
BU98R10_PAR_DRVCTRL_NORMAL
);
//帧刷新率
BU98R10_0_Command_Write
(
BU98R10_CMD_FREQ
);
BU98R10_0_Command_Write
(
BU98R10_CMD_FREQ
);
BU98R10_0_Data_Write
(
BU98R10_FRAME_FREQ
);
BU98R10_0_Data_Write
(
BU98R10_FRAME_FREQ
);
//清除RAM数据
BU98R10_0_Command_Write
(
BU98R10_CMD_ADSET
);
BU98R10_0_Command_Write
(
BU98R10_CMD_ADSET
);
BU98R10_0_Data_Write
(
0x00
);
BU98R10_0_Data_Write
(
0x00
);
BU98R10_0_Command_Write
(
BU98R10_CMD_DATWR
);
BU98R10_0_Command_Write
(
BU98R10_CMD_DATWR
);
for
(
i
=
0
;
i
<
90
;
i
++
)
for
(
i
=
0
;
i
<
90
;
i
++
)
{
BU98R10_0_Data_Write
(
BU98R10_DEFAULT_BYTE
);
}
BU98R10_0_Data_Write
(
BU98R10_DEFAULT_BYTE
);
for
(
i
=
0
;
i
<
BU98R10_DDRAM_SIZE
;
i
++
)
{
for
(
i
=
0
;
i
<
BU98R10_DDRAM_SIZE
;
i
++
)
{
BU98R10Chip0DDRAM
.
Byte
[
i
]
=
BU98R10_DEFAULT_BYTE
;
BU98R10Chip0DDRAM
.
Byte
[
i
]
=
BU98R10_DEFAULT_BYTE
;
BU98R10Chip0DDRAMBackup
.
Byte
[
i
]
=
BU98R10_DEFAULT_BYTE
;
BU98R10Chip0DDRAMBackup
.
Byte
[
i
]
=
BU98R10_DEFAULT_BYTE
;
}
}
//开显示
BU98R10_0_Command_Write
(
BU98R10_CMD_DISPON
);
BU98R10_0_Command_Write
(
BU98R10_CMD_DISPON
);
#endif //USE_BU98R10_CHIP_0
#endif
#if USE_BU98R10_CHIP_1
#if USE_BU98R10_CHIP_1
//软件复位
BU98R10_1_Command_Write
(
BU98R10_CMD_SWRST
);
BU98R10_1_Command_Write
(
BU98R10_CMD_SWRST
);
//工作模式
BU98R10_1_Command_Write
(
BU98R10_CMD_ICSET
|
BU98R10_PAR_ICSET_MONO
);
BU98R10_1_Command_Write
(
BU98R10_CMD_ICSET
|
BU98R10_PAR_ICSET_MONO
);
//驱动控制
BU98R10_1_Command_Write
(
BU98R10_CMD_DRVCTRL
|
BU98R10_PAR_DRVCTRL_NORMAL
);
BU98R10_1_Command_Write
(
BU98R10_CMD_DRVCTRL
|
BU98R10_PAR_DRVCTRL_NORMAL
);
//帧刷新率
BU98R10_1_Command_Write
(
BU98R10_CMD_FREQ
);
BU98R10_1_Command_Write
(
BU98R10_CMD_FREQ
);
BU98R10_1_Data_Write
(
BU98R10_FRAME_FREQ
);
BU98R10_1_Data_Write
(
BU98R10_FRAME_FREQ
);
//清除RAM数据
BU98R10_1_Command_Write
(
BU98R10_CMD_ADSET
);
BU98R10_1_Command_Write
(
BU98R10_CMD_ADSET
);
BU98R10_1_Data_Write
(
0x00
);
BU98R10_1_Data_Write
(
0x00
);
BU98R10_1_Command_Write
(
BU98R10_CMD_DATWR
);
BU98R10_1_Command_Write
(
BU98R10_CMD_DATWR
);
for
(
i
=
0
;
i
<
90
;
i
++
)
for
(
i
=
0
;
i
<
90
;
i
++
)
{
BU98R10_1_Data_Write
(
BU98R10_DEFAULT_BYTE
);
}
BU98R10_1_Data_Write
(
BU98R10_DEFAULT_BYTE
);
for
(
i
=
0
;
i
<
BU98R10_DDRAM_SIZE
;
i
++
)
{
for
(
i
=
0
;
i
<
BU98R10_DDRAM_SIZE
;
i
++
)
{
BU98R10Chip1DDRAM
.
Byte
[
i
]
=
BU98R10_DEFAULT_BYTE
;
BU98R10Chip1DDRAM
.
Byte
[
i
]
=
BU98R10_DEFAULT_BYTE
;
BU98R10Chip1DDRAMBackup
.
Byte
[
i
]
=
BU98R10_DEFAULT_BYTE
;
BU98R10Chip1DDRAMBackup
.
Byte
[
i
]
=
BU98R10_DEFAULT_BYTE
;
}
}
//开显示
BU98R10_1_Command_Write
(
BU98R10_CMD_DISPON
);
BU98R10_1_Command_Write
(
BU98R10_CMD_DISPON
);
#endif //USE_BU98R10_CHIP_1
#endif
#endif
#endif //BU98R10_COLORFUL_LCD_MODE
#endif
#endif //BU98R10_WRITE_AT_SAME_TIME
BU98R10Update
.
En
=
0
;
BU98R10Update
.
En
=
0
;
BU98R10Update
.
Step
=
0
;
BU98R10Update
.
Step
=
0
;
BU98R10Update
.
Cont
=
0
;
BU98R10Update
.
Cont
=
0
;
BU98R10Update
.
Addr
=
0
;
BU98R10Update
.
Addr
=
0
;
#if USE_BU98R10_CHIP_0
BU98R10Update
.
Chip
=
0
;
BU98R10Update
.
Chip
=
0
;
#elif USE_BU98R10_CHIP_1
BU98R10Update
.
Chip
=
1
;
#else
BU98R10Update
.
Chip
=
255
;
#endif
}
}
/******************************************************************************
函数名:BU98R10_Shutdown
功 能:关闭BU98R10显示,使其进入低功耗模式
参 数:无
返回值:无
******************************************************************************/
void
BU98R10_Shutdown
(
void
)
void
BU98R10_Shutdown
(
void
)
{
{
BU98R10_InitFlag
=
0U
;
#if BU98R10_WRITE_AT_SAME_TIME
#if BU98R10_WRITE_AT_SAME_TIME
BU98R10_All_Command_Write
(
BU98R10_CMD_DISPOFF
);
BU98R10_All_Command_Write
(
BU98R10_CMD_DISPOFF
);
#else
#else
...
@@ -474,104 +376,105 @@ void BU98R10_Shutdown(void)
...
@@ -474,104 +376,105 @@ void BU98R10_Shutdown(void)
#endif
#endif
}
}
/******************************************************************************
uint8_t
u8BU98R10CheckCount
=
0
;
函数名:BU98R10_Update_Request
功 能:请求刷新BU98R10的段码显示
参 数:无
返回值:无
******************************************************************************/
void
BU98R10_Update_Request
(
void
)
void
BU98R10_Update_Request
(
void
)
{
{
// if (g_sysFlag.Bits.AccSaveState)
//{
// //if (u8BU98R10CheckCount < 20)
// //{
// // BU98R10Update.En = 1;
// // u8BU98R10CheckCount++;
// //}
// BU98R10Update.En = 1;
// }
// else
{
u8BU98R10CheckCount
=
0
;
BU98R10Update
.
En
=
1
;
BU98R10Update
.
En
=
1
;
LedUpdateDeviceFlg
=
1
;
}
#if USE_BU98R10_CHIP_0
BU98R10Update
.
Chip
=
0
;
#elif USE_BU98R10_CHIP_1
BU98R10Update
.
Chip
=
1
;
#else
BU98R10Update
.
Chip
=
255
;
#endif
}
}
/******************************************************************************
函数名:BU98R10_Update_Service
功 能:BU98R10段码显示刷新服务
参 数:无
返回值:无
*******************************************************************************
注 意:该服务函数必须每于系统空闲时实时调用
******************************************************************************/
void
BU98R10_Update_Service
(
void
)
void
BU98R10_Update_Service
(
void
)
{
{
uint8_t
i
=
0
;
if
(
BU98R10Update
.
En
)
{
#if BU98R10_WRITE_AT_SAME_TIME
#if BU98R10_WRITE_AT_SAME_TIME
if
(
BU98R10Update
.
En
)
{
switch
(
BU98R10Update
.
Step
)
{
case
0
:
if
((
BU98R10Chip0DDRAM
.
Byte
[
BU98R10Update
.
Addr
]
!=
BU98R10Chip0DDRAMBackup
.
Byte
[
BU98R10Update
.
Addr
])
||
(
BU98R10Chip1DDRAM
.
Byte
[
BU98R10Update
.
Addr
]
!=
BU98R10Chip1DDRAMBackup
.
Byte
[
BU98R10Update
.
Addr
]))
{
BU98R10Chip0DDRAMBackup
.
Byte
[
BU98R10Update
.
Addr
]
=
BU98R10Chip0DDRAM
.
Byte
[
BU98R10Update
.
Addr
];
BU98R10Chip1DDRAMBackup
.
Byte
[
BU98R10Update
.
Addr
]
=
BU98R10Chip1DDRAM
.
Byte
[
BU98R10Update
.
Addr
];
switch
(
BU98R10Update
.
Step
)
{
if
(
BU98R10Update
.
Cont
)
case
0
:
//请求写地址
BU98R10Update
.
Step
=
4
;
//前15个SEG空闲
else
BU98R10Update
.
Addr
=
7
;
BU98R10_All_Command_Write
(
BU98R10_CMD_ADSET
);
BU98R10_All_Data_Write
(
BU98R10Update
.
Addr
,
BU98R10Update
.
Addr
);
BU98R10_All_Command_Write
(
BU98R10_CMD_DATWR
);
BU98R10Update
.
Step
=
1
;
BU98R10Update
.
Step
=
1
;
break
;
case
1
:
for
(
i
=
0
;
i
<
6
;
i
++
)
{
BU98R10_All_Data_Write
(
BU98R10Chip0DDRAM
.
Byte
[
BU98R10Update
.
Addr
],
BU98R10Chip1DDRAM
.
Byte
[
BU98R10Update
.
Addr
]);
if
(
BU98R10Update
.
Addr
>=
30
)
{
BU98R10_All_Command_Write
(
BU98R10_CMD_ADSET
);
BU98R10_All_Data_Write
(
BU98R10Update
.
Addr
,
BU98R10Update
.
Addr
);
BU98R10_All_Command_Write
(
BU98R10_CMD_DATWR
);
BU98R10Update
.
Step
=
2
;
break
;
}
}
else
{
else
//地址调整
{
BU98R10Update
.
Cont
=
0
;
BU98R10Update
.
Addr
++
;
BU98R10Update
.
Addr
++
;
if
(
BU98R10Update
.
Addr
>=
BU98R10_DDRAM_SIZE
)
{
BU98R10Update
.
Addr
=
0
;
BU98R10Update
.
En
=
0
;
}
}
}
}
break
;
break
;
case
2
:
case
1
:
for
(
i
=
0
;
i
<
6
;
i
++
)
{
BU98R10_All_Data_Write
(
BU98R10Chip0DDRAM
.
Byte
[
BU98R10Update
.
Addr
],
BU98R10Chip1DDRAM
.
Byte
[
BU98R10Update
.
Addr
]);
if
(
BU98R10Update
.
Addr
>=
60
)
{
BU98R10_All_Command_Write
(
BU98R10_CMD_ADSET
);
BU98R10_All_Command_Write
(
BU98R10_CMD_ADSET
);
BU98R10_All_Data_Write
(
BU98R10Update
.
Addr
,
BU98R10Update
.
Addr
);
BU98R10Update
.
Step
=
2
;
BU98R10_All_Command_Write
(
BU98R10_CMD_DATWR
);
break
;
case
2
:
#if BU98R10_COLORFUL_LCD_MODE
BU98R10_All_Data_Write
(
BU98R10Update
.
Addr
,
BU98R10Update
.
Addr
);
#else
BU98R10_All_Data_Write
(
BU98R10Update
.
Addr
*
4
,
BU98R10Update
.
Addr
*
4
);
#endif
BU98R10Update
.
Step
=
3
;
BU98R10Update
.
Step
=
3
;
break
;
break
;
}
else
{
//地址调整
BU98R10Update
.
Addr
++
;
}
}
case
3
:
BU98R10_All_Command_Write
(
BU98R10_CMD_DATWR
);
BU98R10Update
.
Step
=
4
;
break
;
break
;
case
3
:
case
4
:
for
(
i
=
0
;
i
<
6
;
i
++
)
{
BU98R10_All_Data_Write
(
BU98R10Chip0DDRAMBackup
.
Byte
[
BU98R10Update
.
Addr
],
BU98R10Chip1DDRAMBackup
.
Byte
[
BU98R10Update
.
Addr
]);
BU98R10_All_Data_Write
(
BU98R10Chip0DDRAM
.
Byte
[
BU98R10Update
.
Addr
],
BU98R10Chip1DDRAM
.
Byte
[
BU98R10Update
.
Addr
]);
BU98R10Update
.
Step
=
5
;
break
;
if
(
BU98R10Update
.
Addr
==
86
)
{
case
5
:
BU98R10Update
.
Addr
++
;
if
(
BU98R10Update
.
Addr
>=
BU98R10_DDRAM_SIZE
)
{
BU98R10Update
.
Addr
=
0
;
BU98R10Update
.
Addr
=
0
;
BU98R10Update
.
En
=
0
;
BU98R10Update
.
En
=
0
;
BU98R10Update
.
Step
=
0
;
BU98R10Update
.
Cont
=
0
;
break
;
}
else
{
//地址调整
BU98R10Update
.
Addr
++
;
}
}
}
else
BU98R10Update
.
Cont
=
1
;
BU98R10Update
.
Step
=
0
;
break
;
break
;
default
:
default
:
BU98R10Update
.
En
=
0
;
BU98R10Update
.
En
=
0
;
BU98R10Update
.
Step
=
0
;
BU98R10Update
.
Step
=
0
;
BU98R10Update
.
Cont
=
0
;
BU98R10Update
.
Cont
=
0
;
...
@@ -579,566 +482,476 @@ void BU98R10_Update_Service(void)
...
@@ -579,566 +482,476 @@ void BU98R10_Update_Service(void)
break
;
break
;
}
}
#else
#if USE_BU98R10_CHIP_0
if
(
BU98R10Update
.
Chip
==
0
)
{
switch
(
BU98R10Update
.
Step
)
{
case
0
:
if
(
BU98R10Chip0DDRAM
.
Byte
[
BU98R10Update
.
Addr
]
!=
BU98R10Chip0DDRAMBackup
.
Byte
[
BU98R10Update
.
Addr
])
{
BU98R10Chip0DDRAMBackup
.
Byte
[
BU98R10Update
.
Addr
]
=
BU98R10Chip0DDRAM
.
Byte
[
BU98R10Update
.
Addr
];
if
(
BU98R10Update
.
Cont
)
BU98R10Update
.
Step
=
4
;
else
BU98R10Update
.
Step
=
1
;
}
}
else
{
BU98R10Update
.
Cont
=
0
;
BU98R10Update
.
Addr
++
;
if
(
BU98R10Update
.
Addr
>=
BU98R10_DDRAM_SIZE
)
{
BU98R10Update
.
Addr
=
0
;
#if USE_BU98R10_CHIP_1
BU98R10Update
.
Chip
=
1
;
#else
#else
BU98R10Update
.
En
=
0
;
#endif
}
}
break
;
if
(
BU98R10Update
.
En
)
{
case
1
:
switch
(
BU98R10Update
.
Step
)
{
case
0
:
//请求写地址
//前11个SEG空闲
BU98R10Update
.
Addr
=
5
;
BU98R10_0_Command_Write
(
BU98R10_CMD_ADSET
);
BU98R10_0_Command_Write
(
BU98R10_CMD_ADSET
);
BU98R10Update
.
Step
=
2
;
break
;
case
2
:
#if BU98R10_COLORFUL_LCD_MODE
BU98R10_0_Data_Write
(
BU98R10Update
.
Addr
);
BU98R10_0_Data_Write
(
BU98R10Update
.
Addr
);
#else
BU98R10_0_Data_Write
(
BU98R10Update
.
Addr
*
4
);
#endif
BU98R10Update
.
Step
=
3
;
break
;
case
3
:
BU98R10_0_Command_Write
(
BU98R10_CMD_DATWR
);
BU98R10_0_Command_Write
(
BU98R10_CMD_DATWR
);
BU98R10Update
.
Step
=
1
;
BU98R10Update
.
Step
=
4
;
break
;
case
4
:
BU98R10_0_Data_Write
(
BU98R10Chip0DDRAMBackup
.
Byte
[
BU98R10Update
.
Addr
]);
BU98R10Update
.
Step
=
5
;
break
;
break
;
case
1
:
case
5
:
for
(
i
=
0
;
i
<
6
;
i
++
)
{
BU98R10Update
.
Addr
++
;
//写入数据 5--18
if
(
BU98R10Update
.
Addr
>=
BU98R10_DDRAM_SIZE
)
BU98R10_0_Data_Write
(
BU98R10Chip0DDRAM
.
Byte
[
BU98R10Update
.
Addr
]);
{
BU98R10Update
.
Addr
=
0
;
BU98R10Update
.
Cont
=
0
;
if
(
BU98R10Update
.
Addr
==
18
)
{
//---SEG38
#if USE_BU98R10_CHIP_1
BU98R10Update
.
Addr
=
80
;
BU98R10Update
.
Chip
=
1
;
BU98R10_0_Command_Write
(
BU98R10_CMD_ADSET
);
#else
BU98R10_0_Data_Write
(
BU98R10Update
.
Addr
);
BU98R10Update
.
En
=
0
;
BU98R10_0_Command_Write
(
BU98R10_CMD_DATWR
);
#endif
BU98R10Update
.
Step
=
2
;
}
else
BU98R10Update
.
Cont
=
1
;
BU98R10Update
.
Step
=
0
;
break
;
break
;
default:
BU98R10Update
.
En
=
0
;
BU98R10Update
.
Step
=
0
;
BU98R10Update
.
Cont
=
0
;
BU98R10Update
.
Addr
=
0
;
break
;
}
}
}
else
{
//地址调整
#if USE_BU98R10_CHIP_1
else
if
(
BU98R10Update
.
Chip
==
1
)
#endif
#elif USE_BU98R10_CHIP_1
if
(
BU98R10Update
.
Chip
==
1
)
#endif
#if USE_BU98R10_CHIP_1
{
switch
(
BU98R10Update
.
Step
)
{
case
0
:
if
(
BU98R10Chip1DDRAM
.
Byte
[
BU98R10Update
.
Addr
]
!=
BU98R10Chip1DDRAMBackup
.
Byte
[
BU98R10Update
.
Addr
])
{
BU98R10Chip1DDRAMBackup
.
Byte
[
BU98R10Update
.
Addr
]
=
BU98R10Chip1DDRAM
.
Byte
[
BU98R10Update
.
Addr
];
if
(
BU98R10Update
.
Cont
)
BU98R10Update
.
Step
=
4
;
else
BU98R10Update
.
Step
=
1
;
}
else
{
BU98R10Update
.
Cont
=
0
;
BU98R10Update
.
Addr
++
;
BU98R10Update
.
Addr
++
;
if
(
BU98R10Update
.
Addr
>=
BU98R10_DDRAM_SIZE
)
{
BU98R10Update
.
Addr
=
0
;
BU98R10Update
.
En
=
0
;
}
}
}
}
break
;
break
;
case
2
:
case
1
:
for
(
i
=
0
;
i
<
6
;
i
++
)
{
//写入数据 80-86
BU98R10_0_Data_Write
(
BU98R10Chip0DDRAM
.
Byte
[
BU98R10Update
.
Addr
]);
if
(
BU98R10Update
.
Addr
==
86
)
{
//---SEG174
BU98R10Update
.
Addr
=
19
;
BU98R10_0_Command_Write
(
BU98R10_CMD_ADSET
);
BU98R10_0_Command_Write
(
BU98R10_CMD_ADSET
);
BU98R10Update
.
Step
=
2
;
break
;
case
2
:
#if BU98R10_COLORFUL_LCD_MODE
BU98R10_0_Data_Write
(
BU98R10Update
.
Addr
);
BU98R10_0_Data_Write
(
BU98R10Update
.
Addr
);
BU98R10_0_Command_Write
(
BU98R10_CMD_DATWR
);
#else
BU98R10_0_Data_Write
(
BU98R10Update
.
Addr
*
4
);
#endif
BU98R10Update
.
Step
=
3
;
BU98R10Update
.
Step
=
3
;
break
;
break
;
}
else
{
//地址调整
BU98R10Update
.
Addr
++
;
}
}
case
3
:
BU98R10_0_Command_Write
(
BU98R10_CMD_DATWR
);
BU98R10Update
.
Step
=
4
;
break
;
break
;
case
3
:
case
4
:
for
(
i
=
0
;
i
<
6
;
i
++
)
{
BU98R10_0_Data_Write
(
BU98R10Chip1DDRAMBackup
.
Byte
[
BU98R10Update
.
Addr
]);
//写入数据19
-79
BU98R10Update
.
Step
=
5
;
BU98R10_0_Data_Write
(
BU98R10Chip0DDRAM
.
Byte
[
BU98R10Update
.
Addr
])
;
break
;
if
(
BU98R10Update
.
Addr
==
79
)
{
case
5
:
BU98R10Update
.
Addr
++
;
if
(
BU98R10Update
.
Addr
>=
BU98R10_DDRAM_SIZE
)
{
BU98R10Update
.
Addr
=
0
;
BU98R10Update
.
Addr
=
0
;
BU98R10Update
.
Cont
=
0
;
BU98R10Update
.
En
=
0
;
BU98R10Update
.
En
=
0
;
BU98R10Update
.
Step
=
0
;
break
;
}
else
{
//地址调整
BU98R10Update
.
Addr
++
;
}
}
}
else
BU98R10Update
.
Cont
=
1
;
BU98R10Update
.
Step
=
0
;
break
;
break
;
default
:
default
:
BU98R10Update
.
En
=
0
;
BU98R10Update
.
En
=
0
;
BU98R10Update
.
Step
=
0
;
BU98R10Update
.
Step
=
0
;
BU98R10Update
.
Cont
=
0
;
BU98R10Update
.
Cont
=
0
;
BU98R10Update
.
Addr
=
0
;
BU98R10Update
.
Addr
=
0
;
break
;
break
;
}
}
}
}
#endif
#endif
}
#if ((USE_BU98R10_CHIP_0) || (USE_BU98R10_CHIP_1))
else
#define BU98R10_DELAY_NS \
#endif
__NOP(); \
BU98R10Update
.
En
=
0
;
__NOP(); \
__NOP();
// __NOP(); \
// __NOP(); \
// __NOP(); \
// __NOP();
#endif
}
}
#if USE_BU98R10_CHIP_0
#if USE_BU98R10_CHIP_0
/******************************************************************************
函数名:BU98R10_0_Command_Write
功 能:向BU98R10芯片0写控制命令
参 数:Cmd:要写入的命令
返回值:无
******************************************************************************/
void
BU98R10_0_Command_Write
(
uint8_t
Cmd
)
void
BU98R10_0_Command_Write
(
uint8_t
Cmd
)
{
{
uint8_t
i
;
uint8_t
i
;
//D/C = 0,表示发送命令
/* SD 输出低 */
*
((
volatile
uint8_t
*
)(
0x40040300UL
+
SEG_LCD_SD_PORT
))
&=
~
(
1
<<
SEG_LCD_SD_PIN
);
//PORT_ClrBit
*
((
volatile
uint8_t
*
)(
SEG_LCD0_SD
))
&=
~
(
1
<<
SEG_LCD0_SD_PIN
);
*
((
volatile
uint8_t
*
)(
0x40040300UL
+
SEG_LCD_SCL_PORT
))
&=
~
(
1
<<
SEG_LCD_SCL_PIN
);
//PORT_ClrBit
*
((
volatile
uint8_t
*
)(
0x40040300UL
+
SEG_LCD_CS_PORT
))
&=
~
(
1
<<
SEG_LCD_CS_PIN
);
//PORT_ClrBit
/* SCL 输出低 */
// PORT_ClrBit(SEG_LCD_SD);
*
((
volatile
uint8_t
*
)(
SEG_LCD0_SCL
))
&=
~
(
1
<<
SEG_LCD0_SCL_PIN
);
// PORT_ClrBit(SEG_LCD_SCL);
// PORT_ClrBit(SEG_LCD_CSB);
/* CS 输出低 */
*
((
volatile
uint8_t
*
)(
SEG_LCD0_CS
))
&=
~
(
1
<<
SEG_LCD0_CS_PIN
);
BU98R10_DELAY_NS
;
// BU98R10_DELAY_NS;
__NOP
();
// BU98R10_DELAY_NS;
__NOP
();
// BU98R10_DELAY_NS;
__NOP
();
// BU98R10_DELAY_NS;
// BU98R10_DELAY_NS;
/* SCL 输出高 */
*
((
volatile
uint8_t
*
)(
SEG_LCD0_SCL
))
|=
(
1
<<
SEG_LCD0_SCL_PIN
);
// PORT_SetBit(SEG_LCD_SCL);
*
((
volatile
uint8_t
*
)(
0x40040300UL
+
SEG_LCD_SCL_PORT
))
|=
(
1
<<
SEG_LCD_SCL_PIN
);
//PORT_SetBit
for
(
i
=
0
;
i
<
8
;
i
++
)
{
BU98R10_DELAY_NS
;
/* SCL 输出低 */
// BU98R10_DELAY_NS;
*
((
volatile
uint8_t
*
)(
SEG_LCD0_SCL
))
&=
~
(
1
<<
SEG_LCD0_SCL_PIN
);
// BU98R10_DELAY_NS;
// BU98R10_DELAY_NS;
// BU98R10_DELAY_NS;
// BU98R10_DELAY_NS;
for
(
i
=
0
;
i
<
8
;
i
++
)
{
// PORT_ClrBit(SEG_LCD_SCL);
*
((
volatile
uint8_t
*
)(
0x40040300UL
+
SEG_LCD_SCL_PORT
))
&=
~
(
1
<<
SEG_LCD_SCL_PIN
);
//PORT_ClrBit
if
(
Cmd
&
0x80
)
if
(
Cmd
&
0x80
)
// PORT_SetBit(SEG_LCD_SD);
/* SD 输出高 */
{
*
((
volatile
uint8_t
*
)(
0x40040300UL
+
SEG_LCD_SD_PORT
))
|=
(
1
<<
SEG_LCD_SD_PIN
);
}
//PORT_SetBit
*
((
volatile
uint8_t
*
)(
SEG_LCD0_SD
))
|=
(
1
<<
SEG_LCD0_SD_PIN
);
else
else
// PORT_ClrBit(SEG_LCD_SD);
/* SD 输出低 */
{
*
((
volatile
uint8_t
*
)(
0x40040300UL
+
SEG_LCD_SD_PORT
))
&=
~
(
1
<<
SEG_LCD_SD_PIN
);
}
//PORT_ClrBit
*
((
volatile
uint8_t
*
)(
SEG_LCD0_SD
))
&=
~
(
1
<<
SEG_LCD0_SD_PIN
);
BU98R10_DELAY_NS
;
// BU98R10_DELAY_NS;
// BU98R10_DELAY_NS;
// BU98R10_DELAY_NS;
//PORT_SetBit(SEG_LCD_SCL);
__NOP
();
*
((
volatile
uint8_t
*
)(
0x40040300UL
+
SEG_LCD_SCL_PORT
))
|=
(
1
<<
SEG_LCD_SCL_PIN
);
//PORT_SetBit
__NOP
();
__NOP
();
BU98R10_DELAY_NS
;
/* SCL 输出高 */
// BU98R10_DELAY_NS;
*
((
volatile
uint8_t
*
)(
SEG_LCD0_SCL
))
|=
(
1
<<
SEG_LCD0_SCL_PIN
);
// BU98R10_DELAY_NS;
// BU98R10_DELAY_NS;
Cmd
<<=
1
;
Cmd
<<=
1
;
}
}
//PORT_SetBit(SEG_LCD_CSB);
/* CS 输出高 */
*
((
volatile
uint8_t
*
)(
0x40040300UL
+
SEG_LCD_CS_PORT
))
|=
(
1
<<
SEG_LCD_CS_PIN
);
//PORT_SetBit
*
((
volatile
uint8_t
*
)(
SEG_LCD0_CS
))
|=
(
1
<<
SEG_LCD0_CS_PIN
);
BU98R10_DELAY_NS
;
// BU98R10_DELAY_NS;
// BU98R10_DELAY_NS;
}
}
/******************************************************************************
函数名:BU98R10_0_Data_Write
功 能:向BU98R10芯片0写数据
参 数:Dat:要写入的数据
返回值:无
******************************************************************************/
void
BU98R10_0_Data_Write
(
uint8_t
Dat
)
void
BU98R10_0_Data_Write
(
uint8_t
Dat
)
{
{
uint8_t
i
;
uint8_t
i
;
//D/C = 1,表示发送数据
/* SD 输出高 */
//PORT_SetBit(SEG_LCD_SD);
*
((
volatile
uint8_t
*
)(
SEG_LCD0_SD
))
|=
(
1
<<
SEG_LCD0_SD_PIN
);
// PORT_ClrBit(SEG_LCD_SCL);
// PORT_ClrBit(SEG_LCD_CSB);
/* SCL 输出低 */
*
((
volatile
uint8_t
*
)(
0x40040300UL
+
SEG_LCD_SD_PORT
))
|=
(
1
<<
SEG_LCD_SD_PIN
);
//PORT_SetBit
*
((
volatile
uint8_t
*
)(
SEG_LCD0_SCL
))
&=
~
(
1
<<
SEG_LCD0_SCL_PIN
);
*
((
volatile
uint8_t
*
)(
0x40040300UL
+
SEG_LCD_SCL_PORT
))
&=
~
(
1
<<
SEG_LCD_SCL_PIN
);
//PORT_ClrBit
*
((
volatile
uint8_t
*
)(
0x40040300UL
+
SEG_LCD_CS_PORT
))
&=
~
(
1
<<
SEG_LCD_CS_PIN
);
//PORT_ClrBit
/* CS 输出低 */
*
((
volatile
uint8_t
*
)(
SEG_LCD0_CS
))
&=
~
(
1
<<
SEG_LCD0_CS_PIN
);
BU98R10_DELAY_NS
;
__NOP
();
// BU98R10_DELAY_NS;
__NOP
();
// BU98R10_DELAY_NS;
__NOP
();
// BU98R10_DELAY_NS;
// BU98R10_DELAY_NS;
/* SCL 输出高 */
// BU98R10_DELAY_NS;
*
((
volatile
uint8_t
*
)(
SEG_LCD0_SCL
))
|=
(
1
<<
SEG_LCD0_SCL_PIN
);
// PORT_SetBit(SEG_LCD_SCL);
for
(
i
=
0
;
i
<
8
;
i
++
)
*
((
volatile
uint8_t
*
)(
0x40040300UL
+
SEG_LCD_SCL_PORT
))
|=
(
1
<<
SEG_LCD_SCL_PIN
);
//PORT_SetBit
{
/* SCL 输出低 */
BU98R10_DELAY_NS
;
*
((
volatile
uint8_t
*
)(
SEG_LCD0_SCL
))
&=
~
(
1
<<
SEG_LCD0_SCL_PIN
);
// BU98R10_DELAY_NS;
// BU98R10_DELAY_NS;
// BU98R10_DELAY_NS;
// BU98R10_DELAY_NS;
// BU98R10_DELAY_NS;
for
(
i
=
0
;
i
<
8
;
i
++
)
{
//PORT_ClrBit(SEG_LCD_SCL);
*
((
volatile
uint8_t
*
)(
0x40040300UL
+
SEG_LCD_SCL_PORT
))
&=
~
(
1
<<
SEG_LCD_SCL_PIN
);
//PORT_ClrBit
if
(
Dat
&
0x80
)
if
(
Dat
&
0x80
)
//PORT_SetBit(SEG_LCD_SD);
/* SD 输出高 */
{
*
((
volatile
uint8_t
*
)(
0x40040300UL
+
SEG_LCD_SD_PORT
))
|=
(
1
<<
SEG_LCD_SD_PIN
);
}
//PORT_SetBit
*
((
volatile
uint8_t
*
)(
SEG_LCD0_SD
))
|=
(
1
<<
SEG_LCD0_SD_PIN
);
else
else
//PORT_ClrBit(SEG_LCD_SD);
/* SCL 输出低 */
{
*
((
volatile
uint8_t
*
)(
0x40040300UL
+
SEG_LCD_SD_PORT
))
&=
~
(
1
<<
SEG_LCD_SD_PIN
);
}
//PORT_ClrBit
*
((
volatile
uint8_t
*
)(
SEG_LCD0_SCL
))
&=
~
(
1
<<
SEG_LCD0_SCL_PIN
);
BU98R10_DELAY_NS
;
__NOP
();
// BU98R10_DELAY_NS;
__NOP
();
// BU98R10_DELAY_NS;
__NOP
();
// BU98R10_DELAY_NS;
//PORT_SetBit(SEG_LCD_SCL);
*
((
volatile
uint8_t
*
)(
0x40040300UL
+
SEG_LCD_SCL_PORT
))
|=
(
1
<<
SEG_LCD_SCL_PIN
);
//PORT_SetBit
BU98R10_DELAY_NS
;
/* SCL 输出高 */
// BU98R10_DELAY_NS;
*
((
volatile
uint8_t
*
)(
SEG_LCD0_SCL
))
|=
(
1
<<
SEG_LCD0_SCL_PIN
);
// BU98R10_DELAY_NS;
// BU98R10_DELAY_NS;
Dat
<<=
1
;
Dat
<<=
1
;
}
}
//PORT_SetBit(SEG_LCD_CSB);
/* CS 输出高 */
*
((
volatile
uint8_t
*
)(
0x40040300UL
+
SEG_LCD_CS_PORT
))
|=
(
1
<<
SEG_LCD_CS_PIN
);
//PORT_SetBit
*
((
volatile
uint8_t
*
)(
SEG_LCD0_CS
))
|=
(
1
<<
SEG_LCD0_CS_PIN
);
BU98R10_DELAY_NS
;
// BU98R10_DELAY_NS;
// BU98R10_DELAY_NS;
}
}
#endif
#endif
#if USE_BU98R10_CHIP_1
#if USE_BU98R10_CHIP_1
/******************************************************************************
函数名:BU98R10_1_Command_Write
功 能:向BU98R10芯片1写控制命令
参 数:Cmd:要写入的命令
返回值:无
******************************************************************************/
void
BU98R10_1_Command_Write
(
uint8_t
Cmd
)
void
BU98R10_1_Command_Write
(
uint8_t
Cmd
)
{
{
uint8_t
i
;
uint8_t
i
;
//D/C = 0,表示发送命令
/* SD 输出低 */
PORT_ClrBit
(
SEG_LCD_SD1
);
*
((
volatile
uint8_t
*
)(
SEG_LCD1_SD
))
&=
~
(
1
<<
SEG_LCD1_SD_PIN
);
PORT_ClrBit
(
SEG_LCD_SCL1
);
/* SCL 输出低 */
PORT_ClrBit
(
SEG_LCD_CSB1
);
*
((
volatile
uint8_t
*
)(
SEG_LCD1_SCL
))
&=
~
(
1
<<
SEG_LCD1_SCL_PIN
);
/* CS 输出低 */
*
((
volatile
uint8_t
*
)(
SEG_LCD1_CS
))
&=
~
(
1
<<
SEG_LCD1_CS_PIN
);
BU98R10_DELAY_NS
;
__NOP
();
BU98R10_DELAY_NS
;
__NOP
();
BU98R10_DELAY_NS
;
__NOP
();
BU98R10_DELAY_NS
;
BU98R10_DELAY_NS
;
BU98R10_DELAY_NS
;
PORT_SetBit
(
SEG_LCD_SCL1
);
BU98R10_DELAY_NS
;
/* SCL 输出高 */
BU98R10_DELAY_NS
;
*
((
volatile
uint8_t
*
)(
SEG_LCD1_SCL
))
|=
(
1
<<
SEG_LCD1_SCL_PIN
);
BU98R10_DELAY_NS
;
BU98R10_DELAY_NS
;
BU98R10_DELAY_NS
;
BU98R10_DELAY_NS
;
for
(
i
=
0
;
i
<
8
;
i
++
)
{
for
(
i
=
0
;
i
<
8
;
i
++
)
PORT_ClrBit
(
SEG_LCD_SCL1
);
{
/* SCL 输出低 */
*
((
volatile
uint8_t
*
)(
SEG_LCD1_SCL
))
&=
~
(
1
<<
SEG_LCD1_SCL_PIN
);
if
(
Cmd
&
0x80
)
if
(
Cmd
&
0x80
)
{
PORT_SetBit
(
SEG_LCD_SD1
);
}
/* SD 输出高 */
*
((
volatile
uint8_t
*
)(
SEG_LCD1_SD
))
|=
(
1
<<
SEG_LCD1_SD_PIN
);
else
else
{
PORT_ClrBit
(
SEG_LCD_SD1
);
}
/* SD 输出低 */
*
((
volatile
uint8_t
*
)(
SEG_LCD1_SD
))
&=
~
(
1
<<
SEG_LCD1_SD_PIN
);
BU98R10_DELAY_NS
;
BU98R10_DELAY_NS
;
BU98R10_DELAY_NS
;
BU98R10_DELAY_NS
;
PORT_SetBit
(
SEG_LCD_SCL1
);
__NOP
();
__NOP
();
__NOP
();
BU98R10_DELAY_NS
;
/* SCL 输出高 */
BU98R10_DELAY_NS
;
*
((
volatile
uint8_t
*
)(
SEG_LCD1_SCL
))
|=
(
1
<<
SEG_LCD1_SCL_PIN
);
BU98R10_DELAY_NS
;
BU98R10_DELAY_NS
;
Cmd
<<=
1
;
Cmd
<<=
1
;
}
}
PORT_SetBit
(
SEG_LCD_CSB1
);
/* CS 输出高 */
*
((
volatile
uint8_t
*
)(
SEG_LCD0_CS
))
|=
(
1
<<
SEG_LCD0_CS_PIN
);
BU98R10_DELAY_NS
;
BU98R10_DELAY_NS
;
BU98R10_DELAY_NS
;
}
}
/******************************************************************************
函数名:BU98R10_1_Data_Write
功 能:向BU98R10芯片1写数据
参 数:Dat:要写入的数据
返回值:无
******************************************************************************/
void
BU98R10_1_Data_Write
(
uint8_t
Dat
)
void
BU98R10_1_Data_Write
(
uint8_t
Dat
)
{
{
uint8_t
i
;
uint8_t
i
;
//D/C = 1,表示发送数据
/* SD 输出高 */
PORT_SetBit
(
SEG_LCD_SD1
);
*
((
volatile
uint8_t
*
)(
SEG_LCD1_SD
))
|=
(
1
<<
SEG_LCD1_SD_PIN
);
PORT_ClrBit
(
SEG_LCD_SCL1
);
/* SCL 输出低 */
PORT_ClrBit
(
SEG_LCD_CSB1
);
*
((
volatile
uint8_t
*
)(
SEG_LCD1_SCL
))
&=
~
(
1
<<
SEG_LCD1_SCL_PIN
);
/* CS 输出低 */
BU98R10_DELAY_NS
;
*
((
volatile
uint8_t
*
)(
SEG_LCD1_CS
))
&=
~
(
1
<<
SEG_LCD1_CS_PIN
);
BU98R10_DELAY_NS
;
BU98R10_DELAY_NS
;
BU98R10_DELAY_NS
;
BU98R10_DELAY_NS
;
BU98R10_DELAY_NS
;
PORT_SetBit
(
SEG_LCD_SCL1
);
__NOP
();
__NOP
();
__NOP
();
BU98R10_DELAY_NS
;
/* SCL 输出高 */
BU98R10_DELAY_NS
;
*
((
volatile
uint8_t
*
)(
SEG_LCD1_SCL
))
|=
(
1
<<
SEG_LCD1_SCL_PIN
);
BU98R10_DELAY_NS
;
BU98R10_DELAY_NS
;
BU98R10_DELAY_NS
;
BU98R10_DELAY_NS
;
for
(
i
=
0
;
i
<
8
;
i
++
)
{
for
(
i
=
0
;
i
<
8
;
i
++
)
PORT_ClrBit
(
SEG_LCD_SCL1
);
{
/* SCL 输出低 */
*
((
volatile
uint8_t
*
)(
SEG_LCD1_SCL
))
&=
~
(
1
<<
SEG_LCD1_SCL_PIN
);
if
(
Dat
&
0x80
)
if
(
Dat
&
0x80
)
{
PORT_SetBit
(
SEG_LCD_SD1
);
}
/* SD 输出高 */
*
((
volatile
uint8_t
*
)(
SEG_LCD1_SD
))
|=
(
1
<<
SEG_LCD1_SD_PIN
);
else
else
{
PORT_ClrBit
(
SEG_LCD_SD1
);
}
/* SD 输出低 */
*
((
volatile
uint8_t
*
)(
SEG_LCD1_SD
))
&=
~
(
1
<<
SEG_LCD1_SD_PIN
);
BU98R10_DELAY_NS
;
__NOP
();
BU98R10_DELAY_NS
;
__NOP
();
BU98R10_DELAY_NS
;
__NOP
();
BU98R10_DELAY_NS
;
PORT_SetBit
(
SEG_LCD_SCL1
);
BU98R10_DELAY_NS
;
/* SCL 输出高 */
BU98R10_DELAY_NS
;
*
((
volatile
uint8_t
*
)(
SEG_LCD1_SCL
))
|=
(
1
<<
SEG_LCD1_SCL_PIN
);
BU98R10_DELAY_NS
;
BU98R10_DELAY_NS
;
Dat
<<=
1
;
Dat
<<=
1
;
}
}
PORT_SetBit
(
SEG_LCD_CSB1
);
/* CS 输出高 */
*
((
volatile
uint8_t
*
)(
SEG_LCD0_CS
))
|=
(
1
<<
SEG_LCD0_CS_PIN
);
BU98R10_DELAY_NS
;
BU98R10_DELAY_NS
;
BU98R10_DELAY_NS
;
}
}
#endif
#endif
#if BU98R10_WRITE_AT_SAME_TIME
#if BU98R10_WRITE_AT_SAME_TIME
/******************************************************************************
函数名:BU98R10_All_Command_Write
功 能:同时向BU98R10芯片0和芯片1写控制命令
参 数:Cmd:要写入的命令
返回值:无
******************************************************************************/
void
BU98R10_All_Command_Write
(
uint8_t
Cmd
)
void
BU98R10_All_Command_Write
(
uint8_t
Cmd
)
{
{
uint8_t
i
;
uint8_t
i
;
//D/C = 0,表示发送命令
/* SD/SCL/CS 输出低电平 */
*
((
volatile
uint8_t
*
)(
0x40040300UL
+
SEG_LCD_SD_PORT
))
&=
~
(
1
<<
SEG_LCD_SD_PIN
);
//PORT_ClrBit
*
((
volatile
uint8_t
*
)(
SEG_LCD0_SD
))
&=
~
(
1
<<
SEG_LCD0_SD_PIN
);
*
((
volatile
uint8_t
*
)(
0x40040300UL
+
SEG_LCD_SCL_PORT
))
&=
~
(
1
<<
SEG_LCD_SCL_PIN
);
//PORT_ClrBit
*
((
volatile
uint8_t
*
)(
SEG_LCD1_SD
))
&=
~
(
1
<<
SEG_LCD1_SD_PIN
);
*
((
volatile
uint8_t
*
)(
0x40040300UL
+
SEG_LCD_CS_PORT
))
&=
~
(
1
<<
SEG_LCD_CS_PIN
);
//PORT_ClrBit
*
((
volatile
uint8_t
*
)(
0x40040300UL
+
SEG_LCD_SD1_PORT
))
&=
~
(
1
<<
SEG_LCD_SD1_PIN
);
//PORT_ClrBit
*
((
volatile
uint8_t
*
)(
0x40040300UL
+
SEG_LCD_SCL1_PORT
))
&=
~
(
1
<<
SEG_LCD_SCL1_PIN
);
//PORT_ClrBit
*
((
volatile
uint8_t
*
)(
0x40040300UL
+
SEG_LCD_CS1_PORT
))
&=
~
(
1
<<
SEG_LCD_CS1_PIN
);
//PORT_ClrBit
*
((
volatile
uint8_t
*
)(
SEG_LCD0_SCL
))
&=
~
(
1
<<
SEG_LCD0_SCL_PIN
);
*
((
volatile
uint8_t
*
)(
SEG_LCD1_SCL
))
&=
~
(
1
<<
SEG_LCD1_SCL_PIN
);
// PORT_ClrBit(SEG_LCD_SD
);
*
((
volatile
uint8_t
*
)(
SEG_LCD0_CS
))
&=
~
(
1
<<
SEG_LCD0_CS_PIN
);
// PORT_ClrBit(SEG_LCD_SD1
);
*
((
volatile
uint8_t
*
)(
SEG_LCD1_CS
))
&=
~
(
1
<<
SEG_LCD1_CS_PIN
);
// PORT_ClrBit(SEG_LCD_SCL);
__NOP
();
// PORT_ClrBit(SEG_LCD_SCL1);
/* SCL 输出高 */
*
((
volatile
uint8_t
*
)(
SEG_LCD0_SCL
))
|=
(
1
<<
SEG_LCD0_SCL_PIN
);
// PORT_ClrBit(SEG_LCD_CSB);
*
((
volatile
uint8_t
*
)(
SEG_LCD1_SCL
))
|=
(
1
<<
SEG_LCD1_SCL_PIN
);
// PORT_ClrBit(SEG_LCD_CSB1);
// BU98R10_DELAY_NS;
// BU98R10_DELAY_NS;
// BU98R10_DELAY_NS;
// BU98R10_DELAY_NS;
// BU98R10_DELAY_NS;
// BU98R10_DELAY_NS;
// PORT_SetBit(SEG_LCD_SCL);
// PORT_SetBit(SEG_LCD_SCL1);
*
((
volatile
uint8_t
*
)(
0x40040300UL
+
SEG_LCD_SCL_PORT
))
|=
(
1
<<
SEG_LCD_SCL_PIN
);
//PORT_SetBit
*
((
volatile
uint8_t
*
)(
0x40040300UL
+
SEG_LCD_SCL1_PORT
))
|=
(
1
<<
SEG_LCD_SCL1_PIN
);
//PORT_SetBit
// BU98R10_DELAY_NS;
// BU98R10_DELAY_NS;
// BU98R10_DELAY_NS;
// BU98R10_DELAY_NS;
// BU98R10_DELAY_NS;
// BU98R10_DELAY_NS;
for
(
i
=
0
;
i
<
8
;
i
++
)
{
for
(
i
=
0
;
i
<
8
;
i
++
)
// PORT_ClrBit(SEG_LCD_SCL);
{
// PORT_ClrBit(SEG_LCD_SCL1);
/* SCL 输出低 */
*
((
volatile
uint8_t
*
)(
0x40040300UL
+
SEG_LCD_SCL_PORT
))
&=
~
(
1
<<
SEG_LCD_SCL_PIN
);
//PORT_ClrBit
*
((
volatile
uint8_t
*
)(
SEG_LCD0_SCL
))
&=
~
(
1
<<
SEG_LCD0_SCL_PIN
);
*
((
volatile
uint8_t
*
)(
0x40040300UL
+
SEG_LCD_SCL1_PORT
))
&=
~
(
1
<<
SEG_LCD_SCL1_PIN
);
//PORT_ClrBit
*
((
volatile
uint8_t
*
)(
SEG_LCD1_SCL
))
&=
~
(
1
<<
SEG_LCD1_SCL_PIN
);
if
(
Cmd
&
0x80
)
{
if
(
Cmd
&
0x80
)
// PORT_SetBit(SEG_LCD_SD);
{
// PORT_SetBit(SEG_LCD_SD1);
/* SD 输出高 */
{
*
((
volatile
uint8_t
*
)(
0x40040300UL
+
SEG_LCD_SD_PORT
))
|=
(
1
<<
SEG_LCD_SD_PIN
);
}
//PORT_SetBit
*
((
volatile
uint8_t
*
)(
SEG_LCD0_SD
))
|=
(
1
<<
SEG_LCD0_SD_PIN
);
{
*
((
volatile
uint8_t
*
)(
0x40040300UL
+
SEG_LCD_SD1_PORT
))
|=
(
1
<<
SEG_LCD_SD1_PIN
);
}
//PORT_SetBit
*
((
volatile
uint8_t
*
)(
SEG_LCD1_SD
))
|=
(
1
<<
SEG_LCD1_SD_PIN
);
}
}
else
{
else
// PORT_ClrBit(SEG_LCD_SD);
{
// PORT_ClrBit(SEG_LCD_SD1);
/* SD 输出低 */
{
*
((
volatile
uint8_t
*
)(
0x40040300UL
+
SEG_LCD_SD_PORT
))
&=
~
(
1
<<
SEG_LCD_SD_PIN
);
}
//PORT_ClrBit
*
((
volatile
uint8_t
*
)(
SEG_LCD0_SD
))
&=
~
(
1
<<
SEG_LCD0_SD_PIN
);
{
*
((
volatile
uint8_t
*
)(
0x40040300UL
+
SEG_LCD_SD1_PORT
))
&=
~
(
1
<<
SEG_LCD_SD1_PIN
);
}
//PORT_ClrBit
*
((
volatile
uint8_t
*
)(
SEG_LCD1_SD
))
&=
~
(
1
<<
SEG_LCD1_SD_PIN
);
}
}
// BU98R10_DELAY_NS;
__NOP
();
// BU98R10_DELAY_NS;
/* SCL 输出高 */
// BU98R10_DELAY_NS;
*
((
volatile
uint8_t
*
)(
SEG_LCD0_SCL
))
|=
(
1
<<
SEG_LCD0_SCL_PIN
);
// BU98R10_DELAY_NS;
*
((
volatile
uint8_t
*
)(
SEG_LCD1_SCL
))
|=
(
1
<<
SEG_LCD1_SCL_PIN
);
// PORT_SetBit(SEG_LCD_SCL);
// PORT_SetBit(SEG_LCD_SCL1);
*
((
volatile
uint8_t
*
)(
0x40040300UL
+
SEG_LCD_SCL_PORT
))
|=
(
1
<<
SEG_LCD_SCL_PIN
);
//PORT_SetBit
*
((
volatile
uint8_t
*
)(
0x40040300UL
+
SEG_LCD_SCL1_PORT
))
|=
(
1
<<
SEG_LCD_SCL1_PIN
);
//PORT_SetBit
// BU98R10_DELAY_NS;
// BU98R10_DELAY_NS;
// BU98R10_DELAY_NS;
// BU98R10_DELAY_NS;
Cmd
<<=
1
;
Cmd
<<=
1
;
}
}
/* CS 输出高 */
// PORT_SetBit(SEG_LCD_CSB);
*
((
volatile
uint8_t
*
)(
SEG_LCD0_CS
))
|=
(
1
<<
SEG_LCD0_CS_PIN
);
// PORT_SetBit(SEG_LCD_CSB1);
*
((
volatile
uint8_t
*
)(
SEG_LCD1_CS
))
|=
(
1
<<
SEG_LCD1_CS_PIN
);
*
((
volatile
uint8_t
*
)(
0x40040300UL
+
SEG_LCD_CS_PORT
))
|=
(
1
<<
SEG_LCD_CS_PIN
);
//PORT_SetBit
*
((
volatile
uint8_t
*
)(
0x40040300UL
+
SEG_LCD_CS1_PORT
))
|=
(
1
<<
SEG_LCD_CS1_PIN
);
//PORT_SetBit
// BU98R10_DELAY_NS;
// BU98R10_DELAY_NS;
// BU98R10_DELAY_NS;
}
}
/******************************************************************************
函数名:BU98R10_All_Data_Write
功 能:同时向BU98R10芯片0和芯片1写数据
参 数:Dat0:要写入BU98R10芯片0的数据
Dat1:要写入BU98R10芯片1的数据
返回值:无
******************************************************************************/
void
BU98R10_All_Data_Write
(
uint8_t
Dat0
,
uint8_t
Dat1
)
void
BU98R10_All_Data_Write
(
uint8_t
Dat0
,
uint8_t
Dat1
)
{
{
uint8_t
i
;
uint8_t
i
;
//D/C = 1,表示发送数据
/* SD 输出高 */
// PORT_SetBit(SEG_LCD_SD);
*
((
volatile
uint8_t
*
)(
SEG_LCD0_SD
))
|=
(
1
<<
SEG_LCD0_SD_PIN
);
// PORT_SetBit(SEG_LCD_SD1);
*
((
volatile
uint8_t
*
)(
SEG_LCD1_SD
))
|=
(
1
<<
SEG_LCD1_SD_PIN
);
// PORT_ClrBit(SEG_LCD_SCL);
/* SCL 输出低 */
// PORT_ClrBit(SEG_LCD_SCL1);
*
((
volatile
uint8_t
*
)(
SEG_LCD0_SCL
))
&=
~
(
1
<<
SEG_LCD0_SCL_PIN
);
*
((
volatile
uint8_t
*
)(
SEG_LCD1_SCL
))
&=
~
(
1
<<
SEG_LCD1_SCL_PIN
);
// PORT_ClrBit(SEG_LCD_CSB);
// PORT_ClrBit(SEG_LCD_CSB1);
/* CS 输出低 */
*
((
volatile
uint8_t
*
)(
0x40040300UL
+
SEG_LCD_SD_PORT
))
|=
(
1
<<
SEG_LCD_SD_PIN
);
//PORT_SetBit
*
((
volatile
uint8_t
*
)(
SEG_LCD0_CS
))
&=
~
(
1
<<
SEG_LCD0_CS_PIN
);
*
((
volatile
uint8_t
*
)(
0x40040300UL
+
SEG_LCD_SCL_PORT
))
&=
~
(
1
<<
SEG_LCD_SCL_PIN
);
//PORT_ClrBit
*
((
volatile
uint8_t
*
)(
SEG_LCD1_CS
))
&=
~
(
1
<<
SEG_LCD1_CS_PIN
);
*
((
volatile
uint8_t
*
)(
0x40040300UL
+
SEG_LCD_CS_PORT
))
&=
~
(
1
<<
SEG_LCD_CS_PIN
);
//PORT_ClrBit
__NOP
();
*
((
volatile
uint8_t
*
)(
0x40040300UL
+
SEG_LCD_SD1_PORT
))
|=
(
1
<<
SEG_LCD_SD1_PIN
);
//PORT_SetBit
*
((
volatile
uint8_t
*
)(
0x40040300UL
+
SEG_LCD_SCL1_PORT
))
&=
~
(
1
<<
SEG_LCD_SCL1_PIN
);
//PORT_ClrBit
/* SCL 输出高 */
*
((
volatile
uint8_t
*
)(
0x40040300UL
+
SEG_LCD_CS1_PORT
))
&=
~
(
1
<<
SEG_LCD_CS1_PIN
);
//PORT_ClrBit
*
((
volatile
uint8_t
*
)(
SEG_LCD0_SCL
))
|=
(
1
<<
SEG_LCD0_SCL_PIN
);
*
((
volatile
uint8_t
*
)(
SEG_LCD1_SCL
))
|=
(
1
<<
SEG_LCD1_SCL_PIN
);
// BU98R10_DELAY_NS;
// BU98R10_DELAY_NS;
for
(
i
=
0
;
i
<
8
;
i
++
)
// BU98R10_DELAY_NS;
{
// BU98R10_DELAY_NS;
/* SCL 输出低 */
// BU98R10_DELAY_NS;
*
((
volatile
uint8_t
*
)(
SEG_LCD0_SCL
))
&=
~
(
1
<<
SEG_LCD0_SCL_PIN
);
// BU98R10_DELAY_NS;
*
((
volatile
uint8_t
*
)(
SEG_LCD1_SCL
))
&=
~
(
1
<<
SEG_LCD1_SCL_PIN
);
// PORT_SetBit(SEG_LCD_SCL);
// PORT_SetBit(SEG_LCD_SCL1);
*
((
volatile
uint8_t
*
)(
0x40040300UL
+
SEG_LCD_SCL_PORT
))
|=
(
1
<<
SEG_LCD_SCL_PIN
);
//PORT_SetBit
*
((
volatile
uint8_t
*
)(
0x40040300UL
+
SEG_LCD_SCL1_PORT
))
|=
(
1
<<
SEG_LCD_SCL1_PIN
);
//PORT_SetBit
// BU98R10_DELAY_NS;
// BU98R10_DELAY_NS;
// BU98R10_DELAY_NS;
// BU98R10_DELAY_NS;
// BU98R10_DELAY_NS;
// BU98R10_DELAY_NS;
for
(
i
=
0
;
i
<
8
;
i
++
)
{
// PORT_ClrBit(SEG_LCD_SCL);
// PORT_ClrBit(SEG_LCD_SCL1);
*
((
volatile
uint8_t
*
)(
0x40040300UL
+
SEG_LCD_SCL_PORT
))
&=
~
(
1
<<
SEG_LCD_SCL_PIN
);
//PORT_ClrBit
*
((
volatile
uint8_t
*
)(
0x40040300UL
+
SEG_LCD_SCL1_PORT
))
&=
~
(
1
<<
SEG_LCD_SCL1_PIN
);
//PORT_ClrBit
if
(
Dat0
&
0x80
)
if
(
Dat0
&
0x80
)
// { PORT_SetBit(SEG_LCD_SD); }
*
((
volatile
uint8_t
*
)(
SEG_LCD0_SD
))
|=
(
1
<<
SEG_LCD0_SD_PIN
);
{
*
((
volatile
uint8_t
*
)(
0x40040300UL
+
SEG_LCD_SD_PORT
))
|=
(
1
<<
SEG_LCD_SD_PIN
);
}
//PORT_SetBit
else
else
// { PORT_ClrBit(SEG_LCD_SD); }
*
((
volatile
uint8_t
*
)(
SEG_LCD0_SD
))
&=
~
(
1
<<
SEG_LCD0_SD_PIN
);
{
*
((
volatile
uint8_t
*
)(
0x40040300UL
+
SEG_LCD_SD_PORT
))
&=
~
(
1
<<
SEG_LCD_SD_PIN
);
}
//PORT_ClrBit
if
(
Dat1
&
0x80
)
if
(
Dat1
&
0x80
)
// { PORT_SetBit(SEG_LCD_SD1); }
*
((
volatile
uint8_t
*
)(
SEG_LCD0_SD
))
|=
(
1
<<
SEG_LCD0_SD_PIN
);
{
*
((
volatile
uint8_t
*
)(
0x40040300UL
+
SEG_LCD_SD1_PORT
))
|=
(
1
<<
SEG_LCD_SD1_PIN
);
}
//PORT_SetBit
else
else
// { PORT_ClrBit(SEG_LCD_SD1); }
*
((
volatile
uint8_t
*
)(
SEG_LCD1_SD
))
&=
~
(
1
<<
SEG_LCD1_SD_PIN
);
{
*
((
volatile
uint8_t
*
)(
0x40040300UL
+
SEG_LCD_SD1_PORT
))
&=
~
(
1
<<
SEG_LCD_SD1_PIN
);
}
//PORT_ClrBit
// BU98R10_DELAY_NS;
// BU98R10_DELAY_NS;
// BU98R10_DELAY_NS;
// BU98R10_DELAY_NS;
// PORT_SetBit(SEG_LCD_SCL);
__NOP
();
// PORT_SetBit(SEG_LCD_SCL1);
*
((
volatile
uint8_t
*
)(
0x40040300UL
+
SEG_LCD_SCL_PORT
))
|=
(
1
<<
SEG_LCD_SCL_PIN
);
//PORT_SetBit
*
((
volatile
uint8_t
*
)(
0x40040300UL
+
SEG_LCD_SCL1_PORT
))
|=
(
1
<<
SEG_LCD_SCL1_PIN
);
//PORT_SetBit
// BU98R10_DELAY_NS;
*
((
volatile
uint8_t
*
)(
SEG_LCD0_SCL
))
|=
(
1
<<
SEG_LCD0_SCL_PIN
);
// BU98R10_DELAY_NS;
*
((
volatile
uint8_t
*
)(
SEG_LCD1_SCL
))
|=
(
1
<<
SEG_LCD1_SCL_PIN
);
// BU98R10_DELAY_NS;
// BU98R10_DELAY_NS;
Dat0
<<=
1
;
Dat0
<<=
1
;
Dat1
<<=
1
;
Dat1
<<=
1
;
}
}
// PORT_SetBit(SEG_LCD_CSB);
/* CS 输出高 */
// PORT_SetBit(SEG_LCD_CSB1);
*
((
volatile
uint8_t
*
)(
SEG_LCD0_CS
))
|=
(
1
<<
SEG_LCD0_CS_PIN
);
*
((
volatile
uint8_t
*
)(
0x40040300UL
+
SEG_LCD_CS_PORT
))
|=
(
1
<<
SEG_LCD_CS_PIN
);
//PORT_SetBit
*
((
volatile
uint8_t
*
)(
SEG_LCD1_CS
))
|=
(
1
<<
SEG_LCD1_CS_PIN
);
*
((
volatile
uint8_t
*
)(
0x40040300UL
+
SEG_LCD_CS1_PORT
))
|=
(
1
<<
SEG_LCD_CS1_PIN
);
//PORT_SetBit
// BU98R10_DELAY_NS;
// BU98R10_DELAY_NS;
// BU98R10_DELAY_NS;
}
}
#endif
#if
0
#if
BU98R10_WRITE_AT_SAME_TIME
static
void
BU98R10_All_ReadRam
(
uint8_t
addr
,
uint8_t
*
data0
,
uint8_t
*
data1
)
static
void
BU98R10_All_ReadRam
(
uint8_t
addr
,
uint8_t
*
data0
,
uint8_t
*
data1
)
{
{
uint8_t
i
;
uint8_t
i
;
...
@@ -1150,176 +963,129 @@ static void BU98R10_All_ReadRam(uint8_t addr, uint8_t *data0, uint8_t *data1)
...
@@ -1150,176 +963,129 @@ static void BU98R10_All_ReadRam(uint8_t addr, uint8_t *data0, uint8_t *data1)
BU98R10_All_Data_Write
(
addr
,
addr
);
BU98R10_All_Data_Write
(
addr
,
addr
);
Cmd
=
0x09
;
Cmd
=
0x09
;
// D/C = 0,表示发送命令
// D/C = 0,表示发送命令
//SegLCD_Set_SD(0);
*
((
volatile
uint8_t
*
)(
SEG_LCD0_SD
))
&=
~
(
1
<<
SEG_LCD0_SD_PIN
);
//SegLCD_Set_SCL(0);
*
((
volatile
uint8_t
*
)(
SEG_LCD1_SD
))
&=
~
(
1
<<
SEG_LCD1_SD_PIN
);
//SegLCD_Set_CSB(0);
*
((
volatile
uint8_t
*
)(
SEG_LCD0_SCL
))
&=
~
(
1
<<
SEG_LCD0_SCL_PIN
);
//PORT_ClrBit(SEG_LCD_SD);
*
((
volatile
uint8_t
*
)(
SEG_LCD1_SCL
))
&=
~
(
1
<<
SEG_LCD1_SCL_PIN
);
//PORT_ClrBit(SEG_LCD_SCL);
//PORT_ClrBit(SEG_LCD_CSB);
*
((
volatile
uint8_t
*
)(
SEG_LCD0_CS
))
&=
~
(
1
<<
SEG_LCD0_CS_PIN
);
*
((
volatile
uint8_t
*
)(
SEG_LCD1_CS
))
&=
~
(
1
<<
SEG_LCD1_CS_PIN
);
PORT_ClrBit(SEG_LCD_SD1);
PORT_ClrBit(SEG_LCD_SCL1);
__NOP
();
PORT_ClrBit(SEG_LCD_CSB1);
__NOP
();
__NOP
();
BU98R10_DELAY_NS;
/* SCL 输出高 */
BU98R10_DELAY_NS;
*
((
volatile
uint8_t
*
)(
SEG_LCD0_SCL
))
|=
(
1
<<
SEG_LCD0_SCL_PIN
);
BU98R10_DELAY_NS;
*
((
volatile
uint8_t
*
)(
SEG_LCD1_SCL
))
|=
(
1
<<
SEG_LCD1_SCL_PIN
);
BU98R10_DELAY_NS;
BU98R10_DELAY_NS;
for
(
i
=
0
;
i
<
8
;
i
++
)
BU98R10_DELAY_NS;
{
/* SCL 输出低 */
//SegLCD_Set_SCL(1);
*
((
volatile
uint8_t
*
)(
SEG_LCD0_SCL
))
&=
~
(
1
<<
SEG_LCD0_SCL_PIN
);
//PORT_SetBit(SEG_LCD_SCL);
*
((
volatile
uint8_t
*
)(
SEG_LCD1_SCL
))
&=
~
(
1
<<
SEG_LCD1_SCL_PIN
);
PORT_SetBit(SEG_LCD_SCL1);
if
(
Cmd
&
0x80
)
for (i = 0; i < 8; i++) {
{
//SegLCD_Set_SCL(0);
/* SD 输出高 */
//PORT_ClrBit(SEG_LCD_SCL);
*
((
volatile
uint8_t
*
)(
SEG_LCD0_SD
))
|=
(
1
<<
SEG_LCD0_SD_PIN
);
PORT_ClrBit(SEG_LCD_SCL1);
*
((
volatile
uint8_t
*
)(
SEG_LCD1_SD
))
|=
(
1
<<
SEG_LCD1_SD_PIN
);
if (Cmd & 0x80) {
//SegLCD_Set_SD(1);
//PORT_SetBit(SEG_LCD_SD);
PORT_SetBit(SEG_LCD_SD1);
}
}
else {
else
//SegLCD_Set_SD(0);
{
//PORT_ClrBit(SEG_LCD_SD);
/* SD 输出低 */
PORT_ClrBit(SEG_LCD_SD1);
*
((
volatile
uint8_t
*
)(
SEG_LCD0_SD
))
&=
~
(
1
<<
SEG_LCD0_SD_PIN
);
*
((
volatile
uint8_t
*
)(
SEG_LCD1_SD
))
&=
~
(
1
<<
SEG_LCD1_SD_PIN
);
}
}
BU98R10_DELAY_NS;
__NOP
();
BU98R10_DELAY_NS;
__NOP
();
BU98R10_DELAY_NS;
__NOP
();
BU98R10_DELAY_NS;
BU98R10_DELAY_NS;
BU98R10_DELAY_NS;
//SegLCD_Set_SCL(1);
//PORT_SetBit(SEG_LCD_SCL);
PORT_SetBit(SEG_LCD_SCL1);
/* SCL 输出高 */
*
((
volatile
uint8_t
*
)(
SEG_LCD0_SCL
))
|=
(
1
<<
SEG_LCD0_SCL_PIN
);
*
((
volatile
uint8_t
*
)(
SEG_LCD1_SCL
))
|=
(
1
<<
SEG_LCD1_SCL_PIN
);
Cmd
<<=
1
;
Cmd
<<=
1
;
}
}
//SegLCD_Set_SD_Dir(0);
// PORT_Init(SEG_LCD_SD1, INPUT); // ???
//PORT_Init(SEG_LCD_SD, INPUT);
// PORT_Init(SEG_LCD_SD1, INPUT); // ???
PORT_Init(SEG_LCD_SD1, INPUT);
/* SCL 输出低 */
//SegLCD_Set_SCL(0);
*
((
volatile
uint8_t
*
)(
SEG_LCD0_SCL
))
&=
~
(
1
<<
SEG_LCD0_SCL_PIN
);
//PORT_ClrBit(SEG_LCD_SCL);
*
((
volatile
uint8_t
*
)(
SEG_LCD1_SCL
))
&=
~
(
1
<<
SEG_LCD1_SCL_PIN
);
PORT_ClrBit(SEG_LCD_SCL1);
__NOP
();
__NOP
();
BU98R10_DELAY_NS;
__NOP
();
BU98R10_DELAY_NS;
BU98R10_DELAY_NS;
/* SCL 输出高 */
BU98R10_DELAY_NS;
*
((
volatile
uint8_t
*
)(
SEG_LCD0_SCL
))
|=
(
1
<<
SEG_LCD0_SCL_PIN
);
BU98R10_DELAY_NS;
*
((
volatile
uint8_t
*
)(
SEG_LCD1_SCL
))
|=
(
1
<<
SEG_LCD1_SCL_PIN
);
BU98R10_DELAY_NS;
__NOP
();
__NOP
();
//SegLCD_Set_SCL(1);
__NOP
();
//PORT_SetBit(SEG_LCD_SCL);
PORT_SetBit(SEG_LCD_SCL1);
for
(
i
=
0
;
i
<
8
;
i
++
)
{
BU98R10_DELAY_NS;
/* SCL 输出低 */
BU98R10_DELAY_NS;
*
((
volatile
uint8_t
*
)(
SEG_LCD0_SCL
))
&=
~
(
1
<<
SEG_LCD0_SCL_PIN
);
BU98R10_DELAY_NS;
*
((
volatile
uint8_t
*
)(
SEG_LCD1_SCL
))
&=
~
(
1
<<
SEG_LCD1_SCL_PIN
);
BU98R10_DELAY_NS;
wdata0
<<=
1
;
BU98R10_DELAY_NS;
BU98R10_DELAY_NS;
for (i = 0; i < 8; i++) {
//SegLCD_Set_SCL(0);
//PORT_ClrBit(SEG_LCD_SCL);
PORT_ClrBit(SEG_LCD_SCL1);
//wdata0 <<= 1;
wdata1
<<=
1
;
wdata1
<<=
1
;
//SegLCD_Set_SCL(1);
/* SCL 输出高 */
//PORT_SetBit(SEG_LCD_SCL
);
*
((
volatile
uint8_t
*
)(
SEG_LCD0_SCL
))
|=
(
1
<<
SEG_LCD0_SCL_PIN
);
PORT_SetBit(SEG_LCD_SCL1
);
*
((
volatile
uint8_t
*
)(
SEG_LCD1_SCL
))
|=
(
1
<<
SEG_LCD1_SCL_PIN
);
/*if (SegLCD_Get_SD0_Data
)
if
(
*
((
volatile
uint8_t
*
)(
SEG_LCD0_SD
))
&
SEG_LCD0_SD_PIN
)
{
{
wdata0 |= SegLCD_Get_SD0_Data
;
wdata0
|=
*
((
volatile
uint8_t
*
)(
SEG_LCD0_SD
))
&
SEG_LCD0_SD_PIN
;
}
}
if (SegLCD_Get_SD1_Data)
if
(
*
((
volatile
uint8_t
*
)(
SEG_LCD1_SD
))
&
SEG_LCD1_SD_PIN
)
{
wdata1 |= SegLCD_Get_SD1_Data;
}*/
//if (PORT_GetBit(SEG_LCD_SD))
{
{
//wdata0 |= PORT_GetBit(SEG_LCD_SD);
wdata0
|=
*
((
volatile
uint8_t
*
)(
SEG_LCD1_SD
))
&
SEG_LCD1_SD_PIN
;
}
if (PORT_GetBit(SEG_LCD_SD1)) {
wdata1 |= PORT_GetBit(SEG_LCD_SD1);
}
}
}
}
*
data0
=
wdata0
;
*
data0
=
wdata0
;
*
data1
=
wdata1
;
*
data1
=
wdata1
;
//SegLCD_Set_SD_Dir(1);
/* SD 方向设置成输出 */
//PORT_Init(SEG_LCD_SD, OUTPUT);
// PORT_Init(SEG_LCD_SD1, OUTPUT); //???
PORT_Init(SEG_LCD_SD1, OUTPUT);
// PORT_Init(SEG_LCD_SD1, OUTPUT); //???
//SegLCD_Set_CSB(1);
/* CS 输出高 */
//PORT_SetBit(SEG_LCD_CSB
);
*
((
volatile
uint8_t
*
)(
SEG_LCD0_CS
))
|=
(
1
<<
SEG_LCD0_CS_PIN
);
PORT_SetBit(SEG_LCD_CSB1
);
*
((
volatile
uint8_t
*
)(
SEG_LCD1_CS
))
|=
(
1
<<
SEG_LCD1_CS_PIN
);
}
}
#endif
#endif
#endif
/*
uint8_t
checkInterval
=
0
;
uint8_t
checkCount
=
0
;
uint8_t checkData[2];
uint8_t checkData[2];
uint8_t
checkDelay
=
0
;
void checkSegTftState(void)
void checkSegTftState(void)
{
{
#if 0
if (System_FUN_KL15_Status_Get()) {
if(checkDelay == 0) {
checkInterval++;
if (checkInterval >= 5) {
BU98R10_0_ReadRam(37, &checkData[0], &checkData[1]); // seg61 加油图标方向段 (61+1)/2 -1 =30 ==0x07 异常时 heckData[1]= 0xff
checkInterval = 0;
if ((checkData[1] & 0x0f) != 0x07) {
if (g_curkeyinput == KeyON)
checkCount = 50;
{
BU98R10Chip1DDRAMBackup.Bit.Seg75 = 0; //BU98R10_1_SEG75
if ((u8BU98R10CheckCount >= 20) && (BU98R10Update.En == 0))
}
{
}
u8BU98R10CheckCount = 0;
}
checkData[0] = 0;
else {
checkData[1] = 0;
checkDelay --;
checkInterval = 0;
}
if(checkCount > 0) {
BU98R10_All_ReadRam(48, &checkData[0], &checkData[1]);
checkCount--;
}
if (checkCount == 30) {
if ((checkData[0] & 0xf0) != 0x70)
checkDelay = 20;
{
SEG_LCD_Init();
BU98R10_Init();
}
}
}
else {
checkInterval = 0;
checkCount = 0;
}
}
#endif
}
}
else
{
u8BU98R10CheckCount = 0;
}
}
*/
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment