bug fix: SS was not declared in the spi_write_and_read(.. function
Diff: platform_drivers.cpp
- Revision:
- 6:38fa8ac6e43b
- Parent:
- 5:52f39fdbcd67
- Child:
- 7:efb143ea4191
--- a/platform_drivers.cpp Tue Aug 27 09:38:19 2019 +0000 +++ b/platform_drivers.cpp Fri Aug 30 15:47:06 2019 +0000 @@ -47,13 +47,14 @@ /** Provide implementations for the following extern functions. For Example - in main.cpp - DigitalOut SS(SPI_CS); + PinName slave_selects[8] = { SPI_CS, SPI_CSE }; mbed::SPI spi(SPI_MOSI, SPI_MISO, SPI_SCK); mbed::I2C i2c(I2C_SDA, I2C_SCL); **/ -extern DigitalOut SS; + extern SPI spi; extern I2C i2c; +extern PinName slave_selects[MAX_SLAVE_SELECTS]; /******************************************************************************/ /************************ Functions Definitions *******************************/ /******************************************************************************/ @@ -163,7 +164,8 @@ new_desc->mode = param->mode; new_desc->max_speed_hz = param->max_speed_hz; *desc = new_desc; - + //Create the DigitalOut object, based on user-defined chip-select + DigitalOut SS(slave_selects[new_desc->chip_select]); spi.format(SEND_BYTE, param->mode); //Stick to byte-multiples /** NOTE: Actual frequency of SPI clk will be somewhat device