Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Skyward Boardcore
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
Model registry
Analyze
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
Avionics
Software Development
Skyward Boardcore
Wiki
GPIO Usage & Used Pins
Changes
Page history
New page
Templates
Clone repository
solved typos and fixed style
authored
4 years ago
by
Luca Conterio
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
GPIO-Usage-&-Used-Pins.md
+4
-4
4 additions, 4 deletions
GPIO-Usage-&-Used-Pins.md
with
4 additions
and
4 deletions
GPIO-Usage-&-Used-Pins.md
View page @
937d8f4f
...
...
@@ -4,7 +4,7 @@ GPIOs are grouped in ports and so each GPIO has an identifier.
The identifiers have the following format:
`PXY`
, where
`X`
is the GPIO port name and
`Y`
is the pin number.
## Introduction
GPIO ports registers are mapped to well defined memory addresses. This means that by accessing those addresses, we can access the GPIO registers.
GPIO ports
'
registers are mapped to well defined memory addresses. This means that by accessing those addresses, we can access the GPIO registers.
Then, we can define a structure that represents the memory layout of the GPIO registers:
```
cpp
typedef
struct
...
...
@@ -23,14 +23,14 @@ typedef struct
```
Remmeber that strcut member's are allocated to consecutive addresses in memory.
In order to access a specific register (address) we need a pointer to
the GPIO port
.
In order to access a specific register (address) we need a pointer to
a
`GPIO_TypeDef`
structure
.
Assuming we want to control the
`GPIOA`
port and that it can be found at
`0x48000000`
:
```
cpp
#define GPIOA ((GPIO_TypeDef *) 0x48000000)
```
By simply changing the pointer address we can access different GPIO ports.
By simply changing the pointer address we can access
to
different GPIO ports.
Via
*bitwise operations*
we can
access
the GPIO registers:
Via
*bitwise operations*
we can
modify single bits of
the GPIO registers:
```
cpp
// set 5th bit of ODR to 1
GPIOA
->
ODR
|=
(
1
<<
4
);
...
...
This diff is collapsed.
Click to expand it.