opt: add SPI_TxRxBytes() to exchange multiple bytes
This commit is contained in:
parent
76f4fc2426
commit
ddbaea3157
@ -92,5 +92,6 @@ typedef enum
|
||||
#define SPI_SetPort(__ALTER_PORT__) (P_SW1 = P_SW1 & ~(0x03 << 2) | ((__ALTER_PORT__) << 2))
|
||||
|
||||
uint8_t SPI_TxRx(uint8_t dat);
|
||||
void SPI_TxRxBytes(uint8_t *pBuf, uint8_t len);
|
||||
|
||||
#endif
|
||||
|
@ -24,3 +24,11 @@ uint8_t SPI_TxRx(uint8_t dat)
|
||||
SPI_ClearInterrupts();
|
||||
return SPDAT;
|
||||
}
|
||||
|
||||
void SPI_TxRxBytes(uint8_t *pBuf, uint8_t len)
|
||||
{
|
||||
while(len--)
|
||||
{
|
||||
*pBuf++ = SPI_TxRx(*pBuf);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user