Commit 6f94cc8b authored by 高士达's avatar 高士达

feat:增加BU98驱动,待调式

parent 3cd9d850
...@@ -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'
*/ */
......
/******************************************************************************
�� �� ����BU98R10.c
����������BU98R10����Һ�����������������ͷ�ļ�
�� �ߣ�����
�� ����V1.0
�� �ڣ�2017.4.28
******************************************************************************/
#ifndef _BU98R10_H_ #ifndef _BU98R10_H_
#define _BU98R10_H_ #define _BU98R10_H_
#include "GPIO.h" #include "GPIO.h"
#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
/*** ������������ ***/ //#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_SD SEG_LCD_SD
/*** ����ʱ������ ***/
//#define BU98R10_0_SCL SEG_LCD_SCL #define USE_BU98R10_CHIP_1 1
/*** оƬѡ������ ***/ ///#ifndef BU98R10_1_SD
//#define BU98R10_0_CSB SEG_LCD_CSB ///#define BU98R10_1_SD PIN_16_P
///#define SEG_LCD_SD_Dir1 PIN_16_D
///#endif
///
///
///#ifndef BU98R10_1_SCL
///#define BU98R10_1_SCL PIN_17_P
///#endif
///
///
///#ifndef BU98R10_1_CSB
///#define BU98R10_1_CSB PIN_18_P
///#endif
/******************************************************************************
BU98R10 оƬ1����
******************************************************************************/
/*** оƬʹ�� ***/
#define USE_BU98R10_CHIP_1 1
/*** ������������ ***/ #define BU98R10_SD_SCL_MULTIPLEX 0 //0 - ?????? 1 - ????
#ifndef BU98R10_1_SD
//#define BU98R10_1_SD SEG_LCD_SD1
#endif
/*** ����ʱ������ ***/
#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,10 +141,8 @@ BU98R10�����б� ...@@ -186,10 +141,8 @@ 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)
#define BU98R10_PAR_ICSET_EXTCLK ((uint8_t)0x02) #define BU98R10_PAR_ICSET_EXTCLK ((uint8_t)0x02)
...@@ -199,412 +152,406 @@ BU98R10�����б� ...@@ -199,412 +152,406 @@ 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;
uint8_t Chip; uint8_t Chip;
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
typedef union typedef union
{ {
uint8_t Byte[BU98R10_DDRAM_SIZE]; uint8_t Byte[BU98R10_DDRAM_SIZE];
struct struct
{ {
uint8_t Seg1 : 4; uint8_t Seg1 : 4;
uint8_t Seg2 : 4; uint8_t Seg2 : 4;
uint8_t Seg3 : 4; uint8_t Seg3 : 4;
uint8_t Seg4 : 4; uint8_t Seg4 : 4;
uint8_t Seg5 : 4; uint8_t Seg5 : 4;
uint8_t Seg6 : 4; uint8_t Seg6 : 4;
uint8_t Seg7 : 4; uint8_t Seg7 : 4;
uint8_t Seg8 : 4; uint8_t Seg8 : 4;
uint8_t Seg9 : 4; uint8_t Seg9 : 4;
uint8_t Seg10 : 4; uint8_t Seg10 : 4;
uint8_t Seg11 : 4; uint8_t Seg11 : 4;
uint8_t Seg12 : 4; uint8_t Seg12 : 4;
uint8_t Seg13 : 4; uint8_t Seg13 : 4;
uint8_t Seg14 : 4; uint8_t Seg14 : 4;
uint8_t Seg15 : 4; uint8_t Seg15 : 4;
uint8_t Seg16 : 4; uint8_t Seg16 : 4;
uint8_t Seg17 : 4; uint8_t Seg17 : 4;
uint8_t Seg18 : 4; uint8_t Seg18 : 4;
uint8_t Seg19 : 4; uint8_t Seg19 : 4;
uint8_t Seg20 : 4; uint8_t Seg20 : 4;
uint8_t Seg21 : 4; uint8_t Seg21 : 4;
uint8_t Seg22 : 4; uint8_t Seg22 : 4;
uint8_t Seg23 : 4; uint8_t Seg23 : 4;
uint8_t Seg24 : 4; uint8_t Seg24 : 4;
uint8_t Seg25 : 4; uint8_t Seg25 : 4;
uint8_t Seg26 : 4; uint8_t Seg26 : 4;
uint8_t Seg27 : 4; uint8_t Seg27 : 4;
uint8_t Seg28 : 4; uint8_t Seg28 : 4;
uint8_t Seg29 : 4; uint8_t Seg29 : 4;
uint8_t Seg30 : 4; uint8_t Seg30 : 4;
uint8_t Seg31 : 4; uint8_t Seg31 : 4;
uint8_t Seg32 : 4; uint8_t Seg32 : 4;
uint8_t Seg33 : 4; uint8_t Seg33 : 4;
uint8_t Seg34 : 4; uint8_t Seg34 : 4;
uint8_t Seg35 : 4; uint8_t Seg35 : 4;
uint8_t Seg36 : 4; uint8_t Seg36 : 4;
uint8_t Seg37 : 4; uint8_t Seg37 : 4;
uint8_t Seg38 : 4; uint8_t Seg38 : 4;
uint8_t Seg39 : 4; uint8_t Seg39 : 4;
uint8_t Seg40 : 4; uint8_t Seg40 : 4;
uint8_t Seg41 : 4; uint8_t Seg41 : 4;
uint8_t Seg42 : 4; uint8_t Seg42 : 4;
uint8_t Seg43 : 4; uint8_t Seg43 : 4;
uint8_t Seg44 : 4; uint8_t Seg44 : 4;
uint8_t Seg45 : 4; uint8_t Seg45 : 4;
uint8_t Seg46 : 4; uint8_t Seg46 : 4;
uint8_t Seg47 : 4; uint8_t Seg47 : 4;
uint8_t Seg48 : 4; uint8_t Seg48 : 4;
uint8_t Seg49 : 4; uint8_t Seg49 : 4;
uint8_t Seg50 : 4; uint8_t Seg50 : 4;
uint8_t Seg51 : 4; uint8_t Seg51 : 4;
uint8_t Seg52 : 4; uint8_t Seg52 : 4;
uint8_t Seg53 : 4; uint8_t Seg53 : 4;
uint8_t Seg54 : 4; uint8_t Seg54 : 4;
uint8_t Seg55 : 4; uint8_t Seg55 : 4;
uint8_t Seg56 : 4; uint8_t Seg56 : 4;
uint8_t Seg57 : 4; uint8_t Seg57 : 4;
uint8_t Seg58 : 4; uint8_t Seg58 : 4;
uint8_t Seg59 : 4; uint8_t Seg59 : 4;
uint8_t Seg60 : 4; uint8_t Seg60 : 4;
uint8_t Seg61 : 4; uint8_t Seg61 : 4;
uint8_t Seg62 : 4; uint8_t Seg62 : 4;
uint8_t Seg63 : 4; uint8_t Seg63 : 4;
uint8_t Seg64 : 4; uint8_t Seg64 : 4;
uint8_t Seg65 : 4; uint8_t Seg65 : 4;
uint8_t Seg66 : 4; uint8_t Seg66 : 4;
uint8_t Seg67 : 4; uint8_t Seg67 : 4;
uint8_t Seg68 : 4; uint8_t Seg68 : 4;
uint8_t Seg69 : 4; uint8_t Seg69 : 4;
uint8_t Seg70 : 4; uint8_t Seg70 : 4;
uint8_t Seg71 : 4; uint8_t Seg71 : 4;
uint8_t Seg72 : 4; uint8_t Seg72 : 4;
uint8_t Seg73 : 4; uint8_t Seg73 : 4;
uint8_t Seg74 : 4; uint8_t Seg74 : 4;
uint8_t Seg75 : 4; uint8_t Seg75 : 4;
uint8_t Seg76 : 4; uint8_t Seg76 : 4;
uint8_t Seg77 : 4; uint8_t Seg77 : 4;
uint8_t Seg78 : 4; uint8_t Seg78 : 4;
uint8_t Seg79 : 4; uint8_t Seg79 : 4;
uint8_t Seg80 : 4; uint8_t Seg80 : 4;
uint8_t Seg81 : 4; uint8_t Seg81 : 4;
uint8_t Seg82 : 4; uint8_t Seg82 : 4;
uint8_t Seg83 : 4; uint8_t Seg83 : 4;
uint8_t Seg84 : 4; uint8_t Seg84 : 4;
uint8_t Seg85 : 4; uint8_t Seg85 : 4;
uint8_t Seg86 : 4; uint8_t Seg86 : 4;
uint8_t Seg87 : 4; uint8_t Seg87 : 4;
uint8_t Seg88 : 4; uint8_t Seg88 : 4;
uint8_t Seg89 : 4; uint8_t Seg89 : 4;
uint8_t Seg90 : 4; uint8_t Seg90 : 4;
uint8_t Seg91 : 4; uint8_t Seg91 : 4;
uint8_t Seg92 : 4; uint8_t Seg92 : 4;
uint8_t Seg93 : 4; uint8_t Seg93 : 4;
uint8_t Seg94 : 4; uint8_t Seg94 : 4;
uint8_t Seg95 : 4; uint8_t Seg95 : 4;
uint8_t Seg96 : 4; uint8_t Seg96 : 4;
uint8_t Seg97 : 4; uint8_t Seg97 : 4;
uint8_t Seg98 : 4; uint8_t Seg98 : 4;
uint8_t Seg99 : 4; uint8_t Seg99 : 4;
uint8_t Seg100 : 4; uint8_t Seg100 : 4;
uint8_t Seg101 : 4; uint8_t Seg101 : 4;
uint8_t Seg102 : 4; uint8_t Seg102 : 4;
uint8_t Seg103 : 4; uint8_t Seg103 : 4;
uint8_t Seg104 : 4; uint8_t Seg104 : 4;
uint8_t Seg105 : 4; uint8_t Seg105 : 4;
uint8_t Seg106 : 4; uint8_t Seg106 : 4;
uint8_t Seg107 : 4; uint8_t Seg107 : 4;
uint8_t Seg108 : 4; uint8_t Seg108 : 4;
uint8_t Seg109 : 4; uint8_t Seg109 : 4;
uint8_t Seg110 : 4; uint8_t Seg110 : 4;
uint8_t Seg111 : 4; uint8_t Seg111 : 4;
uint8_t Seg112 : 4; uint8_t Seg112 : 4;
uint8_t Seg113 : 4; uint8_t Seg113 : 4;
uint8_t Seg114 : 4; uint8_t Seg114 : 4;
uint8_t Seg115 : 4; uint8_t Seg115 : 4;
uint8_t Seg116 : 4; uint8_t Seg116 : 4;
uint8_t Seg117 : 4; uint8_t Seg117 : 4;
uint8_t Seg118 : 4; uint8_t Seg118 : 4;
uint8_t Seg119 : 4; uint8_t Seg119 : 4;
uint8_t Seg120 : 4; uint8_t Seg120 : 4;
uint8_t Seg121 : 4; uint8_t Seg121 : 4;
uint8_t Seg122 : 4; uint8_t Seg122 : 4;
uint8_t Seg123 : 4; uint8_t Seg123 : 4;
uint8_t Seg124 : 4; uint8_t Seg124 : 4;
uint8_t Seg125 : 4; uint8_t Seg125 : 4;
uint8_t Seg126 : 4; uint8_t Seg126 : 4;
uint8_t Seg127 : 4; uint8_t Seg127 : 4;
uint8_t Seg128 : 4; uint8_t Seg128 : 4;
uint8_t Seg129 : 4; uint8_t Seg129 : 4;
uint8_t Seg130 : 4; uint8_t Seg130 : 4;
uint8_t Seg131 : 4; uint8_t Seg131 : 4;
uint8_t Seg132 : 4; uint8_t Seg132 : 4;
uint8_t Seg133 : 4; uint8_t Seg133 : 4;
uint8_t Seg134 : 4; uint8_t Seg134 : 4;
uint8_t Seg135 : 4; uint8_t Seg135 : 4;
uint8_t Seg136 : 4; uint8_t Seg136 : 4;
uint8_t Seg137 : 4; uint8_t Seg137 : 4;
uint8_t Seg138 : 4; uint8_t Seg138 : 4;
uint8_t Seg139 : 4; uint8_t Seg139 : 4;
uint8_t Seg140 : 4; uint8_t Seg140 : 4;
uint8_t Seg141 : 4; uint8_t Seg141 : 4;
uint8_t Seg142 : 4; uint8_t Seg142 : 4;
uint8_t Seg143 : 4; uint8_t Seg143 : 4;
uint8_t Seg144 : 4; uint8_t Seg144 : 4;
uint8_t Seg145 : 4; uint8_t Seg145 : 4;
uint8_t Seg146 : 4; uint8_t Seg146 : 4;
uint8_t Seg147 : 4; uint8_t Seg147 : 4;
uint8_t Seg148 : 4; uint8_t Seg148 : 4;
uint8_t Seg149 : 4; uint8_t Seg149 : 4;
uint8_t Seg150 : 4; uint8_t Seg150 : 4;
uint8_t Seg151 : 4; uint8_t Seg151 : 4;
uint8_t Seg152 : 4; uint8_t Seg152 : 4;
uint8_t Seg153 : 4; uint8_t Seg153 : 4;
uint8_t Seg154 : 4; uint8_t Seg154 : 4;
uint8_t Seg155 : 4; uint8_t Seg155 : 4;
uint8_t Seg156 : 4; uint8_t Seg156 : 4;
uint8_t Seg157 : 4; uint8_t Seg157 : 4;
uint8_t Seg158 : 4; uint8_t Seg158 : 4;
uint8_t Seg159 : 4; uint8_t Seg159 : 4;
uint8_t Seg160 : 4; uint8_t Seg160 : 4;
uint8_t Seg161 : 4; uint8_t Seg161 : 4;
uint8_t Seg162 : 4; uint8_t Seg162 : 4;
uint8_t Seg163 : 4; uint8_t Seg163 : 4;
uint8_t Seg164 : 4; uint8_t Seg164 : 4;
uint8_t Seg165 : 4; uint8_t Seg165 : 4;
uint8_t Seg166 : 4; uint8_t Seg166 : 4;
uint8_t Seg167 : 4; uint8_t Seg167 : 4;
uint8_t Seg168 : 4; uint8_t Seg168 : 4;
uint8_t Seg169 : 4; uint8_t Seg169 : 4;
uint8_t Seg170 : 4; uint8_t Seg170 : 4;
uint8_t Seg171 : 4; uint8_t Seg171 : 4;
uint8_t Seg172 : 4; uint8_t Seg172 : 4;
uint8_t Seg173 : 4; uint8_t Seg173 : 4;
uint8_t Seg174 : 4; uint8_t Seg174 : 4;
uint8_t Seg175 : 4; uint8_t Seg175 : 4;
uint8_t Seg176 : 4; uint8_t Seg176 : 4;
uint8_t Seg177 : 4; uint8_t Seg177 : 4;
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
#define BU98R10_DDRAM_SIZE 23 #define BU98R10_DDRAM_SIZE 23
typedef union typedef union
{ {
uint8_t Byte[BU98R10_DDRAM_SIZE]; uint8_t Byte[BU98R10_DDRAM_SIZE];
struct struct
{ {
uint8_t Seg1 : 1; uint8_t Seg1 : 1;
uint8_t Seg2 : 1; uint8_t Seg2 : 1;
uint8_t Seg3 : 1; uint8_t Seg3 : 1;
uint8_t Seg4 : 1; uint8_t Seg4 : 1;
uint8_t Seg5 : 1; uint8_t Seg5 : 1;
uint8_t Seg6 : 1; uint8_t Seg6 : 1;
uint8_t Seg7 : 1; uint8_t Seg7 : 1;
uint8_t Seg8 : 1; uint8_t Seg8 : 1;
uint8_t Seg9 : 1; uint8_t Seg9 : 1;
uint8_t Seg10 : 1; uint8_t Seg10 : 1;
uint8_t Seg11 : 1; uint8_t Seg11 : 1;
uint8_t Seg12 : 1; uint8_t Seg12 : 1;
uint8_t Seg13 : 1; uint8_t Seg13 : 1;
uint8_t Seg14 : 1; uint8_t Seg14 : 1;
uint8_t Seg15 : 1; uint8_t Seg15 : 1;
uint8_t Seg16 : 1; uint8_t Seg16 : 1;
uint8_t Seg17 : 1; uint8_t Seg17 : 1;
uint8_t Seg18 : 1; uint8_t Seg18 : 1;
uint8_t Seg19 : 1; uint8_t Seg19 : 1;
uint8_t Seg20 : 1; uint8_t Seg20 : 1;
uint8_t Seg21 : 1; uint8_t Seg21 : 1;
uint8_t Seg22 : 1; uint8_t Seg22 : 1;
uint8_t Seg23 : 1; uint8_t Seg23 : 1;
uint8_t Seg24 : 1; uint8_t Seg24 : 1;
uint8_t Seg25 : 1; uint8_t Seg25 : 1;
uint8_t Seg26 : 1; uint8_t Seg26 : 1;
uint8_t Seg27 : 1; uint8_t Seg27 : 1;
uint8_t Seg28 : 1; uint8_t Seg28 : 1;
uint8_t Seg29 : 1; uint8_t Seg29 : 1;
uint8_t Seg30 : 1; uint8_t Seg30 : 1;
uint8_t Seg31 : 1; uint8_t Seg31 : 1;
uint8_t Seg32 : 1; uint8_t Seg32 : 1;
uint8_t Seg33 : 1; uint8_t Seg33 : 1;
uint8_t Seg34 : 1; uint8_t Seg34 : 1;
uint8_t Seg35 : 1; uint8_t Seg35 : 1;
uint8_t Seg36 : 1; uint8_t Seg36 : 1;
uint8_t Seg37 : 1; uint8_t Seg37 : 1;
uint8_t Seg38 : 1; uint8_t Seg38 : 1;
uint8_t Seg39 : 1; uint8_t Seg39 : 1;
uint8_t Seg40 : 1; uint8_t Seg40 : 1;
uint8_t Seg41 : 1; uint8_t Seg41 : 1;
uint8_t Seg42 : 1; uint8_t Seg42 : 1;
uint8_t Seg43 : 1; uint8_t Seg43 : 1;
uint8_t Seg44 : 1; uint8_t Seg44 : 1;
uint8_t Seg45 : 1; uint8_t Seg45 : 1;
uint8_t Seg46 : 1; uint8_t Seg46 : 1;
uint8_t Seg47 : 1; uint8_t Seg47 : 1;
uint8_t Seg48 : 1; uint8_t Seg48 : 1;
uint8_t Seg49 : 1; uint8_t Seg49 : 1;
uint8_t Seg50 : 1; uint8_t Seg50 : 1;
uint8_t Seg51 : 1; uint8_t Seg51 : 1;
uint8_t Seg52 : 1; uint8_t Seg52 : 1;
uint8_t Seg53 : 1; uint8_t Seg53 : 1;
uint8_t Seg54 : 1; uint8_t Seg54 : 1;
uint8_t Seg55 : 1; uint8_t Seg55 : 1;
uint8_t Seg56 : 1; uint8_t Seg56 : 1;
uint8_t Seg57 : 1; uint8_t Seg57 : 1;
uint8_t Seg58 : 1; uint8_t Seg58 : 1;
uint8_t Seg59 : 1; uint8_t Seg59 : 1;
uint8_t Seg60 : 1; uint8_t Seg60 : 1;
uint8_t Seg61 : 1; uint8_t Seg61 : 1;
uint8_t Seg62 : 1; uint8_t Seg62 : 1;
uint8_t Seg63 : 1; uint8_t Seg63 : 1;
uint8_t Seg64 : 1; uint8_t Seg64 : 1;
uint8_t Seg65 : 1; uint8_t Seg65 : 1;
uint8_t Seg66 : 1; uint8_t Seg66 : 1;
uint8_t Seg67 : 1; uint8_t Seg67 : 1;
uint8_t Seg68 : 1; uint8_t Seg68 : 1;
uint8_t Seg69 : 1; uint8_t Seg69 : 1;
uint8_t Seg70 : 1; uint8_t Seg70 : 1;
uint8_t Seg71 : 1; uint8_t Seg71 : 1;
uint8_t Seg72 : 1; uint8_t Seg72 : 1;
uint8_t Seg73 : 1; uint8_t Seg73 : 1;
uint8_t Seg74 : 1; uint8_t Seg74 : 1;
uint8_t Seg75 : 1; uint8_t Seg75 : 1;
uint8_t Seg76 : 1; uint8_t Seg76 : 1;
uint8_t Seg77 : 1; uint8_t Seg77 : 1;
uint8_t Seg78 : 1; uint8_t Seg78 : 1;
uint8_t Seg79 : 1; uint8_t Seg79 : 1;
uint8_t Seg80 : 1; uint8_t Seg80 : 1;
uint8_t Seg81 : 1; uint8_t Seg81 : 1;
uint8_t Seg82 : 1; uint8_t Seg82 : 1;
uint8_t Seg83 : 1; uint8_t Seg83 : 1;
uint8_t Seg84 : 1; uint8_t Seg84 : 1;
uint8_t Seg85 : 1; uint8_t Seg85 : 1;
uint8_t Seg86 : 1; uint8_t Seg86 : 1;
uint8_t Seg87 : 1; uint8_t Seg87 : 1;
uint8_t Seg88 : 1; uint8_t Seg88 : 1;
uint8_t Seg89 : 1; uint8_t Seg89 : 1;
uint8_t Seg90 : 1; uint8_t Seg90 : 1;
uint8_t Seg91 : 1; uint8_t Seg91 : 1;
uint8_t Seg92 : 1; uint8_t Seg92 : 1;
uint8_t Seg93 : 1; uint8_t Seg93 : 1;
uint8_t Seg94 : 1; uint8_t Seg94 : 1;
uint8_t Seg95 : 1; uint8_t Seg95 : 1;
uint8_t Seg96 : 1; uint8_t Seg96 : 1;
uint8_t Seg97 : 1; uint8_t Seg97 : 1;
uint8_t Seg98 : 1; uint8_t Seg98 : 1;
uint8_t Seg99 : 1; uint8_t Seg99 : 1;
uint8_t Seg100 : 1; uint8_t Seg100 : 1;
uint8_t Seg101 : 1; uint8_t Seg101 : 1;
uint8_t Seg102 : 1; uint8_t Seg102 : 1;
uint8_t Seg103 : 1; uint8_t Seg103 : 1;
uint8_t Seg104 : 1; uint8_t Seg104 : 1;
uint8_t Seg105 : 1; uint8_t Seg105 : 1;
uint8_t Seg106 : 1; uint8_t Seg106 : 1;
uint8_t Seg107 : 1; uint8_t Seg107 : 1;
uint8_t Seg108 : 1; uint8_t Seg108 : 1;
uint8_t Seg109 : 1; uint8_t Seg109 : 1;
uint8_t Seg110 : 1; uint8_t Seg110 : 1;
uint8_t Seg111 : 1; uint8_t Seg111 : 1;
uint8_t Seg112 : 1; uint8_t Seg112 : 1;
uint8_t Seg113 : 1; uint8_t Seg113 : 1;
uint8_t Seg114 : 1; uint8_t Seg114 : 1;
uint8_t Seg115 : 1; uint8_t Seg115 : 1;
uint8_t Seg116 : 1; uint8_t Seg116 : 1;
uint8_t Seg117 : 1; uint8_t Seg117 : 1;
uint8_t Seg118 : 1; uint8_t Seg118 : 1;
uint8_t Seg119 : 1; uint8_t Seg119 : 1;
uint8_t Seg120 : 1; uint8_t Seg120 : 1;
uint8_t Seg121 : 1; uint8_t Seg121 : 1;
uint8_t Seg122 : 1; uint8_t Seg122 : 1;
uint8_t Seg123 : 1; uint8_t Seg123 : 1;
uint8_t Seg124 : 1; uint8_t Seg124 : 1;
uint8_t Seg125 : 1; uint8_t Seg125 : 1;
uint8_t Seg126 : 1; uint8_t Seg126 : 1;
uint8_t Seg127 : 1; uint8_t Seg127 : 1;
uint8_t Seg128 : 1; uint8_t Seg128 : 1;
uint8_t Seg129 : 1; uint8_t Seg129 : 1;
uint8_t Seg130 : 1; uint8_t Seg130 : 1;
uint8_t Seg131 : 1; uint8_t Seg131 : 1;
uint8_t Seg132 : 1; uint8_t Seg132 : 1;
uint8_t Seg133 : 1; uint8_t Seg133 : 1;
uint8_t Seg134 : 1; uint8_t Seg134 : 1;
uint8_t Seg135 : 1; uint8_t Seg135 : 1;
uint8_t Seg136 : 1; uint8_t Seg136 : 1;
uint8_t Seg137 : 1; uint8_t Seg137 : 1;
uint8_t Seg138 : 1; uint8_t Seg138 : 1;
uint8_t Seg139 : 1; uint8_t Seg139 : 1;
uint8_t Seg140 : 1; uint8_t Seg140 : 1;
uint8_t Seg141 : 1; uint8_t Seg141 : 1;
uint8_t Seg142 : 1; uint8_t Seg142 : 1;
uint8_t Seg143 : 1; uint8_t Seg143 : 1;
uint8_t Seg144 : 1; uint8_t Seg144 : 1;
uint8_t Seg145 : 1; uint8_t Seg145 : 1;
uint8_t Seg146 : 1; uint8_t Seg146 : 1;
uint8_t Seg147 : 1; uint8_t Seg147 : 1;
uint8_t Seg148 : 1; uint8_t Seg148 : 1;
uint8_t Seg149 : 1; uint8_t Seg149 : 1;
uint8_t Seg150 : 1; uint8_t Seg150 : 1;
uint8_t Seg151 : 1; uint8_t Seg151 : 1;
uint8_t Seg152 : 1; uint8_t Seg152 : 1;
uint8_t Seg153 : 1; uint8_t Seg153 : 1;
uint8_t Seg154 : 1; uint8_t Seg154 : 1;
uint8_t Seg155 : 1; uint8_t Seg155 : 1;
uint8_t Seg156 : 1; uint8_t Seg156 : 1;
uint8_t Seg157 : 1; uint8_t Seg157 : 1;
uint8_t Seg158 : 1; uint8_t Seg158 : 1;
uint8_t Seg159 : 1; uint8_t Seg159 : 1;
uint8_t Seg160 : 1; uint8_t Seg160 : 1;
uint8_t Seg161 : 1; uint8_t Seg161 : 1;
uint8_t Seg162 : 1; uint8_t Seg162 : 1;
uint8_t Seg163 : 1; uint8_t Seg163 : 1;
uint8_t Seg164 : 1; uint8_t Seg164 : 1;
uint8_t Seg165 : 1; uint8_t Seg165 : 1;
uint8_t Seg166 : 1; uint8_t Seg166 : 1;
uint8_t Seg167 : 1; uint8_t Seg167 : 1;
uint8_t Seg168 : 1; uint8_t Seg168 : 1;
uint8_t Seg169 : 1; uint8_t Seg169 : 1;
uint8_t Seg170 : 1; uint8_t Seg170 : 1;
uint8_t Seg171 : 1; uint8_t Seg171 : 1;
uint8_t Seg172 : 1; uint8_t Seg172 : 1;
uint8_t Seg173 : 1; uint8_t Seg173 : 1;
uint8_t Seg174 : 1; uint8_t Seg174 : 1;
uint8_t Seg175 : 1; uint8_t Seg175 : 1;
uint8_t Seg176 : 1; uint8_t Seg176 : 1;
uint8_t Seg177 : 1; uint8_t Seg177 : 1;
uint8_t Seg178 : 1; uint8_t Seg178 : 1;
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
/******************************************************************************
文 件 名: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"
#if USE_BU98R10_CHIP_0 /* 端口寄存器基地址 */
volatile BU98R10DDRAMUnion BU98R10Chip0DDRAM; #define Register_Base_Address 0X40040000UL
BU98R10DDRAMUnion BU98R10Chip0DDRAMBackup;
#endif /* 端口寄存器偏移地址*/
#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_1 #if USE_BU98R10_CHIP_0
volatile BU98R10DDRAMUnion BU98R10Chip1DDRAM; volatile BU98R10DDRAMUnion BU98R10Chip0DDRAM;
BU98R10DDRAMUnion BU98R10Chip1DDRAMBackup; BU98R10DDRAMUnion BU98R10Chip0DDRAMBackup;
#endif #endif
BU98R10UpdateCtrlStruct BU98R10Update; #if USE_BU98R10_CHIP_1
uint8_t BU98R10_InitFlag = 0u; volatile BU98R10DDRAMUnion BU98R10Chip1DDRAM;
BU98R10DDRAMUnion BU98R10Chip1DDRAMBackup;
#define SEG_LCD_SD_PORT 1 #endif
#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
//色彩设置初始化(注意,未做?芯片兼) BU98R10UpdateCtrlStruct BU98R10Update;
/*
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_COLORFUL_LCD_MODE
//软件复位 #if BU98R10_WRITE_AT_SAME_TIME
BU98R10_All_Command_Write(BU98R10_CMD_SWRST); #if BU98R10_COLORFUL_LCD_MODE
//工作模式
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_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_Data_Write(0x12, 0x12);
BU98R10_All_Command_Write(BU98R10_CMD_SEG_R);
BU98R10_All_Data_Write(BU98R10_REG_SEG_R, BU98R10_REG_SEG_R);
BU98R10_All_Command_Write(BU98R10_CMD_SEG_G); BU98R10_All_Command_Write(BU98R10_CMD_SWRST);
BU98R10_All_Data_Write(BU98R10_REG_SEG_G, BU98R10_REG_SEG_G);
BU98R10_All_Command_Write(BU98R10_CMD_SEG_B); BU98R10_All_Command_Write(BU98R10_CMD_ICSET | BU98R10_PAR_ICSET_RGB);
BU98R10_All_Data_Write(BU98R10_REG_SEG_B, BU98R10_REG_SEG_B);
BU98R10_All_Command_Write(BU98R10_CMD_LED_STARTR); BU98R10_All_Command_Write(BU98R10_CMD_DRVCTRL | BU98R10_PAR_DRVCTRL_NORMAL);
BU98R10_All_Data_Write(BU98R10_LRS, BU98R10_LRS);
BU98R10_All_Command_Write(BU98R10_CMD_LED_STARTG); BU98R10_All_Command_Write(BU98R10_CMD_FREQ);
BU98R10_All_Data_Write(BU98R10_LGS, BU98R10_LGS); BU98R10_All_Data_Write(BU98R10_FRAME_FREQ, BU98R10_FRAME_FREQ);
BU98R10_All_Command_Write(BU98R10_CMD_LED_STARTB); BU98R10_All_Command_Write(BU98R10_CMD_LED_CTRL);
BU98R10_All_Data_Write(BU98R10_LBS, BU98R10_LBS); BU98R10_All_Data_Write(0x12, 0x12);
BU98R10_All_Command_Write(BU98R10_CMD_LED_WIDTHR); BU98R10_All_Command_Write(BU98R10_CMD_SEG_R);
BU98R10_All_Data_Write(BU98R10_LRW, BU98R10_LRW); BU98R10_All_Data_Write(BU98R10_REG_SEG_R, BU98R10_REG_SEG_R);
BU98R10_All_Command_Write(BU98R10_CMD_LED_WIDTHG); BU98R10_All_Command_Write(BU98R10_CMD_SEG_G);
BU98R10_All_Data_Write(BU98R10_LGW, BU98R10_LGW); BU98R10_All_Data_Write(BU98R10_REG_SEG_G, BU98R10_REG_SEG_G);
BU98R10_All_Command_Write(BU98R10_CMD_LED_WIDTHB); BU98R10_All_Command_Write(BU98R10_CMD_SEG_B);
BU98R10_All_Data_Write(BU98R10_LBW, BU98R10_LBW); BU98R10_All_Data_Write(BU98R10_REG_SEG_B, BU98R10_REG_SEG_B);
#endif //USE_NEW_COLORFUL_STRATEGY
//清除RAM数据 BU98R10_All_Command_Write(BU98R10_CMD_LED_STARTR);
BU98R10_All_Command_Write(BU98R10_CMD_ADSET); BU98R10_All_Data_Write(BU98R10_LRS, BU98R10_LRS);
BU98R10_All_Data_Write(0x00, 0x00);
BU98R10_All_Command_Write(BU98R10_CMD_DATWR); BU98R10_All_Command_Write(BU98R10_CMD_LED_STARTG);
BU98R10_All_Data_Write(BU98R10_LGS, BU98R10_LGS);
for (i = 0; i < 90; i++) BU98R10_All_Command_Write(BU98R10_CMD_LED_STARTB);
{ BU98R10_All_Data_Write(BU98R10_DEFAULT_BYTE, BU98R10_DEFAULT_BYTE); } BU98R10_All_Data_Write(BU98R10_LBS, BU98R10_LBS);
for (i = 0; i < BU98R10_DDRAM_SIZE; i++) { BU98R10_All_Command_Write(BU98R10_CMD_LED_WIDTHR);
BU98R10Chip0DDRAM.Byte[i] = BU98R10_DEFAULT_BYTE; BU98R10_All_Data_Write(BU98R10_LRW, BU98R10_LRW);
BU98R10Chip0DDRAMBackup.Byte[i] = BU98R10_DEFAULT_BYTE;
BU98R10Chip1DDRAM.Byte[i] = BU98R10_DEFAULT_BYTE; BU98R10_All_Command_Write(BU98R10_CMD_LED_WIDTHG);
BU98R10Chip1DDRAMBackup.Byte[i] = BU98R10_DEFAULT_BYTE; BU98R10_All_Data_Write(BU98R10_LGW, BU98R10_LGW);
}
//开显示 BU98R10_All_Command_Write(BU98R10_CMD_LED_WIDTHB);
BU98R10_All_Command_Write(BU98R10_CMD_DISPON); BU98R10_All_Data_Write(BU98R10_LBW, BU98R10_LBW);
#else //BU98R10_COLORFUL_LCD_MODE BU98R10_All_Command_Write(BU98R10_CMD_ADSET);
BU98R10_All_Data_Write(0x00, 0x00);
//软件复位 BU98R10_All_Command_Write(BU98R10_CMD_DATWR);
BU98R10_All_Command_Write(BU98R10_CMD_SWRST); for (i = 0; i < 90; i++)
BU98R10_All_Data_Write(BU98R10_DEFAULT_BYTE, BU98R10_DEFAULT_BYTE);
//工作模式 for (i = 0; i < BU98R10_DDRAM_SIZE; i++)
BU98R10_All_Command_Write(BU98R10_CMD_ICSET | BU98R10_PAR_ICSET_MONO); {
BU98R10Chip0DDRAM.Byte[i] = BU98R10_DEFAULT_BYTE;
BU98R10Chip0DDRAMBackup.Byte[i] = BU98R10_DEFAULT_BYTE;
//驱动控制 BU98R10Chip1DDRAM.Byte[i] = BU98R10_DEFAULT_BYTE;
BU98R10_All_Command_Write(BU98R10_CMD_DRVCTRL | BU98R10_PAR_DRVCTRL_NORMAL); BU98R10Chip1DDRAMBackup.Byte[i] = BU98R10_DEFAULT_BYTE;
}
//帧刷新率 BU98R10_All_Command_Write(BU98R10_CMD_DISPON);
BU98R10_All_Command_Write(BU98R10_CMD_FREQ);
BU98R10_All_Data_Write(BU98R10_FRAME_FREQ, BU98R10_FRAME_FREQ);
//清除RAM数据 #else
BU98R10_All_Command_Write(BU98R10_CMD_ADSET);
BU98R10_All_Data_Write(0x00, 0x00);
BU98R10_All_Command_Write(BU98R10_CMD_DATWR); BU98R10_All_Command_Write(BU98R10_CMD_SWRST);
for (i = 0; i < 90; i++) BU98R10_All_Command_Write(BU98R10_CMD_ICSET | BU98R10_PAR_ICSET_MONO);
{ BU98R10_All_Data_Write(BU98R10_DEFAULT_BYTE, BU98R10_DEFAULT_BYTE); }
for (i = 0; i < BU98R10_DDRAM_SIZE; i++) { BU98R10_All_Command_Write(BU98R10_CMD_DRVCTRL | BU98R10_PAR_DRVCTRL_NORMAL);
BU98R10Chip0DDRAM.Byte[i] = BU98R10_DEFAULT_BYTE;
BU98R10Chip0DDRAMBackup.Byte[i] = BU98R10_DEFAULT_BYTE;
BU98R10Chip1DDRAM.Byte[i] = BU98R10_DEFAULT_BYTE; BU98R10_All_Command_Write(BU98R10_CMD_FREQ);
BU98R10Chip1DDRAMBackup.Byte[i] = BU98R10_DEFAULT_BYTE; BU98R10_All_Data_Write(BU98R10_FRAME_FREQ, BU98R10_FRAME_FREQ);
}
//开显示 BU98R10_All_Command_Write(BU98R10_CMD_ADSET);
BU98R10_All_Command_Write(BU98R10_CMD_DISPON); BU98R10_All_Data_Write(0x00, 0x00);
#endif // BU98R10_COLORFUL_LCD_MODE BU98R10_All_Command_Write(BU98R10_CMD_DATWR);
for (i = 0; i < 90; i++)
BU98R10_All_Data_Write(BU98R10_DEFAULT_BYTE, BU98R10_DEFAULT_BYTE);
for (i = 0; i < BU98R10_DDRAM_SIZE; i++)
{
BU98R10Chip0DDRAM.Byte[i] = BU98R10_DEFAULT_BYTE;
BU98R10Chip0DDRAMBackup.Byte[i] = BU98R10_DEFAULT_BYTE;
#else //BU98R10_WRITE_AT_SAME_TIME BU98R10Chip1DDRAM.Byte[i] = BU98R10_DEFAULT_BYTE;
BU98R10Chip1DDRAMBackup.Byte[i] = BU98R10_DEFAULT_BYTE;
}
BU98R10_All_Command_Write(BU98R10_CMD_DISPON);
#endif
#else
#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_DRVCTRL | BU98R10_PAR_DRVCTRL_NORMAL);
//帧刷新率 BU98R10_0_Command_Write(BU98R10_CMD_ICSET | BU98R10_PAR_ICSET_RGB);
BU98R10_0_Command_Write(BU98R10_CMD_FREQ);
BU98R10_0_Data_Write(BU98R10_FRAME_FREQ);
//色彩设置 BU98R10_0_Command_Write(BU98R10_CMD_DRVCTRL | BU98R10_PAR_DRVCTRL_NORMAL);
BU98R10_0_Command_Write(BU98R10_CMD_LED_CTRL);
BU98R10_0_Data_Write(0x12);
BU98R10_0_Command_Write(BU98R10_CMD_SEG_R); BU98R10_0_Command_Write(BU98R10_CMD_FREQ);
BU98R10_0_Data_Write(BU98R10_REG_SEG_R); BU98R10_0_Data_Write(BU98R10_FRAME_FREQ);
BU98R10_0_Command_Write(BU98R10_CMD_SEG_G); BU98R10_0_Command_Write(BU98R10_CMD_LED_CTRL);
BU98R10_0_Data_Write(BU98R10_REG_SEG_G); BU98R10_0_Data_Write(0x12);
BU98R10_0_Command_Write(BU98R10_CMD_SEG_B); BU98R10_0_Command_Write(BU98R10_CMD_SEG_R);
BU98R10_0_Data_Write(BU98R10_REG_SEG_B); BU98R10_0_Data_Write(BU98R10_REG_SEG_R);
BU98R10_0_Command_Write(BU98R10_CMD_LED_STARTR); BU98R10_0_Command_Write(BU98R10_CMD_SEG_G);
BU98R10_0_Data_Write(BU98R10_LRS); BU98R10_0_Data_Write(BU98R10_REG_SEG_G);
BU98R10_0_Command_Write(BU98R10_CMD_LED_STARTG); BU98R10_0_Command_Write(BU98R10_CMD_SEG_B);
BU98R10_0_Data_Write(BU98R10_LGS); BU98R10_0_Data_Write(BU98R10_REG_SEG_B);
BU98R10_0_Command_Write(BU98R10_CMD_LED_STARTB); BU98R10_0_Command_Write(BU98R10_CMD_LED_STARTR);
BU98R10_0_Data_Write(BU98R10_LBS); BU98R10_0_Data_Write(BU98R10_LRS);
BU98R10_0_Command_Write(BU98R10_CMD_LED_WIDTHR); BU98R10_0_Command_Write(BU98R10_CMD_LED_STARTG);
BU98R10_0_Data_Write(BU98R10_LRW); BU98R10_0_Data_Write(BU98R10_LGS);
BU98R10_0_Command_Write(BU98R10_CMD_LED_WIDTHG); BU98R10_0_Command_Write(BU98R10_CMD_LED_STARTB);
BU98R10_0_Data_Write(BU98R10_LGW); BU98R10_0_Data_Write(BU98R10_LBS);
BU98R10_0_Command_Write(BU98R10_CMD_LED_WIDTHB); BU98R10_0_Command_Write(BU98R10_CMD_LED_WIDTHR);
BU98R10_0_Data_Write(BU98R10_LBW); BU98R10_0_Data_Write(BU98R10_LRW);
//清除RAM数据 BU98R10_0_Command_Write(BU98R10_CMD_LED_WIDTHG);
BU98R10_0_Command_Write(BU98R10_CMD_ADSET); BU98R10_0_Data_Write(BU98R10_LGW);
BU98R10_0_Data_Write(0x00);
BU98R10_0_Command_Write(BU98R10_CMD_DATWR); BU98R10_0_Command_Write(BU98R10_CMD_LED_WIDTHB);
BU98R10_0_Data_Write(BU98R10_LBW);
for (i = 0; i < 90; i++) BU98R10_0_Command_Write(BU98R10_CMD_ADSET);
{ BU98R10_0_Data_Write(BU98R10_DEFAULT_BYTE); } BU98R10_0_Data_Write(0x00);
for (i = 0; i < BU98R10_DDRAM_SIZE; i++) { BU98R10_0_Command_Write(BU98R10_CMD_DATWR);
BU98R10Chip0DDRAM.Byte[i] = BU98R10_DEFAULT_BYTE; for (i = 0; i < 90; i++)
BU98R10Chip0DDRAMBackup.Byte[i] = BU98R10_DEFAULT_BYTE; BU98R10_0_Data_Write(BU98R10_DEFAULT_BYTE);
}
//开显示 for (i = 0; i < BU98R10_DDRAM_SIZE; i++)
BU98R10_0_Command_Write(BU98R10_CMD_DISPON); {
BU98R10Chip0DDRAM.Byte[i] = BU98R10_DEFAULT_BYTE;
BU98R10Chip0DDRAMBackup.Byte[i] = BU98R10_DEFAULT_BYTE;
}
#endif //USE_BU98R10_CHIP_0 BU98R10_0_Command_Write(BU98R10_CMD_DISPON);
#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_DRVCTRL | BU98R10_PAR_DRVCTRL_NORMAL);
//帧刷新率
BU98R10_1_Command_Write(BU98R10_CMD_FREQ);
BU98R10_1_Data_Write(BU98R10_FRAME_FREQ);
//色彩设置 BU98R10_1_Command_Write(BU98R10_CMD_ICSET | BU98R10_PAR_ICSET_RGB);
BU98R10_1_Command_Write(BU98R10_CMD_LED_CTRL);
BU98R10_1_Data_Write(0x12);
BU98R10_1_Command_Write(BU98R10_CMD_SEG_R); BU98R10_1_Command_Write(BU98R10_CMD_DRVCTRL | BU98R10_PAR_DRVCTRL_NORMAL);
BU98R10_1_Data_Write(BU98R10_REG_SEG_R);
BU98R10_1_Command_Write(BU98R10_CMD_SEG_G); BU98R10_1_Command_Write(BU98R10_CMD_FREQ);
BU98R10_1_Data_Write(BU98R10_REG_SEG_G); BU98R10_1_Data_Write(BU98R10_FRAME_FREQ);
BU98R10_1_Command_Write(BU98R10_CMD_SEG_B); BU98R10_1_Command_Write(BU98R10_CMD_LED_CTRL);
BU98R10_1_Data_Write(BU98R10_REG_SEG_B); BU98R10_1_Data_Write(0x12);
BU98R10_1_Command_Write(BU98R10_CMD_LED_STARTR); BU98R10_1_Command_Write(BU98R10_CMD_SEG_R);
BU98R10_1_Data_Write(BU98R10_LRS); BU98R10_1_Data_Write(BU98R10_REG_SEG_R);
BU98R10_1_Command_Write(BU98R10_CMD_LED_STARTG); BU98R10_1_Command_Write(BU98R10_CMD_SEG_G);
BU98R10_1_Data_Write(BU98R10_LGS); BU98R10_1_Data_Write(BU98R10_REG_SEG_G);
BU98R10_1_Command_Write(BU98R10_CMD_LED_STARTB); BU98R10_1_Command_Write(BU98R10_CMD_SEG_B);
BU98R10_1_Data_Write(BU98R10_LBS); BU98R10_1_Data_Write(BU98R10_REG_SEG_B);
BU98R10_1_Command_Write(BU98R10_CMD_LED_WIDTHR); BU98R10_1_Command_Write(BU98R10_CMD_LED_STARTR);
BU98R10_1_Data_Write(BU98R10_LRW); BU98R10_1_Data_Write(BU98R10_LRS);
BU98R10_1_Command_Write(BU98R10_CMD_LED_WIDTHG); BU98R10_1_Command_Write(BU98R10_CMD_LED_STARTG);
BU98R10_1_Data_Write(BU98R10_LGW); BU98R10_1_Data_Write(BU98R10_LGS);
BU98R10_1_Command_Write(BU98R10_CMD_LED_WIDTHB); BU98R10_1_Command_Write(BU98R10_CMD_LED_STARTB);
BU98R10_1_Data_Write(BU98R10_LBW); BU98R10_1_Data_Write(BU98R10_LBS);
//清除RAM数据 BU98R10_1_Command_Write(BU98R10_CMD_LED_WIDTHR);
BU98R10_1_Command_Write(BU98R10_CMD_ADSET); BU98R10_1_Data_Write(BU98R10_LRW);
BU98R10_1_Data_Write(0x00);
BU98R10_1_Command_Write(BU98R10_CMD_DATWR); BU98R10_1_Command_Write(BU98R10_CMD_LED_WIDTHG);
BU98R10_1_Data_Write(BU98R10_LGW);
for (i = 0; i < 90; i++) BU98R10_1_Command_Write(BU98R10_CMD_LED_WIDTHB);
{ BU98R10_1_Data_Write(BU98R10_DEFAULT_BYTE); } BU98R10_1_Data_Write(BU98R10_LBW);
for (i = 0; i < BU98R10_DDRAM_SIZE; i++) { BU98R10_1_Command_Write(BU98R10_CMD_ADSET);
BU98R10Chip1DDRAM.Byte[i] = BU98R10_DEFAULT_BYTE; BU98R10_1_Data_Write(0x00);
BU98R10Chip1DDRAMBackup.Byte[i] = BU98R10_DEFAULT_BYTE;
}
//开显示 BU98R10_1_Command_Write(BU98R10_CMD_DATWR);
BU98R10_1_Command_Write(BU98R10_CMD_DISPON); for (i = 0; i < 90; i++)
BU98R10_1_Data_Write(BU98R10_DEFAULT_BYTE);
#endif //USE_BU98R10_CHIP_1 for (i = 0; i < BU98R10_DDRAM_SIZE; i++)
{
BU98R10Chip1DDRAM.Byte[i] = BU98R10_DEFAULT_BYTE;
BU98R10Chip1DDRAMBackup.Byte[i] = BU98R10_DEFAULT_BYTE;
}
#else //BU98R10_COLORFUL_LCD_MODE BU98R10_1_Command_Write(BU98R10_CMD_DISPON);
#endif
#else
#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_Data_Write(BU98R10_FRAME_FREQ);
//清除RAM数据 BU98R10_0_Command_Write(BU98R10_CMD_FREQ);
BU98R10_0_Command_Write(BU98R10_CMD_ADSET); BU98R10_0_Data_Write(BU98R10_FRAME_FREQ);
BU98R10_0_Data_Write(0x00);
BU98R10_0_Command_Write(BU98R10_CMD_DATWR); BU98R10_0_Command_Write(BU98R10_CMD_ADSET);
BU98R10_0_Data_Write(0x00);
for (i = 0; i < 90; i++) BU98R10_0_Command_Write(BU98R10_CMD_DATWR);
{ BU98R10_0_Data_Write(BU98R10_DEFAULT_BYTE); } for (i = 0; i < 90; i++)
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; {
BU98R10Chip0DDRAMBackup.Byte[i] = BU98R10_DEFAULT_BYTE; BU98R10Chip0DDRAM.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_DRVCTRL | BU98R10_PAR_DRVCTRL_NORMAL);
//帧刷新率
BU98R10_1_Command_Write(BU98R10_CMD_FREQ);
BU98R10_1_Data_Write(BU98R10_FRAME_FREQ);
//清除RAM数据
BU98R10_1_Command_Write(BU98R10_CMD_ADSET);
BU98R10_1_Data_Write(0x00);
BU98R10_1_Command_Write(BU98R10_CMD_DATWR); BU98R10_1_Command_Write(BU98R10_CMD_ICSET | BU98R10_PAR_ICSET_MONO);
for (i = 0; i < 90; i++) BU98R10_1_Command_Write(BU98R10_CMD_DRVCTRL | BU98R10_PAR_DRVCTRL_NORMAL);
{ BU98R10_1_Data_Write(BU98R10_DEFAULT_BYTE); }
for (i = 0; i < BU98R10_DDRAM_SIZE; i++) { BU98R10_1_Command_Write(BU98R10_CMD_FREQ);
BU98R10Chip1DDRAM.Byte[i] = BU98R10_DEFAULT_BYTE; BU98R10_1_Data_Write(BU98R10_FRAME_FREQ);
BU98R10Chip1DDRAMBackup.Byte[i] = BU98R10_DEFAULT_BYTE;
}
//开显示 BU98R10_1_Command_Write(BU98R10_CMD_ADSET);
BU98R10_1_Command_Write(BU98R10_CMD_DISPON); BU98R10_1_Data_Write(0x00);
#endif //USE_BU98R10_CHIP_1 BU98R10_1_Command_Write(BU98R10_CMD_DATWR);
for (i = 0; i < 90; i++)
BU98R10_1_Data_Write(BU98R10_DEFAULT_BYTE);
#endif //BU98R10_COLORFUL_LCD_MODE for (i = 0; i < BU98R10_DDRAM_SIZE; i++)
{
BU98R10Chip1DDRAM.Byte[i] = BU98R10_DEFAULT_BYTE;
BU98R10Chip1DDRAMBackup.Byte[i] = BU98R10_DEFAULT_BYTE;
}
#endif //BU98R10_WRITE_AT_SAME_TIME BU98R10_1_Command_Write(BU98R10_CMD_DISPON);
BU98R10Update.En = 0; #endif
BU98R10Update.Step = 0; #endif
BU98R10Update.Cont = 0; #endif
BU98R10Update.Addr = 0;
BU98R10Update.Chip = 0; BU98R10Update.En = 0;
BU98R10Update.Step = 0;
BU98R10Update.Cont = 0;
BU98R10Update.Addr = 0;
#if USE_BU98R10_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
BU98R10_All_Command_Write(BU98R10_CMD_DISPOFF);
#if BU98R10_WRITE_AT_SAME_TIME
BU98R10_All_Command_Write(BU98R10_CMD_DISPOFF);
#else #else
#if USE_BU98R10_CHIP_0 #if USE_BU98R10_CHIP_0
BU98R10_0_Command_Write(BU98R10_CMD_DISPOFF); BU98R10_0_Command_Write(BU98R10_CMD_DISPOFF);
#endif #endif
#if USE_BU98R10_CHIP_1 #if USE_BU98R10_CHIP_1
BU98R10_1_Command_Write(BU98R10_CMD_DISPOFF); BU98R10_1_Command_Write(BU98R10_CMD_DISPOFF);
#endif #endif
#endif #endif
} }
/****************************************************************************** uint8_t u8BU98R10CheckCount = 0;
函数名:BU98R10_Update_Request
功 能:请求刷新BU98R10的段码显示
参 数:无
返回值:无
******************************************************************************/
void BU98R10_Update_Request(void) void BU98R10_Update_Request(void)
{ {
BU98R10Update.En = 1; // if (g_sysFlag.Bits.AccSaveState)
LedUpdateDeviceFlg = 1; //{
// //if (u8BU98R10CheckCount < 20)
// //{
// // BU98R10Update.En = 1;
// // u8BU98R10CheckCount++;
// //}
// BU98R10Update.En = 1;
// }
// else
{
u8BU98R10CheckCount = 0;
BU98R10Update.En = 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)
{
switch (BU98R10Update.Step) { case 0:
case 0 : //请求写地址 if ((BU98R10Chip0DDRAM.Byte[BU98R10Update.Addr] != BU98R10Chip0DDRAMBackup.Byte[BU98R10Update.Addr]) ||
//前15个SEG空闲 (BU98R10Chip1DDRAM.Byte[BU98R10Update.Addr] != BU98R10Chip1DDRAMBackup.Byte[BU98R10Update.Addr]))
BU98R10Update.Addr = 7; {
BU98R10_All_Command_Write(BU98R10_CMD_ADSET); BU98R10Chip0DDRAMBackup.Byte[BU98R10Update.Addr] = BU98R10Chip0DDRAM.Byte[BU98R10Update.Addr];
BU98R10_All_Data_Write(BU98R10Update.Addr,BU98R10Update.Addr); BU98R10Chip1DDRAMBackup.Byte[BU98R10Update.Addr] = BU98R10Chip1DDRAM.Byte[BU98R10Update.Addr];
BU98R10_All_Command_Write(BU98R10_CMD_DATWR);
BU98R10Update.Step = 1; if (BU98R10Update.Cont)
BU98R10Update.Step = 4;
break; else
BU98R10Update.Step = 1;
case 1 : }
for(i = 0; i < 6; i++) { else
BU98R10_All_Data_Write(BU98R10Chip0DDRAM.Byte[BU98R10Update.Addr],BU98R10Chip1DDRAM.Byte[BU98R10Update.Addr]); {
BU98R10Update.Cont = 0;
if(BU98R10Update.Addr >= 30) { BU98R10Update.Addr++;
BU98R10_All_Command_Write(BU98R10_CMD_ADSET); if (BU98R10Update.Addr >= BU98R10_DDRAM_SIZE)
BU98R10_All_Data_Write(BU98R10Update.Addr,BU98R10Update.Addr); {
BU98R10_All_Command_Write(BU98R10_CMD_DATWR); BU98R10Update.Addr = 0;
BU98R10Update.Step = 2; BU98R10Update.En = 0;
break; }
} }
else{ break;
//地址调整
BU98R10Update.Addr++; case 1:
} BU98R10_All_Command_Write(BU98R10_CMD_ADSET);
} BU98R10Update.Step = 2;
break;
break;
case 2:
case 2 : #if BU98R10_COLORFUL_LCD_MODE
for(i = 0; i < 6; i++) { BU98R10_All_Data_Write(BU98R10Update.Addr, BU98R10Update.Addr);
BU98R10_All_Data_Write(BU98R10Chip0DDRAM.Byte[BU98R10Update.Addr],BU98R10Chip1DDRAM.Byte[BU98R10Update.Addr]); #else
BU98R10_All_Data_Write(BU98R10Update.Addr * 4, BU98R10Update.Addr * 4);
if(BU98R10Update.Addr >= 60) { #endif
BU98R10_All_Command_Write(BU98R10_CMD_ADSET); BU98R10Update.Step = 3;
BU98R10_All_Data_Write(BU98R10Update.Addr,BU98R10Update.Addr); break;
BU98R10_All_Command_Write(BU98R10_CMD_DATWR);
BU98R10Update.Step = 3; case 3:
break; BU98R10_All_Command_Write(BU98R10_CMD_DATWR);
} BU98R10Update.Step = 4;
else{ break;
//地址调整
BU98R10Update.Addr++; case 4:
} BU98R10_All_Data_Write(BU98R10Chip0DDRAMBackup.Byte[BU98R10Update.Addr], BU98R10Chip1DDRAMBackup.Byte[BU98R10Update.Addr]);
} BU98R10Update.Step = 5;
break;
break;
case 5:
case 3 : BU98R10Update.Addr++;
for(i = 0; i < 6; i++) { if (BU98R10Update.Addr >= BU98R10_DDRAM_SIZE)
BU98R10_All_Data_Write(BU98R10Chip0DDRAM.Byte[BU98R10Update.Addr],BU98R10Chip1DDRAM.Byte[BU98R10Update.Addr]); {
BU98R10Update.Addr = 0;
if(BU98R10Update.Addr == 86) { BU98R10Update.En = 0;
BU98R10Update.Addr = 0; BU98R10Update.Cont = 0;
BU98R10Update.En = 0; }
BU98R10Update.Step = 0; else
break; BU98R10Update.Cont = 1;
}
else{ BU98R10Update.Step = 0;
//地址调整 break;
BU98R10Update.Addr++;
} default:
} BU98R10Update.En = 0;
BU98R10Update.Step = 0;
break; BU98R10Update.Cont = 0;
BU98R10Update.Addr = 0;
default : break;
BU98R10Update.En = 0; }
BU98R10Update.Step = 0;
BU98R10Update.Cont = 0;
BU98R10Update.Addr = 0;
break;
}
}
#else #else
if (BU98R10Update.En) { #if USE_BU98R10_CHIP_0
switch (BU98R10Update.Step) { if (BU98R10Update.Chip == 0)
case 0 : //请求写地址 {
//前11个SEG空闲 switch (BU98R10Update.Step)
BU98R10Update.Addr = 5; {
BU98R10_0_Command_Write(BU98R10_CMD_ADSET); case 0:
BU98R10_0_Data_Write(BU98R10Update.Addr); if (BU98R10Chip0DDRAM.Byte[BU98R10Update.Addr] != BU98R10Chip0DDRAMBackup.Byte[BU98R10Update.Addr])
BU98R10_0_Command_Write(BU98R10_CMD_DATWR); {
BU98R10Update.Step = 1; BU98R10Chip0DDRAMBackup.Byte[BU98R10Update.Addr] = BU98R10Chip0DDRAM.Byte[BU98R10Update.Addr];
break; if (BU98R10Update.Cont)
BU98R10Update.Step = 4;
case 1 : else
for(i = 0; i < 6; i++) { BU98R10Update.Step = 1;
//写入数据 5--18 }
BU98R10_0_Data_Write(BU98R10Chip0DDRAM.Byte[BU98R10Update.Addr]); else
{
if(BU98R10Update.Addr == 18) { //---SEG38 BU98R10Update.Cont = 0;
BU98R10Update.Addr = 80; BU98R10Update.Addr++;
BU98R10_0_Command_Write(BU98R10_CMD_ADSET); if (BU98R10Update.Addr >= BU98R10_DDRAM_SIZE)
BU98R10_0_Data_Write(BU98R10Update.Addr); {
BU98R10_0_Command_Write(BU98R10_CMD_DATWR); BU98R10Update.Addr = 0;
BU98R10Update.Step = 2;
break; #if USE_BU98R10_CHIP_1
} BU98R10Update.Chip = 1;
else{ #else
//地址调整 BU98R10Update.En = 0;
BU98R10Update.Addr++;
}
}
break;
case 2 :
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_Data_Write(BU98R10Update.Addr);
BU98R10_0_Command_Write(BU98R10_CMD_DATWR);
BU98R10Update.Step = 3;
break;
}
else{
//地址调整
BU98R10Update.Addr++;
}
}
break;
case 3 :
for(i = 0; i < 6; i++) {
//写入数据19-79
BU98R10_0_Data_Write(BU98R10Chip0DDRAM.Byte[BU98R10Update.Addr]);
if(BU98R10Update.Addr == 79) {
BU98R10Update.Addr = 0;
BU98R10Update.En = 0;
BU98R10Update.Step = 0;
break;
}
else{
//地址调整
BU98R10Update.Addr++;
}
}
break;
default :
BU98R10Update.En = 0;
BU98R10Update.Step = 0;
BU98R10Update.Cont = 0;
BU98R10Update.Addr = 0;
break;
}
}
#endif #endif
}
}
break;
} case 1:
BU98R10_0_Command_Write(BU98R10_CMD_ADSET);
BU98R10Update.Step = 2;
break;
#define BU98R10_DELAY_NS \ case 2:
__NOP(); \ #if BU98R10_COLORFUL_LCD_MODE
__NOP(); \ BU98R10_0_Data_Write(BU98R10Update.Addr);
__NOP(); #else
// __NOP(); \ BU98R10_0_Data_Write(BU98R10Update.Addr * 4);
// __NOP(); \ #endif
// __NOP(); \ BU98R10Update.Step = 3;
// __NOP(); break;
case 3:
BU98R10_0_Command_Write(BU98R10_CMD_DATWR);
BU98R10Update.Step = 4;
break;
case 4:
BU98R10_0_Data_Write(BU98R10Chip0DDRAMBackup.Byte[BU98R10Update.Addr]);
BU98R10Update.Step = 5;
break;
case 5:
BU98R10Update.Addr++;
if (BU98R10Update.Addr >= BU98R10_DDRAM_SIZE)
{
BU98R10Update.Addr = 0;
BU98R10Update.Cont = 0;
#if USE_BU98R10_CHIP_1
BU98R10Update.Chip = 1;
#else
BU98R10Update.En = 0;
#endif
}
else
BU98R10Update.Cont = 1;
BU98R10Update.Step = 0;
break;
default:
BU98R10Update.En = 0;
BU98R10Update.Step = 0;
BU98R10Update.Cont = 0;
BU98R10Update.Addr = 0;
break;
}
}
#if USE_BU98R10_CHIP_0 #if USE_BU98R10_CHIP_1
/****************************************************************************** else if (BU98R10Update.Chip == 1)
函数名:BU98R10_0_Command_Write #endif
功 能:向BU98R10芯片0写控制命令
参 数:Cmd:要写入的命令
返回值:无
******************************************************************************/
void BU98R10_0_Command_Write(uint8_t Cmd)
{
uint8_t i;
//D/C = 0,表示发送命令
*((volatile uint8_t *)(0x40040300UL + SEG_LCD_SD_PORT)) &= ~(1 << SEG_LCD_SD_PIN); //PORT_ClrBit
*((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
// PORT_ClrBit(SEG_LCD_SD);
// PORT_ClrBit(SEG_LCD_SCL);
// PORT_ClrBit(SEG_LCD_CSB);
BU98R10_DELAY_NS;
// BU98R10_DELAY_NS;
// BU98R10_DELAY_NS;
// BU98R10_DELAY_NS;
// BU98R10_DELAY_NS;
// 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;
// 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 (Cmd & 0x80)
// PORT_SetBit(SEG_LCD_SD);
{ *((volatile uint8_t *)(0x40040300UL + SEG_LCD_SD_PORT)) |= (1 << SEG_LCD_SD_PIN); } //PORT_SetBit
else
// PORT_ClrBit(SEG_LCD_SD);
{ *((volatile uint8_t *)(0x40040300UL + SEG_LCD_SD_PORT)) &= ~(1 << SEG_LCD_SD_PIN); } //PORT_ClrBit
BU98R10_DELAY_NS;
// BU98R10_DELAY_NS;
// BU98R10_DELAY_NS;
// 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;
// BU98R10_DELAY_NS;
// BU98R10_DELAY_NS;
// BU98R10_DELAY_NS;
Cmd <<= 1;
}
//PORT_SetBit(SEG_LCD_CSB);
*((volatile uint8_t *)(0x40040300UL + SEG_LCD_CS_PORT)) |= (1 << SEG_LCD_CS_PIN); //PORT_SetBit
BU98R10_DELAY_NS;
// BU98R10_DELAY_NS;
// BU98R10_DELAY_NS;
}
/****************************************************************************** #elif USE_BU98R10_CHIP_1
函数名:BU98R10_0_Data_Write if (BU98R10Update.Chip == 1)
功 能:向BU98R10芯片0写数据
参 数:Dat:要写入的数据
返回值:无
******************************************************************************/
void BU98R10_0_Data_Write(uint8_t Dat)
{
uint8_t i;
//D/C = 1,表示发送数据
//PORT_SetBit(SEG_LCD_SD);
// PORT_ClrBit(SEG_LCD_SCL);
// PORT_ClrBit(SEG_LCD_CSB);
*((volatile uint8_t *)(0x40040300UL + SEG_LCD_SD_PORT)) |= (1 << SEG_LCD_SD_PIN); //PORT_SetBit
*((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
BU98R10_DELAY_NS;
// BU98R10_DELAY_NS;
// BU98R10_DELAY_NS;
// BU98R10_DELAY_NS;
// BU98R10_DELAY_NS;
// 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;
// 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)
//PORT_SetBit(SEG_LCD_SD);
{ *((volatile uint8_t *)(0x40040300UL + SEG_LCD_SD_PORT)) |= (1 << SEG_LCD_SD_PIN); } //PORT_SetBit
else
//PORT_ClrBit(SEG_LCD_SD);
{ *((volatile uint8_t *)(0x40040300UL + SEG_LCD_SD_PORT)) &= ~(1 << SEG_LCD_SD_PIN); } //PORT_ClrBit
BU98R10_DELAY_NS;
// BU98R10_DELAY_NS;
// BU98R10_DELAY_NS;
// 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;
// BU98R10_DELAY_NS;
// BU98R10_DELAY_NS;
// BU98R10_DELAY_NS;
Dat <<= 1;
}
//PORT_SetBit(SEG_LCD_CSB);
*((volatile uint8_t *)(0x40040300UL + SEG_LCD_CS_PORT)) |= (1 << SEG_LCD_CS_PIN); //PORT_SetBit
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 switch (BU98R10Update.Step)
功 能:向BU98R10芯片1写控制命令 {
参 数:Cmd:要写入的命令 case 0:
返回值:无 if (BU98R10Chip1DDRAM.Byte[BU98R10Update.Addr] != BU98R10Chip1DDRAMBackup.Byte[BU98R10Update.Addr])
******************************************************************************/ {
void BU98R10_1_Command_Write(uint8_t Cmd) BU98R10Chip1DDRAMBackup.Byte[BU98R10Update.Addr] = BU98R10Chip1DDRAM.Byte[BU98R10Update.Addr];
{
uint8_t i; 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;
BU98R10Update.En = 0;
}
}
break;
case 1:
BU98R10_0_Command_Write(BU98R10_CMD_ADSET);
BU98R10Update.Step = 2;
break;
case 2:
#if BU98R10_COLORFUL_LCD_MODE
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);
BU98R10Update.Step = 4;
break;
case 4:
BU98R10_0_Data_Write(BU98R10Chip1DDRAMBackup.Byte[BU98R10Update.Addr]);
BU98R10Update.Step = 5;
break;
case 5:
BU98R10Update.Addr++;
if (BU98R10Update.Addr >= BU98R10_DDRAM_SIZE)
{
BU98R10Update.Addr = 0;
BU98R10Update.Cont = 0;
BU98R10Update.En = 0;
}
else
BU98R10Update.Cont = 1;
BU98R10Update.Step = 0;
break;
default:
BU98R10Update.En = 0;
BU98R10Update.Step = 0;
BU98R10Update.Cont = 0;
BU98R10Update.Addr = 0;
break;
}
}
#endif
#if ((USE_BU98R10_CHIP_0) || (USE_BU98R10_CHIP_1))
else
#endif
BU98R10Update.En = 0;
//D/C = 0,表示发送命令 #endif
PORT_ClrBit(SEG_LCD_SD1); }
PORT_ClrBit(SEG_LCD_SCL1); }
PORT_ClrBit(SEG_LCD_CSB1);
BU98R10_DELAY_NS; #if USE_BU98R10_CHIP_0
BU98R10_DELAY_NS;
BU98R10_DELAY_NS; void BU98R10_0_Command_Write(uint8_t Cmd)
BU98R10_DELAY_NS; {
BU98R10_DELAY_NS; uint8_t i;
BU98R10_DELAY_NS;
PORT_SetBit(SEG_LCD_SCL1); /* SD 输出低 */
*((volatile uint8_t *)(SEG_LCD0_SD)) &= ~(1 << SEG_LCD0_SD_PIN);
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++) { /* CS 输出低 */
PORT_ClrBit(SEG_LCD_SCL1); *((volatile uint8_t *)(SEG_LCD0_CS)) &= ~(1 << SEG_LCD0_CS_PIN);
if (Cmd & 0x80) __NOP();
{ PORT_SetBit(SEG_LCD_SD1); } __NOP();
else __NOP();
{ PORT_ClrBit(SEG_LCD_SD1); }
BU98R10_DELAY_NS; /* SCL 输出高 */
BU98R10_DELAY_NS; *((volatile uint8_t *)(SEG_LCD0_SCL)) |= (1 << SEG_LCD0_SCL_PIN);
BU98R10_DELAY_NS;
BU98R10_DELAY_NS;
PORT_SetBit(SEG_LCD_SCL1); for (i = 0; i < 8; i++)
{
/* SCL 输出低 */
*((volatile uint8_t *)(SEG_LCD0_SCL)) &= ~(1 << SEG_LCD0_SCL_PIN);
BU98R10_DELAY_NS; if (Cmd & 0x80)
BU98R10_DELAY_NS; /* SD 输出高 */
BU98R10_DELAY_NS; *((volatile uint8_t *)(SEG_LCD0_SD)) |= (1 << SEG_LCD0_SD_PIN);
BU98R10_DELAY_NS; else
/* SD 输出低 */
*((volatile uint8_t *)(SEG_LCD0_SD)) &= ~(1 << SEG_LCD0_SD_PIN);
Cmd <<= 1; __NOP();
} __NOP();
__NOP();
PORT_SetBit(SEG_LCD_CSB1); /* SCL 输出高 */
*((volatile uint8_t *)(SEG_LCD0_SCL)) |= (1 << SEG_LCD0_SCL_PIN);
BU98R10_DELAY_NS; Cmd <<= 1;
BU98R10_DELAY_NS; }
BU98R10_DELAY_NS;
/* CS 输出高 */
*((volatile uint8_t *)(SEG_LCD0_CS)) |= (1 << SEG_LCD0_CS_PIN);
} }
/****************************************************************************** void BU98R10_0_Data_Write(uint8_t Dat)
函数名:BU98R10_1_Data_Write
功 能:向BU98R10芯片1写数据
参 数: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_LCD0_SD)) |= (1 << SEG_LCD0_SD_PIN);
PORT_ClrBit(SEG_LCD_SCL1);
PORT_ClrBit(SEG_LCD_CSB1);
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;
PORT_SetBit(SEG_LCD_SCL1); /* CS 输出低 */
*((volatile uint8_t *)(SEG_LCD0_CS)) &= ~(1 << SEG_LCD0_CS_PIN);
__NOP();
__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;
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_LCD0_SCL)) &= ~(1 << SEG_LCD0_SCL_PIN);
if (Dat & 0x80) if (Dat & 0x80)
{ PORT_SetBit(SEG_LCD_SD1); } /* SD 输出高 */
else *((volatile uint8_t *)(SEG_LCD0_SD)) |= (1 << SEG_LCD0_SD_PIN);
{ PORT_ClrBit(SEG_LCD_SD1); } else
/* SCL 输出低 */
*((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_SCL1); /* SCL 输出高 */
*((volatile uint8_t *)(SEG_LCD0_SCL)) |= (1 << SEG_LCD0_SCL_PIN);
BU98R10_DELAY_NS; Dat <<= 1;
BU98R10_DELAY_NS; }
BU98R10_DELAY_NS;
BU98R10_DELAY_NS;
Dat <<= 1; /* CS 输出高 */
} *((volatile uint8_t *)(SEG_LCD0_CS)) |= (1 << SEG_LCD0_CS_PIN);
}
#endif
PORT_SetBit(SEG_LCD_CSB1); #if USE_BU98R10_CHIP_1
BU98R10_DELAY_NS; void BU98R10_1_Command_Write(uint8_t Cmd)
BU98R10_DELAY_NS; {
BU98R10_DELAY_NS; uint8_t i;
/* SD 输出低 */
*((volatile uint8_t *)(SEG_LCD1_SD)) &= ~(1 << SEG_LCD1_SD_PIN);
/* SCL 输出低 */
*((volatile uint8_t *)(SEG_LCD1_SCL)) &= ~(1 << SEG_LCD1_SCL_PIN);
/* CS 输出低 */
*((volatile uint8_t *)(SEG_LCD1_CS)) &= ~(1 << SEG_LCD1_CS_PIN);
__NOP();
__NOP();
__NOP();
/* SCL 输出高 */
*((volatile uint8_t *)(SEG_LCD1_SCL)) |= (1 << SEG_LCD1_SCL_PIN);
for (i = 0; i < 8; i++)
{
/* SCL 输出低 */
*((volatile uint8_t *)(SEG_LCD1_SCL)) &= ~(1 << SEG_LCD1_SCL_PIN);
if (Cmd & 0x80)
/* SD 输出高 */
*((volatile uint8_t *)(SEG_LCD1_SD)) |= (1 << SEG_LCD1_SD_PIN);
else
/* SD 输出低 */
*((volatile uint8_t *)(SEG_LCD1_SD)) &= ~(1 << SEG_LCD1_SD_PIN);
__NOP();
__NOP();
__NOP();
/* SCL 输出高 */
*((volatile uint8_t *)(SEG_LCD1_SCL)) |= (1 << SEG_LCD1_SCL_PIN);
Cmd <<= 1;
}
/* CS 输出高 */
*((volatile uint8_t *)(SEG_LCD0_CS)) |= (1 << SEG_LCD0_CS_PIN);
}
void BU98R10_1_Data_Write(uint8_t Dat)
{
uint8_t i;
/* SD 输出高 */
*((volatile uint8_t *)(SEG_LCD1_SD)) |= (1 << SEG_LCD1_SD_PIN);
/* SCL 输出低 */
*((volatile uint8_t *)(SEG_LCD1_SCL)) &= ~(1 << SEG_LCD1_SCL_PIN);
/* CS 输出低 */
*((volatile uint8_t *)(SEG_LCD1_CS)) &= ~(1 << SEG_LCD1_CS_PIN);
__NOP();
__NOP();
__NOP();
/* SCL 输出高 */
*((volatile uint8_t *)(SEG_LCD1_SCL)) |= (1 << SEG_LCD1_SCL_PIN);
for (i = 0; i < 8; i++)
{
/* SCL 输出低 */
*((volatile uint8_t *)(SEG_LCD1_SCL)) &= ~(1 << SEG_LCD1_SCL_PIN);
if (Dat & 0x80)
/* SD 输出高 */
*((volatile uint8_t *)(SEG_LCD1_SD)) |= (1 << SEG_LCD1_SD_PIN);
else
/* SD 输出低 */
*((volatile uint8_t *)(SEG_LCD1_SD)) &= ~(1 << SEG_LCD1_SD_PIN);
__NOP();
__NOP();
__NOP();
/* SCL 输出高 */
*((volatile uint8_t *)(SEG_LCD1_SCL)) |= (1 << SEG_LCD1_SCL_PIN);
Dat <<= 1;
}
/* CS 输出高 */
*((volatile uint8_t *)(SEG_LCD0_CS)) |= (1 << SEG_LCD0_CS_PIN);
} }
#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 *)(SEG_LCD0_SCL)) &= ~(1 << SEG_LCD0_SCL_PIN);
*((volatile uint8_t *)(0x40040300UL + SEG_LCD_SD1_PORT)) &= ~(1 << SEG_LCD_SD1_PIN); //PORT_ClrBit *((volatile uint8_t *)(SEG_LCD1_SCL)) &= ~(1 << SEG_LCD1_SCL_PIN);
*((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_CS)) &= ~(1 << SEG_LCD0_CS_PIN);
*((volatile uint8_t *)(SEG_LCD1_CS)) &= ~(1 << SEG_LCD1_CS_PIN);
// PORT_ClrBit(SEG_LCD_SD); __NOP();
// PORT_ClrBit(SEG_LCD_SD1); /* SCL 输出高 */
*((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);
for (i = 0; i < 8; i++)
// PORT_ClrBit(SEG_LCD_CSB); {
// PORT_ClrBit(SEG_LCD_CSB1); /* SCL 输出低 */
*((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; if (Cmd & 0x80)
// BU98R10_DELAY_NS; {
// BU98R10_DELAY_NS; /* SD 输出高 */
// BU98R10_DELAY_NS; *((volatile uint8_t *)(SEG_LCD0_SD)) |= (1 << SEG_LCD0_SD_PIN);
*((volatile uint8_t *)(SEG_LCD1_SD)) |= (1 << SEG_LCD1_SD_PIN);
// PORT_SetBit(SEG_LCD_SCL); }
// PORT_SetBit(SEG_LCD_SCL1); else
*((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 /* SD 输出低 */
*((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; }
// BU98R10_DELAY_NS;
// 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);
for (i = 0; i < 8; i++) { Cmd <<= 1;
// PORT_ClrBit(SEG_LCD_SCL); }
// PORT_ClrBit(SEG_LCD_SCL1); /* CS 输出高 */
*((volatile uint8_t *)(0x40040300UL + SEG_LCD_SCL_PORT)) &= ~(1 << SEG_LCD_SCL_PIN); //PORT_ClrBit *((volatile uint8_t *)(SEG_LCD0_CS)) |= (1 << SEG_LCD0_CS_PIN);
*((volatile uint8_t *)(0x40040300UL + SEG_LCD_SCL1_PORT)) &= ~(1 << SEG_LCD_SCL1_PIN); //PORT_ClrBit *((volatile uint8_t *)(SEG_LCD1_CS)) |= (1 << SEG_LCD1_CS_PIN);
if (Cmd & 0x80) {
// PORT_SetBit(SEG_LCD_SD);
// PORT_SetBit(SEG_LCD_SD1);
{ *((volatile uint8_t *)(0x40040300UL + SEG_LCD_SD_PORT)) |= (1 << SEG_LCD_SD_PIN); } //PORT_SetBit
{ *((volatile uint8_t *)(0x40040300UL + SEG_LCD_SD1_PORT)) |= (1 << SEG_LCD_SD1_PIN); } //PORT_SetBit
}
else {
// PORT_ClrBit(SEG_LCD_SD);
// PORT_ClrBit(SEG_LCD_SD1);
{ *((volatile uint8_t *)(0x40040300UL + SEG_LCD_SD_PORT)) &= ~(1 << SEG_LCD_SD_PIN); } //PORT_ClrBit
{ *((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);
// 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;
}
// PORT_SetBit(SEG_LCD_CSB);
// PORT_SetBit(SEG_LCD_CSB1);
*((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,表示发送数据
// PORT_SetBit(SEG_LCD_SD);
// PORT_SetBit(SEG_LCD_SD1);
// PORT_ClrBit(SEG_LCD_SCL);
// PORT_ClrBit(SEG_LCD_SCL1);
// PORT_ClrBit(SEG_LCD_CSB);
// PORT_ClrBit(SEG_LCD_CSB1);
*((volatile uint8_t *)(0x40040300UL + SEG_LCD_SD_PORT)) |= (1 << SEG_LCD_SD_PIN); //PORT_SetBit
*((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
*((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
*((volatile uint8_t *)(0x40040300UL + SEG_LCD_CS1_PORT)) &= ~(1 << SEG_LCD_CS1_PIN); //PORT_ClrBit
// 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++) {
// 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)
// { PORT_SetBit(SEG_LCD_SD); }
{ *((volatile uint8_t *)(0x40040300UL + SEG_LCD_SD_PORT)) |= (1 << SEG_LCD_SD_PIN); } //PORT_SetBit
else
// { PORT_ClrBit(SEG_LCD_SD); }
{ *((volatile uint8_t *)(0x40040300UL + SEG_LCD_SD_PORT)) &= ~(1 << SEG_LCD_SD_PIN); } //PORT_ClrBit
if (Dat1 & 0x80)
// { PORT_SetBit(SEG_LCD_SD1); }
{ *((volatile uint8_t *)(0x40040300UL + SEG_LCD_SD1_PORT)) |= (1 << SEG_LCD_SD1_PIN); } //PORT_SetBit
else
// { PORT_ClrBit(SEG_LCD_SD1); }
{ *((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);
// 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;
Dat0 <<= 1;
Dat1 <<= 1;
}
// PORT_SetBit(SEG_LCD_CSB);
// PORT_SetBit(SEG_LCD_CSB1);
*((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;
}
#if 0 /* SD 输出高 */
static void BU98R10_All_ReadRam(uint8_t addr, uint8_t *data0, uint8_t *data1) *((volatile uint8_t *)(SEG_LCD0_SD)) |= (1 << SEG_LCD0_SD_PIN);
{ *((volatile uint8_t *)(SEG_LCD1_SD)) |= (1 << SEG_LCD1_SD_PIN);
uint8_t i;
uint8_t Cmd = 0x09; /* SCL 输出低 */
uint8_t wdata0 = 0; *((volatile uint8_t *)(SEG_LCD0_SCL)) &= ~(1 << SEG_LCD0_SCL_PIN);
uint8_t wdata1 = 0; *((volatile uint8_t *)(SEG_LCD1_SCL)) &= ~(1 << SEG_LCD1_SCL_PIN);
BU98R10_All_Command_Write(BU98R10_CMD_ADSET); /* CS 输出低 */
BU98R10_All_Data_Write(addr, addr); *((volatile uint8_t *)(SEG_LCD0_CS)) &= ~(1 << SEG_LCD0_CS_PIN);
*((volatile uint8_t *)(SEG_LCD1_CS)) &= ~(1 << SEG_LCD1_CS_PIN);
Cmd = 0x09;
// D/C = 0,表示发送命令 __NOP();
//SegLCD_Set_SD(0);
//SegLCD_Set_SCL(0); /* SCL 输出高 */
//SegLCD_Set_CSB(0); *((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);
//PORT_ClrBit(SEG_LCD_SCL); for (i = 0; i < 8; i++)
//PORT_ClrBit(SEG_LCD_CSB); {
/* SCL 输出低 */
PORT_ClrBit(SEG_LCD_SD1); *((volatile uint8_t *)(SEG_LCD0_SCL)) &= ~(1 << SEG_LCD0_SCL_PIN);
PORT_ClrBit(SEG_LCD_SCL1); *((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;
//SegLCD_Set_SCL(1);
//PORT_SetBit(SEG_LCD_SCL);
PORT_SetBit(SEG_LCD_SCL1);
for (i = 0; i < 8; i++) {
//SegLCD_Set_SCL(0);
//PORT_ClrBit(SEG_LCD_SCL);
PORT_ClrBit(SEG_LCD_SCL1);
if (Cmd & 0x80) {
//SegLCD_Set_SD(1);
//PORT_SetBit(SEG_LCD_SD);
PORT_SetBit(SEG_LCD_SD1);
}
else {
//SegLCD_Set_SD(0);
//PORT_ClrBit(SEG_LCD_SD);
PORT_ClrBit(SEG_LCD_SD1);
}
BU98R10_DELAY_NS;
BU98R10_DELAY_NS;
BU98R10_DELAY_NS;
BU98R10_DELAY_NS;
BU98R10_DELAY_NS;
BU98R10_DELAY_NS;
//SegLCD_Set_SCL(1);
//PORT_SetBit(SEG_LCD_SCL);
PORT_SetBit(SEG_LCD_SCL1);
Cmd <<= 1;
}
//SegLCD_Set_SD_Dir(0);
//PORT_Init(SEG_LCD_SD, INPUT);
PORT_Init(SEG_LCD_SD1, INPUT);
//SegLCD_Set_SCL(0);
//PORT_ClrBit(SEG_LCD_SCL);
PORT_ClrBit(SEG_LCD_SCL1);
BU98R10_DELAY_NS;
BU98R10_DELAY_NS;
BU98R10_DELAY_NS;
BU98R10_DELAY_NS;
BU98R10_DELAY_NS;
BU98R10_DELAY_NS;
//SegLCD_Set_SCL(1);
//PORT_SetBit(SEG_LCD_SCL);
PORT_SetBit(SEG_LCD_SCL1);
BU98R10_DELAY_NS;
BU98R10_DELAY_NS;
BU98R10_DELAY_NS;
BU98R10_DELAY_NS;
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;
//SegLCD_Set_SCL(1);
//PORT_SetBit(SEG_LCD_SCL);
PORT_SetBit(SEG_LCD_SCL1);
/*if (SegLCD_Get_SD0_Data)
{
wdata0 |= SegLCD_Get_SD0_Data;
}
if (SegLCD_Get_SD1_Data)
{
wdata1 |= SegLCD_Get_SD1_Data;
}*/
//if (PORT_GetBit(SEG_LCD_SD))
{
//wdata0 |= PORT_GetBit(SEG_LCD_SD);
}
if (PORT_GetBit(SEG_LCD_SD1)) {
wdata1 |= PORT_GetBit(SEG_LCD_SD1);
}
}
*data0 = wdata0;
*data1 = wdata1;
//SegLCD_Set_SD_Dir(1);
//PORT_Init(SEG_LCD_SD, OUTPUT);
PORT_Init(SEG_LCD_SD1, OUTPUT);
//SegLCD_Set_CSB(1);
//PORT_SetBit(SEG_LCD_CSB);
PORT_SetBit(SEG_LCD_CSB1);
}
#endif
if (Dat0 & 0x80)
*((volatile uint8_t *)(SEG_LCD0_SD)) |= (1 << SEG_LCD0_SD_PIN);
else
*((volatile uint8_t *)(SEG_LCD0_SD)) &= ~(1 << SEG_LCD0_SD_PIN);
if (Dat1 & 0x80)
*((volatile uint8_t *)(SEG_LCD0_SD)) |= (1 << SEG_LCD0_SD_PIN);
else
*((volatile uint8_t *)(SEG_LCD1_SD)) &= ~(1 << SEG_LCD1_SD_PIN);
__NOP();
*((volatile uint8_t *)(SEG_LCD0_SCL)) |= (1 << SEG_LCD0_SCL_PIN);
*((volatile uint8_t *)(SEG_LCD1_SCL)) |= (1 << SEG_LCD1_SCL_PIN);
Dat0 <<= 1;
Dat1 <<= 1;
}
/* CS 输出高 */
*((volatile uint8_t *)(SEG_LCD0_CS)) |= (1 << SEG_LCD0_CS_PIN);
*((volatile uint8_t *)(SEG_LCD1_CS)) |= (1 << SEG_LCD1_CS_PIN);
}
#endif #endif
uint8_t checkInterval = 0; #if BU98R10_WRITE_AT_SAME_TIME
uint8_t checkCount = 0; static void BU98R10_All_ReadRam(uint8_t addr, uint8_t *data0, uint8_t *data1)
{
uint8_t i;
uint8_t Cmd = 0x09;
uint8_t wdata0 = 0;
uint8_t wdata1 = 0;
BU98R10_All_Command_Write(BU98R10_CMD_ADSET);
BU98R10_All_Data_Write(addr, addr);
Cmd = 0x09;
// D/C = 0,表示发送命令
*((volatile uint8_t *)(SEG_LCD0_SD)) &= ~(1 << SEG_LCD0_SD_PIN);
*((volatile uint8_t *)(SEG_LCD1_SD)) &= ~(1 << SEG_LCD1_SD_PIN);
*((volatile uint8_t *)(SEG_LCD0_SCL)) &= ~(1 << SEG_LCD0_SCL_PIN);
*((volatile uint8_t *)(SEG_LCD1_SCL)) &= ~(1 << SEG_LCD1_SCL_PIN);
*((volatile uint8_t *)(SEG_LCD0_CS)) &= ~(1 << SEG_LCD0_CS_PIN);
*((volatile uint8_t *)(SEG_LCD1_CS)) &= ~(1 << SEG_LCD1_CS_PIN);
__NOP();
__NOP();
__NOP();
/* SCL 输出高 */
*((volatile uint8_t *)(SEG_LCD0_SCL)) |= (1 << SEG_LCD0_SCL_PIN);
*((volatile uint8_t *)(SEG_LCD1_SCL)) |= (1 << SEG_LCD1_SCL_PIN);
for (i = 0; i < 8; i++)
{
/* SCL 输出低 */
*((volatile uint8_t *)(SEG_LCD0_SCL)) &= ~(1 << SEG_LCD0_SCL_PIN);
*((volatile uint8_t *)(SEG_LCD1_SCL)) &= ~(1 << SEG_LCD1_SCL_PIN);
if (Cmd & 0x80)
{
/* SD 输出高 */
*((volatile uint8_t *)(SEG_LCD0_SD)) |= (1 << SEG_LCD0_SD_PIN);
*((volatile uint8_t *)(SEG_LCD1_SD)) |= (1 << SEG_LCD1_SD_PIN);
}
else
{
/* SD 输出低 */
*((volatile uint8_t *)(SEG_LCD0_SD)) &= ~(1 << SEG_LCD0_SD_PIN);
*((volatile uint8_t *)(SEG_LCD1_SD)) &= ~(1 << SEG_LCD1_SD_PIN);
}
__NOP();
__NOP();
__NOP();
/* 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;
}
// PORT_Init(SEG_LCD_SD1, INPUT); // ???
// PORT_Init(SEG_LCD_SD1, INPUT); // ???
/* SCL 输出低 */
*((volatile uint8_t *)(SEG_LCD0_SCL)) &= ~(1 << SEG_LCD0_SCL_PIN);
*((volatile uint8_t *)(SEG_LCD1_SCL)) &= ~(1 << SEG_LCD1_SCL_PIN);
__NOP();
__NOP();
__NOP();
/* SCL 输出高 */
*((volatile uint8_t *)(SEG_LCD0_SCL)) |= (1 << SEG_LCD0_SCL_PIN);
*((volatile uint8_t *)(SEG_LCD1_SCL)) |= (1 << SEG_LCD1_SCL_PIN);
__NOP();
__NOP();
__NOP();
for (i = 0; i < 8; i++)
{
/* SCL 输出低 */
*((volatile uint8_t *)(SEG_LCD0_SCL)) &= ~(1 << SEG_LCD0_SCL_PIN);
*((volatile uint8_t *)(SEG_LCD1_SCL)) &= ~(1 << SEG_LCD1_SCL_PIN);
wdata0 <<= 1;
wdata1 <<= 1;
/* SCL 输出高 */
*((volatile uint8_t *)(SEG_LCD0_SCL)) |= (1 << SEG_LCD0_SCL_PIN);
*((volatile uint8_t *)(SEG_LCD1_SCL)) |= (1 << SEG_LCD1_SCL_PIN);
if (*((volatile uint8_t *)(SEG_LCD0_SD)) & SEG_LCD0_SD_PIN)
{
wdata0 |= *((volatile uint8_t *)(SEG_LCD0_SD)) & SEG_LCD0_SD_PIN;
}
if (*((volatile uint8_t *)(SEG_LCD1_SD)) & SEG_LCD1_SD_PIN)
{
wdata0 |= *((volatile uint8_t *)(SEG_LCD1_SD)) & SEG_LCD1_SD_PIN;
}
}
*data0 = wdata0;
*data1 = wdata1;
/* SD 方向设置成输出 */
// PORT_Init(SEG_LCD_SD1, OUTPUT); //???
// PORT_Init(SEG_LCD_SD1, OUTPUT); //???
/* CS 输出高 */
*((volatile uint8_t *)(SEG_LCD0_CS)) |= (1 << SEG_LCD0_CS_PIN);
*((volatile uint8_t *)(SEG_LCD1_CS)) |= (1 << SEG_LCD1_CS_PIN);
}
#endif
/*
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) {
checkCount = 50;
BU98R10Chip1DDRAMBackup.Bit.Seg75 = 0; //BU98R10_1_SEG75
}
}
}
else {
checkDelay --;
checkInterval = 0;
}
if(checkCount > 0) {
checkCount--;
}
if (checkCount == 30) {
checkDelay = 20;
SEG_LCD_Init();
}
}
else {
checkInterval = 0;
checkCount = 0;
}
#endif if (g_curkeyinput == KeyON)
{
if ((u8BU98R10CheckCount >= 20) && (BU98R10Update.En == 0))
{
u8BU98R10CheckCount = 0;
checkData[0] = 0;
checkData[1] = 0;
BU98R10_All_ReadRam(48, &checkData[0], &checkData[1]);
if ((checkData[0] & 0xf0) != 0x70)
{
BU98R10_Init();
}
}
} }
else
{
u8BU98R10CheckCount = 0;
}
}
*/
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