mbed library sources. Supersedes mbed-src. Fixed broken STM32F1xx RTC on rtc_api.c
Dependents: Nucleo_F103RB_RTC_battery_bkup_pwr_off_okay
Fork of mbed-dev by
Diff: targets/TARGET_Maxim/TARGET_MAX32625/spi_api.c
- Revision:
- 167:e84263d55307
- Parent:
- 150:02e0a0aed4ec
- Child:
- 170:19eb464bc2be
diff -r c97ed07ec1a8 -r e84263d55307 targets/TARGET_Maxim/TARGET_MAX32625/spi_api.c --- a/targets/TARGET_Maxim/TARGET_MAX32625/spi_api.c Thu Jun 08 15:02:37 2017 +0100 +++ b/targets/TARGET_Maxim/TARGET_MAX32625/spi_api.c Wed Jun 21 17:46:44 2017 +0100 @@ -167,6 +167,20 @@ return *req.rx_data; } +int spi_master_block_write(spi_t *obj, const char *tx_buffer, int tx_length, char *rx_buffer, int rx_length) { + int total = (tx_length > rx_length) ? tx_length : rx_length; + + for (int i = 0; i < total; i++) { + char out = (i < tx_length) ? tx_buffer[i] : 0xff; + char in = spi_master_write(obj, out); + if (i < rx_length) { + rx_buffer[i] = in; + } + } + + return total; +} + //****************************************************************************** int spi_busy(spi_t *obj) {