chips/pn53x: add pn53x_data_new() function to alloc and init pn53x_data structure.
This commit is contained in:
@@ -193,7 +193,9 @@ acr122_connect (const nfc_device_desc_t * pndd)
|
||||
char *pcFirmware;
|
||||
nfc_device_t *pnd = nfc_device_new ();
|
||||
pnd->driver_data = malloc (sizeof (struct acr122_data));
|
||||
pnd->chip_data = malloc (sizeof (struct pn53x_data));
|
||||
|
||||
// Alloc and init chip's data
|
||||
pn53x_data_new (pnd, &acr122_io);
|
||||
|
||||
SCARDCONTEXT *pscc;
|
||||
|
||||
@@ -220,8 +222,6 @@ acr122_connect (const nfc_device_desc_t * pndd)
|
||||
// Done, we found the reader we are looking for
|
||||
snprintf (pnd->acName, sizeof (pnd->acName), "%s / %s", pndd->acDevice, pcFirmware);
|
||||
|
||||
CHIP_DATA (pnd)->power_mode = NORMAL;
|
||||
CHIP_DATA (pnd)->io = &acr122_io;
|
||||
// 50: empirical tuning on Touchatag
|
||||
// 46: empirical tuning on ACR122U
|
||||
CHIP_DATA (pnd)->timer_correction = 50;
|
||||
|
||||
@@ -117,9 +117,9 @@ arygon_probe (nfc_device_desc_t pnddDevices[], size_t szDevices, size_t * pszDev
|
||||
pnd->driver = &arygon_driver;
|
||||
pnd->driver_data = malloc(sizeof(struct arygon_data));
|
||||
DRIVER_DATA (pnd)->port = sp;
|
||||
pnd->chip_data = malloc(sizeof(struct pn53x_data));
|
||||
CHIP_DATA (pnd)->power_mode = NORMAL;
|
||||
CHIP_DATA (pnd)->io = &arygon_tama_io;
|
||||
|
||||
// Alloc and init chip's data
|
||||
pn53x_data_new (pnd, &arygon_tama_io);
|
||||
|
||||
bool res = arygon_reset_tama (pnd);
|
||||
nfc_device_free (pnd);
|
||||
|
||||
@@ -98,10 +98,11 @@ pn532_uart_probe (nfc_device_desc_t pnddDevices[], size_t szDevices, size_t * ps
|
||||
pnd->driver = &pn532_uart_driver;
|
||||
pnd->driver_data = malloc(sizeof(struct pn532_uart_data));
|
||||
DRIVER_DATA (pnd)->port = sp;
|
||||
pnd->chip_data = malloc(sizeof(struct pn53x_data));
|
||||
CHIP_DATA (pnd)->type = PN532;
|
||||
|
||||
// Alloc and init chip's data
|
||||
pn53x_data_new (pnd, &pn532_uart_io);
|
||||
// This device starts in LowVBat power mode
|
||||
CHIP_DATA (pnd)->power_mode = LOWVBAT;
|
||||
CHIP_DATA (pnd)->io = &pn532_uart_io;
|
||||
|
||||
// Check communication using "Diagnose" command, with "Communication test" (0x00)
|
||||
bool res = pn53x_check_communication (pnd);
|
||||
|
||||
@@ -290,10 +290,9 @@ pn53x_usb_connect (const nfc_device_desc_t *pndd)
|
||||
|
||||
pnd->driver_data = malloc(sizeof(struct pn53x_usb_data));
|
||||
*DRIVER_DATA (pnd) = data;
|
||||
pnd->chip_data = malloc(sizeof(struct pn53x_data));
|
||||
|
||||
CHIP_DATA (pnd)->power_mode = NORMAL;
|
||||
CHIP_DATA (pnd)->io = &pn53x_usb_io;
|
||||
// Alloc and init chip's data
|
||||
pn53x_data_new (pnd, &pn53x_usb_io);
|
||||
|
||||
switch (DRIVER_DATA (pnd)->model) {
|
||||
// empirical tuning
|
||||
|
||||
Reference in New Issue
Block a user