I am a bit confused about how the wire library is being used in this code portion.
In the following code, what is exactly "TwoWire *pwire = &WIRE" mean in the "begin" function under the class "ST25DV"?
#define SerialPort Serial
#if defined(ARDUINO_B_L4S5I_IOT01A)
#define GPO_PIN RC5
#define LPD_PIN PE2
#define SDA_PIN RC4
#define SCL_PIN RC3
#define WireNFC MyWire
TwoWire MyWire(SDA_PIN, SCL_PIN);
#else
// Please define the pin and wire instance used for your board
#define GPO_PIN PE4
#define LPD_PIN PE2
#define SDA_PIN PB11
#define SCL_PIN PB10
#define WireNFC Wire // Default wire instance
#endif
#if !defined(GPO_PIN) || !defined(LPD_PIN)
#error define the pin and wire instance used for your board
#endif
if(st25dv.begin(GPO_PIN, LPD_PIN, &WireNFC) == 0) {
SerialPort.println("System Init done!");
} else {
SerialPort.println("System Init failed!");
while(1);
}
Related code portion from header file:
class ST25DV {
public:
ST25DV(void);
int begin(uint8_t gpo, uint8_t ldp, TwoWire *pwire = &WIRE);
int writeURI(String protocol, String uri, String info);
int readURI(String *s);
void ST25DV_GPO_Init(void);
void ST25DV_GPO_DeInit(void);
uint8_t ST25DV_GPO_ReadPin(void);
void ST25DV_LPD_Init(void);
void ST25DV_LPD_DeInit(void);
uint8_t ST25DV_LPD_ReadPin(void);
void ST25DV_LPD_WritePin(uint8_t LpdPinState);
void ST25DV_I2C_Init(void);
void ST25DV_SelectI2cSpeed(uint8_t i2cspeedchoice);
TwoWire *_pwire;
private:
uint8_t _gpo;
uint8_t _lpd;
};
extern ST25DV st25dv; //Indication of function definitions in another file
#endif