prepare for esp32
This commit is contained in:
@@ -37,6 +37,7 @@
|
||||
#include "stdbool.h"
|
||||
#include "drv_95HF.h"
|
||||
#include "lib_pcd.h"
|
||||
#include "Arduino.h"
|
||||
|
||||
/** @addtogroup BSP
|
||||
* @{
|
||||
@@ -67,7 +68,7 @@ static int8_t drv95HF_SPIPollingCommand(void);
|
||||
* @brief buffer to exchange data with the RF tranceiver.
|
||||
*/
|
||||
uint8_t u95HFBuffer [RFTRANS_95HF_MAX_BUFFER_SIZE+3];
|
||||
|
||||
uint8_t sspin=0;
|
||||
/**
|
||||
* @brief This uTimeOut variable is used as a timeout duting the communication with the RF tranceiver
|
||||
*/
|
||||
@@ -91,9 +92,10 @@ drv95HF_ConfigStruct drv95HFConfig;
|
||||
* @param None
|
||||
* @retval void
|
||||
*/
|
||||
static void drv95HF_InitializeSPI(void)
|
||||
static void drv95HF_InitializeSPI(int8_t sck, int8_t miso, int8_t mosi, int8_t ss)
|
||||
{
|
||||
RFTRANS_SPI_Init();
|
||||
sspin = ss;
|
||||
RFTRANS_SPI_Init(sck, miso, mosi, ss);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -131,7 +133,7 @@ static int8_t drv95HF_SPIPollingCommand( void )
|
||||
do
|
||||
{
|
||||
/* Low level on NSS */
|
||||
RFTRANS_95HF_NSS_LOW();
|
||||
RFTRANS_95HF_NSS_LOW(sspin);
|
||||
delay(2);
|
||||
|
||||
/* poll the 95HF transceiver until he's ready ! */
|
||||
@@ -150,7 +152,7 @@ static int8_t drv95HF_SPIPollingCommand( void )
|
||||
while( Polling_Status != RFTRANS_95HF_FLAG_DATA_READY && uTimeOut != true );
|
||||
|
||||
/* High level on NSS */
|
||||
RFTRANS_95HF_NSS_HIGH();
|
||||
RFTRANS_95HF_NSS_HIGH(sspin);
|
||||
|
||||
DEV_SPI.endTransaction();
|
||||
|
||||
@@ -193,16 +195,16 @@ void drv95HF_InitConfigStructure (void)
|
||||
void drv95HF_ResetSPI(void)
|
||||
{
|
||||
/* Deselect Rftransceiver over SPI */
|
||||
RFTRANS_95HF_NSS_HIGH();
|
||||
RFTRANS_95HF_NSS_HIGH(sspin);
|
||||
delay(1);
|
||||
|
||||
DEV_SPI.beginTransaction(SPISettings(1500000, MSBFIRST, SPI_MODE3));
|
||||
/* Select 95HF device over SPI */
|
||||
RFTRANS_95HF_NSS_LOW();
|
||||
RFTRANS_95HF_NSS_LOW(sspin);
|
||||
/* Send reset control byte */
|
||||
drv95HF_SendSPIResetByte();
|
||||
/* Deselect 95HF device over SPI */
|
||||
RFTRANS_95HF_NSS_HIGH();
|
||||
RFTRANS_95HF_NSS_HIGH(sspin);
|
||||
|
||||
DEV_SPI.endTransaction();
|
||||
|
||||
@@ -250,7 +252,7 @@ void drv95HF_ResetSPI(void)
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
void drv95HF_InitilizeSerialInterface(void)
|
||||
void drv95HF_InitilizeSerialInterface(int8_t sck, int8_t miso, int8_t mosi, int8_t ss)
|
||||
{
|
||||
/* -- Get interface pin state to select UART or SPI mode -- */
|
||||
//if (drv95HF_GetInterfacePinState() != RFTRANS_95HF_INTERFACE_UART)
|
||||
@@ -286,7 +288,7 @@ void drv95HF_SendSPICommand(const uint8_t *pData)
|
||||
DEV_SPI.beginTransaction(SPISettings(1500000, MSBFIRST, SPI_MODE3));
|
||||
|
||||
/* Select xx95HF over SPI */
|
||||
RFTRANS_95HF_NSS_LOW();
|
||||
RFTRANS_95HF_NSS_LOW(sspin);
|
||||
|
||||
/* Send a sending request to xx95HF */
|
||||
SPI_SendReceiveByte(RFTRANS_95HF_COMMAND_SEND);
|
||||
@@ -303,7 +305,7 @@ void drv95HF_SendSPICommand(const uint8_t *pData)
|
||||
}
|
||||
|
||||
/* Deselect xx95HF over SPI */
|
||||
RFTRANS_95HF_NSS_HIGH();
|
||||
RFTRANS_95HF_NSS_HIGH(sspin);
|
||||
|
||||
DEV_SPI.endTransaction();
|
||||
}
|
||||
@@ -322,7 +324,7 @@ void drv95HF_ReceiveSPIResponse(uint8_t *pData)
|
||||
DEV_SPI.beginTransaction(SPISettings(1500000, MSBFIRST, SPI_MODE3));
|
||||
|
||||
/* Select 95HF transceiver over SPI */
|
||||
RFTRANS_95HF_NSS_LOW();
|
||||
RFTRANS_95HF_NSS_LOW(sspin);
|
||||
|
||||
/* Request a response from 95HF transceiver */
|
||||
SPI_SendReceiveByte(RFTRANS_95HF_COMMAND_RECEIVE);
|
||||
@@ -353,7 +355,7 @@ void drv95HF_ReceiveSPIResponse(uint8_t *pData)
|
||||
}
|
||||
|
||||
/* Deselect xx95HF over SPI */
|
||||
RFTRANS_95HF_NSS_HIGH();
|
||||
RFTRANS_95HF_NSS_HIGH(sspin);
|
||||
|
||||
DEV_SPI.endTransaction();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user