Skip to content

Commit cd811f1

Browse files
committed
update SPI to use max freq when asked for higher than max
1 parent cc760b7 commit cd811f1

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

libraries/SPI/src/SPI.cpp

+6
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,12 @@ void arduino::MbedSPI::beginTransaction(SPISettings settings) {
5353
begin();
5454
}
5555
if (settings != this->settings) {
56+
//If requested to set frequency above max, just set to max.
57+
if(settings.getClockFreq() > AM_HAL_IOM_MAX_FREQ)
58+
{
59+
settings = SPISettings(AM_HAL_IOM_MAX_FREQ, settings.getBitOrder(), settings.getDataMode());
60+
}
61+
5662
dev->format(8, settings.getDataMode());
5763
dev->frequency(settings.getClockFreq());
5864
this->settings = settings;

0 commit comments

Comments
 (0)