Skip to content

Commit 6b838d7

Browse files
jeremybrodt0xc0170
authored andcommitted
Removed constant structure element.
1 parent aaa0811 commit 6b838d7

File tree

2 files changed

+16
-19
lines changed

2 files changed

+16
-19
lines changed

hal/targets/hal/TARGET_Maxim/TARGET_MAX32620/objects.h

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -88,16 +88,15 @@ struct spi_s {
8888
uint32_t width; // SPI data width (number of data lines to use)
8989
PinName sclk; // PinName saved to use in Quad SPI pin mapping table
9090
#if DEVICE_SPI_ASYNCH
91-
// Async transaction state
92-
uint8_t deass; // De-assert slave select at the end of the transaction
93-
const uint8_t *tx_data; // TX buffer
94-
uint8_t *rx_data; // RX buffer
95-
unsigned len; // Number of bytes to send
96-
unsigned read_num; // Number of bytes read
97-
unsigned write_num; // Number of bytes written
98-
void (*callback)(); // Callback for asynchronous request
99-
unsigned head_rem; // Remaining count for current header
100-
uint32_t event; // Callback response events
91+
// Async transaction state
92+
const uint8_t *tx_data; // TX buffer
93+
uint8_t *rx_data; // RX buffer
94+
unsigned len; // Number of bytes to send
95+
unsigned read_num; // Number of bytes read
96+
unsigned write_num; // Number of bytes written
97+
void (*callback)(); // Callback for asynchronous request
98+
unsigned head_rem; // Remaining count for current header
99+
uint32_t event; // Callback response events
101100
#endif
102101
};
103102

hal/targets/hal/TARGET_Maxim/TARGET_MAX32620/spi_api.c

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ static uint32_t spi_master_transfer_handler(spi_t *obj)
318318
req->head_rem -= bytes_read;
319319
}
320320

321-
// Figure out how many byte we have left to read
321+
// Figure out how many bytes we have left to read
322322
if (req->head_rem > 0) {
323323
remain = req->head_rem;
324324
} else {
@@ -358,7 +358,7 @@ static uint32_t spi_master_transfer_handler(spi_t *obj)
358358
// Send a 32 byte header
359359
if (remain == SPI_MAX_BYTE_LEN) {
360360

361-
header |= (MXC_S_SPI_FIFO_UNIT_BYTES | (req->deass << MXC_F_SPI_FIFO_DASS_POS));
361+
header |= (MXC_S_SPI_FIFO_UNIT_BYTES | MXC_F_SPI_FIFO_DASS);
362362

363363
// Save the number of bytes we need to write to the FIFO
364364
bytes = SPI_MAX_BYTE_LEN;
@@ -377,8 +377,8 @@ static uint32_t spi_master_transfer_handler(spi_t *obj)
377377
}
378378

379379
// Check if this is the last header we will send
380-
if((remain - bytes) == 0) {
381-
header |= (req->deass << MXC_F_SPI_FIFO_DASS_POS);
380+
if ((remain - bytes) == 0) {
381+
header |= MXC_F_SPI_FIFO_DASS;
382382
}
383383
}
384384

@@ -388,9 +388,8 @@ static uint32_t spi_master_transfer_handler(spi_t *obj)
388388
req->head_rem = bytes;
389389

390390
} else {
391-
// Send final header with the number of bytes remaining and if
392-
// we want to de-assert the SS at the end of the transaction
393-
header |= (MXC_S_SPI_FIFO_UNIT_BYTES | (remain << MXC_F_SPI_FIFO_SIZE_POS) | (req->deass << MXC_F_SPI_FIFO_DASS_POS));
391+
// Send final header with the number of bytes remaining and de-assert the SS at the end of the transaction
392+
header |= (MXC_S_SPI_FIFO_UNIT_BYTES | (remain << MXC_F_SPI_FIFO_SIZE_POS) | MXC_F_SPI_FIFO_DASS);
394393
fifo->trans_16[0] = header;
395394
req->head_rem = remain;
396395
}
@@ -472,7 +471,6 @@ void spi_master_transfer(spi_t *obj, const void *tx, size_t tx_length, void *rx,
472471
state[obj->spi.index] = &obj->spi;
473472

474473
// Initialize request info
475-
obj->spi.deass = 1;
476474
obj->spi.tx_data = tx;
477475
obj->spi.rx_data = rx;
478476
obj->spi.len = tx_length;
@@ -517,7 +515,7 @@ uint8_t spi_active(spi_t *obj)
517515
mxc_spi_regs_t *spim = obj->spi.spi;
518516

519517
// Check to see if there are any ongoing transactions
520-
if((state[obj->spi.index] == NULL) &&
518+
if ((state[obj->spi.index] == NULL) &&
521519
!(spim->fifo_ctrl & MXC_F_SPI_FIFO_CTRL_TX_FIFO_USED)) {
522520
return 0;
523521
}

0 commit comments

Comments
 (0)