Skip to content

Commit beaf0bd

Browse files
Cruz Monrreal IICruz Monrreal II
authored andcommitted
Merge branch 'TomoYamanaka-improve_spi_drv' into rollup2
2 parents 304059d + 7a61a17 commit beaf0bd

File tree

1 file changed

+5
-3
lines changed
  • targets/TARGET_RENESAS/TARGET_RZ_A1XX

1 file changed

+5
-3
lines changed

targets/TARGET_RENESAS/TARGET_RZ_A1XX/spi_api.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,9 +149,11 @@ void spi_frequency(spi_t *obj, int hz) {
149149

150150
hz_min = pclk_base / 2 / 256 / 8;
151151
hz_max = pclk_base / 2;
152-
if (((uint32_t)hz < hz_min) || ((uint32_t)hz > hz_max)) {
153-
error("Couldn't setup requested SPI frequency");
154-
return;
152+
if ((uint32_t)hz < hz_min) {
153+
hz = hz_min;
154+
}
155+
if ((uint32_t)hz > hz_max) {
156+
hz = hz_max;
155157
}
156158

157159
div = (pclk_base / hz / 2);

0 commit comments

Comments
 (0)