Revision e251c4e6
periphery-lld/periphAL.h | ||
---|---|---|
531 | 531 |
return APAL_STATUS_OK; |
532 | 532 |
} |
533 | 533 |
|
534 |
/** |
|
535 |
* @brief Transmit data to SPI and receive data afterwards without releasing the bus in between |
|
536 |
* |
|
537 |
* @param spid The SPI driver to use. |
|
538 |
* @param txData Transmit data buffer. |
|
539 |
* @param rxData Receive data buffer. |
|
540 |
* @param txLength Number of bytes to send. |
|
541 |
* @param rxLength Number of bytes to receive. |
|
542 |
* |
|
543 |
* @return The status indicates whether the function call was succesful. |
|
544 |
*/ |
|
545 |
static inline apalExitStatus_t apalSPITransmitAndReceive(apalSPIDriver_t* spid, const uint8_t* const txData , uint8_t* const rxData, const size_t txLength, const size_t rxLength) |
|
546 |
{ |
|
547 |
aosDbgCheck(spid != NULL); |
|
548 |
|
|
549 |
#if (SPI_USE_MUTUAL_EXCLUSION) |
|
550 |
spiAcquireBus(spid); |
|
551 |
#endif |
|
552 |
spiSelect(spid); |
|
553 |
spiSend(spid, txLength, txData); |
|
554 |
spiReceive(spid, rxLength, rxData); |
|
555 |
spiUnselect(spid); |
|
556 |
#if (SPI_USE_MUTUAL_EXCLUSION) |
|
557 |
spiReleaseBus(spid); |
|
558 |
#endif |
|
559 |
|
|
560 |
return APAL_STATUS_OK; |
|
561 |
} |
|
562 |
|
|
534 | 563 |
#endif |
535 | 564 |
|
536 | 565 |
/*============================================================================*/ |
Also available in: Unified diff