Skip to content

Commit 9207365

Browse files
authored
Merge pull request #4807 from 0xc0170/fix_lpc_write_fill
LPC MCUXpresso: fix write_fill argument for block write function
2 parents 1f94ede + c8d43ae commit 9207365

File tree

1 file changed

+3
-2
lines changed
  • targets/TARGET_NXP/TARGET_MCUXpresso_MCUS/api

1 file changed

+3
-2
lines changed

targets/TARGET_NXP/TARGET_MCUXpresso_MCUS/api/spi_api.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,11 +154,12 @@ int spi_master_write(spi_t *obj, int value)
154154
return rx_data & 0xffff;
155155
}
156156

157-
int spi_master_block_write(spi_t *obj, const char *tx_buffer, int tx_length, char *rx_buffer, int rx_length) {
157+
int spi_master_block_write(spi_t *obj, const char *tx_buffer, int tx_length,
158+
char *rx_buffer, int rx_length, char write_fill) {
158159
int total = (tx_length > rx_length) ? tx_length : rx_length;
159160

160161
for (int i = 0; i < total; i++) {
161-
char out = (i < tx_length) ? tx_buffer[i] : 0xff;
162+
char out = (i < tx_length) ? tx_buffer[i] : write_fill;
162163
char in = spi_master_write(obj, out);
163164
if (i < rx_length) {
164165
rx_buffer[i] = in;

0 commit comments

Comments
 (0)