Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
TianYing_ty100
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
TY
TianYing_ty100
Commits
8a47b987
Commit
8a47b987
authored
Aug 28, 2024
by
李俭双
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
🐞
fix:更改BU98寄存器配置方式
parent
2d196c43
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
126 additions
and
26 deletions
+126
-26
BU98R10.c
Firmware/Source/Component/BU98R10/BU98R10.c
+126
-26
No files found.
Firmware/Source/Component/BU98R10/BU98R10.c
View file @
8a47b987
...
...
@@ -12,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
)
{
...
...
@@ -23,6 +25,59 @@ 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
)
{
...
...
@@ -30,15 +85,22 @@ void BU98R10_CHIP0_SET_SD_LEVEL(uint8_t Level)
{
//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->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_Set_Level(BU98R10_CHIP0_SD, RTE_GPIO_LEVEL_LOW);
PORT
->
P0
&=
~
(
1
<<
2
);
//P02
PORT
->
PM0
&=
~
(
1
<<
2
);
// 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
);
...
...
@@ -48,15 +110,21 @@ void BU98R10_CHIP1_SET_SD_LEVEL(uint8_t Level)
{
//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->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_Set_Level(BU98R10_CHIP1_SD, RTE_GPIO_LEVEL_LOW);
PORT
->
P7
&=
~
(
1
<<
2
);
//P72
// 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
);
...
...
@@ -66,15 +134,21 @@ void BU98R10_CHIP0_SET_CSB_LEVEL(uint8_t Level)
{
// 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->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_Set_Level(BU98R10_CHIP0_CSB, RTE_GPIO_LEVEL_LOW);
PORT
->
P0
&=
~
(
1
<<
3
);
//P03
PORT
->
PM0
&=
~
(
1
<<
3
);
// 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
);
...
...
@@ -84,15 +158,21 @@ void BU98R10_CHIP1_SET_CSB_LEVEL(uint8_t Level)
{
// 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->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_Set_Level(BU98R10_CHIP1_CSB, RTE_GPIO_LEVEL_LOW);
PORT
->
P7
&=
~
(
1
<<
1
);
//P71
// 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
);
...
...
@@ -102,15 +182,21 @@ void BU98R10_CHIP0_SET_SCL_LEVEL(uint8_t Level)
{
//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->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_Set_Level(BU98R10_CHIP0_SCL, RTE_GPIO_LEVEL_LOW);
PORT
->
P0
&=
~
(
1
<<
4
);
//P04
PORT
->
PM0
&=
~
(
1
<<
4
);
// 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
);
...
...
@@ -120,15 +206,21 @@ void BU98R10_CHIP1_SET_SCL_LEVEL(uint8_t Level)
{
//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->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_Set_Level(BU98R10_CHIP1_SCL, RTE_GPIO_LEVEL_LOW);
PORT
->
P7
&=
~
(
1
<<
0
);
//P70
PORT
->
PM7
&=
~
(
1
<<
0
);
// 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
);
...
...
@@ -137,14 +229,18 @@ void BU98R10_CHIP0_SET_SD_DIR(uint8_t Dir)
if
(
Dir
)
{
//RTE_GPIO_Set_Level(BU98R10_CHIP0_SD, RTE_GPIO_LEVEL_HIGH);
PORT
->
P0
|=
(
1
<<
2
);
PORT
->
PM0
&=
~
(
1
<<
2
);
//
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);
PORT
->
PM0
|=
(
1
<<
2
);
// PORT->PM0 |= (1<<2);
PORT
->
PCLR0
=
(
1
<<
2
);
NOP_DelayTime
(
BU98R10_NOP_TIME
);
}
}
void
BU98R10_CHIP1_SET_SD_DIR
(
uint8_t
Dir
);
...
...
@@ -154,13 +250,17 @@ void BU98R10_CHIP1_SET_SD_DIR(uint8_t Dir)
{
//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->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);
PORT
->
PM7
|=
(
1
<<
2
);
// PORT->PM7 |= (1<<2);
PORT
->
PCLR7
=
(
1
<<
2
);
NOP_DelayTime
(
BU98R10_NOP_TIME
);
}
}
...
...
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