Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
jiancetai
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
陈家乐
jiancetai
Commits
78caace0
Commit
78caace0
authored
May 07, 2025
by
戴荣
🎨
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
✨
feat:比亚乔检测台最终版
parent
68178d89
Changes
19
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
4242 additions
and
551 deletions
+4242
-551
settings.json
.vscode/settings.json
+6
-1
Application.gpj
YueJin_test_bench/ghs/group/Application.gpj
+6
-1
Driver.gpj
YueJin_test_bench/ghs/group/Driver.gpj
+6
-1
project.gpj
YueJin_test_bench/ghs/project.gpj
+1
-0
BU91R65_User.c
YueJin_test_bench/source/Appliciation/BU91R65_User.c
+738
-0
BU91R65_User.h
YueJin_test_bench/source/Appliciation/BU91R65_User.h
+143
-0
RTE_GPIO.h
YueJin_test_bench/source/Appliciation/RTE_GPIO.h
+34
-0
SEG_Display.c
YueJin_test_bench/source/Appliciation/SEG_Display.c
+92
-0
SEG_Display.h
YueJin_test_bench/source/Appliciation/SEG_Display.h
+34
-0
Task.c
YueJin_test_bench/source/Appliciation/Task.c
+9
-5
BU91R65.c
YueJin_test_bench/source/Driver/BU91R65/BU91R65.c
+64
-0
BU91R65.h
YueJin_test_bench/source/Driver/BU91R65/BU91R65.h
+2210
-0
BU91R65_Access.c
YueJin_test_bench/source/Driver/BU91R65/BU91R65_Access.c
+631
-0
BU91R65_Access.h
YueJin_test_bench/source/Driver/BU91R65/BU91R65_Access.h
+132
-0
BU91R65_Porting.c
YueJin_test_bench/source/Driver/BU91R65/BU91R65_Porting.c
+76
-0
BU91R65_Porting.h
YueJin_test_bench/source/Driver/BU91R65/BU91R65_Porting.h
+37
-0
GPIO.c
YueJin_test_bench/source/Driver/GPIO/GPIO.c
+20
-20
init.c
YueJin_test_bench/source/System/init.c
+3
-0
GPIO.h
YueJin_test_bench/utility/GPIO/GPIO.h
+0
-523
No files found.
.vscode/settings.json
View file @
78caace0
...
...
@@ -58,6 +58,11 @@
"C_Cpp_Runner.msvcSecureNoWarnings"
:
false
,
"files.associations"
:
{
"api_rs485.h"
:
"c"
,
"tyw_stdint.h"
:
"c"
"tyw_stdint.h"
:
"c"
,
"bu91r65_access.h"
:
"c"
,
"gpio.h"
:
"c"
,
"bu91r65.h"
:
"c"
,
"bu91r65_user.h"
:
"c"
,
"bu91r65_porting.h"
:
"c"
}
}
\ No newline at end of file
YueJin_test_bench/ghs/group/Application.gpj
View file @
78caace0
...
...
@@ -63,4 +63,9 @@ Key_user.c
Key.h
app_lsdn.c
app_lsdn.h
\ No newline at end of file
app_lsdn.h
BU91R65_User.c
BU91R65_User.h
SEG_Display.c
SEG_Display.h
\ No newline at end of file
YueJin_test_bench/ghs/group/Driver.gpj
View file @
78caace0
...
...
@@ -23,4 +23,9 @@ UART\UART.h
.\GPIO\Simulated_8080.c
.\GPIO\TFT_LCD.c
.\GPIO\TM035HFZGZx.c
.\BU91R65\BU91R65.c
.\BU91R65\BU91R65.h
.\BU91R65\BU91R65_Access.c
.\BU91R65\BU91R65_Access.h
.\BU91R65\BU91R65_Porting.c
.\BU91R65\BU91R65_Porting.h
YueJin_test_bench/ghs/project.gpj
View file @
78caace0
...
...
@@ -31,6 +31,7 @@ primaryTarget=v800_standalone.tgt
-I..\source\Driver\Analog_Signals
-I..\source\Driver\CAN
-I..\source\Driver\GPIO
-I..\source\Driver\BU91R65
-I..\source\System
-I..\source\Appliciation
-I..\source\FCL
...
...
YueJin_test_bench/source/Appliciation/BU91R65_User.c
0 → 100644
View file @
78caace0
#include "BU91R65_User.h"
#include "BU91R65.h"
// #include "BU91R65_Access.h"
#include <string.h>
/*数字显示数组*/
/*0, 1 2 3 4 5 6 7 8 9 A b C d E F U P L - null*/
const
uint8_t
BU91R65MASK
[
BU91R65DIS_MAX_7
]
=
{
0x3Fu
,
0x06u
,
0x5Bu
,
0x4Fu
,
0x66u
,
0x6Du
,
0x7Du
,
0x07u
,
0x7Fu
,
0x6Fu
,
0x77
,
0x7C
,
0x39
,
0x5E
,
0x79
,
0x71
,
0x3E
,
0x73
,
0x38
,
0x76
,
0x40
,
0x00
};
/*数字显示数组*/
/*0, 1 2 3 4 5 6 7 8 9 null */
/*0, 1 2 3 4 5 6 7 8 9 */
const
uint16_t
BU91R65MASK_16
[
BU91R65DIS16_MAX_16
]
=
{
0x00FFu
,
0x040Cu
,
0x8877u
,
0x083Fu
,
0x888Cu
,
0x88BBu
,
0x88FBu
,
0x000Fu
,
0x88FFu
,
0x88BFu
,
\
/* A B C D E F G H I J K L M N O P */
0x88CFu
,
0x2A3Fu
,
0x00F3u
,
0x223Fu
,
0x80F3u
,
0x80C3u
,
0x08FBu
,
0x88CCu
,
0x2233u
,
0x007Cu
,
0x94C0u
,
0x00F0u
,
0x05CCu
,
0x11CCu
,
0x00FFu
,
0x88C7u
,
\
/* Q R S T U V W X Y Z 乘x + - 除/ [ ] */
0x10FFu
,
0x98C7u
,
0x88BBu
,
0x2203u
,
0x00FCu
,
0x44C0u
,
0x50CCu
,
0x5500u
,
0x88BCu
,
0x4433u
,
0x5500u
,
0xAA00u
,
0x8800u
,
0x4400u
,
0x00E1u
,
0x2221u
,
\
/* ( ) = 度° 下划线 null */
0x1400u
,
0x4100u
,
0x8830u
,
0x0A06u
,
0x0030u
,
0x0000u
,};
uint8_t
BU91R65_Set_Numble
(
const
BU91R65_USER_st_t
*
pBU91R65User
,
uint8_t
enBU91R65Value
,
BU91R65_Number_SEG_en_t
enBU91R65SEGNum
,
uint8_t
Enable
)
{
uint8_t
i
=
0
;
uint8_t
u8Index
=
0
;
uint8_t
u8COM
=
0
;
uint8_t
BU91R65NUMBERMAX
=
0
;
if
(
pBU91R65User
==
(
void
*
)
0
)
{
return
2
;
}
if
(
enBU91R65SEGNum
==
BU91R65_NUMBER_SEG_7
)
{
BU91R65NUMBERMAX
=
7
;
}
else
if
(
enBU91R65SEGNum
==
BU91R65_NUMBER_SEG_16
)
{
BU91R65NUMBERMAX
=
16
;
}
else
{
return
2
;
}
for
(
i
=
0
;
i
<
BU91R65NUMBERMAX
;
i
++
)
{
if
((
pBU91R65User
[
i
].
u8BU91R65_Seg
<=
BU91R65SEGMAX
)
&&
(
pBU91R65User
[
i
].
enBU91R65Channel
<
BU91R65_CHANNEL_MAX
)
&&
(
pBU91R65User
[
i
].
u8BU91R65_COM
<
BU91R65_COM_MAX
))
{
u8Index
=
pBU91R65User
[
i
].
u8BU91R65_Seg
;
u8COM
=
pBU91R65User
[
i
].
u8BU91R65_COM
;
if
(
pBU91R65User
[
i
].
enBU91R65Channel
==
0
)
{
if
(
enBU91R65SEGNum
==
BU91R65_NUMBER_SEG_7
)
{
if
(
Enable
)
{
if
((
BU91R65MASK
[
enBU91R65Value
]
&
(
1
<<
i
))
!=
0
)
{
g_stBU91R65Chip0Seg
.
Byte
[
u8Index
/
2
]
|=
(
0x1
<<
((
u8Index
%
2
)
*
4
+
u8COM
));
}
else
{
g_stBU91R65Chip0Seg
.
Byte
[
u8Index
/
2
]
&=
~
(
0x1
<<
((
u8Index
%
2
)
*
4
+
u8COM
));
}
}
else
{
g_stBU91R65Chip0Seg
.
Byte
[
u8Index
/
2
]
&=
~
(
0x1
<<
((
u8Index
%
2
)
*
4
+
u8COM
));
}
}
else
if
(
enBU91R65SEGNum
==
BU91R65_NUMBER_SEG_16
)
{
if
(
Enable
)
{
if
((
BU91R65MASK_16
[
enBU91R65Value
]
&
(
1
<<
i
))
!=
0
)
{
g_stBU91R65Chip0Seg
.
Byte
[
u8Index
/
2
]
|=
(
0x1
<<
((
u8Index
%
2
)
*
4
+
u8COM
));
}
else
{
g_stBU91R65Chip0Seg
.
Byte
[
u8Index
/
2
]
&=
~
(
0x1
<<
((
u8Index
%
2
)
*
4
+
u8COM
));
}
}
else
{
g_stBU91R65Chip0Seg
.
Byte
[
u8Index
/
2
]
&=
~
(
0x1
<<
((
u8Index
%
2
)
*
4
+
u8COM
));
}
}
else
{
return
2
;
}
}
else
{
if
(
enBU91R65SEGNum
==
BU91R65_NUMBER_SEG_7
)
{
if
(
Enable
)
{
if
((
BU91R65MASK
[
enBU91R65Value
]
&
(
1
<<
i
))
!=
0
)
{
g_stBU91R65Chip1Seg
.
Byte
[
u8Index
/
2
]
|=
(
0x1
<<
((
u8Index
%
2
)
*
4
+
u8COM
));
}
else
{
g_stBU91R65Chip1Seg
.
Byte
[
u8Index
/
2
]
&=
~
(
0x1
<<
((
u8Index
%
2
)
*
4
+
u8COM
));
}
}
else
{
g_stBU91R65Chip1Seg
.
Byte
[
u8Index
/
2
]
&=
~
(
0x1
<<
((
u8Index
%
2
)
*
4
+
u8COM
));
}
}
else
if
(
enBU91R65SEGNum
==
BU91R65_NUMBER_SEG_16
)
{
if
(
Enable
)
{
if
((
BU91R65MASK_16
[
enBU91R65Value
]
&
(
1
<<
i
))
!=
0
)
{
g_stBU91R65Chip1Seg
.
Byte
[
u8Index
/
2
]
|=
(
0x1
<<
((
u8Index
%
2
)
*
4
+
u8COM
));
}
else
{
g_stBU91R65Chip1Seg
.
Byte
[
u8Index
/
2
]
&=
~
(
0x1
<<
((
u8Index
%
2
)
*
4
+
u8COM
));
}
}
else
{
g_stBU91R65Chip1Seg
.
Byte
[
u8Index
/
2
]
&=
~
(
0x1
<<
((
u8Index
%
2
)
*
4
+
u8COM
));
}
}
else
{
return
2
;
}
}
}
else
{
return
3
;
}
}
return
0
;
}
void
Clear_All_BU91R65
(
void
)
{
uint8_t
i
=
0
;
for
(
i
=
0
;
i
<
BU91R65_BUFFER_SIZE
;
i
++
)
{
BU91R65_Write_Buffer
(
&
g_stBU91R65Chip0
,
i
,
0x00
);
BU91R65_Write_Buffer
(
&
g_stBU91R65Chip1
,
i
,
0x00
);
}
}
/* example */
// #define SEG_7_MAX 7
// #define SEG_7(channel, com, segment) {channel, com, segment}
// const BU91R65_USER_st_t VSPEEDSEG_0[SEG_7_MAX] = {
// SEG_7(BU91R65_CHANNEL_2, 1, 16),
// SEG_7(BU91R65_CHANNEL_2, 1, 17),
// SEG_7(BU91R65_CHANNEL_2, 1, 18),
// SEG_7(BU91R65_CHANNEL_2, 0, 15),
// SEG_7(BU91R65_CHANNEL_2, 1, 15),
// SEG_7(BU91R65_CHANNEL_2, 0, 16),
// SEG_7(BU91R65_CHANNEL_2, 0, 17),
// };
#define SEG_16_MAX 16
#define SEG_16(channel, com, segment) {channel, com, segment}
const
BU91R65_USER_st_t
MiZi_Seg_0
[
SEG_16_MAX
]
=
{
SEG_16
(
BU91R65_CHANNEL_1
,
3
,
32
),
SEG_16
(
BU91R65_CHANNEL_1
,
3
,
34
),
SEG_16
(
BU91R65_CHANNEL_1
,
3
,
35
),
SEG_16
(
BU91R65_CHANNEL_1
,
2
,
35
),
SEG_16
(
BU91R65_CHANNEL_1
,
0
,
35
),
SEG_16
(
BU91R65_CHANNEL_1
,
0
,
33
),
SEG_16
(
BU91R65_CHANNEL_1
,
0
,
32
),
SEG_16
(
BU91R65_CHANNEL_1
,
1
,
32
),
SEG_16
(
BU91R65_CHANNEL_1
,
2
,
32
),
SEG_16
(
BU91R65_CHANNEL_1
,
3
,
33
),
SEG_16
(
BU91R65_CHANNEL_1
,
2
,
34
),
SEG_16
(
BU91R65_CHANNEL_1
,
1
,
34
),
SEG_16
(
BU91R65_CHANNEL_1
,
1
,
35
),
SEG_16
(
BU91R65_CHANNEL_1
,
0
,
34
),
SEG_16
(
BU91R65_CHANNEL_1
,
1
,
33
),
SEG_16
(
BU91R65_CHANNEL_1
,
2
,
33
),
};
const
BU91R65_USER_st_t
MiZi_Seg_1
[
SEG_16_MAX
]
=
{
SEG_16
(
BU91R65_CHANNEL_1
,
3
,
37
),
SEG_16
(
BU91R65_CHANNEL_1
,
3
,
38
),
SEG_16
(
BU91R65_CHANNEL_1
,
3
,
39
),
SEG_16
(
BU91R65_CHANNEL_1
,
0
,
40
),
SEG_16
(
BU91R65_CHANNEL_1
,
0
,
38
),
SEG_16
(
BU91R65_CHANNEL_1
,
0
,
37
),
SEG_16
(
BU91R65_CHANNEL_1
,
1
,
36
),
SEG_16
(
BU91R65_CHANNEL_1
,
3
,
36
),
SEG_16
(
BU91R65_CHANNEL_1
,
2
,
37
),
SEG_16
(
BU91R65_CHANNEL_1
,
2
,
38
),
SEG_16
(
BU91R65_CHANNEL_1
,
2
,
39
),
SEG_16
(
BU91R65_CHANNEL_1
,
1
,
39
),
SEG_16
(
BU91R65_CHANNEL_1
,
0
,
39
),
SEG_16
(
BU91R65_CHANNEL_1
,
1
,
38
),
SEG_16
(
BU91R65_CHANNEL_1
,
1
,
37
),
SEG_16
(
BU91R65_CHANNEL_1
,
2
,
36
),
};
const
BU91R65_USER_st_t
MiZi_Seg_2
[
SEG_16_MAX
]
=
{
SEG_16
(
BU91R65_CHANNEL_1
,
3
,
41
),
SEG_16
(
BU91R65_CHANNEL_1
,
3
,
42
),
SEG_16
(
BU91R65_CHANNEL_1
,
3
,
44
),
SEG_16
(
BU91R65_CHANNEL_1
,
2
,
44
),
SEG_16
(
BU91R65_CHANNEL_1
,
0
,
43
),
SEG_16
(
BU91R65_CHANNEL_1
,
0
,
42
),
SEG_16
(
BU91R65_CHANNEL_1
,
2
,
40
),
SEG_16
(
BU91R65_CHANNEL_1
,
3
,
40
),
SEG_16
(
BU91R65_CHANNEL_1
,
2
,
41
),
SEG_16
(
BU91R65_CHANNEL_1
,
2
,
42
),
SEG_16
(
BU91R65_CHANNEL_1
,
3
,
43
),
SEG_16
(
BU91R65_CHANNEL_1
,
2
,
43
),
SEG_16
(
BU91R65_CHANNEL_1
,
1
,
43
),
SEG_16
(
BU91R65_CHANNEL_1
,
1
,
42
),
SEG_16
(
BU91R65_CHANNEL_1
,
0
,
41
),
SEG_16
(
BU91R65_CHANNEL_1
,
1
,
41
),
};
const
BU91R65_USER_st_t
MiZi_Seg_3
[
SEG_16_MAX
]
=
{
SEG_16
(
BU91R65_CHANNEL_1
,
3
,
45
),
SEG_16
(
BU91R65_CHANNEL_1
,
3
,
47
),
SEG_16
(
BU91R65_CHANNEL_1
,
3
,
48
),
SEG_16
(
BU91R65_CHANNEL_1
,
2
,
48
),
SEG_16
(
BU91R65_CHANNEL_1
,
0
,
48
),
SEG_16
(
BU91R65_CHANNEL_1
,
0
,
46
),
SEG_16
(
BU91R65_CHANNEL_1
,
0
,
45
),
SEG_16
(
BU91R65_CHANNEL_1
,
1
,
45
),
SEG_16
(
BU91R65_CHANNEL_1
,
2
,
45
),
SEG_16
(
BU91R65_CHANNEL_1
,
3
,
46
),
SEG_16
(
BU91R65_CHANNEL_1
,
2
,
47
),
SEG_16
(
BU91R65_CHANNEL_1
,
1
,
47
),
SEG_16
(
BU91R65_CHANNEL_1
,
1
,
48
),
SEG_16
(
BU91R65_CHANNEL_1
,
0
,
47
),
SEG_16
(
BU91R65_CHANNEL_1
,
1
,
46
),
SEG_16
(
BU91R65_CHANNEL_1
,
2
,
46
),
};
const
BU91R65_USER_st_t
MiZi_Seg_4
[
SEG_16_MAX
]
=
{
SEG_16
(
BU91R65_CHANNEL_1
,
3
,
50
),
SEG_16
(
BU91R65_CHANNEL_1
,
3
,
51
),
SEG_16
(
BU91R65_CHANNEL_1
,
3
,
52
),
SEG_16
(
BU91R65_CHANNEL_1
,
0
,
53
),
SEG_16
(
BU91R65_CHANNEL_1
,
0
,
51
),
SEG_16
(
BU91R65_CHANNEL_1
,
0
,
50
),
SEG_16
(
BU91R65_CHANNEL_1
,
1
,
49
),
SEG_16
(
BU91R65_CHANNEL_1
,
3
,
49
),
SEG_16
(
BU91R65_CHANNEL_1
,
2
,
50
),
SEG_16
(
BU91R65_CHANNEL_1
,
2
,
51
),
SEG_16
(
BU91R65_CHANNEL_1
,
2
,
52
),
SEG_16
(
BU91R65_CHANNEL_1
,
1
,
52
),
SEG_16
(
BU91R65_CHANNEL_1
,
0
,
52
),
SEG_16
(
BU91R65_CHANNEL_1
,
1
,
51
),
SEG_16
(
BU91R65_CHANNEL_1
,
1
,
50
),
SEG_16
(
BU91R65_CHANNEL_1
,
2
,
49
),
};
const
BU91R65_USER_st_t
MiZi_Seg_5
[
SEG_16_MAX
]
=
{
SEG_16
(
BU91R65_CHANNEL_1
,
3
,
54
),
SEG_16
(
BU91R65_CHANNEL_1
,
3
,
55
),
SEG_16
(
BU91R65_CHANNEL_1
,
3
,
57
),
SEG_16
(
BU91R65_CHANNEL_1
,
2
,
57
),
SEG_16
(
BU91R65_CHANNEL_1
,
0
,
56
),
SEG_16
(
BU91R65_CHANNEL_1
,
0
,
55
),
SEG_16
(
BU91R65_CHANNEL_1
,
2
,
53
),
SEG_16
(
BU91R65_CHANNEL_1
,
3
,
53
),
SEG_16
(
BU91R65_CHANNEL_1
,
2
,
54
),
SEG_16
(
BU91R65_CHANNEL_1
,
2
,
55
),
SEG_16
(
BU91R65_CHANNEL_1
,
3
,
56
),
SEG_16
(
BU91R65_CHANNEL_1
,
2
,
56
),
SEG_16
(
BU91R65_CHANNEL_1
,
1
,
56
),
SEG_16
(
BU91R65_CHANNEL_1
,
1
,
55
),
SEG_16
(
BU91R65_CHANNEL_1
,
0
,
54
),
SEG_16
(
BU91R65_CHANNEL_1
,
1
,
54
),
};
const
BU91R65_USER_st_t
MiZi_Seg_6
[
SEG_16_MAX
]
=
{
SEG_16
(
BU91R65_CHANNEL_1
,
3
,
58
),
SEG_16
(
BU91R65_CHANNEL_1
,
3
,
60
),
SEG_16
(
BU91R65_CHANNEL_1
,
3
,
61
),
SEG_16
(
BU91R65_CHANNEL_1
,
2
,
61
),
SEG_16
(
BU91R65_CHANNEL_1
,
0
,
61
),
SEG_16
(
BU91R65_CHANNEL_1
,
0
,
59
),
SEG_16
(
BU91R65_CHANNEL_1
,
0
,
58
),
SEG_16
(
BU91R65_CHANNEL_1
,
1
,
58
),
SEG_16
(
BU91R65_CHANNEL_1
,
2
,
58
),
SEG_16
(
BU91R65_CHANNEL_1
,
3
,
59
),
SEG_16
(
BU91R65_CHANNEL_1
,
2
,
60
),
SEG_16
(
BU91R65_CHANNEL_1
,
1
,
60
),
SEG_16
(
BU91R65_CHANNEL_1
,
1
,
61
),
SEG_16
(
BU91R65_CHANNEL_1
,
0
,
60
),
SEG_16
(
BU91R65_CHANNEL_1
,
1
,
59
),
SEG_16
(
BU91R65_CHANNEL_1
,
2
,
59
),
};
const
BU91R65_USER_st_t
MiZi_Seg_7
[
SEG_16_MAX
]
=
{
SEG_16
(
BU91R65_CHANNEL_1
,
3
,
63
),
SEG_16
(
BU91R65_CHANNEL_1
,
3
,
64
),
SEG_16
(
BU91R65_CHANNEL_1
,
3
,
65
),
SEG_16
(
BU91R65_CHANNEL_1
,
0
,
66
),
SEG_16
(
BU91R65_CHANNEL_1
,
0
,
64
),
SEG_16
(
BU91R65_CHANNEL_1
,
0
,
63
),
SEG_16
(
BU91R65_CHANNEL_1
,
1
,
62
),
SEG_16
(
BU91R65_CHANNEL_1
,
3
,
62
),
SEG_16
(
BU91R65_CHANNEL_1
,
2
,
63
),
SEG_16
(
BU91R65_CHANNEL_1
,
2
,
64
),
SEG_16
(
BU91R65_CHANNEL_1
,
2
,
65
),
SEG_16
(
BU91R65_CHANNEL_1
,
1
,
65
),
SEG_16
(
BU91R65_CHANNEL_1
,
0
,
65
),
SEG_16
(
BU91R65_CHANNEL_1
,
1
,
64
),
SEG_16
(
BU91R65_CHANNEL_1
,
1
,
63
),
SEG_16
(
BU91R65_CHANNEL_1
,
2
,
62
),
};
const
BU91R65_USER_st_t
MiZi_Seg_8
[
SEG_16_MAX
]
=
{
SEG_16
(
BU91R65_CHANNEL_1
,
3
,
67
),
SEG_16
(
BU91R65_CHANNEL_1
,
3
,
68
),
SEG_16
(
BU91R65_CHANNEL_1
,
3
,
70
),
SEG_16
(
BU91R65_CHANNEL_1
,
2
,
70
),
SEG_16
(
BU91R65_CHANNEL_1
,
0
,
69
),
SEG_16
(
BU91R65_CHANNEL_1
,
0
,
68
),
SEG_16
(
BU91R65_CHANNEL_1
,
2
,
66
),
SEG_16
(
BU91R65_CHANNEL_1
,
3
,
66
),
SEG_16
(
BU91R65_CHANNEL_1
,
2
,
67
),
SEG_16
(
BU91R65_CHANNEL_1
,
2
,
68
),
SEG_16
(
BU91R65_CHANNEL_1
,
3
,
69
),
SEG_16
(
BU91R65_CHANNEL_1
,
2
,
69
),
SEG_16
(
BU91R65_CHANNEL_1
,
1
,
69
),
SEG_16
(
BU91R65_CHANNEL_1
,
1
,
68
),
SEG_16
(
BU91R65_CHANNEL_1
,
0
,
67
),
SEG_16
(
BU91R65_CHANNEL_1
,
1
,
67
),
};
const
BU91R65_USER_st_t
MiZi_Seg_9
[
SEG_16_MAX
]
=
{
SEG_16
(
BU91R65_CHANNEL_1
,
3
,
71
),
SEG_16
(
BU91R65_CHANNEL_1
,
3
,
73
),
SEG_16
(
BU91R65_CHANNEL_1
,
3
,
74
),
SEG_16
(
BU91R65_CHANNEL_1
,
2
,
74
),
SEG_16
(
BU91R65_CHANNEL_1
,
0
,
74
),
SEG_16
(
BU91R65_CHANNEL_1
,
0
,
72
),
SEG_16
(
BU91R65_CHANNEL_1
,
0
,
71
),
SEG_16
(
BU91R65_CHANNEL_1
,
1
,
71
),
SEG_16
(
BU91R65_CHANNEL_1
,
2
,
71
),
SEG_16
(
BU91R65_CHANNEL_1
,
3
,
72
),
SEG_16
(
BU91R65_CHANNEL_1
,
2
,
73
),
SEG_16
(
BU91R65_CHANNEL_1
,
1
,
73
),
SEG_16
(
BU91R65_CHANNEL_1
,
1
,
74
),
SEG_16
(
BU91R65_CHANNEL_1
,
0
,
73
),
SEG_16
(
BU91R65_CHANNEL_1
,
1
,
72
),
SEG_16
(
BU91R65_CHANNEL_1
,
2
,
72
),
};
const
BU91R65_USER_st_t
MiZi_Seg_10
[
SEG_16_MAX
]
=
{
SEG_16
(
BU91R65_CHANNEL_1
,
3
,
76
),
SEG_16
(
BU91R65_CHANNEL_1
,
3
,
77
),
SEG_16
(
BU91R65_CHANNEL_1
,
3
,
78
),
SEG_16
(
BU91R65_CHANNEL_1
,
0
,
79
),
SEG_16
(
BU91R65_CHANNEL_1
,
0
,
77
),
SEG_16
(
BU91R65_CHANNEL_1
,
0
,
76
),
SEG_16
(
BU91R65_CHANNEL_1
,
1
,
75
),
SEG_16
(
BU91R65_CHANNEL_1
,
3
,
75
),
SEG_16
(
BU91R65_CHANNEL_1
,
2
,
76
),
SEG_16
(
BU91R65_CHANNEL_1
,
2
,
77
),
SEG_16
(
BU91R65_CHANNEL_1
,
2
,
78
),
SEG_16
(
BU91R65_CHANNEL_1
,
1
,
78
),
SEG_16
(
BU91R65_CHANNEL_1
,
0
,
78
),
SEG_16
(
BU91R65_CHANNEL_1
,
1
,
77
),
SEG_16
(
BU91R65_CHANNEL_1
,
1
,
76
),
SEG_16
(
BU91R65_CHANNEL_1
,
2
,
75
),
};
const
BU91R65_USER_st_t
MiZi_Seg_11
[
SEG_16_MAX
]
=
{
SEG_16
(
BU91R65_CHANNEL_1
,
3
,
80
),
SEG_16
(
BU91R65_CHANNEL_1
,
3
,
81
),
SEG_16
(
BU91R65_CHANNEL_1
,
3
,
83
),
SEG_16
(
BU91R65_CHANNEL_1
,
2
,
83
),
SEG_16
(
BU91R65_CHANNEL_1
,
0
,
82
),
SEG_16
(
BU91R65_CHANNEL_1
,
0
,
81
),
SEG_16
(
BU91R65_CHANNEL_1
,
2
,
79
),
SEG_16
(
BU91R65_CHANNEL_1
,
3
,
79
),
SEG_16
(
BU91R65_CHANNEL_1
,
2
,
80
),
SEG_16
(
BU91R65_CHANNEL_1
,
2
,
81
),
SEG_16
(
BU91R65_CHANNEL_1
,
3
,
82
),
SEG_16
(
BU91R65_CHANNEL_1
,
2
,
82
),
SEG_16
(
BU91R65_CHANNEL_1
,
1
,
82
),
SEG_16
(
BU91R65_CHANNEL_1
,
1
,
81
),
SEG_16
(
BU91R65_CHANNEL_1
,
0
,
80
),
SEG_16
(
BU91R65_CHANNEL_1
,
1
,
80
),
};
const
BU91R65_USER_st_t
MiZi_Seg_12
[
SEG_16_MAX
]
=
{
SEG_16
(
BU91R65_CHANNEL_1
,
3
,
84
),
SEG_16
(
BU91R65_CHANNEL_1
,
3
,
86
),
SEG_16
(
BU91R65_CHANNEL_1
,
3
,
87
),
SEG_16
(
BU91R65_CHANNEL_1
,
2
,
87
),
SEG_16
(
BU91R65_CHANNEL_1
,
0
,
87
),
SEG_16
(
BU91R65_CHANNEL_1
,
0
,
85
),
SEG_16
(
BU91R65_CHANNEL_1
,
0
,
84
),
SEG_16
(
BU91R65_CHANNEL_1
,
1
,
84
),
SEG_16
(
BU91R65_CHANNEL_1
,
2
,
84
),
SEG_16
(
BU91R65_CHANNEL_1
,
3
,
85
),
SEG_16
(
BU91R65_CHANNEL_1
,
2
,
86
),
SEG_16
(
BU91R65_CHANNEL_1
,
1
,
86
),
SEG_16
(
BU91R65_CHANNEL_1
,
1
,
87
),
SEG_16
(
BU91R65_CHANNEL_1
,
0
,
86
),
SEG_16
(
BU91R65_CHANNEL_1
,
1
,
85
),
SEG_16
(
BU91R65_CHANNEL_1
,
2
,
85
),
};
const
BU91R65_USER_st_t
MiZi_Seg_13
[
SEG_16_MAX
]
=
{
SEG_16
(
BU91R65_CHANNEL_1
,
3
,
89
),
SEG_16
(
BU91R65_CHANNEL_1
,
3
,
90
),
SEG_16
(
BU91R65_CHANNEL_1
,
3
,
91
),
SEG_16
(
BU91R65_CHANNEL_1
,
0
,
92
),
SEG_16
(
BU91R65_CHANNEL_1
,
0
,
90
),
SEG_16
(
BU91R65_CHANNEL_1
,
0
,
89
),
SEG_16
(
BU91R65_CHANNEL_1
,
1
,
88
),
SEG_16
(
BU91R65_CHANNEL_1
,
3
,
88
),
SEG_16
(
BU91R65_CHANNEL_1
,
2
,
89
),
SEG_16
(
BU91R65_CHANNEL_1
,
2
,
90
),
SEG_16
(
BU91R65_CHANNEL_1
,
2
,
91
),
SEG_16
(
BU91R65_CHANNEL_1
,
1
,
91
),
SEG_16
(
BU91R65_CHANNEL_1
,
0
,
91
),
SEG_16
(
BU91R65_CHANNEL_1
,
1
,
90
),
SEG_16
(
BU91R65_CHANNEL_1
,
1
,
89
),
SEG_16
(
BU91R65_CHANNEL_1
,
2
,
88
),
};
const
BU91R65_USER_st_t
MiZi_Seg_14
[
SEG_16_MAX
]
=
{
SEG_16
(
BU91R65_CHANNEL_1
,
3
,
93
),
SEG_16
(
BU91R65_CHANNEL_1
,
3
,
94
),
SEG_16
(
BU91R65_CHANNEL_1
,
3
,
96
),
SEG_16
(
BU91R65_CHANNEL_1
,
2
,
96
),
SEG_16
(
BU91R65_CHANNEL_1
,
0
,
95
),
SEG_16
(
BU91R65_CHANNEL_1
,
0
,
94
),
SEG_16
(
BU91R65_CHANNEL_1
,
2
,
92
),
SEG_16
(
BU91R65_CHANNEL_1
,
3
,
92
),
SEG_16
(
BU91R65_CHANNEL_1
,
2
,
93
),
SEG_16
(
BU91R65_CHANNEL_1
,
2
,
94
),
SEG_16
(
BU91R65_CHANNEL_1
,
3
,
95
),
SEG_16
(
BU91R65_CHANNEL_1
,
2
,
95
),
SEG_16
(
BU91R65_CHANNEL_1
,
1
,
95
),
SEG_16
(
BU91R65_CHANNEL_1
,
1
,
94
),
SEG_16
(
BU91R65_CHANNEL_1
,
0
,
93
),
SEG_16
(
BU91R65_CHANNEL_1
,
1
,
93
),
};
const
BU91R65_USER_st_t
MiZi_Seg_15
[
SEG_16_MAX
]
=
{
SEG_16
(
BU91R65_CHANNEL_1
,
3
,
97
),
SEG_16
(
BU91R65_CHANNEL_1
,
3
,
99
),
SEG_16
(
BU91R65_CHANNEL_1
,
3
,
100
),
SEG_16
(
BU91R65_CHANNEL_1
,
2
,
100
),
SEG_16
(
BU91R65_CHANNEL_1
,
0
,
100
),
SEG_16
(
BU91R65_CHANNEL_1
,
0
,
98
),
SEG_16
(
BU91R65_CHANNEL_1
,
0
,
97
),
SEG_16
(
BU91R65_CHANNEL_1
,
1
,
97
),
SEG_16
(
BU91R65_CHANNEL_1
,
2
,
97
),
SEG_16
(
BU91R65_CHANNEL_1
,
3
,
98
),
SEG_16
(
BU91R65_CHANNEL_1
,
2
,
99
),
SEG_16
(
BU91R65_CHANNEL_1
,
1
,
99
),
SEG_16
(
BU91R65_CHANNEL_1
,
1
,
100
),
SEG_16
(
BU91R65_CHANNEL_1
,
0
,
99
),
SEG_16
(
BU91R65_CHANNEL_1
,
1
,
98
),
SEG_16
(
BU91R65_CHANNEL_1
,
2
,
98
),
};
const
BU91R65_USER_st_t
*
LibertyMizi
[]
=
{
&
MiZi_Seg_0
[
0
],
&
MiZi_Seg_1
[
0
],
&
MiZi_Seg_2
[
0
],
&
MiZi_Seg_3
[
0
],
&
MiZi_Seg_4
[
0
],
&
MiZi_Seg_5
[
0
],
&
MiZi_Seg_6
[
0
],
&
MiZi_Seg_7
[
0
],
&
MiZi_Seg_8
[
0
],
&
MiZi_Seg_9
[
0
],
&
MiZi_Seg_10
[
0
],
&
MiZi_Seg_11
[
0
],
&
MiZi_Seg_12
[
0
],
&
MiZi_Seg_13
[
0
],
&
MiZi_Seg_14
[
0
],
&
MiZi_Seg_15
[
0
],
};
uint8_t
BU91R65_num
=
0
;
uint8_t
BU91R65_time
=
0
;
void
BU91R65_DSIP
(
void
)
{
if
(
++
BU91R65_time
>
10
)
{
BU91R65_time
=
0
;
BU91R65_Set_Numble
(
&
MiZi_Seg_0
[
0
],
BU91R65_num
,
BU91R65_NUMBER_SEG_16
,
BU91R65_Enable
);
BU91R65_num
++
;
if
(
BU91R65_num
>=
BU91R65DIS16_MAX_16
)
{
BU91R65_num
=
0
;
}
}
}
void
BU91R65_Clear_NUM_7
(
const
BU91R65_USER_st_t
*
pBU91R65User
)
{
BU91R65_Set_Numble
(
pBU91R65User
,
BU91R65DIS_NUMBLE_NULL
,
BU91R65_NUMBER_SEG_7
,
BU91R65_Enable
);
}
uint8_t
LibertyString
[
LIBERTY_STRING_LENTH
]
=
{
0
};
uint8_t
PrefixBlankNum
=
0xff
;
void
Liberty_String_Display_Init
(
void
)
{
uint8_t
i
=
0u
;
for
(
i
=
0
;
i
<
LIBERTY_STRING_LENTH
;
i
++
)
{
LibertyString
[
i
]
=
0u
;
}
PrefixBlankNum
=
0xff
;
}
uint8_t
String_Compare
(
uint8_t
*
bku
,
const
uint8_t
*
dat
,
const
uint8_t
lenth
)
{
uint8_t
i
=
0u
;
uint8_t
ret
=
0u
;
for
(
i
=
0
;
i
<
lenth
;
i
++
)
{
if
(
bku
[
i
]
!=
dat
[
i
])
{
break
;
}
}
if
(
i
==
lenth
)
{
ret
=
1u
;
}
else
{
ret
=
0u
;
}
memcpy
(
bku
,
dat
,
lenth
);
return
ret
;
}
/**
* @brief 自由项目米字格字符串显示函数。自由项目共16个米字格,此函数在16个米字格上显示字符。
* @brief 显示内容索引:BU91R65_Numble16_Mask_en_t
*
* @param f_blank_num: 有效字符前有几个米字格需要不显示内容,此参数不可以大于16
* @param *dat :有效字符,必须有'\0'结尾!!
* @param *dat :摄氏度的°符号,用.代替
*
* @param example: Liberty_String_Display(3u, "SET TEMP .C");
* * @param example:从第四个米字格开始,显示:SET TEMP °C
* @param example: Liberty_String_Display(0u, "");
* * @param example:清空16个米字格
*
*/
void
Liberty_String_Display
(
const
uint8_t
f_blank_num
,
const
uint8_t
*
dat
)
{
uint8_t
i
=
0u
;
uint8_t
idx
=
BU91R65DIS16_NUMBLE_NULL
;
uint8_t
lenth
=
0u
;
while
(
dat
[
lenth
++
]
!=
'\0'
)
{
}
if
(
lenth
==
0u
)
{
return
;
}
if
((
lenth
+
f_blank_num
)
>
LIBERTY_STRING_LENTH
)
{
return
;
}
if
(
String_Compare
(
LibertyString
,
dat
,
lenth
)
==
1u
&&
PrefixBlankNum
==
f_blank_num
)
{
return
;
}
PrefixBlankNum
=
f_blank_num
;
for
(
i
=
0
;
i
<
LIBERTY_STRING_LENTH
;
i
++
)
{
if
((
i
<
f_blank_num
)
||
(
i
>=
f_blank_num
+
lenth
-
1
))
{
idx
=
BU91R65DIS16_NUMBLE_NULL
;
}
else
{
if
(
dat
[
i
-
f_blank_num
]
>=
'0'
&&
dat
[
i
-
f_blank_num
]
<=
'9'
)
{
idx
=
BU91R65DIS16_NUMBLE_0
+
(
dat
[
i
-
f_blank_num
]
-
'0'
);
}
else
if
(
dat
[
i
-
f_blank_num
]
>=
'A'
&&
dat
[
i
-
f_blank_num
]
<=
'Z'
)
{
idx
=
BU91R65DIS16_ALPHABET_A
+
(
dat
[
i
-
f_blank_num
]
-
'A'
);
}
else
{
switch
(
dat
[
i
-
f_blank_num
])
{
case
' '
:
{
idx
=
BU91R65DIS16_NUMBLE_NULL
;
break
;
}
case
'x'
:
{
idx
=
BU91R65DIS16_NUMBLE_mul
;
break
;
}
case
'+'
:
{
idx
=
BU91R65DIS16_NUMBLE_add
;
break
;
}
case
'-'
:
{
idx
=
BU91R65DIS16_NUMBLE_sub
;
break
;
}
case
'/'
:
{
idx
=
BU91R65DIS16_NUMBLE_exc
;
break
;
}
case
'['
:
{
idx
=
BU91R65DIS16_NUMBLE_LMPar
;
break
;
}
case
']'
:
{
idx
=
BU91R65DIS16_NUMBLE_RMPar
;
break
;
}
case
'('
:
{
idx
=
BU91R65DIS16_NUMBLE_LSPar
;
break
;
}
case
')'
:
{
idx
=
BU91R65DIS16_NUMBLE_RSPar
;
break
;
}
case
'='
:
{
idx
=
BU91R65DIS16_NUMBLE_equal
;
break
;
}
case
'.'
:
{
idx
=
BU91R65DIS16_NUMBLE_degrees
;
break
;
}
case
'_'
:
{
idx
=
BU91R65DIS16_NUMBLE__
;
break
;
}
default:
{
idx
=
BU91R65DIS16_NUMBLE_NULL
;
break
;
}
}
}
}
if
(
idx
<
BU91R65DIS16_MAX_16
)
{
BU91R65_Set_Numble
(
LibertyMizi
[
i
],
idx
,
BU91R65_NUMBER_SEG_16
,
BU91R65_Enable
);
}
}
}
YueJin_test_bench/source/Appliciation/BU91R65_User.h
0 → 100644
View file @
78caace0
#ifndef _BU91R65_USER_H_
#define _BU91R65_USER_H_
#include "TYW_stdint.h"
#define BU91R65SEGMAX 160
/* 段码段码最大值 */
#define SEG_7_MAX 7
#define SEG_16_MAX 16
// #define BU91R65NUMBERMAX 7 /* 数字段数最大值 */
typedef
enum
{
BU91R65_NUMBER_SEG_7
=
0
,
BU91R65_NUMBER_SEG_16
,
BU91R65_NUMBER_SEG_MAX
,
}
BU91R65_Number_SEG_en_t
;
/* 段码段 */
typedef
enum
{
BU91R65_CHANNEL_1
=
0
,
BU91R65_CHANNEL_2
,
BU91R65_CHANNEL_MAX
,
}
BU91R65_Channel_en_t
;
/* 段码通道 */
typedef
enum
{
BU91R65_COM_0
=
0
,
BU91R65_COM_1
,
BU91R65_COM_2
,
BU91R65_COM_3
,
BU91R65_COM_MAX
,
}
BU91R65_COM_en_t
;
/* 段码通道 */
typedef
enum
{
BU91R65_Disable
=
0
,
BU91R65_Enable
,
}
BU91R65_Enable_en_t
;
/* 段码点亮等级 */
typedef
enum
{
BU91R65DIS_NUMBLE_0
=
0
,
BU91R65DIS_NUMBLE_1
,
BU91R65DIS_NUMBLE_2
,
BU91R65DIS_NUMBLE_3
,
BU91R65DIS_NUMBLE_4
,
BU91R65DIS_NUMBLE_5
,
BU91R65DIS_NUMBLE_6
,
BU91R65DIS_NUMBLE_7
,
BU91R65DIS_NUMBLE_8
,
BU91R65DIS_NUMBLE_9
,
BU91R65DIS_ALPHABET_A
,
BU91R65DIS_ALPHABET_B
,
BU91R65DIS_ALPHABET_C
,
BU91R65DIS_ALPHABET_D
,
BU91R65DIS_ALPHABET_E
,
BU91R65DIS_ALPHABET_F
,
BU91R65DIS_ALPHABET_U
,
BU91R65DIS_ALPHABET_P
,
BU91R65DIS_ALPHABET_L
,
BU91R65DIS_ALPHABET_H
,
BU91R65DIS_NUMBLE_LINE
,
BU91R65DIS_NUMBLE_NULL
,
BU91R65DIS_MAX_7
,
}
BU91R65_Numble7_Mask_en_t
;
/* 段码掩码(7段适用) */
typedef
enum
{
BU91R65DIS16_NUMBLE_0
=
0
,
BU91R65DIS16_NUMBLE_1
,
BU91R65DIS16_NUMBLE_2
,
BU91R65DIS16_NUMBLE_3
,
BU91R65DIS16_NUMBLE_4
,
BU91R65DIS16_NUMBLE_5
,
BU91R65DIS16_NUMBLE_6
,
BU91R65DIS16_NUMBLE_7
,
BU91R65DIS16_NUMBLE_8
,
BU91R65DIS16_NUMBLE_9
,
BU91R65DIS16_ALPHABET_A
,
BU91R65DIS16_ALPHABET_B
,
BU91R65DIS16_ALPHABET_C
,
BU91R65DIS16_ALPHABET_D
,
BU91R65DIS16_ALPHABET_E
,
BU91R65DIS16_ALPHABET_F
,
BU91R65DIS16_ALPHABET_G
,
BU91R65DIS16_ALPHABET_H
,
BU91R65DIS16_ALPHABET_I
,
BU91R65DIS16_ALPHABET_J
,
BU91R65DIS16_ALPHABET_K
,
BU91R65DIS16_ALPHABET_L
,
BU91R65DIS16_ALPHABET_M
,
BU91R65DIS16_ALPHABET_N
,
BU91R65DIS16_ALPHABET_O
,
BU91R65DIS16_ALPHABET_P
,
BU91R65DIS16_ALPHABET_Q
,
BU91R65DIS16_ALPHABET_R
,
BU91R65DIS16_ALPHABET_S
,
BU91R65DIS16_ALPHABET_T
,
BU91R65DIS16_ALPHABET_U
,
BU91R65DIS16_ALPHABET_V
,
BU91R65DIS16_ALPHABET_W
,
BU91R65DIS16_ALPHABET_X
,
BU91R65DIS16_ALPHABET_Y
,
BU91R65DIS16_ALPHABET_Z
,
BU91R65DIS16_NUMBLE_mul
,
//乘 x
BU91R65DIS16_NUMBLE_add
,
//加 +
BU91R65DIS16_NUMBLE_sub
,
//减 -
BU91R65DIS16_NUMBLE_exc
,
//除 /
BU91R65DIS16_NUMBLE_LMPar
,
//左中括号 [
BU91R65DIS16_NUMBLE_RMPar
,
//右中括号 ]
BU91R65DIS16_NUMBLE_LSPar
,
//左小括号 (
BU91R65DIS16_NUMBLE_RSPar
,
//右小括号 )
BU91R65DIS16_NUMBLE_equal
,
//等于 =
BU91R65DIS16_NUMBLE_degrees
,
//度 °
BU91R65DIS16_NUMBLE__
,
//下划线 _
BU91R65DIS16_NUMBLE_NULL
,
//空
BU91R65DIS16_MAX_16
,
}
BU91R65_Numble16_Mask_en_t
;
/* 段码掩码(16段适用) */
typedef
struct
{
BU91R65_Channel_en_t
enBU91R65Channel
;
/* 选择第几片段码 */
uint8_t
u8BU91R65_COM
;
/* 需显示的COM */
uint8_t
u8BU91R65_Seg
;
/* 需显示的SEG值 */
}
BU91R65_USER_st_t
;
/**
* @brief 设置段码显示数字或字母显示
* @param pBU91R65User 传入BU91R65_USER_st_t指针
* @param enBU91R65Value 需要显示的内容 数字或者字母详见BU91R65_Numble7_Mask_en_t BU91R65_Numble27_Mask_en_t BU91R65_Numble25_Mask_en_t BU91R65_Numble23_Mask_en_t
* @param enBU91R65SEGNum 需要显示的段码段数 详见 BU91R65_Number_SEG_en_t 以及示例图 若没有可以联系作者补上掩码
* @param Enable 是否点亮
* @return 0:正确 1 传入关闭等级错误 2 传入空指针 3 传入SEG错误或设置段码通道错误 或传入enBU91R65Value错误
*/
extern
uint8_t
BU91R65_Set_Numble
(
const
BU91R65_USER_st_t
*
pBU91R65User
,
uint8_t
enBU91R65Value
,
BU91R65_Number_SEG_en_t
enBU91R65SEGNum
,
uint8_t
Enable
);
void
Clear_All_BU91R65
(
void
);
// void BU91R65_DSIP(void);
#define LIBERTY_STRING_LENTH 17
void
Liberty_String_Display
(
const
uint8_t
f_blank_num
,
const
uint8_t
*
dat
);
void
BU91R65_Clear_NUM_7
(
const
BU91R65_USER_st_t
*
pBU91R65User
);
void
Liberty_String_Display_Init
(
void
);
#endif
YueJin_test_bench/source/Appliciation/RTE_GPIO.h
View file @
78caace0
...
...
@@ -4,6 +4,40 @@
#include "TYW_stdint.h"
#include "GPIO.h"
#define LCD_CSB1 GPIO_OUT_PORT08_PIN07
#define LCD_CSB2 GPIO_OUT_PORT10_PIN01
#define LCD_CSB1_DIR GPIO_DIR_PORT08_PIN07
#define LCD_CSB2_DIR GPIO_DIR_PORT10_PIN01
#define LCD_SCK1 GPIO_OUT_PORT10_PIN11
#define LCD_SCK2 GPIO_OUT_PORT10_PIN00
#define LCD_SCK1_DIR GPIO_DIR_PORT10_PIN11
#define LCD_SCK2_DIR GPIO_DIR_PORT10_PIN00
#define LCD_SDI1_OUT GPIO_OUT_PORT10_PIN09
#define LCD_SDI1_INPUT GPIO_IN_PORT10_PIN09
#define LCD_SDI1_DIR GPIO_DIR_PORT10_PIN09
#define LCD_SDI2_OUT GPIO_OUT_PORT08_PIN09
#define LCD_SDI2_INPUT GPIO_IN_PORT08_PIN09
#define LCD_SDI2_DIR GPIO_DIR_PORT08_PIN09
#define LCD_SDO1_OUT GPIO_OUT_PORT10_PIN10
#define LCD_SDO1_INPUT GPIO_IN_PORT10_PIN10
#define LCD_SDO1_DIR GPIO_DIR_PORT10_PIN10
#define LCD_SDO2_OUT GPIO_OUT_PORT08_PIN10
#define LCD_SDO2_INPUT GPIO_IN_PORT08_PIN10
#define LCD_SDO2_DIR GPIO_DIR_PORT08_PIN10
#define LCD_ERROUT1_OUT GPIO_OUT_PORT08_PIN08
#define LCD_ERROUT1_INPUT GPIO_IN_PORT08_PIN08
#define LCD_ERROUT1_DIR GPIO_DIR_PORT08_PIN08
#define LCD_ERROUT2_OUT GPIO_OUT_PORT11_PIN02
#define LCD_ERROUT2_INPUT GPIO_IN_PORT11_PIN02
#define LCD_ERROUT2_DIR GPIO_DIR_PORT11_PIN02
#define LCD_INHB_DIR GPIO_DIR_PORT11_PIN03
#define LCD_INHB_INPUT GPIO_IN_PORT11_PIN03
#define LCD_INHB_OUT GPIO_OUT_PORT11_PIN03
#define LINE_OUT_NEG_09 GPIO_OUT_PORT10_PIN04 //485_RE
...
...
YueJin_test_bench/source/Appliciation/SEG_Display.c
0 → 100644
View file @
78caace0
#include "SEG_Display.h"
#include "BU91R65.h"
#define MODULE_DISPLAY_ON 1U
#define MODULE_DISPLAY_OFF 0U
SEGDiaplay_Control_Struct
g_stSEGDisplay_Control
;
void
Check_SEG_Display
(
void
)
{
static
uint8_t
display_state
=
0
;
if
(
g_stSEGDisplay_Control
.
u16SEGDisplay_Count
++
>=
10u
)
{
g_stSEGDisplay_Control
.
u16SEGDisplay_Count
=
0u
;
switch
(
display_state
)
{
case
0
:
// 偶数
for
(
uint8_t
i
=
0
;
i
<
BU91R65_BUFFER_SIZE
;
i
++
)
{
BU91R65_Write_Buffer
(
BU91R65_CHIP0
,
i
,
0x0F
);
BU91R65_Write_Buffer
(
BU91R65_CHIP1
,
i
,
0x0F
);
}
for
(
uint8_t
i
=
0
;
i
<
BU91R65_BUFFER_SIZE
;
i
++
)
{
BU91R65_Write_Buffer
(
BU91R65_CHIP0
,
i
,
0xF0
);
BU91R65_Write_Buffer
(
BU91R65_CHIP1
,
i
,
0xF0
);
}
break
;
case
1
:
// 奇数
for
(
uint8_t
i
=
0
;
i
<
BU91R65_BUFFER_SIZE
;
i
++
)
{
BU91R65_Write_Buffer
(
BU91R65_CHIP0
,
i
,
0xF0
);
BU91R65_Write_Buffer
(
BU91R65_CHIP1
,
i
,
0xF0
);
}
for
(
uint8_t
i
=
0
;
i
<
BU91R65_BUFFER_SIZE
;
i
++
)
{
BU91R65_Write_Buffer
(
BU91R65_CHIP0
,
i
,
0x0F
);
BU91R65_Write_Buffer
(
BU91R65_CHIP1
,
i
,
0x0F
);
}
break
;
case
2
:
// 全亮
for
(
uint8_t
i
=
0
;
i
<
BU91R65_BUFFER_SIZE
;
i
++
)
{
BU91R65_Write_Buffer
(
BU91R65_CHIP0
,
i
,
0xFF
);
BU91R65_Write_Buffer
(
BU91R65_CHIP1
,
i
,
0xFF
);
}
break
;
default:
for
(
uint8_t
i
=
0
;
i
<
BU91R65_BUFFER_SIZE
;
i
++
)
{
BU91R65_Write_Buffer
(
BU91R65_CHIP0
,
i
,
0x00
);
BU91R65_Write_Buffer
(
BU91R65_CHIP1
,
i
,
0x00
);
}
}
CHIP2_SEG
(
0
,
99
)
=
0u
;
CHIP2_SEG
(
1
,
99
)
=
0u
;
CHIP2_SEG
(
0
,
100
)
=
0u
;
CHIP2_SEG
(
1
,
100
)
=
0u
;
CHIP2_SEG
(
0
,
102
)
=
0u
;
CHIP2_SEG
(
1
,
102
)
=
0u
;
CHIP2_SEG
(
1
,
103
)
=
0u
;
CHIP2_SEG
(
0
,
103
)
=
0u
;
CHIP2_SEG
(
1
,
104
)
=
0u
;
CHIP2_SEG
(
0
,
101
)
=
0u
;
CHIP2_SEG
(
1
,
101
)
=
0u
;
CHIP2_SEG
(
0
,
105
)
=
0u
;
CHIP2_SEG
(
1
,
105
)
=
0u
;
CHIP2_SEG
(
0
,
106
)
=
0u
;
CHIP2_SEG
(
1
,
106
)
=
0u
;
CHIP2_SEG
(
0
,
107
)
=
0u
;
CHIP2_SEG
(
1
,
107
)
=
0u
;
CHIP2_SEG
(
0
,
104
)
=
0u
;
CHIP2_SEG
(
1
,
108
)
=
0u
;
CHIP2_SEG
(
0
,
108
)
=
0u
;
CHIP2_SEG
(
0
,
109
)
=
0u
;
CHIP2_SEG
(
0
,
110
)
=
0u
;
CHIP2_SEG
(
1
,
110
)
=
0u
;
CHIP2_SEG
(
1
,
111
)
=
0u
;
CHIP2_SEG
(
0
,
111
)
=
0u
;
CHIP2_SEG
(
1
,
112
)
=
0u
;
CHIP2_SEG
(
0
,
112
)
=
0u
;
CHIP2_SEG
(
1
,
113
)
=
0u
;
CHIP2_SEG
(
0
,
113
)
=
0u
;
CHIP2_SEG
(
1
,
114
)
=
0u
;
CHIP2_SEG
(
0
,
114
)
=
0u
;
CHIP2_SEG
(
1
,
57
)
=
0u
;
CHIP2_SEG
(
0
,
115
)
=
0u
;
CHIP2_SEG
(
0
,
116
)
=
0u
;
CHIP2_SEG
(
1
,
136
)
=
0u
;
display_state
=
(
display_state
+
1
)
%
3
;
}
}
YueJin_test_bench/source/Appliciation/SEG_Display.h
0 → 100644
View file @
78caace0
#ifndef _SEG_DISPLAY_H_
#define _SEG_DISPLAY_H_
#include "TYW_stdint.h"
#include "BU91R65_User.h"
typedef
struct
{
uint8_t
u8SelfCheck_Status
;
uint16_t
u16SelfCheck_Count
;
}
SelfCheck_Control_Struct
;
typedef
struct
{
uint8_t
u8SEGDisplay_Status
;
uint16_t
u16SEGDisplay_Count
;
}
SEGDiaplay_Control_Struct
;
typedef
struct
{
uint8_t
SEGReset_Status
;
uint16_t
SEGReset_Count
;
//控制时间
}
SEGReset_Control_Struct
;
#define IC_SEG_OFF 0u
#define IC_SEG_ON 1u
// #define IC_SEG_GREY 0x01u
extern
const
BU91R65_USER_st_t
HEATGRIPNUM
[];
void
Check_SEG_Display
(
void
);
#endif
\ No newline at end of file
YueJin_test_bench/source/Appliciation/Task.c
View file @
78caace0
...
...
@@ -20,6 +20,12 @@
#include "string.h"
#include "api_RS485.h"
#include "R485_Communication_Matrix.h"
#include "SEG_Display.h"
#include "BU91R65_Access.h"
#include "BU91R65.h"
#include "BU91R65_Porting.h"
#include "BU91R65_User.h"
/*******************************************************************************
* *
* ϵͳ��������ģʽ(SYS_MODE_OFF / SYS_MODE_ON / SYS_MODE_STANDBY )�����б� *
...
...
@@ -46,7 +52,7 @@ void Sys_Run_Mode_Pseudo_Real_Time_Tasks(void)
{
UDS_Server_Application_Service
(
);
}
BU91R65_Communication_Service
();
TFT_LCD_Display_Update_Service
(
);
Fre_In_Service
(
FRE_VEHICLE
);
//Fre_In_Service(FRE_ENGINE);
...
...
@@ -235,7 +241,7 @@ void Sys_Run_Mode_20ms_Tasks_Group0(void)
// uint8_t data[8] = {0};
// uint32_t SpdN = 0;
// _CAN_Msg canMag;
BU91R65_Refresh_Service
();
// //Total_Check( );
// canMag.MsgID = 0x8FFF00B;
// FT_VehSpeedCalc_Main(FT_CurVehSpeed, &SpdN, SPEED_TO_CANMESSAGE);
...
...
@@ -274,8 +280,6 @@ void Sys_Run_Mode_50ms_Tasks_Group(void)
timerms
++
;
}
// if ( timer_100ms >= 500 )
// {
// if(powerstu == 0)
...
...
@@ -336,7 +340,7 @@ void Sys_Run_Mode_100ms_Tasks_Group(void)
// Recv_Byte1();
// }
Display_PageNum
();
Check_SEG_Display
();
if
(
CHECK_Ctrl_delay
<
200
)
{
...
...
YueJin_test_bench/source/Driver/BU91R65/BU91R65.c
0 → 100644
View file @
78caace0
#include <stddef.h>
// #include "RTE.h"
#include "BU91R65.h"
// #include "RTE_GPIO_R7F7016843.h"
BU91R65_Handler_st_t
g_stBU91R65Chip0
;
// uint8_t g_u8BU91R65Chip0Buffer[BU91R65_BUFFER_SIZE];
BU91R65DDRAMUnion
g_stBU91R65Chip0Seg
;
BU91R65_Handler_st_t
g_stBU91R65Chip1
;
// uint8_t g_u8BU91R65Chip1Buffer[BU91R65_BUFFER_SIZE];
BU91R65DDRAMUnion
g_stBU91R65Chip1Seg
;
// BU91R65_Handler_st_t g_stBU98R10Chip2;
// uint8_t g_u8BU98R10Chip2Buffer[BU91R65_BUFFER_SIZE];
// BU91R65DDRAMUnion g_stBU98R10Chip2Seg;
void
BU91R65_Register
(
void
)
{
BU91R65_Config_st_t
stConfig
;
/* Power on */
//BU98R10_GPIO_Request(RTE_GPIO_PORT06_PIN02);/*不一定需要*/
BU91R65_Init
(
1UL
);
//Trim到200-400khz
stConfig
.
u8DefaultVal
=
0x00U
;
stConfig
.
u8FrameFreq
=
BU98R10_FRAME_FREQ_120_0_Hz
;
stConfig
.
u16PinCS
=
BU91R65_Chip0_Set_nCS
;
stConfig
.
u16PinSCLK
=
BU91R65_Chip0_Set_SCLK
;
stConfig
.
u16PinSD
=
BU91R65_Chip0_Set_SD
;
// stConfig.stColorSetting.u8SRR = 7U;
// stConfig.stColorSetting.u8SRF = 0U;
// stConfig.stColorSetting.u8SGR = 7U;
// stConfig.stColorSetting.u8SGF = 0U;
// stConfig.stColorSetting.u8SBR = 7U;
// stConfig.stColorSetting.u8SBF = 0U;
// stConfig.stColorSetting.u8LRS = 0U;
// stConfig.stColorSetting.u8LRW = 47U;
// stConfig.stColorSetting.u8LGS = 0U;
// stConfig.stColorSetting.u8LGW = 47U;
// stConfig.stColorSetting.u8LBS = 0U;
// stConfig.stColorSetting.u8LBW = 47U;
stConfig
.
pu8Buffer
=
&
g_stBU91R65Chip0Seg
;
BU91R65_Add
(
&
g_stBU91R65Chip0
,
&
stConfig
);
stConfig
.
u16PinCS
=
BU91R65_Chip1_Set_nCS
;
stConfig
.
u16PinSCLK
=
BU91R65_Chip1_Set_SCLK
;
stConfig
.
u16PinSD
=
BU91R65_Chip1_Set_SD
;
stConfig
.
pu8Buffer
=
&
g_stBU91R65Chip1Seg
;
BU91R65_Add
(
&
g_stBU91R65Chip1
,
&
stConfig
);
// stConfig.u16PinCS = RTE_GPIO_PORT11_PIN07;
// stConfig.u16PinSCLK = RTE_GPIO_PORT11_PIN04;
// stConfig.u16PinSD = RTE_GPIO_PORT10_PIN10;
// stConfig.pu8Buffer = &g_stBU98R10Chip2Seg;
// BU91R65_Add(&g_stBU98R10Chip2, &stConfig);
}
YueJin_test_bench/source/Driver/BU91R65/BU91R65.h
0 → 100644
View file @
78caace0
This source diff could not be displayed because it is too large. You can
view the blob
instead.
YueJin_test_bench/source/Driver/BU91R65/BU91R65_Access.c
0 → 100644
View file @
78caace0
#include <stddef.h>
#include "BU91R65_Access.h"
#include "WDT.h"
/******************************************************************************
* BU98R10 command list
******************************************************************************/
#define BU98R10_CMD_DATWR ((uint8_t)0x0AU)
/**< Data Write */
#define BU98R10_CMD_ADSET ((uint8_t)0x40U)
/**< Address Set */
#define BU98R10_CMD_DISPOFF ((uint8_t)0x80U)
/**< Display Off */
#define BU98R10_CMD_DISPON ((uint8_t)0x81U)
/**< Display On */
#define BU98R10_CMD_ICSET ((uint8_t)0x88U)
/**< Set IC mode: clk, RGB/MONO */
#define BU98R10_CMD_DRVCTRL ((uint8_t)0x90U)
/**< Invert-On/Off, AP-On/Off */
#define BU98R10_CMD_FREQ ((uint8_t)0x98U)
/**< Frame-Frequency */
#define BU98R10_CMD_SEG_R ((uint8_t)0xA0U)
#define BU98R10_CMD_SEG_G ((uint8_t)0xA8U)
#define BU98R10_CMD_SEG_B ((uint8_t)0xB0U)
#define BU98R10_CMD_LED_STARTR ((uint8_t)0xB8U)
#define BU98R10_CMD_LED_STARTG ((uint8_t)0xC0U)
#define BU98R10_CMD_LED_STARTB ((uint8_t)0xC8U)
#define BU98R10_CMD_LED_WIDTHR ((uint8_t)0xD0U)
#define BU98R10_CMD_LED_WIDTHG ((uint8_t)0xD8U)
#define BU98R10_CMD_LED_WIDTHB ((uint8_t)0xE0U)
#define BU98R10_CMD_LED_CTRL ((uint8_t)0xE8U)
#define BU98R10_CMD_SWRST ((uint8_t)0xF9U)
/**< Software Reset */
/******************************************************************************
* BU98R10 Parameter list
******************************************************************************/
#define BU98R10_PAR_ICSET_RGB ((uint8_t)0x00U)
/**< Set IC mode: RGB */
#define BU98R10_PAR_ICSET_MONO ((uint8_t)0x01U)
/**< Set IC mode: MONO */
#define BU98R10_PAR_ICSET_INTOSC ((uint8_t)0x00U)
/**< Set IC mode: Internal oscillator clock*/
#define BU98R10_PAR_ICSET_EXTCLK ((uint8_t)0x02U)
/**< Set IC mode: External input clock*/
#define BU98R10_PAR_DRVCTRL_NORMAL ((uint8_t)0x00U)
/**< Normal display */
#define BU98R10_PAR_DRVCTRL_AP_OFF ((uint8_t)0x01U)
/**< All segment off */
#define BU98R10_PAR_DRVCTRL_AP_ON ((uint8_t)0x02U)
/**< All segment on */
#define BU98R10_PAR_DRVCTRL_INVERSE ((uint8_t)0x03U)
/**< Inverse display mode */
/*手册是4吧*/
/******************************************************************************
* BU98R10 state
******************************************************************************/
#define BU91R65_STATE_IDLE (0U)
/**< Chips are idle */
#define BU91R65_STATE_INIT (1U)
/**< Chips are in the initialization process */
#define BU91R65_STATE_RUN (2U)
/**< Chips are ready to run */
/******************************************************************************
* BU98R10 configuration
******************************************************************************/
#define BU91R65_ms_DIV (400UL)
#define BU91R65_RETRY_MAX_NUM (2UL)
#define BU91R65_WRITE_SIZE (16U)
/**< Maximum number of bytes written in a single time */
typedef
struct
{
uint8_t
u8State
;
/**< Operating state */
uint8_t
u8ForceUpdt
;
/**< SEGs to be force updated */
uint8_t
u8InitCnt
;
/**< chip init count*/
uint8_t
u8InitSts
;
/**< chip to be init*/
uint32_t
u32SpeedTrim
;
/**< Timing trim */
BU91R65_Handler_st_t
*
pstCurrent
;
/**< Current chip */
BU91R65_Handler_st_t
*
pstList
;
/**< Start of chip list */
}
BU91R65_Update_Ctrl_st_t
;
static
int32_t
BU91R65_Search
(
BU91R65_Handler_st_t
*
pHandler
);
static
void
BU91R65_Write_Command
(
BU91R65_Handler_st_t
*
pHandler
,
uint8_t
u8Cmd
);
static
void
BU91R65_Write_Data
(
BU91R65_Handler_st_t
*
pHandler
,
uint8_t
u8Data
);
static
void
BU91R65_Delay_ms
(
uint32_t
u32Interval
);
static
void
BU91R65_Delay
(
void
);
uint32_t
g_u32BU91R65DelayCounter
;
BU91R65_Update_Ctrl_st_t
g_stBU91R65UpdateCtrl
;
void
BU91R65_Init
(
uint32_t
u32SpeedTrim
)
{
g_stBU91R65UpdateCtrl
.
u8State
=
BU91R65_STATE_IDLE
;
g_stBU91R65UpdateCtrl
.
u8ForceUpdt
=
0U
;
g_stBU91R65UpdateCtrl
.
u8InitCnt
=
0U
;
g_stBU91R65UpdateCtrl
.
u8InitSts
=
0U
;
g_stBU91R65UpdateCtrl
.
u32SpeedTrim
=
u32SpeedTrim
;
g_stBU91R65UpdateCtrl
.
pstList
=
NULL
;
g_stBU91R65UpdateCtrl
.
pstCurrent
=
NULL
;
}
void
BU91R65_DeInit
(
void
)
{
g_stBU91R65UpdateCtrl
.
u8State
=
BU91R65_STATE_IDLE
;
g_stBU91R65UpdateCtrl
.
u8ForceUpdt
=
0U
;
g_stBU91R65UpdateCtrl
.
u8InitCnt
=
0U
;
g_stBU91R65UpdateCtrl
.
u8InitSts
=
0U
;
g_stBU91R65UpdateCtrl
.
pstList
=
NULL
;
g_stBU91R65UpdateCtrl
.
pstCurrent
=
NULL
;
}
int32_t
BU91R65_Add
(
BU91R65_Handler_st_t
*
pHandler
,
BU91R65_Config_st_t
*
pstCfg
)
{
uint32_t
i
;
int32_t
i32Result
;
BU91R65_Pin_Map_st_t
stPinMap
;
BU91R65_Handler_st_t
*
pstSearch
;
i32Result
=
-
1
;
if
((
BU91R65_Search
(
pHandler
)
==
0
)
&&
(
pstCfg
!=
NULL
))
{
if
(
pstCfg
->
pu8Buffer
!=
NULL
)
{
stPinMap
.
u16PinCS
=
pstCfg
->
u16PinCS
;
stPinMap
.
u16PinSCLK
=
pstCfg
->
u16PinSCLK
;
stPinMap
.
u16PinSD
=
pstCfg
->
u16PinSD
;
i32Result
=
BU91R65_GPIO_Init
(
&
stPinMap
);
if
(
i32Result
==
0
)
{
pHandler
->
stPinMap
.
u16PinCS
=
stPinMap
.
u16PinCS
;
pHandler
->
stPinMap
.
u16PinSCLK
=
stPinMap
.
u16PinSCLK
;
pHandler
->
stPinMap
.
u16PinSD
=
stPinMap
.
u16PinSD
;
pHandler
->
u8Counter
=
0U
;
pHandler
->
u8Freq
=
pstCfg
->
u8FrameFreq
;
pHandler
->
pu8UserBuffer
=
pstCfg
->
pu8Buffer
;
pHandler
->
pstNext
=
NULL
;
// pHandler->stRegVal.u8SegR = pstCfg->stColorSetting.u8SRR << 4;
// pHandler->stRegVal.u8SegR |= pstCfg->stColorSetting.u8SRF & 0x0FU;
// pHandler->stRegVal.u8SegG = pstCfg->stColorSetting.u8SGR << 4;
// pHandler->stRegVal.u8SegG |= pstCfg->stColorSetting.u8SGF & 0x0FU;
// pHandler->stRegVal.u8SegB = pstCfg->stColorSetting.u8SBR << 4;
// pHandler->stRegVal.u8SegB |= pstCfg->stColorSetting.u8SBF & 0x0FU;
// pHandler->stRegVal.u8LRS = pstCfg->stColorSetting.u8LRS & 0x3FU;
// pHandler->stRegVal.u8LGS = pstCfg->stColorSetting.u8LGS & 0x3FU;
// pHandler->stRegVal.u8LBS = pstCfg->stColorSetting.u8LBS & 0x3FU;
// pHandler->stRegVal.u8LRW = pstCfg->stColorSetting.u8LRW & 0x3FU;
// pHandler->stRegVal.u8LGW = pstCfg->stColorSetting.u8LGW & 0x3FU;
// pHandler->stRegVal.u8LBW = pstCfg->stColorSetting.u8LBW & 0x3FU;
for
(
i
=
0UL
;
i
<
(
uint32_t
)
BU91R65_BUFFER_SIZE
;
i
++
)
{
pHandler
->
pu8UserBuffer
[
i
]
=
pstCfg
->
u8DefaultVal
;
pHandler
->
u8BkupBuffer
[
i
]
=
pstCfg
->
u8DefaultVal
;
}
/*全局芯片注册*/
if
(
g_stBU91R65UpdateCtrl
.
pstList
==
NULL
)
{
g_stBU91R65UpdateCtrl
.
pstList
=
pHandler
;
}
else
{
pstSearch
=
g_stBU91R65UpdateCtrl
.
pstList
;
while
(
pstSearch
->
pstNext
!=
NULL
)
{
pstSearch
=
pstSearch
->
pstNext
;
}
pstSearch
->
pstNext
=
pHandler
;
}
}
}
}
/* chip initial */
if
(
i32Result
==
0
)
{
/* Step 1: Apply software reset */
pHandler
->
stPinMap
.
u16PinCS
(
0U
);
BU91R65_Delay
();
BU91R65_Write_Command
(
pHandler
,
0xFD
);
BU91R65_Write_Command
(
pHandler
,
0x81
);
BU91R65_Delay
();
pHandler
->
stPinMap
.
u16PinCS
(
1U
);
BU91R65_Delay_ms
(
20UL
);
/* Step 2: Config chip */
;
// BU98R10_Set_nCS(&(pHandler->stPinMap), 0U);
pHandler
->
stPinMap
.
u16PinCS
(
0U
);
BU91R65_Delay
();
/* Turn off display before setting */
BU91R65_Write_Command
(
pHandler
,
0xC0
);
/* Enter To Extension Mode */
BU91R65_Write_Command
(
pHandler
,
0xFD
);
/* All detections:disable */
BU91R65_Write_Command
(
pHandler
,
0x90
);
/* Set LCD Driving Mode/Set Frame frequency mode */
BU91R65_Write_Command
(
pHandler
,
0xA0
);
/* Contrast Set */
BU91R65_Write_Command
(
pHandler
,
0xB0
);
/* Read setting */
BU91R65_Write_Command
(
pHandler
,
0xC0
);
/* Com setting */
BU91R65_Write_Command
(
pHandler
,
0xE4
);
/* Enter to Normal Mode */
BU91R65_Write_Command
(
pHandler
,
0xFC
);
/* Frame Frequency */
BU91R65_Write_Command
(
pHandler
,
0xED
);
/* Blink setting */
BU91R65_Write_Command
(
pHandler
,
0xF0
);
/* Data write setting */
BU91R65_Write_Command
(
pHandler
,
0xF8
);
/* Sub Address Set */
BU91R65_Write_Command
(
pHandler
,
0xE0
);
/* Address Set1 */
BU91R65_Write_Command
(
pHandler
,
0x00
);
/* Address Set2 */
BU91R65_Write_Command
(
pHandler
,
0x40
);
// /* Transfer display data */
// BU91R65_Write_Command(pHandler, BU98R10_CMD_DATWR);
for
(
i
=
0UL
;
i
<
(
uint32_t
)
BU91R65_BUFFER_SIZE
;
i
++
)
{
// BU91R65_Write_Data(pHandler, pHandler->u8BkupBuffer[i]);
BU91R65_Write_Command
(
pHandler
,
pHandler
->
u8BkupBuffer
[
i
]);
}
BU91R65_Delay
();
pHandler
->
stPinMap
.
u16PinCS
(
1U
);
BU91R65_Delay
();
pHandler
->
stPinMap
.
u16PinCS
(
0U
);
/* Display on */
BU91R65_Write_Command
(
pHandler
,
0xC8
);
BU91R65_Delay
();
pHandler
->
stPinMap
.
u16PinCS
(
1U
);
g_stBU91R65UpdateCtrl
.
u8State
=
BU91R65_STATE_RUN
;
}
return
i32Result
;
}
int32_t
BU91R65_Del
(
BU91R65_Handler_st_t
*
pHandler
)
{
int32_t
i32Result
;
uint32_t
u32Retry
;
BU91R65_Handler_st_t
*
pstSearch
;
i32Result
=
-
1
;
if
(
BU91R65_Search
(
pHandler
)
>
0
)
{
u32Retry
=
0UL
;
do
{
// BU98R10_Set_nCS(&(pHandler->stPinMap), 0U);
pHandler
->
stPinMap
.
u16PinCS
(
0U
);
BU91R65_Delay
();
/* Display off */
BU91R65_Write_Command
(
pHandler
,
0xC0
);
BU91R65_Delay
();
// BU98R10_Set_nCS(&(pHandler->stPinMap), 1U);
pHandler
->
stPinMap
.
u16PinCS
(
1U
);
u32Retry
++
;
}
while
((
u32Retry
<
BU91R65_RETRY_MAX_NUM
)
&&
(
i32Result
!=
0
));
if
(
i32Result
==
0
)
{
/* Stop updating the current chip */
if
(
g_stBU91R65UpdateCtrl
.
pstCurrent
==
pHandler
)
{
g_stBU91R65UpdateCtrl
.
pstCurrent
=
pHandler
->
pstNext
;
}
/* Remove the current chip from list */
if
(
pHandler
==
g_stBU91R65UpdateCtrl
.
pstList
)
{
g_stBU91R65UpdateCtrl
.
pstList
=
pHandler
->
pstNext
;
}
else
{
pstSearch
=
g_stBU91R65UpdateCtrl
.
pstList
;
while
((
pstSearch
->
pstNext
!=
NULL
)
&&
(
pstSearch
->
pstNext
!=
pHandler
))
{
pstSearch
=
pstSearch
->
pstNext
;
}
if
(
pstSearch
->
pstNext
==
pHandler
)
{
pstSearch
->
pstNext
=
pHandler
->
pstNext
;
}
}
/* Reset control parameters */
pHandler
->
u8Counter
=
0U
;
pHandler
->
pstNext
=
NULL
;
}
}
return
i32Result
;
}
void
BU91R65_Refresh_Service
(
void
)
/*20ms*/
{
#if 1
if
((
g_stBU91R65UpdateCtrl
.
u8State
==
BU91R65_STATE_RUN
)
&&
(
g_stBU91R65UpdateCtrl
.
pstList
!=
NULL
))
{
/* Request update */
if
(
g_stBU91R65UpdateCtrl
.
pstCurrent
==
NULL
)
{
g_stBU91R65UpdateCtrl
.
pstCurrent
=
g_stBU91R65UpdateCtrl
.
pstList
;
}
/* Update 2 SEGs per frame */
// g_stBU91R65UpdateCtrl.u8ForceUpdt += 20U;
// if (g_stBU91R65UpdateCtrl.u8ForceUpdt >= BU91R65_BUFFER_SIZE)
// {
// g_stBU91R65UpdateCtrl.u8ForceUpdt = 0U;
// }
/* Init per second*/
// g_stBU91R65UpdateCtrl.u8InitCnt++;
// if (g_stBU91R65UpdateCtrl.u8InitCnt >= 50U)
// {
// g_stBU91R65UpdateCtrl.u8InitSts = 1U;
// g_stBU91R65UpdateCtrl.u8InitCnt = 0U;
// }
}
#endif
}
void
BU91R65_Communication_Service
(
void
)
{
uint8_t
u8Len
;
uint8_t
u8Diff
;
uint8_t
u8Index
;
uint8_t
u8AddHigh
;
uint8_t
u8AddLow
;
uint8_t
u8Buffer
[
BU91R65_WRITE_SIZE
]
=
{
0
};
uint16_t
u16ResetPin
;
uint32_t
u32Retry
;
BU91R65_Handler_st_t
*
pstChip
;
if
((
g_stBU91R65UpdateCtrl
.
u8State
==
BU91R65_STATE_RUN
)
&&
(
g_stBU91R65UpdateCtrl
.
pstList
!=
NULL
)
&&
(
g_stBU91R65UpdateCtrl
.
pstCurrent
!=
NULL
))
{
pstChip
=
g_stBU91R65UpdateCtrl
.
pstCurrent
;
u8Diff
=
0U
;
u8Index
=
0U
;
while
((
pstChip
->
u8Counter
<
BU91R65_BUFFER_SIZE
)
&&
(
u8Diff
==
0U
))
{
if
(
pstChip
->
pu8UserBuffer
[
pstChip
->
u8Counter
]
!=
pstChip
->
u8BkupBuffer
[
pstChip
->
u8Counter
])
// if ((pstChip->pu8UserBuffer[pstChip->u8Counter] != pstChip->u8BkupBuffer[pstChip->u8Counter]) || \
// ((pstChip->u8Counter & 0xFEU) == g_stBU91R65UpdateCtrl.u8ForceUpdt))
{
u8Diff
=
1U
;
u8Index
=
pstChip
->
u8Counter
;
}
else
{
pstChip
->
u8Counter
++
;
}
}
if
(
u8Diff
)
{
u8Len
=
0U
;
while
((
u8Diff
!=
0U
)
&&
(
u8Len
<
BU91R65_WRITE_SIZE
)
&&
(
u8Index
<
BU91R65_BUFFER_SIZE
))
{
if
(
pstChip
->
pu8UserBuffer
[
u8Index
]
!=
pstChip
->
u8BkupBuffer
[
u8Index
])
// if ((pstChip->pu8UserBuffer[u8Index] != pstChip->u8BkupBuffer[u8Index]) || \
// ((u8Index & 0xFEU) == g_stBU91R65UpdateCtrl.u8ForceUpdt))
{
u8Buffer
[
u8Len
]
=
pstChip
->
pu8UserBuffer
[
u8Index
];
u8Len
++
;
u8Index
++
;
}
else
{
u8Diff
=
0U
;
}
}
/*init judgement*/
// if (g_stBU91R65UpdateCtrl.u8InitSts)
// {
// g_stBU91R65UpdateCtrl.u8InitSts = 0U;
// do
// {
// pstChip->stPinMap.u16PinCS(0U);
// /* Set frame frequency */
// BU91R65_Write_Command(pstChip, 0xED);
// // BU91R65_Write_Data(pstChip, pstChip->u8Freq);
// BU91R65_Delay();
// /* Display on */
// BU91R65_Write_Command(pstChip, 0xC8); /* code */
// // BU98R10_Set_nCS(&(pstChip->stPinMap), 1U);
// BU91R65_Delay();
// pstChip->stPinMap.u16PinCS(0U);
// if (pstChip ->pstNext != NULL)
// {
// pstChip = pstChip -> pstNext;
// }
// else
// {
// pstChip = g_stBU91R65UpdateCtrl.pstList;
// }
// } while (pstChip != g_stBU91R65UpdateCtrl.pstCurrent);
// }
pstChip
->
stPinMap
.
u16PinCS
(
0U
);
BU91R65_Delay
();
/* Set start address */
BU91R65_Write_Command
(
pstChip
,
0xE0
);
BU91R65_Write_Command
(
pstChip
,
((
pstChip
->
u8Counter
*
2
)
&
0xF0
)
>>
4
);
BU91R65_Write_Command
(
pstChip
,
((
pstChip
->
u8Counter
*
2
)
&
0x0F
)
|
0x40
);
/* Transfer display data */
for
(
u8Index
=
0U
;
u8Index
<
u8Len
;
u8Index
++
)
{
BU91R65_Write_Data
(
pstChip
,
u8Buffer
[
u8Index
]);
}
BU91R65_Delay
();
pstChip
->
stPinMap
.
u16PinCS
(
1U
);
for
(
u8Index
=
0U
;
u8Index
<
u8Len
;
u8Index
++
)
{
pstChip
->
u8BkupBuffer
[
pstChip
->
u8Counter
]
=
pstChip
->
pu8UserBuffer
[
pstChip
->
u8Counter
];
pstChip
->
u8Counter
++
;
}
}
if
(
pstChip
->
u8Counter
>=
BU91R65_BUFFER_SIZE
)
{
pstChip
->
u8Counter
=
0U
;
}
g_stBU91R65UpdateCtrl
.
pstCurrent
=
pstChip
->
pstNext
;
}
}
int32_t
BU91R65_Write_Buffer
(
BU91R65_Handler_st_t
*
pHandler
,
uint8_t
u8Index
,
uint8_t
u8Val
)
{
int32_t
i32Result
;
i32Result
=
-
1
;
if
((
pHandler
!=
NULL
)
&&
(
u8Index
<
BU91R65_BUFFER_SIZE
))
{
if
(
pHandler
->
pu8UserBuffer
!=
NULL
)
{
pHandler
->
pu8UserBuffer
[
u8Index
]
=
u8Val
;
i32Result
=
0
;
}
}
return
i32Result
;
}
int32_t
BU91R65_Write_SEG
(
BU91R65_Handler_st_t
*
pHandler
,
uint8_t
u8Index
,
uint8_t
u8Val
)
{
uint8_t
u8Checksum
;
uint8_t
u8Status
;
uint32_t
u32Retry
;
int32_t
i32Result
;
i32Result
=
-
1
;
// u8Status = BU98R10_Get_Status(pHandler);
if
(
u8Index
<
BU91R65_BUFFER_SIZE
)
{
/* Device is ready */
pHandler
->
pu8UserBuffer
[
u8Index
]
=
u8Val
;
u32Retry
=
0UL
;
do
{
u8Checksum
=
0U
;
// BU98R10_Set_nCS(&(pHandler->stPinMap), 0U);
pHandler
->
stPinMap
.
u16PinCS
(
0U
);
BU91R65_Delay
();
/* Set start address */
BU91R65_Write_Command
(
pHandler
,
0xE0
);
BU91R65_Write_Command
(
pHandler
,
((
u8Index
*
2
)
&
0xF0
)
>>
4
);
BU91R65_Write_Command
(
pHandler
,
((
u8Index
*
2
)
&
0x0F
)
|
0x40
);
/* Transfer display data */
// BU91R65_Write_Command(pHandler, BU98R10_CMD_DATWR);
BU91R65_Write_Data
(
pHandler
,
u8Val
);
BU91R65_Delay
();
// BU98R10_Set_nCS(&(pHandler->stPinMap), 1U);
pHandler
->
stPinMap
.
u16PinCS
(
1U
);
u32Retry
++
;
}
while
((
u32Retry
<
BU91R65_RETRY_MAX_NUM
)
&&
(
i32Result
!=
0
));
if
(
i32Result
==
0
)
{
pHandler
->
u8BkupBuffer
[
u8Index
]
=
u8Val
;
}
}
return
i32Result
;
}
static
int32_t
BU91R65_Search
(
BU91R65_Handler_st_t
*
pHandler
)
{
int32_t
i32Result
;
BU91R65_Handler_st_t
*
pstSearch
;
if
(
pHandler
!=
NULL
)
{
i32Result
=
0
;
pstSearch
=
g_stBU91R65UpdateCtrl
.
pstList
;
while
((
pstSearch
!=
NULL
)
&&
(
i32Result
==
0
))
{
if
(
pstSearch
==
pHandler
)
{
i32Result
=
1
;
}
else
{
pstSearch
=
pstSearch
->
pstNext
;
}
}
}
else
{
i32Result
=
-
1
;
}
return
i32Result
;
}
static
void
BU91R65_Write_Command
(
BU91R65_Handler_st_t
*
pHandler
,
uint8_t
u8Cmd
)
{
uint32_t
i
;
if
(
pHandler
!=
NULL
)
{
// BU91R65_Delay();
/* Default value of SCLK = 1 */
// BU98R10_Set_SCLK(&(pHandler->stPinMap), 0U); /* SCLK = 0 */
// pHandler->stPinMap.u16PinSCLK(0U);
// BU98R10_Set_SD(&(pHandler->stPinMap), 0U); /* SD = 0, Command */
// pHandler->stPinMap.u16PinSD(0U);
// BU91R65_Delay();
// BU98R10_Set_SCLK(&(pHandler->stPinMap), 1U); /* SCLK = 1, Transfer bit */
// pHandler->stPinMap.u16PinSCLK(1U);
for
(
i
=
0UL
;
i
<
8UL
;
i
++
)
{
BU91R65_Delay
();
// BU98R10_Set_SCLK(&(pHandler->stPinMap), 0U); /* SCLK = 0 */
pHandler
->
stPinMap
.
u16PinSCLK
(
0U
);
if
(
u8Cmd
&
0x80U
)
/* Load bit to MOSI */
{
// BU98R10_Set_SD(&(pHandler->stPinMap), 1U);
pHandler
->
stPinMap
.
u16PinSD
(
1U
);
}
else
{
// BU98R10_Set_SD(&(pHandler->stPinMap), 0U);
pHandler
->
stPinMap
.
u16PinSD
(
0U
);
}
u8Cmd
<<=
1
;
BU91R65_Delay
();
// BU98R10_Set_SCLK(&(pHandler->stPinMap), 1U); /* SCLK = 1, Transfer bit */
pHandler
->
stPinMap
.
u16PinSCLK
(
1U
);
}
// BU91R65_Delay();
}
}
static
void
BU91R65_Write_Data
(
BU91R65_Handler_st_t
*
pHandler
,
uint8_t
u8Data
)
{
uint32_t
i
;
if
(
pHandler
!=
NULL
)
{
// BU91R65_Delay();
/* Default value of SCLK = 1 */
// BU98R10_Set_SCLK(&(pHandler->stPinMap), 0U); /* SCLK = 0 */
// pHandler->stPinMap.u16PinSCLK(0U);
// BU98R10_Set_SD(&(pHandler->stPinMap), 0U); /* SD = 0, Command */
// pHandler->stPinMap.u16PinSD(0U);
// BU91R65_Delay();
// BU98R10_Set_SCLK(&(pHandler->stPinMap), 1U); /* SCLK = 1, Transfer bit */
// pHandler->stPinMap.u16PinSCLK(1U);
for
(
i
=
0UL
;
i
<
8UL
;
i
++
)
{
BU91R65_Delay
();
// BU98R10_Set_SCLK(&(pHandler->stPinMap), 0U); /* SCLK = 0 */
pHandler
->
stPinMap
.
u16PinSCLK
(
0U
);
if
(
u8Data
&
0x01U
)
/* Load bit to MOSI */
{
// BU98R10_Set_SD(&(pHandler->stPinMap), 1U);
pHandler
->
stPinMap
.
u16PinSD
(
1U
);
}
else
{
// BU98R10_Set_SD(&(pHandler->stPinMap), 0U);
pHandler
->
stPinMap
.
u16PinSD
(
0U
);
}
u8Data
>>=
1
;
BU91R65_Delay
();
// BU98R10_Set_SCLK(&(pHandler->stPinMap), 1U); /* SCLK = 1, Transfer bit */
pHandler
->
stPinMap
.
u16PinSCLK
(
1U
);
}
BU91R65_Delay
();
}
}
static
void
BU91R65_Delay_ms
(
uint32_t
u32Interval
)
/*未调整*/
{
u32Interval
*=
BU91R65_ms_DIV
;
while
(
u32Interval
)
{
BU91R65_Delay
();
u32Interval
--
;
}
}
static
void
BU91R65_Delay
(
void
)
{
g_u32BU91R65DelayCounter
=
g_stBU91R65UpdateCtrl
.
u32SpeedTrim
;
while
(
g_u32BU91R65DelayCounter
)
{
WDT__Clear
();
g_u32BU91R65DelayCounter
--
;
}
}
YueJin_test_bench/source/Driver/BU91R65/BU91R65_Access.h
0 → 100644
View file @
78caace0
#ifndef BU91R65_ACCESS_H__
#define BU91R65_ACCESS_H__
#include "BU91R65_Porting.h"
#define BU91R65_BUFFER_SIZE (80U)
/**< Buffer size = 90 (90 * 2 = 180 SEGs) */
/** @struct BU98R10_Reg_Val_st_t
* @brief BU98R10寄存器数据存储结构 \n
* 存储BU98R10配置相关的寄存器数值
*/
// typedef struct
// {
// uint8_t u8Freq;
// uint8_t u8SegR;
// uint8_t u8SegG;
// uint8_t u8SegB;
// uint8_t u8LRS;
// uint8_t u8LGS;
// uint8_t u8LBS;
// uint8_t u8LRW;
// uint8_t u8LGW;
// uint8_t u8LBW;
// uint8_t u8Rsvd[2];
// }BU98R10_Reg_Val_st_t;
typedef
struct
stBU98R10Handler
{
uint8_t
u8Step
;
/*目前只有一步,应该可以不要了*/
uint8_t
u8Counter
;
uint8_t
u8Freq
;
BU91R65_Pin_Map_st_t
stPinMap
;
uint8_t
u8BkupBuffer
[
BU91R65_BUFFER_SIZE
];
uint8_t
*
pu8UserBuffer
;
// BU98R10_Reg_Val_st_t stRegVal; /**< 寄存器设置值 */
struct
stBU98R10Handler
*
pstNext
;
}
BU91R65_Handler_st_t
;
/** @struct BU98R10_Color_Setting_st_t
* @brief BU98R10 color setting parameters,please refer to the data sheet for details
*/
// typedef struct
// {
// uint8_t u8SRR;
// uint8_t u8SRF;
// uint8_t u8SGR;
// uint8_t u8SGF;
// uint8_t u8SBR;
// uint8_t u8SBF;
// uint8_t u8LRS;
// uint8_t u8LRW;
// uint8_t u8LGS;
// uint8_t u8LGW;
// uint8_t u8LBS;
// uint8_t u8LBW;
// }BU98R10_Color_Setting_st_t;
// typedef void (*pfunBU91R65_Set_nCS)(uint8_t u8Level);
// typedef void (*pfunBU91R65_Set_SCLK)(uint8_t u8Level);
// typedef void (*pfunBU91R65_Set_SD)(uint8_t u8Level);
typedef
struct
{
uint8_t
u8DefaultVal
;
/**< Default value 0 ~ 7 */
uint8_t
u8FrameFreq
;
/**< Frame frequency */
pfunBU91R65_Set_nCS
u16PinCS
;
/**< Number of CSB pin */
pfunBU91R65_Set_SCLK
u16PinSCLK
;
/**< Number of SCL pin */
pfunBU91R65_Set_SD
u16PinSD
;
/**< Number of SD pin */
// BU98R10_Color_Setting_st_t stColorSetting; /**< Color setting */
uint8_t
u16Rsvd
[
3
];
uint8_t
*
pu8Buffer
;
/**< Data buffer */
}
BU91R65_Config_st_t
;
#define BU98R10_FRAME_FREQ_50_0_Hz (0x00U)
/**< Frame frequency = 50.0Hz */
#define BU98R10_FRAME_FREQ_60_0_Hz (0x01U)
/**< Frame frequency = 60.0Hz */
#define BU98R10_FRAME_FREQ_69_3_Hz (0x02U)
/**< Frame frequency = 69.3Hz */
#define BU98R10_FRAME_FREQ_75_0_Hz (0x03U)
/**< Frame frequency = 75.0Hz */
#define BU98R10_FRAME_FREQ_81_8_Hz (0x04U)
/**< Frame frequency = 81.8Hz */
#define BU98R10_FRAME_FREQ_90_0_Hz (0x05U)
/**< Frame frequency = 90.0Hz */
#define BU98R10_FRAME_FREQ_100_0_Hz (0x06U)
/**< Frame frequency = 100.0Hz */
#define BU98R10_FRAME_FREQ_112_5_Hz (0x07U)
/**< Frame frequency = 112.5Hz */
#define BU98R10_FRAME_FREQ_120_0_Hz (0x08U)
/**< Frame frequency = 120.0Hz */
#define BU98R10_FRAME_FREQ_128_6_Hz (0x09U)
/**< Frame frequency = 128.6Hz */
#define BU98R10_FRAME_FREQ_138_5_Hz (0x0AU)
/**< Frame frequency = 138.5Hz */
#define BU98R10_FRAME_FREQ_150_0_Hz (0x0BU)
/**< Frame frequency = 150.0Hz */
#define BU98R10_FRAME_FREQ_163_6_Hz (0x0CU)
/**< Frame frequency = 163.6Hz */
#define BU98R10_FRAME_FREQ_180_0_Hz (0x0EU)
/**< Frame frequency = 180.0Hz */
#define BU98R10_FRAME_FREQ_200_0_Hz (0x0FU)
/**< Frame frequency = 200.0Hz */
#define BU98R10_STATUS_RUN (0x01U)
/**< Running flag */
/******************************************************************************
STARTUP PROCEDURE
1. Call BU91R65_Init() to create a runtime environment.
2. Use BU91R65_Add() to register chips,
all chips on the segment screen need to be registered one by one.
3. When the chip is registered, its bus will be idle.
Delay a few ms to wait for the chip to be ready to work.
(During this time, initialization for other devices can be performed)
4. Call BU98R10_Setup() to initialize all chips.
If Open/Short detection is enabled, go to step 5,
otherwise go to step 6 directly.
5. Open/Short detection takes some time,
please delay for a while to wait for the detection to complete.
Typically, waiting 600 ms is reliable. Or at least
(1000*u8ShortChkPulse)+(2*u8OpenChkPulse) when startup timing is tight.
(During this time, initialization for other devices can be performed)
6. Call BU98R10_Display_On(), all chips start to display.
******************************************************************************/
/******************************************************************************
SHUTDOWN PROCEDURE
1. Remove all chips from the registration list by calling BU91R65_Del().
2. Call BU91R65_DeInit() to clear runtime environment.
******************************************************************************/
extern
void
BU91R65_Init
(
uint32_t
u32SpeedTrim
);
extern
void
BU91R65_DeInit
(
void
);
extern
int32_t
BU91R65_Add
(
BU91R65_Handler_st_t
*
pHandler
,
BU91R65_Config_st_t
*
pstCfg
);
extern
int32_t
BU91R65_Del
(
BU91R65_Handler_st_t
*
pHandler
);
extern
void
BU91R65_Refresh_Service
(
void
);
extern
void
BU91R65_Communication_Service
(
void
);
extern
int32_t
BU91R65_Write_Buffer
(
BU91R65_Handler_st_t
*
pHandler
,
uint8_t
u8Index
,
uint8_t
u8Val
);
extern
int32_t
BU91R65_Write_SEG
(
BU91R65_Handler_st_t
*
pHandler
,
uint8_t
u8Index
,
uint8_t
u8Val
);
#endif
/* BU98R10_ACCESS_H__ */
YueJin_test_bench/source/Driver/BU91R65/BU91R65_Porting.c
0 → 100644
View file @
78caace0
#include <stddef.h>
// #include "RTE.h"
#include "BU91R65_Porting.h"
#include "RTE_GPIO.h"
int32_t
BU91R65_GPIO_Init
(
BU91R65_Pin_Map_st_t
*
pstPinMap
)
{
int32_t
i32Result
;
i32Result
=
-
1
;
if
(
pstPinMap
!=
NULL
)
{
i32Result
=
0
;
/* CSB = 1 */
// if (i32Result == 0)
// {
// RTE_GPIO_Set_GPIO_Mode(pstPinMap->u16PinCS);
// RTE_GPIO_Set_Direction(pstPinMap->u16PinCS, RTE_GPIO_DIR_OUT);
// RTE_GPIO_Set_Level(pstPinMap->u16PinCS, GPIO_Level_High);
BU91R65_CHIP0_CSB
=
GPIO_Level_High
;
BU91R65_CHIP1_CSB
=
GPIO_Level_High
;
// }
/* SCLK = 1 */
// if (i32Result == 0)
// {
// RTE_GPIO_Set_GPIO_Mode(pstPinMap->u16PinSCLK);
// RTE_GPIO_Set_Direction(pstPinMap->u16PinSCLK, RTE_GPIO_DIR_OUT);
// RTE_GPIO_Set_Level(pstPinMap->u16PinSCLK, GPIO_Level_Low);
BU91R65_CHIP0_SCL
=
GPIO_Level_High
;
BU91R65_CHIP1_SCL
=
GPIO_Level_High
;
// }
/* SD = 0 */
// if (i32Result == 0)/*Note: SD = 1*/
// {
// RTE_GPIO_Set_GPIO_Mode(pstPinMap->u16PinSD);
// RTE_GPIO_Set_Direction(pstPinMap->u16PinSD, RTE_GPIO_DIR_OUT);
// RTE_GPIO_Set_Level(pstPinMap->u16PinSD, GPIO_Level_Low);
BU91R65_CHIP0_SD
=
GPIO_Level_Low
;
BU91R65_CHIP1_SD
=
GPIO_Level_Low
;
// }
}
return
i32Result
;
}
void
BU91R65_Chip0_Set_nCS
(
uint8_t
u8Level
)
{
BU91R65_CHIP0_CSB
=
u8Level
;
}
void
BU91R65_Chip0_Set_SCLK
(
uint8_t
u8Level
)
{
BU91R65_CHIP0_SCL
=
u8Level
;
}
void
BU91R65_Chip0_Set_SD
(
uint8_t
u8Level
)
{
BU91R65_CHIP0_SD
=
u8Level
;
}
void
BU91R65_Chip1_Set_nCS
(
uint8_t
u8Level
)
{
BU91R65_CHIP1_CSB
=
u8Level
;
}
void
BU91R65_Chip1_Set_SCLK
(
uint8_t
u8Level
)
{
BU91R65_CHIP1_SCL
=
u8Level
;
}
void
BU91R65_Chip1_Set_SD
(
uint8_t
u8Level
)
{
BU91R65_CHIP1_SD
=
u8Level
;
}
YueJin_test_bench/source/Driver/BU91R65/BU91R65_Porting.h
0 → 100644
View file @
78caace0
#ifndef BU91R65_PORTING_H__
#define BU91R65_PORTING_H__
#include "TYW_stdint.h"
#include "GPIO.h"
#define BU91R65_CHIP0_SD LCD_SDI1_OUT
#define BU91R65_CHIP0_CSB LCD_CSB1
#define BU91R65_CHIP0_SCL LCD_SCK1
#define BU91R65_CHIP1_SD LCD_SDI2_OUT
#define BU91R65_CHIP1_CSB LCD_CSB2
#define BU91R65_CHIP1_SCL LCD_SCK2
typedef
void
(
*
pfunBU91R65_Set_nCS
)(
uint8_t
u8Level
);
typedef
void
(
*
pfunBU91R65_Set_SCLK
)(
uint8_t
u8Level
);
typedef
void
(
*
pfunBU91R65_Set_SD
)(
uint8_t
u8Level
);
typedef
struct
{
pfunBU91R65_Set_nCS
u16PinCS
;
/**< Number of CSB pin */
pfunBU91R65_Set_SCLK
u16PinSCLK
;
/**< Number of SCL pin */
pfunBU91R65_Set_SD
u16PinSD
;
/**< Number of SD pin */
uint16_t
u16Rsvd
;
}
BU91R65_Pin_Map_st_t
;
#define BU91R65_NOT_USED_PIN (0xFFFFU)
extern
int32_t
BU91R65_GPIO_Init
(
BU91R65_Pin_Map_st_t
*
pstPinMap
);
extern
void
BU91R65_Chip0_Set_nCS
(
uint8_t
u8Level
);
extern
void
BU91R65_Chip0_Set_SCLK
(
uint8_t
u8Level
);
extern
void
BU91R65_Chip0_Set_SD
(
uint8_t
u8Level
);
extern
void
BU91R65_Chip1_Set_nCS
(
uint8_t
u8Level
);
extern
void
BU91R65_Chip1_Set_SCLK
(
uint8_t
u8Level
);
extern
void
BU91R65_Chip1_Set_SD
(
uint8_t
u8Level
);
#endif
/* BU98R10_PORTING_H__ */
YueJin_test_bench/source/Driver/GPIO/GPIO.c
View file @
78caace0
...
...
@@ -41,47 +41,45 @@ const uint16_t g_u16GPIOConfigArray[56U][2U] =
{
0x0000u
,
0x0000u
},
{
0x0000u
,
0x0000u
},
{
0x0000u
,
0x0000u
},
{
0x000Cu
,
0x0000u
},
{
0x0020u
,
0x0000u
},
{
0x0620u
,
0x0600u
},
{
0x0000u
,
0x0000u
},
{
0x0000u
,
0x0000u
},
{
0x063Cu
,
0x0630u
},
{
0x1A6Bu
,
0x1A6Fu
},
{
0x79C3u
,
0x79CFu
},
{
0x0600u
,
0x0600u
},
{
0x0000u
,
0x0000u
},
{
0x0008u
,
0x0080u
},
{
0x0600u
,
0x0600u
},
{
0x0200u
,
0x0208u
},
{
0x79FFu
,
0x79FFu
},
{
0x0000u
,
0x0000u
},
{
0x0000u
,
0x0000u
},
{
0x0000u
,
0x0000u
},
{
0x0000u
,
0x0000u
},
{
0x0000u
,
0x0008u
},
{
0x0000u
,
0x0000u
},
{
0x0000u
,
0x0003u
},
{
0x0000u
,
0x0008u
},
{
0x0108u
,
0x0308u
},
{
0x1FFFu
,
0x1FF7u
},
{
0x0000u
,
0x0000u
},
{
0x0000u
,
0x0000u
},
{
0x0000u
,
0x0000u
},
{
0x1FFFu
,
0x1FFFu
},
{
0x0000u
,
0x0000u
},
{
0x0000u
,
0x0000u
},
{
0x0000u
,
0x0000u
},
{
0x0000u
,
0x0000u
},
{
0x0000u
,
0x0000u
},
{
0x0000u
,
0x0000u
},
{
0x0002u
,
0x0000u
},
{
0x0000u
,
0x0000u
},
{
0x0001u
,
0x0001u
},
{
0x0003u
,
0x0003u
},
{
0x007Fu
,
0x007Fu
},
{
0x0000u
,
0x0000u
},
{
0x0000u
,
0x0000u
},
{
0x0000u
,
0x0000u
},
{
0x1800u
,
0x1000u
},
{
0x0000u
,
0x0800u
},
{
0x0000u
,
0x0800u
},
{
0x3000u
,
0x0000u
},
{
0x3000u
,
0x0000u
},
{
0x0000u
,
0x0000u
},
{
0x0002u
,
0x0200u
},
{
0x1800u
,
0x1800u
},
{
0x0A60u
,
0x0A60u
},
{
0xE7FFu
,
0xE7FFu
},
{
0x0000u
,
0x0000u
},
{
0x8000u
,
0x000Cu
},
{
0x3000u
,
0x0000u
},
{
0x0000u
,
0x0000u
},
{
0xCFFFu
,
0xFFFFu
},
{
0x0000u
,
0x0000u
},
{
0x0000u
,
0x0000u
},
{
0x0000u
,
0x0000u
},
...
...
@@ -89,10 +87,12 @@ const uint16_t g_u16GPIOConfigArray[56U][2U] =
{
0x0000u
,
0x0000u
},
{
0x0000u
,
0x0000u
},
{
0x0000u
,
0x0000u
},
{
0x0089u
,
0x0080u
},
{
0x0000u
,
0x0000u
},
{
0x0004u
,
0x000Du
},
{
0x00FFu
,
0x00FFu
},
{
0x
02
00u
,
0x0000u
},
{
0x
C07Fu
,
0xC07
Fu
},
{
0x
B0
00u
,
0x0000u
},
{
0x
023Fu
,
0x023
Fu
},
{
0xFFFFu
,
0xFFFFu
},
};
static
void
GPIO_PIN_Init
(
GPIO_Config_Mode_en_t
enGPIOConfigMode
)
...
...
YueJin_test_bench/source/System/init.c
View file @
78caace0
...
...
@@ -39,6 +39,7 @@
#include "Display_Info.h"
#include "FreIn_User.h"
#include "../UART/UART.h"
#include "BU91R65.h"
/* Private typedef -----------------------------------------------------------*/
/* Private define ------------------------------------------------------------*/
/* Private macro -------------------------------------------------------------*/
...
...
@@ -111,6 +112,8 @@ void Sys_Startup_Init(void)
loc_config
.
pfnUARTConfirmCallBack
=
0
;
loc_config
.
pfnUARTErrHandleCallBack
=
0
;
loc_config
.
pfnUARTReadMsgCallBack
=
UART_Put1
;
BU91R65_Register
();
// UART_Init(UART_RLIN31, &loc_config);
// Auto_ONOFF = 1;
// AutoFlag = 1;
...
...
YueJin_test_bench/utility/GPIO/GPIO.h
deleted
100644 → 0
View file @
68178d89
#ifndef GPIO_H__
#define GPIO_H__
/*-----------------use for RH850_F1KM_S1 --------------------*/
#include "dr7f701684.dvf.h"
typedef
struct
{
uint16_t
PIN_0
:
1
;
uint16_t
PIN_1
:
1
;
uint16_t
PIN_2
:
1
;
uint16_t
PIN_3
:
1
;
uint16_t
PIN_4
:
1
;
uint16_t
PIN_5
:
1
;
uint16_t
PIN_6
:
1
;
uint16_t
PIN_7
:
1
;
uint16_t
PIN_8
:
1
;
uint16_t
PIN_9
:
1
;
uint16_t
PIN_10
:
1
;
uint16_t
PIN_11
:
1
;
uint16_t
PIN_12
:
1
;
uint16_t
PIN_13
:
1
;
uint16_t
PIN_14
:
1
;
uint16_t
PIN_15
:
1
;
}
GPIO_Bit_st_t
;
typedef
union
{
uint16_t
UINT16
;
GPIO_Bit_st_t
BIT
;
}
GPIO_Port_Pin_en_t
;
#define PORTPM0_DIR ((volatile GPIO_Port_Pin_en_t *)(&PORTPM0))
#define PORTPM8_DIR ((volatile GPIO_Port_Pin_en_t *)(&PORTPM8))
#define PORTPM9_DIR ((volatile GPIO_Port_Pin_en_t *)(&PORTPM9))
#define PORTPM10_DIR ((volatile GPIO_Port_Pin_en_t *)(&PORTPM10))
#define PORTPM11_DIR ((volatile GPIO_Port_Pin_en_t *)(&PORTPM11))
#define PORTAPM0_DIR ((volatile GPIO_Port_Pin_en_t *)(&PORTAPM0))
#define PORTPM0_IN ((volatile GPIO_Port_Pin_en_t *)(&PORTPPR0))
#define PORTPM8_IN ((volatile GPIO_Port_Pin_en_t *)(&PORTPPR8))
#define PORTPM9_IN ((volatile GPIO_Port_Pin_en_t *)(&PORTPPR9))
#define PORTPM10_IN ((volatile GPIO_Port_Pin_en_t *)(&PORTPPR10))
#define PORTPM11_IN ((volatile GPIO_Port_Pin_en_t *)(&PORTPPR11))
#define PORTAPM0_IN ((volatile GPIO_Port_Pin_en_t *)(&PORTAPPR0))
#define PORTPM0_OUT ((volatile GPIO_Port_Pin_en_t *)(&PORTP0))
#define PORTPM8_OUT ((volatile GPIO_Port_Pin_en_t *)(&PORTP8))
#define PORTPM9_OUT ((volatile GPIO_Port_Pin_en_t *)(&PORTP9))
#define PORTPM10_OUT ((volatile GPIO_Port_Pin_en_t *)(&PORTP10))
#define PORTPM11_OUT ((volatile GPIO_Port_Pin_en_t *)(&PORTP11))
#define PORTAPM0_OUT ((volatile GPIO_Port_Pin_en_t *)(&PORTAP0))
/*************************************************************************************/
/*************************************************************************************/
/*************************************************************************************/
/* --- PORT Data Direction --- */
/**** PORT P0****/
#define GPIO_DIR_PORT00_PIN00 PORTPM0_DIR->BIT.PIN_0
#define GPIO_DIR_PORT00_PIN01 PORTPM0_DIR->BIT.PIN_1
#define GPIO_DIR_PORT00_PIN02 PORTPM0_DIR->BIT.PIN_2
#define GPIO_DIR_PORT00_PIN03 PORTPM0_DIR->BIT.PIN_3
#define GPIO_DIR_PORT00_PIN04 PORTPM0_DIR->BIT.PIN_4
#define GPIO_DIR_PORT00_PIN05 PORTPM0_DIR->BIT.PIN_5
#define GPIO_DIR_PORT00_PIN06 PORTPM0_DIR->BIT.PIN_6
#define GPIO_DIR_PORT00_PIN07 PORTPM0_DIR->BIT.PIN_7
#define GPIO_DIR_PORT00_PIN08 PORTPM0_DIR->BIT.PIN_8
#define GPIO_DIR_PORT00_PIN09 PORTPM0_DIR->BIT.PIN_9
#define GPIO_DIR_PORT00_PIN10 PORTPM0_DIR->BIT.PIN_10
#define GPIO_DIR_PORT00_PIN11 PORTPM0_DIR->BIT.PIN_11
#define GPIO_DIR_PORT00_PIN12 PORTPM0_DIR->BIT.PIN_12
#define GPIO_DIR_PORT00_PIN13 PORTPM0_DIR->BIT.PIN_13
#define GPIO_DIR_PORT00_PIN14 PORTPM0_DIR->BIT.PIN_14
#define GPIO_DIR_PORT00_PIN15 PORTPM0_DIR->BIT.PIN_15
/**** PORT P8****/
#define GPIO_DIR_PORT08_PIN00 PORTPM8_DIR->BIT.PIN_0
#define GPIO_DIR_PORT08_PIN01 PORTPM8_DIR->BIT.PIN_1
#define GPIO_DIR_PORT08_PIN02 PORTPM8_DIR->BIT.PIN_2
#define GPIO_DIR_PORT08_PIN03 PORTPM8_DIR->BIT.PIN_3
#define GPIO_DIR_PORT08_PIN04 PORTPM8_DIR->BIT.PIN_4
#define GPIO_DIR_PORT08_PIN05 PORTPM8_DIR->BIT.PIN_5
#define GPIO_DIR_PORT08_PIN06 PORTPM8_DIR->BIT.PIN_6
#define GPIO_DIR_PORT08_PIN07 PORTPM8_DIR->BIT.PIN_7
#define GPIO_DIR_PORT08_PIN08 PORTPM8_DIR->BIT.PIN_8
#define GPIO_DIR_PORT08_PIN09 PORTPM8_DIR->BIT.PIN_9
#define GPIO_DIR_PORT08_PIN10 PORTPM8_DIR->BIT.PIN_10
#define GPIO_DIR_PORT08_PIN11 PORTPM8_DIR->BIT.PIN_11
#define GPIO_DIR_PORT08_PIN12 PORTPM8_DIR->BIT.PIN_12
#define GPIO_DIR_PORT08_PIN13 PORTPM8_DIR->BIT.PIN_13
#define GPIO_DIR_PORT08_PIN14 PORTPM8_DIR->BIT.PIN_14
#define GPIO_DIR_PORT08_PIN15 PORTPM8_DIR->BIT.PIN_15
/**** PORT P9****/
#define GPIO_DIR_PORT09_PIN00 PORTPM9_DIR->BIT.PIN_0
#define GPIO_DIR_PORT09_PIN01 PORTPM9_DIR->BIT.PIN_1
#define GPIO_DIR_PORT09_PIN02 PORTPM9_DIR->BIT.PIN_2
#define GPIO_DIR_PORT09_PIN03 PORTPM9_DIR->BIT.PIN_3
#define GPIO_DIR_PORT09_PIN04 PORTPM9_DIR->BIT.PIN_4
#define GPIO_DIR_PORT09_PIN05 PORTPM9_DIR->BIT.PIN_5
#define GPIO_DIR_PORT09_PIN06 PORTPM9_DIR->BIT.PIN_6
#define GPIO_DIR_PORT09_PIN07 PORTPM9_DIR->BIT.PIN_7
#define GPIO_DIR_PORT09_PIN08 PORTPM9_DIR->BIT.PIN_8
#define GPIO_DIR_PORT09_PIN09 PORTPM9_DIR->BIT.PIN_9
#define GPIO_DIR_PORT09_PIN10 PORTPM9_DIR->BIT.PIN_10
#define GPIO_DIR_PORT09_PIN11 PORTPM9_DIR->BIT.PIN_11
#define GPIO_DIR_PORT09_PIN12 PORTPM9_DIR->BIT.PIN_12
#define GPIO_DIR_PORT09_PIN13 PORTPM9_DIR->BIT.PIN_13
#define GPIO_DIR_PORT09_PIN14 PORTPM9_DIR->BIT.PIN_14
#define GPIO_DIR_PORT09_PIN15 PORTPM9_DIR->BIT.PIN_15
/**** PORT P10****/
#define GPIO_DIR_PORT10_PIN00 PORTPM10_DIR->BIT.PIN_0
#define GPIO_DIR_PORT10_PIN01 PORTPM10_DIR->BIT.PIN_1
#define GPIO_DIR_PORT10_PIN02 PORTPM10_DIR->BIT.PIN_2
#define GPIO_DIR_PORT10_PIN03 PORTPM10_DIR->BIT.PIN_3
#define GPIO_DIR_PORT10_PIN04 PORTPM10_DIR->BIT.PIN_4
#define GPIO_DIR_PORT10_PIN05 PORTPM10_DIR->BIT.PIN_5
#define GPIO_DIR_PORT10_PIN06 PORTPM10_DIR->BIT.PIN_6
#define GPIO_DIR_PORT10_PIN07 PORTPM10_DIR->BIT.PIN_7
#define GPIO_DIR_PORT10_PIN08 PORTPM10_DIR->BIT.PIN_8
#define GPIO_DIR_PORT10_PIN09 PORTPM10_DIR->BIT.PIN_9
#define GPIO_DIR_PORT10_PIN10 PORTPM10_DIR->BIT.PIN_10
#define GPIO_DIR_PORT10_PIN11 PORTPM10_DIR->BIT.PIN_11
#define GPIO_DIR_PORT10_PIN12 PORTPM10_DIR->BIT.PIN_12
#define GPIO_DIR_PORT10_PIN13 PORTPM10_DIR->BIT.PIN_13
#define GPIO_DIR_PORT10_PIN14 PORTPM10_DIR->BIT.PIN_14
#define GPIO_DIR_PORT10_PIN15 PORTPM10_DIR->BIT.PIN_15
/**** PORT P11****/
#define GPIO_DIR_PORT11_PIN00 PORTPM11_DIR->BIT.PIN_0
#define GPIO_DIR_PORT11_PIN01 PORTPM11_DIR->BIT.PIN_1
#define GPIO_DIR_PORT11_PIN02 PORTPM11_DIR->BIT.PIN_2
#define GPIO_DIR_PORT11_PIN03 PORTPM11_DIR->BIT.PIN_3
#define GPIO_DIR_PORT11_PIN04 PORTPM11_DIR->BIT.PIN_4
#define GPIO_DIR_PORT11_PIN05 PORTPM11_DIR->BIT.PIN_5
#define GPIO_DIR_PORT11_PIN06 PORTPM11_DIR->BIT.PIN_6
#define GPIO_DIR_PORT11_PIN07 PORTPM11_DIR->BIT.PIN_7
#define GPIO_DIR_PORT11_PIN08 PORTPM11_DIR->BIT.PIN_8
#define GPIO_DIR_PORT11_PIN09 PORTPM11_DIR->BIT.PIN_9
#define GPIO_DIR_PORT11_PIN10 PORTPM11_DIR->BIT.PIN_10
#define GPIO_DIR_PORT11_PIN11 PORTPM11_DIR->BIT.PIN_11
#define GPIO_DIR_PORT11_PIN12 PORTPM11_DIR->BIT.PIN_12
#define GPIO_DIR_PORT11_PIN13 PORTPM11_DIR->BIT.PIN_13
#define GPIO_DIR_PORT11_PIN14 PORTPM11_DIR->BIT.PIN_14
#define GPIO_DIR_PORT11_PIN15 PORTPM11_DIR->BIT.PIN_15
/******PORT AP0********/
#define GPIO_DIR_APORT00_PIN00 PORTAPM0_DIR->BIT.PIN_0
#define GPIO_DIR_APORT00_PIN01 PORTAPM0_DIR->BIT.PIN_1
#define GPIO_DIR_APORT00_PIN02 PORTAPM0_DIR->BIT.PIN_2
#define GPIO_DIR_APORT00_PIN03 PORTAPM0_DIR->BIT.PIN_3
#define GPIO_DIR_APORT00_PIN04 PORTAPM0_DIR->BIT.PIN_4
#define GPIO_DIR_APORT00_PIN05 PORTAPM0_DIR->BIT.PIN_5
#define GPIO_DIR_APORT00_PIN06 PORTAPM0_DIR->BIT.PIN_6
#define GPIO_DIR_APORT00_PIN07 PORTAPM0_DIR->BIT.PIN_7
#define GPIO_DIR_APORT00_PIN08 PORTAPM0_DIR->BIT.PIN_8
#define GPIO_DIR_APORT00_PIN09 PORTAPM0_DIR->BIT.PIN_9
#define GPIO_DIR_APORT00_PIN10 PORTAPM0_DIR->BIT.PIN_10
#define GPIO_DIR_APORT00_PIN11 PORTAPM0_DIR->BIT.PIN_11
#define GPIO_DIR_APORT00_PIN12 PORTAPM0_DIR->BIT.PIN_12
#define GPIO_DIR_APORT00_PIN13 PORTAPM0_DIR->BIT.PIN_13
#define GPIO_DIR_APORT00_PIN14 PORTAPM0_DIR->BIT.PIN_14
#define GPIO_DIR_APORT00_PIN15 PORTAPM0_DIR->BIT.PIN_15
/* --- PORT Data Output Value --- */
/**** PORT P0****/
#define GPIO_OUT_PORT00_PIN00 PORTPM0_OUT->BIT.PIN_0
#define GPIO_OUT_PORT00_PIN01 PORTPM0_OUT->BIT.PIN_1
#define GPIO_OUT_PORT00_PIN02 PORTPM0_OUT->BIT.PIN_2
#define GPIO_OUT_PORT00_PIN03 PORTPM0_OUT->BIT.PIN_3
#define GPIO_OUT_PORT00_PIN04 PORTPM0_OUT->BIT.PIN_4
#define GPIO_OUT_PORT00_PIN05 PORTPM0_OUT->BIT.PIN_5
#define GPIO_OUT_PORT00_PIN06 PORTPM0_OUT->BIT.PIN_6
#define GPIO_OUT_PORT00_PIN07 PORTPM0_OUT->BIT.PIN_7
#define GPIO_OUT_PORT00_PIN08 PORTPM0_OUT->BIT.PIN_8
#define GPIO_OUT_PORT00_PIN09 PORTPM0_OUT->BIT.PIN_9
#define GPIO_OUT_PORT00_PIN10 PORTPM0_OUT->BIT.PIN_10
#define GPIO_OUT_PORT00_PIN11 PORTPM0_OUT->BIT.PIN_11
#define GPIO_OUT_PORT00_PIN12 PORTPM0_OUT->BIT.PIN_12
#define GPIO_OUT_PORT00_PIN13 PORTPM0_OUT->BIT.PIN_13
#define GPIO_OUT_PORT00_PIN14 PORTPM0_OUT->BIT.PIN_14
#define GPIO_OUT_PORT00_PIN15 PORTPM0_OUT->BIT.PIN_15
/**** PORT P8****/
#define GPIO_OUT_PORT08_PIN00 PORTPM8_OUT->BIT.PIN_0
#define GPIO_OUT_PORT08_PIN01 PORTPM8_OUT->BIT.PIN_1
#define GPIO_OUT_PORT08_PIN02 PORTPM8_OUT->BIT.PIN_2
#define GPIO_OUT_PORT08_PIN03 PORTPM8_OUT->BIT.PIN_3
#define GPIO_OUT_PORT08_PIN04 PORTPM8_OUT->BIT.PIN_4
#define GPIO_OUT_PORT08_PIN05 PORTPM8_OUT->BIT.PIN_5
#define GPIO_OUT_PORT08_PIN06 PORTPM8_OUT->BIT.PIN_6
#define GPIO_OUT_PORT08_PIN07 PORTPM8_OUT->BIT.PIN_7
#define GPIO_OUT_PORT08_PIN08 PORTPM8_OUT->BIT.PIN_8
#define GPIO_OUT_PORT08_PIN09 PORTPM8_OUT->BIT.PIN_9
#define GPIO_OUT_PORT08_PIN10 PORTPM8_OUT->BIT.PIN_10
#define GPIO_OUT_PORT08_PIN11 PORTPM8_OUT->BIT.PIN_11
#define GPIO_OUT_PORT08_PIN12 PORTPM8_OUT->BIT.PIN_12
#define GPIO_OUT_PORT08_PIN13 PORTPM8_OUT->BIT.PIN_13
#define GPIO_OUT_PORT08_PIN14 PORTPM8_OUT->BIT.PIN_14
#define GPIO_OUT_PORT08_PIN15 PORTPM8_OUT->BIT.PIN_15
/**** PORT P9****/
#define GPIO_OUT_PORT09_PIN00 PORTPM9_OUT->BIT.PIN_0
#define GPIO_OUT_PORT09_PIN01 PORTPM9_OUT->BIT.PIN_1
#define GPIO_OUT_PORT09_PIN02 PORTPM9_OUT->BIT.PIN_2
#define GPIO_OUT_PORT09_PIN03 PORTPM9_OUT->BIT.PIN_3
#define GPIO_OUT_PORT09_PIN04 PORTPM9_OUT->BIT.PIN_4
#define GPIO_OUT_PORT09_PIN05 PORTPM9_OUT->BIT.PIN_5
#define GPIO_OUT_PORT09_PIN06 PORTPM9_OUT->BIT.PIN_6
#define GPIO_OUT_PORT09_PIN07 PORTPM9_OUT->BIT.PIN_7
#define GPIO_OUT_PORT09_PIN08 PORTPM9_OUT->BIT.PIN_8
#define GPIO_OUT_PORT09_PIN09 PORTPM9_OUT->BIT.PIN_9
#define GPIO_OUT_PORT09_PIN10 PORTPM9_OUT->BIT.PIN_10
#define GPIO_OUT_PORT09_PIN11 PORTPM9_OUT->BIT.PIN_11
#define GPIO_OUT_PORT09_PIN12 PORTPM9_OUT->BIT.PIN_12
#define GPIO_OUT_PORT09_PIN13 PORTPM9_OUT->BIT.PIN_13
#define GPIO_OUT_PORT09_PIN14 PORTPM9_OUT->BIT.PIN_14
#define GPIO_OUT_PORT09_PIN15 PORTPM9_OUT->BIT.PIN_15
/**** PORT P10****/
#define GPIO_OUT_PORT10_PIN00 PORTPM10_OUT->BIT.PIN_0
#define GPIO_OUT_PORT10_PIN01 PORTPM10_OUT->BIT.PIN_1
#define GPIO_OUT_PORT10_PIN02 PORTPM10_OUT->BIT.PIN_2
#define GPIO_OUT_PORT10_PIN03 PORTPM10_OUT->BIT.PIN_3
#define GPIO_OUT_PORT10_PIN04 PORTPM10_OUT->BIT.PIN_4
#define GPIO_OUT_PORT10_PIN05 PORTPM10_OUT->BIT.PIN_5
#define GPIO_OUT_PORT10_PIN06 PORTPM10_OUT->BIT.PIN_6
#define GPIO_OUT_PORT10_PIN07 PORTPM10_OUT->BIT.PIN_7
#define GPIO_OUT_PORT10_PIN08 PORTPM10_OUT->BIT.PIN_8
#define GPIO_OUT_PORT10_PIN09 PORTPM10_OUT->BIT.PIN_9
#define GPIO_OUT_PORT10_PIN10 PORTPM10_OUT->BIT.PIN_10
#define GPIO_OUT_PORT10_PIN11 PORTPM10_OUT->BIT.PIN_11
#define GPIO_OUT_PORT10_PIN12 PORTPM10_OUT->BIT.PIN_12
#define GPIO_OUT_PORT10_PIN13 PORTPM10_OUT->BIT.PIN_13
#define GPIO_OUT_PORT10_PIN14 PORTPM10_OUT->BIT.PIN_14
#define GPIO_OUT_PORT10_PIN15 PORTPM10_OUT->BIT.PIN_15
/**** PORT P11****/
#define GPIO_OUT_PORT11_PIN00 PORTPM11_OUT->BIT.PIN_0
#define GPIO_OUT_PORT11_PIN01 PORTPM11_OUT->BIT.PIN_1
#define GPIO_OUT_PORT11_PIN02 PORTPM11_OUT->BIT.PIN_2
#define GPIO_OUT_PORT11_PIN03 PORTPM11_OUT->BIT.PIN_3
#define GPIO_OUT_PORT11_PIN04 PORTPM11_OUT->BIT.PIN_4
#define GPIO_OUT_PORT11_PIN05 PORTPM11_OUT->BIT.PIN_5
#define GPIO_OUT_PORT11_PIN06 PORTPM11_OUT->BIT.PIN_6
#define GPIO_OUT_PORT11_PIN07 PORTPM11_OUT->BIT.PIN_7
#define GPIO_OUT_PORT11_PIN08 PORTPM11_OUT->BIT.PIN_8
#define GPIO_OUT_PORT11_PIN09 PORTPM11_OUT->BIT.PIN_9
#define GPIO_OUT_PORT11_PIN10 PORTPM11_OUT->BIT.PIN_10
#define GPIO_OUT_PORT11_PIN11 PORTPM11_OUT->BIT.PIN_11
#define GPIO_OUT_PORT11_PIN12 PORTPM11_OUT->BIT.PIN_12
#define GPIO_OUT_PORT11_PIN13 PORTPM11_OUT->BIT.PIN_13
#define GPIO_OUT_PORT11_PIN14 PORTPM11_OUT->BIT.PIN_14
#define GPIO_OUT_PORT11_PIN15 PORTPM11_OUT->BIT.PIN_15
/******PORT AP0********/
#define GPIO_OUT_APORT00_PIN00 PORTAPM0_OUT->BIT.PIN_0
#define GPIO_OUT_APORT00_PIN01 PORTAPM0_OUT->BIT.PIN_1
#define GPIO_OUT_APORT00_PIN02 PORTAPM0_OUT->BIT.PIN_2
#define GPIO_OUT_APORT00_PIN03 PORTAPM0_OUT->BIT.PIN_3
#define GPIO_OUT_APORT00_PIN04 PORTAPM0_OUT->BIT.PIN_4
#define GPIO_OUT_APORT00_PIN05 PORTAPM0_OUT->BIT.PIN_5
#define GPIO_OUT_APORT00_PIN06 PORTAPM0_OUT->BIT.PIN_6
#define GPIO_OUT_APORT00_PIN07 PORTAPM0_OUT->BIT.PIN_7
#define GPIO_OUT_APORT00_PIN08 PORTAPM0_OUT->BIT.PIN_8
#define GPIO_OUT_APORT00_PIN09 PORTAPM0_OUT->BIT.PIN_9
#define GPIO_OUT_APORT00_PIN10 PORTAPM0_OUT->BIT.PIN_10
#define GPIO_OUT_APORT00_PIN11 PORTAPM0_OUT->BIT.PIN_11
#define GPIO_OUT_APORT00_PIN12 PORTAPM0_OUT->BIT.PIN_12
#define GPIO_OUT_APORT00_PIN13 PORTAPM0_OUT->BIT.PIN_13
#define GPIO_OUT_APORT00_PIN14 PORTAPM0_OUT->BIT.PIN_14
#define GPIO_OUT_APORT00_PIN15 PORTAPM0_OUT->BIT.PIN_15
/* --- PORT Data Input Value --- */
/**** PORT P0****/
#define GPIO_IN_PORT00_PIN00 PORTPM0_IN->BIT.PIN_0
#define GPIO_IN_PORT00_PIN01 PORTPM0_IN->BIT.PIN_1
#define GPIO_IN_PORT00_PIN02 PORTPM0_IN->BIT.PIN_2
#define GPIO_IN_PORT00_PIN03 PORTPM0_IN->BIT.PIN_3
#define GPIO_IN_PORT00_PIN04 PORTPM0_IN->BIT.PIN_4
#define GPIO_IN_PORT00_PIN05 PORTPM0_IN->BIT.PIN_5
#define GPIO_IN_PORT00_PIN06 PORTPM0_IN->BIT.PIN_6
#define GPIO_IN_PORT00_PIN07 PORTPM0_IN->BIT.PIN_7
#define GPIO_IN_PORT00_PIN08 PORTPM0_IN->BIT.PIN_8
#define GPIO_IN_PORT00_PIN09 PORTPM0_IN->BIT.PIN_9
#define GPIO_IN_PORT00_PIN10 PORTPM0_IN->BIT.PIN_10
#define GPIO_IN_PORT00_PIN11 PORTPM0_IN->BIT.PIN_11
#define GPIO_IN_PORT00_PIN12 PORTPM0_IN->BIT.PIN_12
#define GPIO_IN_PORT00_PIN13 PORTPM0_IN->BIT.PIN_13
#define GPIO_IN_PORT00_PIN14 PORTPM0_IN->BIT.PIN_14
#define GPIO_IN_PORT00_PIN15 PORTPM0_IN->BIT.PIN_15
/**** PORT P8****/
#define GPIO_IN_PORT08_PIN00 PORTPM8_IN->BIT.PIN_0
#define GPIO_IN_PORT08_PIN01 PORTPM8_IN->BIT.PIN_1
#define GPIO_IN_PORT08_PIN02 PORTPM8_IN->BIT.PIN_2
#define GPIO_IN_PORT08_PIN03 PORTPM8_IN->BIT.PIN_3
#define GPIO_IN_PORT08_PIN04 PORTPM8_IN->BIT.PIN_4
#define GPIO_IN_PORT08_PIN05 PORTPM8_IN->BIT.PIN_5
#define GPIO_IN_PORT08_PIN06 PORTPM8_IN->BIT.PIN_6
#define GPIO_IN_PORT08_PIN07 PORTPM8_IN->BIT.PIN_7
#define GPIO_IN_PORT08_PIN08 PORTPM8_IN->BIT.PIN_8
#define GPIO_IN_PORT08_PIN09 PORTPM8_IN->BIT.PIN_9
#define GPIO_IN_PORT08_PIN10 PORTPM8_IN->BIT.PIN_10
#define GPIO_IN_PORT08_PIN11 PORTPM8_IN->BIT.PIN_11
#define GPIO_IN_PORT08_PIN12 PORTPM8_IN->BIT.PIN_12
#define GPIO_IN_PORT08_PIN13 PORTPM8_IN->BIT.PIN_13
#define GPIO_IN_PORT08_PIN14 PORTPM8_IN->BIT.PIN_14
#define GPIO_IN_PORT08_PIN15 PORTPM8_IN->BIT.PIN_15
/**** PORT P9****/
#define GPIO_IN_PORT09_PIN00 PORTPM9_IN->BIT.PIN_0
#define GPIO_IN_PORT09_PIN01 PORTPM9_IN->BIT.PIN_1
#define GPIO_IN_PORT09_PIN02 PORTPM9_IN->BIT.PIN_2
#define GPIO_IN_PORT09_PIN03 PORTPM9_IN->BIT.PIN_3
#define GPIO_IN_PORT09_PIN04 PORTPM9_IN->BIT.PIN_4
#define GPIO_IN_PORT09_PIN05 PORTPM9_IN->BIT.PIN_5
#define GPIO_IN_PORT09_PIN06 PORTPM9_IN->BIT.PIN_6
#define GPIO_IN_PORT09_PIN07 PORTPM9_IN->BIT.PIN_7
#define GPIO_IN_PORT09_PIN08 PORTPM9_IN->BIT.PIN_8
#define GPIO_IN_PORT09_PIN09 PORTPM9_IN->BIT.PIN_9
#define GPIO_IN_PORT09_PIN10 PORTPM9_IN->BIT.PIN_10
#define GPIO_IN_PORT09_PIN11 PORTPM9_IN->BIT.PIN_11
#define GPIO_IN_PORT09_PIN12 PORTPM9_IN->BIT.PIN_12
#define GPIO_IN_PORT09_PIN13 PORTPM9_IN->BIT.PIN_13
#define GPIO_IN_PORT09_PIN14 PORTPM9_IN->BIT.PIN_14
#define GPIO_IN_PORT09_PIN15 PORTPM9_IN->BIT.PIN_15
/**** PORT P10****/
#define GPIO_IN_PORT10_PIN00 PORTPM10_IN->BIT.PIN_0
#define GPIO_IN_PORT10_PIN01 PORTPM10_IN->BIT.PIN_1
#define GPIO_IN_PORT10_PIN02 PORTPM10_IN->BIT.PIN_2
#define GPIO_IN_PORT10_PIN03 PORTPM10_IN->BIT.PIN_3
#define GPIO_IN_PORT10_PIN04 PORTPM10_IN->BIT.PIN_4
#define GPIO_IN_PORT10_PIN05 PORTPM10_IN->BIT.PIN_5
#define GPIO_IN_PORT10_PIN06 PORTPM10_IN->BIT.PIN_6
#define GPIO_IN_PORT10_PIN07 PORTPM10_IN->BIT.PIN_7
#define GPIO_IN_PORT10_PIN08 PORTPM10_IN->BIT.PIN_8
#define GPIO_IN_PORT10_PIN09 PORTPM10_IN->BIT.PIN_9
#define GPIO_IN_PORT10_PIN10 PORTPM10_IN->BIT.PIN_10
#define GPIO_IN_PORT10_PIN11 PORTPM10_IN->BIT.PIN_11
#define GPIO_IN_PORT10_PIN12 PORTPM10_IN->BIT.PIN_12
#define GPIO_IN_PORT10_PIN13 PORTPM10_IN->BIT.PIN_13
#define GPIO_IN_PORT10_PIN14 PORTPM10_IN->BIT.PIN_14
#define GPIO_IN_PORT10_PIN15 PORTPM10_IN->BIT.PIN_15
/**** PORT P11****/
#define GPIO_IN_PORT11_PIN00 PORTPM11_IN->BIT.PIN_0
#define GPIO_IN_PORT11_PIN01 PORTPM11_IN->BIT.PIN_1
#define GPIO_IN_PORT11_PIN02 PORTPM11_IN->BIT.PIN_2
#define GPIO_IN_PORT11_PIN03 PORTPM11_IN->BIT.PIN_3
#define GPIO_IN_PORT11_PIN04 PORTPM11_IN->BIT.PIN_4
#define GPIO_IN_PORT11_PIN05 PORTPM11_IN->BIT.PIN_5
#define GPIO_IN_PORT11_PIN06 PORTPM11_IN->BIT.PIN_6
#define GPIO_IN_PORT11_PIN07 PORTPM11_IN->BIT.PIN_7
#define GPIO_IN_PORT11_PIN08 PORTPM11_IN->BIT.PIN_8
#define GPIO_IN_PORT11_PIN09 PORTPM11_IN->BIT.PIN_9
#define GPIO_IN_PORT11_PIN10 PORTPM11_IN->BIT.PIN_10
#define GPIO_IN_PORT11_PIN11 PORTPM11_IN->BIT.PIN_11
#define GPIO_IN_PORT11_PIN12 PORTPM11_IN->BIT.PIN_12
#define GPIO_IN_PORT11_PIN13 PORTPM11_IN->BIT.PIN_13
#define GPIO_IN_PORT11_PIN14 PORTPM11_IN->BIT.PIN_14
#define GPIO_IN_PORT11_PIN15 PORTPM11_IN->BIT.PIN_15
/******PORT AP0********/
#define GPIO_IN_APORT00_PIN00 PORTAPM0_IN->BIT.PIN_0
#define GPIO_IN_APORT00_PIN01 PORTAPM0_IN->BIT.PIN_1
#define GPIO_IN_APORT00_PIN02 PORTAPM0_IN->BIT.PIN_2
#define GPIO_IN_APORT00_PIN03 PORTAPM0_IN->BIT.PIN_3
#define GPIO_IN_APORT00_PIN04 PORTAPM0_IN->BIT.PIN_4
#define GPIO_IN_APORT00_PIN05 PORTAPM0_IN->BIT.PIN_5
#define GPIO_IN_APORT00_PIN06 PORTAPM0_IN->BIT.PIN_6
#define GPIO_IN_APORT00_PIN07 PORTAPM0_IN->BIT.PIN_7
#define GPIO_IN_APORT00_PIN08 PORTAPM0_IN->BIT.PIN_8
#define GPIO_IN_APORT00_PIN09 PORTAPM0_IN->BIT.PIN_9
#define GPIO_IN_APORT00_PIN10 PORTAPM0_IN->BIT.PIN_10
#define GPIO_IN_APORT00_PIN11 PORTAPM0_IN->BIT.PIN_11
#define GPIO_IN_APORT00_PIN12 PORTAPM0_IN->BIT.PIN_12
#define GPIO_IN_APORT00_PIN13 PORTAPM0_IN->BIT.PIN_13
#define GPIO_IN_APORT00_PIN14 PORTAPM0_IN->BIT.PIN_14
#define GPIO_IN_APORT00_PIN15 PORTAPM0_IN->BIT.PIN_15
/***************************************************************/
/***************************************************************/
typedef
enum
{
GPIO_PORT_GROUP_0
=
0U
,
GPIO_PORT_GROUP_8
=
8U
,
GPIO_PORT_GROUP_9
=
9U
,
GPIO_PORT_GROUP_10
=
10U
,
GPIO_PORT_GROUP_11
=
11U
,
GPIO_PORT_GROUP_AP0
=
50U
,
}
GPIO_Port_en_t
;
typedef
enum
{
GPIO_PIN_0
=
0X0U
,
GPIO_PIN_1
,
GPIO_PIN_2
,
GPIO_PIN_3
,
GPIO_PIN_4
,
GPIO_PIN_5
,
GPIO_PIN_6
,
GPIO_PIN_7
,
GPIO_PIN_8
,
GPIO_PIN_9
,
GPIO_PIN_10
,
GPIO_PIN_11
,
GPIO_PIN_12
,
GPIO_PIN_13
,
GPIO_PIN_14
,
GPIO_PIN_15
,
}
GPIO_PIN_en_t
;
typedef
enum
{
GPIO_Input_Buf_Close
=
0U
,
GPIO_Input_Buf_Open
,
}
GPIO_Buf_Control_en_t
;
typedef
enum
{
GPIO_MODE_PORT
=
0U
,
GPIO_MODE_ALTER_SOFTWARE
,
GPIO_MODE_ALTER_DIRECT
,
}
GPIO_Mode_en_t
;
typedef
enum
{
GPIO_ALTER_FUN_1
=
0U
,
GPIO_ALTER_FUN_2
,
GPIO_ALTER_FUN_3
,
GPIO_ALTER_FUN_4
,
GPIO_ALTER_FUN_5
,
GPIO_ALTER_FUN_6
,
GPIO_ALTER_FUN_7
,
}
GPIO_Alter_Fuction_en_t
;
typedef
enum
{
GPIO_DIR_OUT
=
0U
,
GPIO_DIR_IN
}
GPIO_Direction_en_t
;
typedef
enum
{
GPIO_Level_Low
=
0U
,
GPIO_Level_High
,
}
GPIO_Level_en_t
;
typedef
enum
{
GPIO_PULL_NONE
=
0U
,
GPIO_PULL_UP
,
GPIO_PULL_DOWN
,
}
GPIO_Pull_en_t
;
typedef
enum
{
GPIO_Drive_Slow
=
0U
,
GPIO_Drive_Fast
,
}
GPIO_Strength_en_t
;
typedef
enum
{
GPIO_Char_Schmitt1
=
0UL
,
GPIO_Char_Schmitt4
,
}
GPIO_Characteristics_en_t
;
typedef
struct
{
GPIO_Port_en_t
enGPIOPort
;
GPIO_PIN_en_t
enGPIOPIN
;
GPIO_Characteristics_en_t
enGPIOCharacter
;
GPIO_Pull_en_t
enGPIOPull
;
GPIO_Level_en_t
enGPIOOutputValue
;
GPIO_Mode_en_t
enGPIOMode
;
GPIO_Direction_en_t
enGPIODir
;
GPIO_Alter_Fuction_en_t
enGPIOAltFun
;
}
GPIO_Config_st_t
;
typedef
enum
{
GPIO_WAKEUP_MODE
=
0U
,
GPIO_SLEEP_MODE
,
}
GPIO_Config_Mode_en_t
;
typedef
enum
{
GPIO_WAKEUP_PIN_P0_1
=
0X00U
,
GPIO_WAKEUP_PIN_P0_2
=
0X01U
,
/*Only one of P0_5 and P0_6 can be used*/
GPIO_WAKEUP_PIN_P0_5
=
0X02U
,
GPIO_WAKEUP_PIN_P0_6
=
0X02U
,
/*Only one of P0_7 and P0_10 can be used*/
GPIO_WAKEUP_PIN_P0_7
=
0X03U
,
GPIO_WAKEUP_PIN_P0_10
=
0X03U
,
GPIO_WAKEUP_PIN_P0_9
=
0X04U
,
GPIO_WAKEUP_PIN_P8_0
=
0X04U
,
GPIO_WAKEUP_PIN_P0_13
=
0X05U
,
GPIO_WAKEUP_PIN_P8_1
=
0X05U
,
GPIO_WAKEUP_PIN_P0_3
=
0X0AU
,
GPIO_WAKEUP_PIN_P0_4
=
0X0BU
,
GPIO_WAKEUP_PIN_P8_2
=
0X06U
,
GPIO_WAKEUP_PIN_P8_3
=
0X07U
,
GPIO_WAKEUP_PIN_P8_4
=
0X08U
,
}
GPIO_Wakeup_PIN_en_t
;
typedef
enum
{
GPIO_WAKEUP_NONE
=
0X0U
,
GPIO_WAKEUP_RISING_EDGE
,
GPIO_WAKEUP_FALLING_EDGE
,
GPIO_WAKEUP_BOTH_EDGE
,
GPIO_WAKEUP_LOW_LEVEL
,
GPIO_WAKEUP_HIGH_LEVEL
,
}
GPIO_Wakeup_Trigger_Mode_en_t
;
/**/
extern
void
GPIO_Init
(
GPIO_Config_Mode_en_t
enGPIOConfigMode
);
extern
void
GPIO_Wakeup_PIN_Set
(
GPIO_Wakeup_PIN_en_t
enGPIOWakeupPIN
,
GPIO_Wakeup_Trigger_Mode_en_t
enGPIOTrigger
);
extern
void
GPIO_Config
(
GPIO_Config_st_t
*
pstGPIOConfig
);
extern
void
GPIO_SET_KEPP
(
void
);
#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