update lib
This commit is contained in:
@@ -213,7 +213,7 @@ void drv95HF_ResetSPI(void);
|
|||||||
uint8_t drv95HF_GetSerialInterface(void);
|
uint8_t drv95HF_GetSerialInterface(void);
|
||||||
//int8_t drv95HF_GetIRQOutState(void);
|
//int8_t drv95HF_GetIRQOutState(void);
|
||||||
void drv95HF_InitConfigStructure(void);
|
void drv95HF_InitConfigStructure(void);
|
||||||
void drv95HF_InitilizeSerialInterface(int8_t sck, int8_t miso, int8_t mosi, int8_t ss);
|
void drv95HF_InitilizeSerialInterface(int8_t sck, int8_t miso, int8_t mosi, int8_t ss, int8_t irq);
|
||||||
void drv95HF_ReceiveSPIResponse(uint8_t *pData);
|
void drv95HF_ReceiveSPIResponse(uint8_t *pData);
|
||||||
void drv95HF_SendSPICommand(const uint8_t *pData );
|
void drv95HF_SendSPICommand(const uint8_t *pData );
|
||||||
int8_t drv95HF_SendReceive(const uint8_t *pCommand, uint8_t *pResponse);
|
int8_t drv95HF_SendReceive(const uint8_t *pCommand, uint8_t *pResponse);
|
||||||
|
|||||||
@@ -57,7 +57,7 @@
|
|||||||
/* Private defines -----------------------------------------------------------*/
|
/* Private defines -----------------------------------------------------------*/
|
||||||
/* Private macros ------------------------------------------------------------*/
|
/* Private macros ------------------------------------------------------------*/
|
||||||
/* Private function prototypes -----------------------------------------------*/
|
/* Private function prototypes -----------------------------------------------*/
|
||||||
static void drv95HF_InitializeSPI(void);
|
static void drv95HF_InitializeSPI(int8_t sck, int8_t miso, int8_t mosi, int8_t ss, int8_t irq);
|
||||||
static void drv95HF_SendSPIResetByte(void);
|
static void drv95HF_SendSPIResetByte(void);
|
||||||
static int8_t drv95HF_SPIPollingCommand(void);
|
static int8_t drv95HF_SPIPollingCommand(void);
|
||||||
/* Global variables ---------------------------------------------------------*/
|
/* Global variables ---------------------------------------------------------*/
|
||||||
@@ -69,6 +69,7 @@ static int8_t drv95HF_SPIPollingCommand(void);
|
|||||||
*/
|
*/
|
||||||
uint8_t u95HFBuffer [RFTRANS_95HF_MAX_BUFFER_SIZE+3];
|
uint8_t u95HFBuffer [RFTRANS_95HF_MAX_BUFFER_SIZE+3];
|
||||||
uint8_t sspin=0;
|
uint8_t sspin=0;
|
||||||
|
uint8_t irqpin=0;
|
||||||
/**
|
/**
|
||||||
* @brief This uTimeOut variable is used as a timeout duting the communication with the RF tranceiver
|
* @brief This uTimeOut variable is used as a timeout duting the communication with the RF tranceiver
|
||||||
*/
|
*/
|
||||||
@@ -92,10 +93,11 @@ drv95HF_ConfigStruct drv95HFConfig;
|
|||||||
* @param None
|
* @param None
|
||||||
* @retval void
|
* @retval void
|
||||||
*/
|
*/
|
||||||
static void drv95HF_InitializeSPI(int8_t sck, int8_t miso, int8_t mosi, int8_t ss)
|
static void drv95HF_InitializeSPI(int8_t sck, int8_t miso, int8_t mosi, int8_t ss, int8_t irq)
|
||||||
{
|
{
|
||||||
sspin = ss;
|
sspin = ss;
|
||||||
RFTRANS_SPI_Init(sck, miso, mosi, ss);
|
irqpin = irq;
|
||||||
|
RFTRANS_SPI_Init(sck, miso, mosi, ss, irq);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -133,7 +135,7 @@ static int8_t drv95HF_SPIPollingCommand( void )
|
|||||||
do
|
do
|
||||||
{
|
{
|
||||||
/* Low level on NSS */
|
/* Low level on NSS */
|
||||||
RFTRANS_95HF_NSS_LOW(sspin);
|
SPI_driveNSS_Low();
|
||||||
delay(2);
|
delay(2);
|
||||||
|
|
||||||
/* poll the 95HF transceiver until he's ready ! */
|
/* poll the 95HF transceiver until he's ready ! */
|
||||||
@@ -152,7 +154,7 @@ static int8_t drv95HF_SPIPollingCommand( void )
|
|||||||
while( Polling_Status != RFTRANS_95HF_FLAG_DATA_READY && uTimeOut != true );
|
while( Polling_Status != RFTRANS_95HF_FLAG_DATA_READY && uTimeOut != true );
|
||||||
|
|
||||||
/* High level on NSS */
|
/* High level on NSS */
|
||||||
RFTRANS_95HF_NSS_HIGH(sspin);
|
SPI_driveNSS_High();
|
||||||
|
|
||||||
DEV_SPI.endTransaction();
|
DEV_SPI.endTransaction();
|
||||||
|
|
||||||
@@ -195,16 +197,16 @@ void drv95HF_InitConfigStructure (void)
|
|||||||
void drv95HF_ResetSPI(void)
|
void drv95HF_ResetSPI(void)
|
||||||
{
|
{
|
||||||
/* Deselect Rftransceiver over SPI */
|
/* Deselect Rftransceiver over SPI */
|
||||||
RFTRANS_95HF_NSS_HIGH(sspin);
|
SPI_driveNSS_High();
|
||||||
delay(1);
|
delay(1);
|
||||||
|
|
||||||
DEV_SPI.beginTransaction(SPISettings(1500000, MSBFIRST, SPI_MODE3));
|
DEV_SPI.beginTransaction(SPISettings(1500000, MSBFIRST, SPI_MODE3));
|
||||||
/* Select 95HF device over SPI */
|
/* Select 95HF device over SPI */
|
||||||
RFTRANS_95HF_NSS_LOW(sspin);
|
SPI_driveNSS_Low();
|
||||||
/* Send reset control byte */
|
/* Send reset control byte */
|
||||||
drv95HF_SendSPIResetByte();
|
drv95HF_SendSPIResetByte();
|
||||||
/* Deselect 95HF device over SPI */
|
/* Deselect 95HF device over SPI */
|
||||||
RFTRANS_95HF_NSS_HIGH(sspin);
|
SPI_driveNSS_High();
|
||||||
|
|
||||||
DEV_SPI.endTransaction();
|
DEV_SPI.endTransaction();
|
||||||
|
|
||||||
@@ -252,7 +254,7 @@ void drv95HF_ResetSPI(void)
|
|||||||
* @param None
|
* @param None
|
||||||
* @retval None
|
* @retval None
|
||||||
*/
|
*/
|
||||||
void drv95HF_InitilizeSerialInterface(int8_t sck, int8_t miso, int8_t mosi, int8_t ss)
|
void drv95HF_InitilizeSerialInterface(int8_t sck, int8_t miso, int8_t mosi, int8_t ss, int8_t irq)
|
||||||
{
|
{
|
||||||
/* -- Get interface pin state to select UART or SPI mode -- */
|
/* -- Get interface pin state to select UART or SPI mode -- */
|
||||||
//if (drv95HF_GetInterfacePinState() != RFTRANS_95HF_INTERFACE_UART)
|
//if (drv95HF_GetInterfacePinState() != RFTRANS_95HF_INTERFACE_UART)
|
||||||
@@ -260,7 +262,7 @@ void drv95HF_InitilizeSerialInterface(int8_t sck, int8_t miso, int8_t mosi, int8
|
|||||||
/* -- Set communication type -- */
|
/* -- Set communication type -- */
|
||||||
drv95HFConfig.uInterface = RFTRANS_95HF_INTERFACE_SPI;
|
drv95HFConfig.uInterface = RFTRANS_95HF_INTERFACE_SPI;
|
||||||
/* -- Initialize SPI Interface -- */
|
/* -- Initialize SPI Interface -- */
|
||||||
drv95HF_InitializeSPI( );
|
drv95HF_InitializeSPI(sck, miso, mosi, ss, irq);
|
||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -288,7 +290,7 @@ void drv95HF_SendSPICommand(const uint8_t *pData)
|
|||||||
DEV_SPI.beginTransaction(SPISettings(1500000, MSBFIRST, SPI_MODE3));
|
DEV_SPI.beginTransaction(SPISettings(1500000, MSBFIRST, SPI_MODE3));
|
||||||
|
|
||||||
/* Select xx95HF over SPI */
|
/* Select xx95HF over SPI */
|
||||||
RFTRANS_95HF_NSS_LOW(sspin);
|
SPI_driveNSS_Low();
|
||||||
|
|
||||||
/* Send a sending request to xx95HF */
|
/* Send a sending request to xx95HF */
|
||||||
SPI_SendReceiveByte(RFTRANS_95HF_COMMAND_SEND);
|
SPI_SendReceiveByte(RFTRANS_95HF_COMMAND_SEND);
|
||||||
@@ -305,7 +307,7 @@ void drv95HF_SendSPICommand(const uint8_t *pData)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Deselect xx95HF over SPI */
|
/* Deselect xx95HF over SPI */
|
||||||
RFTRANS_95HF_NSS_HIGH(sspin);
|
SPI_driveNSS_High();
|
||||||
|
|
||||||
DEV_SPI.endTransaction();
|
DEV_SPI.endTransaction();
|
||||||
}
|
}
|
||||||
@@ -324,7 +326,7 @@ void drv95HF_ReceiveSPIResponse(uint8_t *pData)
|
|||||||
DEV_SPI.beginTransaction(SPISettings(1500000, MSBFIRST, SPI_MODE3));
|
DEV_SPI.beginTransaction(SPISettings(1500000, MSBFIRST, SPI_MODE3));
|
||||||
|
|
||||||
/* Select 95HF transceiver over SPI */
|
/* Select 95HF transceiver over SPI */
|
||||||
RFTRANS_95HF_NSS_LOW(sspin);
|
SPI_driveNSS_Low();
|
||||||
|
|
||||||
/* Request a response from 95HF transceiver */
|
/* Request a response from 95HF transceiver */
|
||||||
SPI_SendReceiveByte(RFTRANS_95HF_COMMAND_RECEIVE);
|
SPI_SendReceiveByte(RFTRANS_95HF_COMMAND_RECEIVE);
|
||||||
@@ -355,7 +357,7 @@ void drv95HF_ReceiveSPIResponse(uint8_t *pData)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Deselect xx95HF over SPI */
|
/* Deselect xx95HF over SPI */
|
||||||
RFTRANS_95HF_NSS_HIGH(sspin);
|
SPI_driveNSS_High();
|
||||||
|
|
||||||
DEV_SPI.endTransaction();
|
DEV_SPI.endTransaction();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,26 +57,24 @@
|
|||||||
* @retval None
|
* @retval None
|
||||||
*/
|
*/
|
||||||
uint8_t ss_pin = 0;
|
uint8_t ss_pin = 0;
|
||||||
|
uint8_t irq_pin = 0;
|
||||||
|
|
||||||
void RFTRANS_SPI_Init(int8_t sck, int8_t miso, int8_t mosi, int8_t ss)
|
void RFTRANS_SPI_Init(int8_t sck, int8_t miso, int8_t mosi, int8_t ss, int8_t irq)
|
||||||
{
|
{
|
||||||
// Configure NSS pin for CR95HF
|
// Configure NSS pin for CR95HF
|
||||||
|
ss_pin = ss;
|
||||||
|
irq_pin = irq;
|
||||||
pinMode(ss, OUTPUT);
|
pinMode(ss, OUTPUT);
|
||||||
|
|
||||||
// Configure interface pin select for CR95HF
|
|
||||||
//pinMode(9, OUTPUT);
|
|
||||||
|
|
||||||
// Configure interrupt input pin for CR95HF
|
// Configure interrupt input pin for CR95HF
|
||||||
//pinMode(8, OUTPUT);
|
pinMode(irq, OUTPUT);
|
||||||
|
|
||||||
// Set the interface pin select high in order to configure the NFC reader to use the SPI interface
|
|
||||||
//digitalWrite(9, HIGH);
|
|
||||||
|
|
||||||
/* SPI_NSS = High Level */
|
/* SPI_NSS = High Level */
|
||||||
SPI_driveNSS_High();
|
SPI_driveNSS_High();
|
||||||
|
|
||||||
/* Set signal to high */
|
/* Set signal to high */
|
||||||
RFTRANS_95HF_IRQIN_HIGH();
|
SPI_driveIRQ_High();
|
||||||
|
|
||||||
DEV_SPI.begin(sck,miso, mosi, ss);
|
DEV_SPI.begin(sck,miso, mosi, ss);
|
||||||
}
|
}
|
||||||
@@ -117,6 +115,15 @@ void SPI_driveNSS_Low(void)
|
|||||||
{
|
{
|
||||||
digitalWrite(ss_pin, 0);
|
digitalWrite(ss_pin, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SPI_driveIRQ_High(void)
|
||||||
|
{
|
||||||
|
digitalWrite(irq_pin, 1);
|
||||||
|
}
|
||||||
|
void SPI_driveIRQ_low(void)
|
||||||
|
{
|
||||||
|
digitalWrite(irq_pin, 0);
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -55,18 +55,21 @@
|
|||||||
//#define RFTRANS_95HF_NSS_LOW(pin) digitalWrite(pin, 0)
|
//#define RFTRANS_95HF_NSS_LOW(pin) digitalWrite(pin, 0)
|
||||||
//#define RFTRANS_95HF_NSS_HIGH(pin) digitalWrite(pin, 1)
|
//#define RFTRANS_95HF_NSS_HIGH(pin) digitalWrite(pin, 1)
|
||||||
/* set state on IRQ_In pin */
|
/* set state on IRQ_In pin */
|
||||||
#define RFTRANS_95HF_IRQIN_LOW() digitalWrite(8, 0)
|
#define RFTRANS_95HF_IRQIN_LOW() SPI_driveIRQ_low()
|
||||||
#define RFTRANS_95HF_IRQIN_HIGH() digitalWrite(8, 1)
|
#define RFTRANS_95HF_IRQIN_HIGH() SPI_driveIRQ_High()
|
||||||
/* Exported functions ------------------------------------------------------- */
|
/* Exported functions ------------------------------------------------------- */
|
||||||
/** @defgroup X_NUCLEO_NFC03A1_Spi_Exported_Functions
|
/** @defgroup X_NUCLEO_NFC03A1_Spi_Exported_Functions
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
void RFTRANS_SPI_Init(int8_t sck, int8_t miso, int8_t mosi, int8_t ss);
|
void RFTRANS_SPI_Init(int8_t sck, int8_t miso, int8_t mosi, int8_t ss, int8_t irq);
|
||||||
void SPI_SendReceiveBuffer(const uint8_t *pCommand, uint8_t length, uint8_t *pResponse);
|
void SPI_SendReceiveBuffer(const uint8_t *pCommand, uint8_t length, uint8_t *pResponse);
|
||||||
uint8_t SPI_SendReceiveByte(uint8_t data);
|
uint8_t SPI_SendReceiveByte(uint8_t data);
|
||||||
|
|
||||||
void SPI_driveNSS_High(void);
|
void SPI_driveNSS_High(void);
|
||||||
void SPI_driveNSS_Low(void);
|
void SPI_driveNSS_Low(void);
|
||||||
|
|
||||||
|
void SPI_driveIRQ_High(void);
|
||||||
|
void SPI_driveIRQ_low(void);
|
||||||
/**
|
/**
|
||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ extern ISO14443A_CARD ISO14443A_Card;
|
|||||||
/** @addtogroup lib_ConfigManager_Private_Functions
|
/** @addtogroup lib_ConfigManager_Private_Functions
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
static void ConfigManager_Init( void);
|
static void ConfigManager_Init( int8_t sck, int8_t miso, int8_t mosi, int8_t ss, int8_t irq);
|
||||||
static int8_t ConfigManager_IDN(uint8_t *pResponse);
|
static int8_t ConfigManager_IDN(uint8_t *pResponse);
|
||||||
static void ConfigManager_Start(void );
|
static void ConfigManager_Start(void );
|
||||||
static int8_t ConfigManager_PORsequence( void );
|
static int8_t ConfigManager_PORsequence( void );
|
||||||
@@ -82,13 +82,13 @@ uint8_t TagUID[16];
|
|||||||
* @param None
|
* @param None
|
||||||
* @retval None
|
* @retval None
|
||||||
*/
|
*/
|
||||||
static void ConfigManager_Init(int8_t sck, int8_t miso, int8_t mosi, int8_t ss)
|
static void ConfigManager_Init(int8_t sck, int8_t miso, int8_t mosi, int8_t ss, int8_t irq)
|
||||||
{
|
{
|
||||||
/* initialize the structure of the Rf tranceiver */
|
/* initialize the structure of the Rf tranceiver */
|
||||||
drv95HF_InitConfigStructure ();
|
drv95HF_InitConfigStructure ();
|
||||||
|
|
||||||
/* configure the Serial interface to communicate with the RF transceiver */
|
/* configure the Serial interface to communicate with the RF transceiver */
|
||||||
drv95HF_InitilizeSerialInterface (sck, miso, mosi, ss );
|
drv95HF_InitilizeSerialInterface (sck, miso, mosi, ss, irq);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -192,11 +192,11 @@ void ConfigManager_Stop(void )
|
|||||||
* @param None
|
* @param None
|
||||||
* @retval None
|
* @retval None
|
||||||
*/
|
*/
|
||||||
void ConfigManager_HWInit (int8_t sck, int8_t miso, int8_t mosi, int8_t ss)
|
void ConfigManager_HWInit (int8_t sck, int8_t miso, int8_t mosi, int8_t ss, int8_t irq)
|
||||||
{
|
{
|
||||||
|
|
||||||
/* Initialize HW according to protocol to use */
|
/* Initialize HW according to protocol to use */
|
||||||
ConfigManager_Init();
|
ConfigManager_Init(sck, miso, mosi, ss, irq);
|
||||||
|
|
||||||
/* initilialize the RF transceiver */
|
/* initilialize the RF transceiver */
|
||||||
if (ConfigManager_PORsequence( ) != MANAGER_SUCCESSCODE)
|
if (ConfigManager_PORsequence( ) != MANAGER_SUCCESSCODE)
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ typedef struct {
|
|||||||
|
|
||||||
/* public function ----------------------------------------------------------------*/
|
/* public function ----------------------------------------------------------------*/
|
||||||
|
|
||||||
void ConfigManager_HWInit (int8_t sck, int8_t miso, int8_t mosi, int8_t ss);
|
void ConfigManager_HWInit (int8_t sck, int8_t miso, int8_t mosi, int8_t ss, int8_t irq);
|
||||||
|
|
||||||
uint8_t ConfigManager_TagHunting ( uint8_t tagsToFind );
|
uint8_t ConfigManager_TagHunting ( uint8_t tagsToFind );
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user