[NANO130] Change dummy to spi_fill in spi_api.c

pull/4631/head
MS30 CCChang12 2017-07-25 16:17:40 +08:00
parent 5f58104640
commit c7cd9b607c
1 changed files with 3 additions and 2 deletions

View File

@ -284,12 +284,13 @@ int spi_master_write(spi_t *obj, int value)
return value2;
}
int spi_master_block_write(spi_t *obj, const char *tx_buffer, int tx_length, char *rx_buffer, int rx_length)
int spi_master_block_write(spi_t *obj, const char *tx_buffer, int tx_length,
char *rx_buffer, int rx_length, char write_fill)
{
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 out = (i < tx_length) ? tx_buffer[i] : write_fill;
char in = spi_master_write(obj, out);
if (i < rx_length) {
rx_buffer[i] = in;