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
Nicolò Caruso
Skyward Boardcore
Commits
72020d60
Commit
72020d60
authored
2 years ago
by
Federico Lolli
Browse files
Options
Downloads
Patches
Plain Diff
[SPI] added some TRACEs
parent
5bb5da48
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/shared/drivers/spi/SPIBus.h
+3
-0
3 additions, 0 deletions
src/shared/drivers/spi/SPIBus.h
src/shared/drivers/spi/SPITransaction.cpp
+6
-1
6 additions, 1 deletion
src/shared/drivers/spi/SPITransaction.cpp
src/shared/sensors/LIS2MDL/LIS2MDL.cpp
+4
-1
4 additions, 1 deletion
src/shared/sensors/LIS2MDL/LIS2MDL.cpp
with
13 additions
and
2 deletions
src/shared/drivers/spi/SPIBus.h
+
3
−
0
View file @
72020d60
...
@@ -25,6 +25,7 @@
...
@@ -25,6 +25,7 @@
#include
<assert.h>
#include
<assert.h>
#include
<interfaces/delays.h>
#include
<interfaces/delays.h>
#include
<utils/ClockUtils.h>
#include
<utils/ClockUtils.h>
#include
<utils/Debug.h>
#include
"SPIBusInterface.h"
#include
"SPIBusInterface.h"
...
@@ -602,9 +603,11 @@ inline uint8_t SPIBus::transfer(uint8_t data)
...
@@ -602,9 +603,11 @@ inline uint8_t SPIBus::transfer(uint8_t data)
while
((
spi
->
SR
&
SPI_SR_BSY
)
>
0
)
while
((
spi
->
SR
&
SPI_SR_BSY
)
>
0
)
;
;
TRACE
(
"Waiting for RXNE
\n
"
);
// Wait until data is received
// Wait until data is received
while
((
spi
->
SR
&
SPI_SR_RXNE
)
==
0
)
while
((
spi
->
SR
&
SPI_SR_RXNE
)
==
0
)
;
;
TRACE
(
"RXNE
\n
"
);
// Read the received data item
// Read the received data item
return
static_cast
<
uint8_t
>
(
spi
->
DR
);
return
static_cast
<
uint8_t
>
(
spi
->
DR
);
...
...
This diff is collapsed.
Click to expand it.
src/shared/drivers/spi/SPITransaction.cpp
+
6
−
1
View file @
72020d60
...
@@ -21,7 +21,7 @@
...
@@ -21,7 +21,7 @@
*/
*/
#include
"SPITransaction.h"
#include
"SPITransaction.h"
#include
<utils/Debug.h>
#include
<interfaces/endianness.h>
#include
<interfaces/endianness.h>
namespace
Boardcore
namespace
Boardcore
...
@@ -255,9 +255,14 @@ void SPITransaction::writeRegister(uint8_t reg, uint8_t data)
...
@@ -255,9 +255,14 @@ void SPITransaction::writeRegister(uint8_t reg, uint8_t data)
if
(
slave
.
config
.
writeBit
==
SPI
::
WriteBit
::
INVERTED
)
if
(
slave
.
config
.
writeBit
==
SPI
::
WriteBit
::
INVERTED
)
reg
|=
0x80
;
reg
|=
0x80
;
TRACE
(
"SPI: writeRegister: reg=%02X, data=%02X
\n
"
,
reg
,
data
);
TRACE
(
"selecting slave %d
\n
"
,
slave
.
cs
);
slave
.
bus
.
select
(
slave
.
cs
);
slave
.
bus
.
select
(
slave
.
cs
);
TRACE
(
"writing reg
\n
"
);
slave
.
bus
.
write
(
reg
);
slave
.
bus
.
write
(
reg
);
TRACE
(
"writing data
\n
"
);
slave
.
bus
.
write
(
data
);
slave
.
bus
.
write
(
data
);
TRACE
(
"deselecting slave %d
\n
"
,
slave
.
cs
);
slave
.
bus
.
deselect
(
slave
.
cs
);
slave
.
bus
.
deselect
(
slave
.
cs
);
}
}
...
...
This diff is collapsed.
Click to expand it.
src/shared/sensors/LIS2MDL/LIS2MDL.cpp
+
4
−
1
View file @
72020d60
...
@@ -59,8 +59,11 @@ bool LIS2MDL::init()
...
@@ -59,8 +59,11 @@ bool LIS2MDL::init()
}
}
{
{
TRACE
(
"Starting SPI transaction
\n
"
);
SPITransaction
spi
(
slave
);
SPITransaction
spi
(
slave
);
TRACE
(
"writing to CFG_REG_A
\n
"
);
spi
.
writeRegister
(
CFG_REG_C
,
ENABLE_4WSPI
|
I2C_DISABLE
);
spi
.
writeRegister
(
CFG_REG_C
,
ENABLE_4WSPI
|
I2C_DISABLE
);
TRACE
(
"SPI transaction ended
\n
"
);
}
}
{
{
...
...
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