Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
R
RT_RMR42E
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
时昊
RT_RMR42E
Commits
e1c1a0dd
Commit
e1c1a0dd
authored
Mar 11, 2025
by
李冠华
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
🎈
perf:更改BU98寄存器配置方式,提高段码刷新速度
parent
743fcfeb
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
174 additions
and
33 deletions
+174
-33
BU98R10.c
Firmware/Source/Component/BU98R10/BU98R10.c
+173
-32
BU98R10.h
Firmware/Source/Component/BU98R10/BU98R10.h
+1
-1
No files found.
Firmware/Source/Component/BU98R10/BU98R10.c
View file @
e1c1a0dd
#include "Components.h"
#include "BAT32A239.h"
#include <string.h>
#include <stdio.h>
#define BU98R10_CHIP0_SD RTE_GPIO_PORT00_PIN02
#define BU98R10_CHIP0_CSB RTE_GPIO_PORT00_PIN03
...
...
@@ -8,6 +12,8 @@
#define BU98R10_CHIP1_CSB RTE_GPIO_PORT07_PIN01
#define BU98R10_CHIP1_SCL RTE_GPIO_PORT07_PIN00
#define BU98R10_NOP_TIME 5U
uint8_t
BU98R10_CHIP0_GET_SD_LEVEL
(
void
);
uint8_t
BU98R10_CHIP0_GET_SD_LEVEL
(
void
)
{
...
...
@@ -19,18 +25,82 @@ uint8_t BU98R10_CHIP1_GET_SD_LEVEL(void)
return
RTE_GPIO_Get_Level
(
BU98R10_CHIP1_SD
);
}
void
NOP_DelayTime
(
uint8_t
timer
)
{
// uint8_t i = 0;
// for(i = 0;i < timer;i++)
// {
__NOP
();
__NOP
();
__NOP
();
__NOP
();
__NOP
();
__NOP
();
__NOP
();
__NOP
();
__NOP
();
__NOP
();
__NOP
();
__NOP
();
__NOP
();
__NOP
();
__NOP
();
__NOP
();
__NOP
();
__NOP
();
__NOP
();
__NOP
();
__NOP
();
__NOP
();
__NOP
();
__NOP
();
__NOP
();
__NOP
();
__NOP
();
__NOP
();
__NOP
();
__NOP
();
__NOP
();
__NOP
();
__NOP
();
__NOP
();
__NOP
();
__NOP
();
__NOP
();
__NOP
();
__NOP
();
__NOP
();
__NOP
();
__NOP
();
__NOP
();
__NOP
();
__NOP
();
// }
}
void
BU98R10_CHIP0_SET_SD_LEVEL
(
uint8_t
Level
);
void
BU98R10_CHIP0_SET_SD_LEVEL
(
uint8_t
Level
)
{
if
(
Level
)
{
RTE_GPIO_Config
(
BU98R10_CHIP0_SD
,
RTE_GPIO_DIR_OUT
|
RTE_GPIO_LEVEL_HIGH
);
//
RTE_GPIO_Config(BU98R10_CHIP0_SD, RTE_GPIO_DIR_OUT | RTE_GPIO_LEVEL_HIGH);
//RTE_GPIO_Set_Level(BU98R10_CHIP0_SD, RTE_GPIO_LEVEL_HIGH);
//PORT->P0 |= (1<<2);
//PORT->PM0 &= ~(1<<2);
PORT
->
PM0
&=
~
(
1
<<
2
);
PORT
->
PSET0
=
(
1
<<
2
);
NOP_DelayTime
(
BU98R10_NOP_TIME
);
}
else
{
RTE_GPIO_Config
(
BU98R10_CHIP0_SD
,
RTE_GPIO_DIR_OUT
|
RTE_GPIO_LEVEL_LOW
);
//
RTE_GPIO_Config(BU98R10_CHIP0_SD, RTE_GPIO_DIR_OUT | RTE_GPIO_LEVEL_LOW);
//RTE_GPIO_Set_Level(BU98R10_CHIP0_SD, RTE_GPIO_LEVEL_LOW);
// PORT->P0 &= ~(1<<2);//P02
// PORT->PM0 &= ~(1<<2);
PORT
->
PM0
&=
~
(
1
<<
2
);
PORT
->
PCLR0
=
(
1
<<
2
);
NOP_DelayTime
(
BU98R10_NOP_TIME
);
}
}
void
BU98R10_CHIP1_SET_SD_LEVEL
(
uint8_t
Level
);
...
...
@@ -38,13 +108,23 @@ void BU98R10_CHIP1_SET_SD_LEVEL(uint8_t Level)
{
if
(
Level
)
{
RTE_GPIO_Config
(
BU98R10_CHIP1_SD
,
RTE_GPIO_DIR_OUT
|
RTE_GPIO_LEVEL_HIGH
);
//
RTE_GPIO_Config(BU98R10_CHIP1_SD, RTE_GPIO_DIR_OUT | RTE_GPIO_LEVEL_HIGH);
//RTE_GPIO_Set_Level(BU98R10_CHIP1_SD, RTE_GPIO_LEVEL_HIGH);
// PORT->P7 |= (1<<2);
// PORT->PM7 &= ~(1<<2);
PORT
->
PM7
&=
~
(
1
<<
2
);
PORT
->
PSET7
=
(
1
<<
2
);
NOP_DelayTime
(
BU98R10_NOP_TIME
);
}
else
{
RTE_GPIO_Config
(
BU98R10_CHIP1_SD
,
RTE_GPIO_DIR_OUT
|
RTE_GPIO_LEVEL_LOW
);
//
RTE_GPIO_Config(BU98R10_CHIP1_SD, RTE_GPIO_DIR_OUT | RTE_GPIO_LEVEL_LOW);
//RTE_GPIO_Set_Level(BU98R10_CHIP1_SD, RTE_GPIO_LEVEL_LOW);
// PORT->P7 &= ~(1<<2);//P72
// PORT->PM7 &= ~(1<<2);
PORT
->
PM7
&=
~
(
1
<<
2
);
PORT
->
PCLR7
=
(
1
<<
2
);
NOP_DelayTime
(
BU98R10_NOP_TIME
);
}
}
void
BU98R10_CHIP0_SET_CSB_LEVEL
(
uint8_t
Level
);
...
...
@@ -52,13 +132,23 @@ void BU98R10_CHIP0_SET_CSB_LEVEL(uint8_t Level)
{
if
(
Level
)
{
RTE_GPIO_Config
(
BU98R10_CHIP0_CSB
,
RTE_GPIO_DIR_OUT
|
RTE_GPIO_LEVEL_HIGH
);
//
RTE_GPIO_Config(BU98R10_CHIP0_CSB, RTE_GPIO_DIR_OUT | RTE_GPIO_LEVEL_HIGH);
//RTE_GPIO_Set_Level(BU98R10_CHIP0_CSB, RTE_GPIO_LEVEL_HIGH);
// PORT->P0 |= (1<<3);
// PORT->PM0 &= ~(1<<3);
PORT
->
PM0
&=
~
(
1
<<
3
);
PORT
->
PSET0
=
(
1
<<
3
);
NOP_DelayTime
(
BU98R10_NOP_TIME
);
}
else
{
RTE_GPIO_Config
(
BU98R10_CHIP0_CSB
,
RTE_GPIO_DIR_OUT
|
RTE_GPIO_LEVEL_LOW
);
//
RTE_GPIO_Config(BU98R10_CHIP0_CSB, RTE_GPIO_DIR_OUT | RTE_GPIO_LEVEL_LOW);
//RTE_GPIO_Set_Level(BU98R10_CHIP0_CSB, RTE_GPIO_LEVEL_LOW);
// PORT->P0 &= ~(1<<3);//P03
// PORT->PM0 &= ~(1<<3);
PORT
->
PM0
&=
~
(
1
<<
3
);
PORT
->
PCLR0
=
(
1
<<
3
);
NOP_DelayTime
(
BU98R10_NOP_TIME
);
}
}
void
BU98R10_CHIP1_SET_CSB_LEVEL
(
uint8_t
Level
);
...
...
@@ -66,13 +156,23 @@ void BU98R10_CHIP1_SET_CSB_LEVEL(uint8_t Level)
{
if
(
Level
)
{
RTE_GPIO_Config
(
BU98R10_CHIP1_CSB
,
RTE_GPIO_DIR_OUT
|
RTE_GPIO_LEVEL_HIGH
);
//
RTE_GPIO_Config(BU98R10_CHIP1_CSB, RTE_GPIO_DIR_OUT | RTE_GPIO_LEVEL_HIGH);
//RTE_GPIO_Set_Level(BU98R10_CHIP1_CSB, RTE_GPIO_LEVEL_HIGH);
// PORT->P7 |= (1<<1);
// PORT->PM7 &= ~(1<<1);
PORT
->
PM7
&=
~
(
1
<<
1
);
PORT
->
PSET7
=
(
1
<<
1
);
NOP_DelayTime
(
BU98R10_NOP_TIME
);
}
else
{
RTE_GPIO_Config
(
BU98R10_CHIP1_CSB
,
RTE_GPIO_DIR_OUT
|
RTE_GPIO_LEVEL_LOW
);
//
RTE_GPIO_Config(BU98R10_CHIP1_CSB, RTE_GPIO_DIR_OUT | RTE_GPIO_LEVEL_LOW);
//RTE_GPIO_Set_Level(BU98R10_CHIP1_CSB, RTE_GPIO_LEVEL_LOW);
// PORT->P7 &= ~(1<<1);//P71
// PORT->PM7 &= ~(1<<1);
PORT
->
PM7
&=
~
(
1
<<
1
);
PORT
->
PCLR7
=
(
1
<<
1
);
NOP_DelayTime
(
BU98R10_NOP_TIME
);
}
}
void
BU98R10_CHIP0_SET_SCL_LEVEL
(
uint8_t
Level
);
...
...
@@ -80,13 +180,23 @@ void BU98R10_CHIP0_SET_SCL_LEVEL(uint8_t Level)
{
if
(
Level
)
{
RTE_GPIO_Config
(
BU98R10_CHIP0_SCL
,
RTE_GPIO_DIR_OUT
|
RTE_GPIO_LEVEL_HIGH
);
//
RTE_GPIO_Config(BU98R10_CHIP0_SCL, RTE_GPIO_DIR_OUT | RTE_GPIO_LEVEL_HIGH);
//RTE_GPIO_Set_Level(BU98R10_CHIP0_SCL, RTE_GPIO_LEVEL_HIGH);
// PORT->P0 |= (1<<4);
// PORT->PM0 &= ~(1<<4);
PORT
->
PM0
&=
~
(
1
<<
4
);
PORT
->
PSET0
=
(
1
<<
4
);
NOP_DelayTime
(
BU98R10_NOP_TIME
);
}
else
{
RTE_GPIO_Config
(
BU98R10_CHIP0_SCL
,
RTE_GPIO_DIR_OUT
|
RTE_GPIO_LEVEL_LOW
);
//
RTE_GPIO_Config(BU98R10_CHIP0_SCL, RTE_GPIO_DIR_OUT | RTE_GPIO_LEVEL_LOW);
//RTE_GPIO_Set_Level(BU98R10_CHIP0_SCL, RTE_GPIO_LEVEL_LOW);
// PORT->P0 &= ~(1<<4);//P04
// PORT->PM0 &= ~(1<<4);
PORT
->
PM0
&=
~
(
1
<<
4
);
PORT
->
PCLR0
=
(
1
<<
4
);
NOP_DelayTime
(
BU98R10_NOP_TIME
);
}
}
void
BU98R10_CHIP1_SET_SCL_LEVEL
(
uint8_t
Level
);
...
...
@@ -94,13 +204,23 @@ void BU98R10_CHIP1_SET_SCL_LEVEL(uint8_t Level)
{
if
(
Level
)
{
RTE_GPIO_Config
(
BU98R10_CHIP1_SCL
,
RTE_GPIO_DIR_OUT
|
RTE_GPIO_LEVEL_HIGH
);
//
RTE_GPIO_Config(BU98R10_CHIP1_SCL, RTE_GPIO_DIR_OUT | RTE_GPIO_LEVEL_HIGH);
//RTE_GPIO_Set_Level(BU98R10_CHIP1_SCL, RTE_GPIO_LEVEL_HIGH);
// PORT->P7 |= (1<<0);
// PORT->PM7 &= ~(1<<0);
PORT
->
PM7
&=
~
(
1
<<
0
);
PORT
->
PSET7
=
(
1
<<
0
);
NOP_DelayTime
(
BU98R10_NOP_TIME
);
}
else
{
RTE_GPIO_Config
(
BU98R10_CHIP1_SCL
,
RTE_GPIO_DIR_OUT
|
RTE_GPIO_LEVEL_LOW
);
//
RTE_GPIO_Config(BU98R10_CHIP1_SCL, RTE_GPIO_DIR_OUT | RTE_GPIO_LEVEL_LOW);
//RTE_GPIO_Set_Level(BU98R10_CHIP1_SCL, RTE_GPIO_LEVEL_LOW);
// PORT->P7 &= ~(1<<0);//P70
// PORT->PM7 &= ~(1<<0);
PORT
->
PM7
&=
~
(
1
<<
0
);
PORT
->
PCLR7
=
(
1
<<
0
);
NOP_DelayTime
(
BU98R10_NOP_TIME
);
}
}
void
BU98R10_CHIP0_SET_SD_DIR
(
uint8_t
Dir
);
...
...
@@ -108,11 +228,19 @@ void BU98R10_CHIP0_SET_SD_DIR(uint8_t Dir)
{
if
(
Dir
)
{
RTE_GPIO_Config
(
BU98R10_CHIP0_SD
,
RTE_GPIO_DIR_OUT
|
RTE_GPIO_LEVEL_HIGH
);
//RTE_GPIO_Set_Level(BU98R10_CHIP0_SD, RTE_GPIO_LEVEL_HIGH);
// PORT->P0 |= (1<<2);
// PORT->PM0 &= ~(1<<2);
// RTE_GPIO_Config(BU98R10_CHIP0_SD, RTE_GPIO_DIR_OUT | RTE_GPIO_LEVEL_HIGH);
PORT
->
PSET0
=
(
1
<<
2
);
NOP_DelayTime
(
BU98R10_NOP_TIME
);
}
else
{
RTE_GPIO_Config
(
BU98R10_CHIP0_SD
,
RTE_GPIO_DIR_IN
);
//RTE_GPIO_Config(BU98R10_CHIP0_SD, RTE_GPIO_DIR_IN);
// PORT->PM0 |= (1<<2);
PORT
->
PCLR0
=
(
1
<<
2
);
NOP_DelayTime
(
BU98R10_NOP_TIME
);
}
}
void
BU98R10_CHIP1_SET_SD_DIR
(
uint8_t
Dir
);
...
...
@@ -120,11 +248,19 @@ void BU98R10_CHIP1_SET_SD_DIR(uint8_t Dir)
{
if
(
Dir
)
{
RTE_GPIO_Config
(
BU98R10_CHIP1_SD
,
RTE_GPIO_DIR_OUT
|
RTE_GPIO_LEVEL_HIGH
);
//RTE_GPIO_Set_Level(BU98R10_CHIP1_SD, RTE_GPIO_LEVEL_HIGH);
//RTE_GPIO_Config(BU98R10_CHIP1_SD, RTE_GPIO_DIR_OUT | RTE_GPIO_LEVEL_HIGH);
// PORT->P7 |= (1<<2);
// PORT->PM7 &= ~(1<<2);
PORT
->
PSET7
=
(
1
<<
2
);
NOP_DelayTime
(
BU98R10_NOP_TIME
);
}
else
{
RTE_GPIO_Config
(
BU98R10_CHIP1_SD
,
RTE_GPIO_DIR_IN
);
//RTE_GPIO_Config(BU98R10_CHIP1_SD, RTE_GPIO_DIR_IN);
// PORT->PM7 |= (1<<2);
PORT
->
PCLR7
=
(
1
<<
2
);
NOP_DelayTime
(
BU98R10_NOP_TIME
);
}
}
...
...
@@ -139,6 +275,7 @@ BU98R10DDRAMUnion BU98R10Chip1DDRAMBackup;
#endif
BU98R10UpdateCtrlStruct
BU98R10Update
;
uint32_t
u32BU98R10ForcedUpdate
=
0UL
;
void
BU98R10_Init
(
void
)
{
...
...
@@ -147,8 +284,12 @@ void BU98R10_Init(void)
#if BU98R10_WRITE_AT_SAME_TIME
#if BU98R10_COLORFUL_LCD_MODE
Gen_TimeDelay
(
120
*
1000u
,
50u
);
BU98R10_All_Command_Write
(
BU98R10_CMD_SWRST
);
Gen_TimeDelay
(
20
*
1000
,
50U
);
BU98R10_All_Command_Write
(
BU98R10_CMD_ICSET
|
BU98R10_PAR_ICSET_RGB
);
BU98R10_All_Command_Write
(
BU98R10_CMD_DRVCTRL
|
BU98R10_PAR_DRVCTRL_NORMAL
);
...
...
@@ -407,7 +548,7 @@ void BU98R10_Init(void)
#endif
#endif
#endif
u32BU98R10ForcedUpdate
=
0UL
;
BU98R10Update
.
En
=
0
;
BU98R10Update
.
Step
=
0
;
BU98R10Update
.
Cont
=
0
;
...
...
@@ -437,25 +578,23 @@ void BU98R10_Shutdown(void)
#endif
}
uint8_t
u8BU98R10CheckCount
=
0
;
#define BU98R10_FORCED_SEG_NUM 2U
void
BU98R10_Update_Request
(
void
)
{
// if (g_sysFlag.Bits.AccSaveState)
//{
// //if (u8BU98R10CheckCount < 20)
// //{
// // BU98R10Update.En = 1;
// // u8BU98R10CheckCount++;
// //}
// BU98R10Update.En = 1;
// }
// else
if
(
BU98R10Update
.
En
==
0
)
{
u8BU98R10CheckCount
=
0
;
BU98R10Update
.
En
=
1
;
if
(
u32BU98R10ForcedUpdate
<=
(
BU98R10_DDRAM_SIZE
-
BU98R10_FORCED_SEG_NUM
))
{
u32BU98R10ForcedUpdate
+=
BU98R10_FORCED_SEG_NUM
;
}
else
{
u32BU98R10ForcedUpdate
=
0UL
;
}
}
BU98R10Update
.
En
=
1
;
#if USE_BU98R10_CHIP_0
BU98R10Update
.
Chip
=
0
;
#elif USE_BU98R10_CHIP_1
...
...
@@ -475,7 +614,9 @@ void BU98R10_Update_Service(void)
{
case
0
:
if
((
BU98R10Chip0DDRAM
.
Byte
[
BU98R10Update
.
Addr
]
!=
BU98R10Chip0DDRAMBackup
.
Byte
[
BU98R10Update
.
Addr
])
||
(
BU98R10Chip1DDRAM
.
Byte
[
BU98R10Update
.
Addr
]
!=
BU98R10Chip1DDRAMBackup
.
Byte
[
BU98R10Update
.
Addr
]))
(
BU98R10Chip1DDRAM
.
Byte
[
BU98R10Update
.
Addr
]
!=
BU98R10Chip1DDRAMBackup
.
Byte
[
BU98R10Update
.
Addr
])
||
((
u32BU98R10ForcedUpdate
<=
BU98R10Update
.
Addr
)
&&
((
u32BU98R10ForcedUpdate
+
BU98R10_FORCED_SEG_NUM
)
>=
BU98R10Update
.
Addr
)))
{
BU98R10Chip0DDRAMBackup
.
Byte
[
BU98R10Update
.
Addr
]
=
BU98R10Chip0DDRAM
.
Byte
[
BU98R10Update
.
Addr
];
BU98R10Chip1DDRAMBackup
.
Byte
[
BU98R10Update
.
Addr
]
=
BU98R10Chip1DDRAM
.
Byte
[
BU98R10Update
.
Addr
];
...
...
Firmware/Source/Component/BU98R10/BU98R10.h
View file @
e1c1a0dd
...
...
@@ -938,7 +938,7 @@ void BU98R10_All_Data_Write(uint8_t Dat0, uint8_t Dat1);
extern
void
checkSegTftState
(
void
);
#endif
extern
void
NOP_DelayTime
(
uint8_t
timer
);
#endif
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