Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
multipass
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
derf
multipass
Commits
d6ac6d35
Unverified
Commit
d6ac6d35
authored
3 years ago
by
Birte Kristina Friesel
Browse files
Options
Downloads
Patches
Plain Diff
stm32f446re: Use pxy instead of px_y pin names
parent
54d72afd
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
include/arch/stm32f446re-nucleo/driver/gpio.h
+24
-24
24 additions, 24 deletions
include/arch/stm32f446re-nucleo/driver/gpio.h
with
24 additions
and
24 deletions
include/arch/stm32f446re-nucleo/driver/gpio.h
+
24
−
24
View file @
d6ac6d35
...
...
@@ -17,12 +17,12 @@ class GPIO {
GPIO
()
{}
enum
Pin
:
unsigned
char
{
pa
_
0
=
0
,
pa
_
1
,
pa
_
2
,
pa
_
3
,
pa
_
4
,
pa
_
5
,
pa
_
6
,
pa
_
7
,
pa
_
8
,
pa
_
9
,
pa
_
10
,
pa
_
11
,
pa
_
12
,
pa
_
13
,
pa
_
14
,
pa
_
15
,
pb
_
0
,
pb
_
1
,
pb
_
2
,
pb
_
3
,
pb
_
4
,
pb
_
5
,
pb
_
6
,
pb
_
7
,
pb
_
8
,
pb
_
9
,
pb
_
10
,
pb
_
11
,
pb
_
12
,
pb
_
13
,
pb
_
14
,
pb
_
15
,
pc
_
0
,
pc
_
1
,
pc
_
2
,
pc
_
3
,
pc
_
4
,
pc
_
5
,
pc
_
6
,
pc
_
7
,
pc
_
8
,
pc
_
9
,
pc
_
10
,
pc
_
11
,
pc
_
12
,
pc
_
13
,
pc
_
14
,
pc
_
15
,
pa0
=
0
,
pa1
,
pa2
,
pa3
,
pa4
,
pa5
,
pa6
,
pa7
,
pa8
,
pa9
,
pa10
,
pa11
,
pa12
,
pa13
,
pa14
,
pa15
,
pb0
,
pb1
,
pb2
,
pb3
,
pb4
,
pb5
,
pb6
,
pb7
,
pb8
,
pb9
,
pb10
,
pb11
,
pb12
,
pb13
,
pb14
,
pb15
,
pc0
,
pc1
,
pc2
,
pc3
,
pc4
,
pc5
,
pc6
,
pc7
,
pc8
,
pc9
,
pc10
,
pc11
,
pc12
,
pc13
,
pc14
,
pc15
,
PIN_INVALID
};
...
...
@@ -46,55 +46,55 @@ class GPIO {
}
#pragma GCC diagnostic pop
inline
void
input
(
unsigned
char
const
pin
)
{
if
(
pin
<
pb
_
0
)
{
if
(
pin
<
pb0
)
{
gpio_mode_setup
(
GPIOA
,
GPIO_MODE_INPUT
,
GPIO_PUPD_NONE
,
1
<<
pin
);
}
else
if
(
pin
<
pc
_
0
)
{
gpio_mode_setup
(
GPIOB
,
GPIO_MODE_INPUT
,
GPIO_PUPD_NONE
,
1
<<
(
pin
-
pb
_
0
));
}
else
if
(
pin
<
pc0
)
{
gpio_mode_setup
(
GPIOB
,
GPIO_MODE_INPUT
,
GPIO_PUPD_NONE
,
1
<<
(
pin
-
pb0
));
}
else
if
(
pin
<
PIN_INVALID
)
{
gpio_mode_setup
(
GPIOC
,
GPIO_MODE_INPUT
,
GPIO_PUPD_NONE
,
1
<<
(
pin
-
pc
_
0
));
gpio_mode_setup
(
GPIOC
,
GPIO_MODE_INPUT
,
GPIO_PUPD_NONE
,
1
<<
(
pin
-
pc0
));
}
}
inline
void
input
(
unsigned
char
const
pin
,
unsigned
char
const
pull
)
{
}
inline
void
output
(
unsigned
char
const
pin
)
{
if
(
pin
<
pb
_
0
)
{
if
(
pin
<
pb0
)
{
gpio_mode_setup
(
GPIOA
,
GPIO_MODE_OUTPUT
,
GPIO_PUPD_NONE
,
1
<<
pin
);
}
else
if
(
pin
<
pc
_
0
)
{
gpio_mode_setup
(
GPIOB
,
GPIO_MODE_OUTPUT
,
GPIO_PUPD_NONE
,
1
<<
(
pin
-
pb
_
0
));
}
else
if
(
pin
<
pc0
)
{
gpio_mode_setup
(
GPIOB
,
GPIO_MODE_OUTPUT
,
GPIO_PUPD_NONE
,
1
<<
(
pin
-
pb0
));
}
else
if
(
pin
<
PIN_INVALID
)
{
gpio_mode_setup
(
GPIOC
,
GPIO_MODE_OUTPUT
,
GPIO_PUPD_NONE
,
1
<<
(
pin
-
pc
_
0
));
gpio_mode_setup
(
GPIOC
,
GPIO_MODE_OUTPUT
,
GPIO_PUPD_NONE
,
1
<<
(
pin
-
pc0
));
}
}
/*
inline void output(unsigned char const pin, unsigned char const value) {
}*/
inline
unsigned
int
read
(
unsigned
char
const
pin
)
{
if
(
pin
<
pb
_
0
)
{
if
(
pin
<
pb0
)
{
return
gpio_get
(
GPIOA
,
1
<<
pin
);
}
else
if
(
pin
<
pc
_
0
)
{
return
gpio_get
(
GPIOB
,
1
<<
(
pin
-
pb
_
0
));
}
else
if
(
pin
<
pc0
)
{
return
gpio_get
(
GPIOB
,
1
<<
(
pin
-
pb0
));
}
else
if
(
pin
<
PIN_INVALID
)
{
return
gpio_get
(
GPIOC
,
1
<<
(
pin
-
pc
_
0
));
return
gpio_get
(
GPIOC
,
1
<<
(
pin
-
pc0
));
}
}
inline
void
write
(
unsigned
char
const
pin
,
unsigned
char
value
)
{
if
(
pin
<
pb
_
0
)
{
if
(
pin
<
pb0
)
{
if
(
value
)
{
gpio_port_write
(
GPIOA
,
gpio_port_read
(
GPIOA
)
|
(
1
<<
pin
));
}
else
{
gpio_port_write
(
GPIOA
,
gpio_port_read
(
GPIOA
)
&
~
(
1
<<
pin
));
}
}
else
if
(
pin
<
pc
_
0
)
{
}
else
if
(
pin
<
pc0
)
{
if
(
value
)
{
gpio_port_write
(
GPIOB
,
gpio_port_read
(
GPIOB
)
|
(
1
<<
(
pin
-
pb
_
0
)));
gpio_port_write
(
GPIOB
,
gpio_port_read
(
GPIOB
)
|
(
1
<<
(
pin
-
pb0
)));
}
else
{
gpio_port_write
(
GPIOB
,
gpio_port_read
(
GPIOB
)
&
~
(
1
<<
(
pin
-
pb
_
0
)));
gpio_port_write
(
GPIOB
,
gpio_port_read
(
GPIOB
)
&
~
(
1
<<
(
pin
-
pb0
)));
}
}
else
if
(
pin
<
PIN_INVALID
)
{
if
(
value
)
{
gpio_port_write
(
GPIOC
,
gpio_port_read
(
GPIOC
)
|
(
1
<<
(
pin
-
pc
_
0
)));
gpio_port_write
(
GPIOC
,
gpio_port_read
(
GPIOC
)
|
(
1
<<
(
pin
-
pc0
)));
}
else
{
gpio_port_write
(
GPIOC
,
gpio_port_read
(
GPIOC
)
&
~
(
1
<<
(
pin
-
pc
_
0
)));
gpio_port_write
(
GPIOC
,
gpio_port_read
(
GPIOC
)
&
~
(
1
<<
(
pin
-
pc0
)));
}
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment