mirror of https://github.com/ARMmbed/mbed-os.git
Improve frequency setting proc of Renesas SPI driver
If the specified frequency exceeds the upper limit and lower limit at SPI driver, an error is output, but this does not match policy with other renesas drivers. Thus I revises the processing as follows. - If "hz" is maximum over, it is rounded by the maximum value. - If "hz" is minimum under, it is rounded by the minimum value.pull/8379/head
parent
c43a3f4dfb
commit
470f9bc375
|
@ -149,9 +149,11 @@ void spi_frequency(spi_t *obj, int hz) {
|
|||
|
||||
hz_min = pclk_base / 2 / 256 / 8;
|
||||
hz_max = pclk_base / 2;
|
||||
if (((uint32_t)hz < hz_min) || ((uint32_t)hz > hz_max)) {
|
||||
error("Couldn't setup requested SPI frequency");
|
||||
return;
|
||||
if ((uint32_t)hz < hz_min) {
|
||||
hz = hz_min;
|
||||
}
|
||||
if ((uint32_t)hz > hz_max) {
|
||||
hz = hz_max;
|
||||
}
|
||||
|
||||
div = (pclk_base / hz / 2);
|
||||
|
|
Loading…
Reference in New Issue