From a95cb20a48fc411779ae3949211d6b37c05981a2 Mon Sep 17 00:00:00 2001 From: REGIOIGER Date: Thu, 26 Dec 2024 14:36:12 -0600 Subject: [PATCH] chore: added chip model enum --- src/Electroniccats_PN7150.cpp | 7 ++++--- src/Electroniccats_PN7150.h | 10 +++++----- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/Electroniccats_PN7150.cpp b/src/Electroniccats_PN7150.cpp index bffa3c1..4b9bd28 100644 --- a/src/Electroniccats_PN7150.cpp +++ b/src/Electroniccats_PN7150.cpp @@ -44,10 +44,11 @@ unsigned char DiscoveryTechnologiesP2P[] = { // P2P Electroniccats_PN7150::Electroniccats_PN7150(uint8_t IRQpin, uint8_t VENpin, uint8_t I2Caddress, - uint8_t chipModel, TwoWire *wire) + ChipModel chipModel, TwoWire *wire) : _IRQpin(IRQpin), _VENpin(VENpin), _I2Caddress(I2Caddress), _chipModel(chipModel), _wire(wire) { pinMode(_IRQpin, INPUT); + if (_VENpin != 255) pinMode(_VENpin, OUTPUT); @@ -227,8 +228,8 @@ uint8_t Electroniccats_PN7150::connectNCI() { // Open connection to NXPNCI // uses setSDA and set SCL with compatible boards - //_wire->setSDA(0); // GPIO 0 como SDA - //_wire->setSCL(1); // GPIO 1 como SCL + _wire->setSDA(0); // GPIO 0 como SDA + _wire->setSCL(1); // GPIO 1 como SCL // Open connection to NXPNCI _wire->begin(); diff --git a/src/Electroniccats_PN7150.h b/src/Electroniccats_PN7150.h index 10a9750..b3cd4eb 100644 --- a/src/Electroniccats_PN7150.h +++ b/src/Electroniccats_PN7150.h @@ -36,9 +36,6 @@ #include #endif -#define PN7150 0 -#define PN7160 1 - #define NO_PN7150_RESET_PIN 255 /* Following definitions specifies which settings will apply when * NxpNci_ConfigureSettings() API is called from the application @@ -69,6 +66,8 @@ #define MaxPayloadSize 255 // See NCI specification V1.0, section 3.1 #define MsgHeaderSize 3 +enum ChipModel { PN7150 = 0, PN7160 = 1 }; + /***** Factory Test dedicated APIs * *********************************************/ #ifdef NFC_FACTORY_TEST @@ -98,7 +97,8 @@ typedef enum { class Electroniccats_PN7150 : public Mode { private: bool _hasBeenInitialized; - uint8_t _IRQpin, _VENpin, _I2Caddress, _chipModel; + uint8_t _IRQpin, _VENpin, _I2Caddress; + ChipModel _chipModel; TwoWire *_wire; RfIntf_t dummyRfInterface; uint8_t rxBuffer[MaxPayloadSize + @@ -122,7 +122,7 @@ class Electroniccats_PN7150 : public Mode { public: Electroniccats_PN7150(uint8_t IRQpin, uint8_t VENpin, uint8_t I2Caddress, - uint8_t chipModel, TwoWire *wire = &Wire); + ChipModel chipModel, TwoWire *wire = &Wire); uint8_t begin(void); RemoteDevice remoteDevice; Protocol protocol;