mirror of https://github.com/ARMmbed/mbed-os.git
Modify frequency setting processing of SPI
In case of off-line compiler, there is no problem about the frequency setting processing. But in case of online compiler, the frequency setting processing will be error. So, modify frequency setting processing of SPI to pass in online compiler.pull/817/head
parent
2f63fa7d78
commit
6126cb7b41
|
|
@ -169,6 +169,8 @@ void spi_frequency(spi_t *obj, int hz) {
|
|||
uint32_t pclk_base;
|
||||
uint32_t div;
|
||||
uint32_t brdv = 0;
|
||||
uint32_t hz_max;
|
||||
uint32_t hz_min;
|
||||
uint16_t mask = 0x000c;
|
||||
|
||||
/* set PCLK */
|
||||
|
|
@ -178,7 +180,9 @@ void spi_frequency(spi_t *obj, int hz) {
|
|||
pclk_base = CM0_RENESAS_RZ_A1_P1_CLK;
|
||||
}
|
||||
|
||||
if ((hz < (pclk_base / 2 / 256 / 8)) || (hz > (pclk_base / 2))) {
|
||||
hz_min = pclk_base / 2 / 256 / 8;
|
||||
hz_max = pclk_base / 2;
|
||||
if ((hz < hz_min) || (hz > hz_max)) {
|
||||
error("Couldn't setup requested SPI frequency");
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue