platform.c 641 B

1234567891011121314151617181920212223242526272829
  1. #include "platform.h"
  2. #include <assert.h>
  3. HAL_StatusTypeDef platformSpiTxRx(const uint8_t *txBuf, uint8_t *rxBuf, uint16_t len) {
  4. HAL_StatusTypeDef ret;
  5. if (txBuf && rxBuf) {
  6. ret = HAL_SPI_TransmitReceive(&hspi3, (uint8_t*)txBuf, rxBuf, len, HAL_MAX_DELAY);
  7. } else if (txBuf) {
  8. ret = HAL_SPI_Transmit(&hspi3, (uint8_t*)txBuf, len, HAL_MAX_DELAY);
  9. } else if (rxBuf) {
  10. ret = HAL_SPI_Receive(&hspi3, (uint8_t*)rxBuf, len, HAL_MAX_DELAY);
  11. }
  12. if(ret != HAL_OK) {
  13. exit(250);
  14. }
  15. return ret;
  16. }
  17. void platformProtectST25RComm()
  18. {
  19. }
  20. void platformUnprotectST25RComm()
  21. {
  22. }