Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
arduino-pico
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
arduino-pico
Commits
02c272b0
Unverified
Commit
02c272b0
authored
Jan 28, 2024
by
Nerradia
Committed by
GitHub
Jan 28, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Skip SPI re-init if clock frequency doesn't change (#1934)
parent
2a74250a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
7 deletions
+10
-7
libraries/SPI/src/SPI.cpp
libraries/SPI/src/SPI.cpp
+10
-7
No files found.
libraries/SPI/src/SPI.cpp
View file @
02c272b0
...
...
@@ -184,15 +184,18 @@ void SPIClassRP2040::beginTransaction(SPISettings settings) {
if
(
_initted
&&
settings
==
_spis
)
{
DEBUGSPI
(
"SPI: Reusing existing initted SPI
\n
"
);
}
else
{
_spis
=
settings
;
if
(
_initted
)
{
DEBUGSPI
(
"SPI: deinitting currently active SPI
\n
"
);
spi_deinit
(
_spi
);
/* Only de-init if the clock changes frequency */
if
(
settings
.
getClockFreq
()
!=
_spis
.
getClockFreq
())
{
if
(
_initted
)
{
DEBUGSPI
(
"SPI: deinitting currently active SPI
\n
"
);
spi_deinit
(
_spi
);
}
DEBUGSPI
(
"SPI: initting SPI
\n
"
);
spi_init
(
_spi
,
settings
.
getClockFreq
());
DEBUGSPI
(
"SPI: actual baudrate=%u
\n
"
,
spi_get_baudrate
(
_spi
));
}
DEBUGSPI
(
"SPI: initting SPI
\n
"
);
spi_init
(
_spi
,
_spis
.
getClockFreq
());
_spis
=
settings
;
spi_set_format
(
_spi
,
8
,
cpol
(),
cpha
(),
SPI_MSB_FIRST
);
DEBUGSPI
(
"SPI: actual baudrate=%u
\n
"
,
spi_get_baudrate
(
_spi
));
_initted
=
true
;
}
// Disable any IRQs that are being used for SPI
...
...
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