mirror of https://github.com/ARMmbed/mbed-os.git
[LPC824] Add correct SPI delay value
- Move SPI delay setting from set_frequency() to spi_init() - Set correct value for PRE_DELAY field - Tested with mbed Application Shieldpull/557/head
parent
07722e70ce
commit
0c3d6305af
|
@ -110,6 +110,7 @@ void spi_init(spi_t *obj, PinName mosi, PinName miso, PinName sclk, PinName ssel
|
|||
spi_format(obj, 8, 0, 1); // 8 bits, mode 0, slave
|
||||
}
|
||||
spi_frequency(obj, 1000000);
|
||||
obj->spi->DLY = 2; // 2 SPI clock times pre-delay
|
||||
|
||||
// enable the ssp channel
|
||||
ssp_enable(obj);
|
||||
|
@ -139,7 +140,6 @@ void spi_frequency(spi_t *obj, int hz)
|
|||
|
||||
// rise DIV value if it cannot be divided
|
||||
obj->spi->DIV = (SystemCoreClock + (hz - 1))/hz - 1;
|
||||
obj->spi->DLY = 0;
|
||||
|
||||
ssp_enable(obj);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue