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
c0c740ea
Commit
c0c740ea
authored
Aug 17, 2024
by
李俭双
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
🐞
fix:更换操作寄存器的方式操作IO口
parent
82902743
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
50 additions
and
16 deletions
+50
-16
BU98R10.c
Firmware/Source/Component/BU98R10/BU98R10.c
+50
-16
No files found.
Firmware/Source/Component/BU98R10/BU98R10.c
View file @
c0c740ea
#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
...
...
@@ -25,12 +29,16 @@ 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_Set_Level
(
BU98R10_CHIP0_SD
,
RTE_GPIO_LEVEL_HIGH
);
//RTE_GPIO_Set_Level(BU98R10_CHIP0_SD, RTE_GPIO_LEVEL_HIGH);
PORT
->
P0
|=
(
1
<<
2
);
PORT
->
PM0
&=
~
(
1
<<
2
);
}
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
);
//RTE_GPIO_Set_Level(BU98R10_CHIP0_SD, RTE_GPIO_LEVEL_LOW);
PORT
->
P0
&=
~
(
1
<<
2
);
//P02
PORT
->
PM0
&=
~
(
1
<<
2
);
}
}
void
BU98R10_CHIP1_SET_SD_LEVEL
(
uint8_t
Level
);
...
...
@@ -39,12 +47,16 @@ 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_Set_Level
(
BU98R10_CHIP1_SD
,
RTE_GPIO_LEVEL_HIGH
);
//RTE_GPIO_Set_Level(BU98R10_CHIP1_SD, RTE_GPIO_LEVEL_HIGH);
PORT
->
P7
|=
(
1
<<
2
);
PORT
->
PM7
&=
~
(
1
<<
2
);
}
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
);
//RTE_GPIO_Set_Level(BU98R10_CHIP1_SD, RTE_GPIO_LEVEL_LOW);
PORT
->
P7
&=
~
(
1
<<
2
);
//P72
PORT
->
PM7
&=
~
(
1
<<
2
);
}
}
void
BU98R10_CHIP0_SET_CSB_LEVEL
(
uint8_t
Level
);
...
...
@@ -53,12 +65,16 @@ 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_Set_Level
(
BU98R10_CHIP0_CSB
,
RTE_GPIO_LEVEL_HIGH
);
//RTE_GPIO_Set_Level(BU98R10_CHIP0_CSB, RTE_GPIO_LEVEL_HIGH);
PORT
->
P0
|=
(
1
<<
3
);
PORT
->
PM0
&=
~
(
1
<<
3
);
}
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
);
//RTE_GPIO_Set_Level(BU98R10_CHIP0_CSB, RTE_GPIO_LEVEL_LOW);
PORT
->
P0
&=
~
(
1
<<
3
);
//P03
PORT
->
PM0
&=
~
(
1
<<
3
);
}
}
void
BU98R10_CHIP1_SET_CSB_LEVEL
(
uint8_t
Level
);
...
...
@@ -67,12 +83,16 @@ 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_Set_Level
(
BU98R10_CHIP1_CSB
,
RTE_GPIO_LEVEL_HIGH
);
//RTE_GPIO_Set_Level(BU98R10_CHIP1_CSB, RTE_GPIO_LEVEL_HIGH);
PORT
->
P7
|=
(
1
<<
1
);
PORT
->
PM7
&=
~
(
1
<<
1
);
}
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
);
//RTE_GPIO_Set_Level(BU98R10_CHIP1_CSB, RTE_GPIO_LEVEL_LOW);
PORT
->
P7
&=
~
(
1
<<
1
);
//P71
PORT
->
PM7
&=
~
(
1
<<
1
);
}
}
void
BU98R10_CHIP0_SET_SCL_LEVEL
(
uint8_t
Level
);
...
...
@@ -81,12 +101,16 @@ 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_Set_Level
(
BU98R10_CHIP0_SCL
,
RTE_GPIO_LEVEL_HIGH
);
//RTE_GPIO_Set_Level(BU98R10_CHIP0_SCL, RTE_GPIO_LEVEL_HIGH);
PORT
->
P0
|=
(
1
<<
4
);
PORT
->
PM0
&=
~
(
1
<<
4
);
}
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
);
//RTE_GPIO_Set_Level(BU98R10_CHIP0_SCL, RTE_GPIO_LEVEL_LOW);
PORT
->
P0
&=
~
(
1
<<
4
);
//P04
PORT
->
PM0
&=
~
(
1
<<
4
);
}
}
void
BU98R10_CHIP1_SET_SCL_LEVEL
(
uint8_t
Level
);
...
...
@@ -95,12 +119,16 @@ 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_Set_Level
(
BU98R10_CHIP1_SCL
,
RTE_GPIO_LEVEL_HIGH
);
//RTE_GPIO_Set_Level(BU98R10_CHIP1_SCL, RTE_GPIO_LEVEL_HIGH);
PORT
->
P7
|=
(
1
<<
0
);
PORT
->
PM7
&=
~
(
1
<<
0
);
}
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
);
//RTE_GPIO_Set_Level(BU98R10_CHIP1_SCL, RTE_GPIO_LEVEL_LOW);
PORT
->
P7
&=
~
(
1
<<
0
);
//P70
PORT
->
PM7
&=
~
(
1
<<
0
);
}
}
void
BU98R10_CHIP0_SET_SD_DIR
(
uint8_t
Dir
);
...
...
@@ -108,12 +136,15 @@ void BU98R10_CHIP0_SET_SD_DIR(uint8_t Dir)
{
if
(
Dir
)
{
RTE_GPIO_Set_Level
(
BU98R10_CHIP0_SD
,
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);
}
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
);
}
}
void
BU98R10_CHIP1_SET_SD_DIR
(
uint8_t
Dir
);
...
...
@@ -122,11 +153,14 @@ void BU98R10_CHIP1_SET_SD_DIR(uint8_t Dir)
if
(
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
);
//RTE_GPIO_Config(BU98R10_CHIP1_SD, RTE_GPIO_DIR_OUT | RTE_GPIO_LEVEL_HIGH);
PORT
->
P7
|=
(
1
<<
2
);
PORT
->
PM7
&=
~
(
1
<<
2
);
}
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
);
}
}
...
...
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