We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 77d6454 + 6126cb7 commit 7234182Copy full SHA for 7234182
libraries/mbed/targets/hal/TARGET_RENESAS/TARGET_RZ_A1H/spi_api.c
@@ -169,6 +169,8 @@ void spi_frequency(spi_t *obj, int hz) {
169
uint32_t pclk_base;
170
uint32_t div;
171
uint32_t brdv = 0;
172
+ uint32_t hz_max;
173
+ uint32_t hz_min;
174
uint16_t mask = 0x000c;
175
176
/* set PCLK */
@@ -178,7 +180,9 @@ void spi_frequency(spi_t *obj, int hz) {
178
180
pclk_base = CM0_RENESAS_RZ_A1_P1_CLK;
179
181
}
182
- if ((hz < (pclk_base / 2 / 256 / 8)) || (hz > (pclk_base / 2))) {
183
+ hz_min = pclk_base / 2 / 256 / 8;
184
+ hz_max = pclk_base / 2;
185
+ if ((hz < hz_min) || (hz > hz_max)) {
186
error("Couldn't setup requested SPI frequency");
187
return;
188
0 commit comments