2020-10-18 22:09:48 +00:00
|
|
|
#include "platform.h"
|
|
|
|
#include <assert.h>
|
2020-11-06 08:31:59 +00:00
|
|
|
#include <main.h>
|
|
|
|
#include <spi.h>
|
2020-10-18 22:09:48 +00:00
|
|
|
|
|
|
|
HAL_StatusTypeDef platformSpiTxRx(const uint8_t *txBuf, uint8_t *rxBuf, uint16_t len) {
|
|
|
|
HAL_StatusTypeDef ret;
|
|
|
|
if (txBuf && rxBuf) {
|
2020-11-06 08:31:59 +00:00
|
|
|
ret = HAL_SPI_TransmitReceive(&SPI_R, (uint8_t*)txBuf, rxBuf, len, HAL_MAX_DELAY);
|
2020-10-18 22:09:48 +00:00
|
|
|
} else if (txBuf) {
|
2020-11-06 08:31:59 +00:00
|
|
|
ret = HAL_SPI_Transmit(&SPI_R, (uint8_t*)txBuf, len, HAL_MAX_DELAY);
|
2020-10-18 22:09:48 +00:00
|
|
|
} else if (rxBuf) {
|
2020-11-06 08:31:59 +00:00
|
|
|
ret = HAL_SPI_Receive(&SPI_R, (uint8_t*)rxBuf, len, HAL_MAX_DELAY);
|
2020-10-18 22:09:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if(ret != HAL_OK) {
|
|
|
|
exit(250);
|
|
|
|
}
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void platformProtectST25RComm()
|
|
|
|
{
|
2020-11-06 08:31:59 +00:00
|
|
|
NFC_SPI_Reconfigure();
|
2020-10-18 22:09:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void platformUnprotectST25RComm()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|