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
Package registry
Container 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
Emilio Corigliano
Skyward Boardcore
Commits
ae510fee
Commit
ae510fee
authored
2 years ago
by
Alberto Nidasio
Browse files
Options
Downloads
Patches
Plain Diff
[SPI] Added asserts on RX FIFO
parent
f19a5fe1
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
src/shared/drivers/spi/SPIBus.h
+16
-0
16 additions, 0 deletions
src/shared/drivers/spi/SPIBus.h
with
16 additions
and
0 deletions
src/shared/drivers/spi/SPIBus.h
+
16
−
0
View file @
ae510fee
...
@@ -22,6 +22,7 @@
...
@@ -22,6 +22,7 @@
#pragma once
#pragma once
#include
<assert.h>
#include
<interfaces/delays.h>
#include
<interfaces/delays.h>
#include
<utils/ClockUtils.h>
#include
<utils/ClockUtils.h>
...
@@ -489,6 +490,9 @@ inline void SPIBus::read(uint8_t* data, size_t nBytes)
...
@@ -489,6 +490,9 @@ inline void SPIBus::read(uint8_t* data, size_t nBytes)
inline
void
SPIBus
::
read16
(
uint16_t
*
data
,
size_t
nBytes
)
inline
void
SPIBus
::
read16
(
uint16_t
*
data
,
size_t
nBytes
)
{
{
// At the start of the transfer we assume that the RX FIFO is empty
assert
((
spi
->
SR
&
SPI_SR_RXNE
)
==
0
);
// Set 16 bit frame format
// Set 16 bit frame format
set16BitFrameFormat
();
set16BitFrameFormat
();
...
@@ -529,6 +533,9 @@ inline void SPIBus::write(const uint8_t* data, size_t nBytes)
...
@@ -529,6 +533,9 @@ inline void SPIBus::write(const uint8_t* data, size_t nBytes)
inline
void
SPIBus
::
write16
(
const
uint16_t
*
data
,
size_t
nBytes
)
inline
void
SPIBus
::
write16
(
const
uint16_t
*
data
,
size_t
nBytes
)
{
{
// At the start of the transfer we assume that the RX FIFO is empty
assert
((
spi
->
SR
&
SPI_SR_RXNE
)
==
0
);
// Set 16 bit frame format
// Set 16 bit frame format
set16BitFrameFormat
();
set16BitFrameFormat
();
...
@@ -555,6 +562,9 @@ inline void SPIBus::write16(const uint16_t* data, size_t nBytes)
...
@@ -555,6 +562,9 @@ inline void SPIBus::write16(const uint16_t* data, size_t nBytes)
inline
uint8_t
SPIBus
::
transfer
(
uint8_t
data
)
inline
uint8_t
SPIBus
::
transfer
(
uint8_t
data
)
{
{
// At the start of the transfer we assume that the RX FIFO is empty
assert
((
spi
->
SR
&
SPI_SR_RXNE
)
==
0
);
// Wait until the peripheral is ready to transmit
// Wait until the peripheral is ready to transmit
while
((
spi
->
SR
&
SPI_SR_TXE
)
==
0
)
while
((
spi
->
SR
&
SPI_SR_TXE
)
==
0
)
;
;
...
@@ -572,6 +582,9 @@ inline uint8_t SPIBus::transfer(uint8_t data)
...
@@ -572,6 +582,9 @@ inline uint8_t SPIBus::transfer(uint8_t data)
inline
uint16_t
SPIBus
::
transfer16
(
uint16_t
data
)
inline
uint16_t
SPIBus
::
transfer16
(
uint16_t
data
)
{
{
// At the start of the transfer we assume that the RX FIFO is empty
assert
((
spi
->
SR
&
SPI_SR_RXNE
)
==
0
);
// Set 16 bit frame format
// Set 16 bit frame format
set16BitFrameFormat
();
set16BitFrameFormat
();
...
@@ -619,6 +632,9 @@ inline void SPIBus::transfer(uint8_t* data, size_t nBytes)
...
@@ -619,6 +632,9 @@ inline void SPIBus::transfer(uint8_t* data, size_t nBytes)
inline
void
SPIBus
::
transfer16
(
uint16_t
*
data
,
size_t
nBytes
)
inline
void
SPIBus
::
transfer16
(
uint16_t
*
data
,
size_t
nBytes
)
{
{
// At the start of the transfer we assume that the RX FIFO is empty
assert
((
spi
->
SR
&
SPI_SR_RXNE
)
==
0
);
// Set 16 bit frame format
// Set 16 bit frame format
set16BitFrameFormat
();
set16BitFrameFormat
();
...
...
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