chips/pn53x: drivers now uses pn53x_data_new() and pn53x_data_free() to handle strcut pn53x_data allocation, initialization and freeing.
This commit is contained in:
@@ -245,6 +245,7 @@ acr122_disconnect (nfc_device_t * pnd)
|
||||
SCardDisconnect (DRIVER_DATA (pnd)->hCard, SCARD_LEAVE_CARD);
|
||||
acr122_free_scardcontext ();
|
||||
|
||||
pn53x_data_free (pnd);
|
||||
nfc_device_free (pnd);
|
||||
}
|
||||
|
||||
|
||||
@@ -175,11 +175,13 @@ arygon_connect (const nfc_device_desc_t * pndd)
|
||||
|
||||
pnd->driver_data = malloc(sizeof(struct arygon_data));
|
||||
DRIVER_DATA (pnd)->port = sp;
|
||||
pnd->chip_data = malloc(sizeof(struct pn53x_data));
|
||||
|
||||
// Alloc and init chip's data
|
||||
pn53x_data_new (pnd, &arygon_tama_io);
|
||||
|
||||
// The PN53x chip connected to ARYGON MCU doesn't seems to be in SLEEP mode
|
||||
// The PN53x chip connected to ARYGON MCU doesn't seems to be in LowVBat mode
|
||||
CHIP_DATA (pnd)->power_mode = NORMAL;
|
||||
CHIP_DATA (pnd)->io = &arygon_tama_io;
|
||||
|
||||
// empirical tuning
|
||||
CHIP_DATA (pnd)->timer_correction = 46;
|
||||
pnd->driver = &arygon_driver;
|
||||
@@ -220,6 +222,7 @@ arygon_disconnect (nfc_device_t * pnd)
|
||||
close (DRIVER_DATA (pnd)->iAbortFds[1]);
|
||||
#endif
|
||||
|
||||
pn53x_data_free(pnd);
|
||||
nfc_device_free (pnd);
|
||||
}
|
||||
|
||||
|
||||
@@ -163,10 +163,11 @@ pn532_uart_connect (const nfc_device_desc_t * pndd)
|
||||
|
||||
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 mode
|
||||
CHIP_DATA(pnd)->power_mode = LOWVBAT;
|
||||
CHIP_DATA(pnd)->io = &pn532_uart_io;
|
||||
|
||||
// empirical tuning
|
||||
CHIP_DATA(pnd)->timer_correction = 48;
|
||||
pnd->driver = &pn532_uart_driver;
|
||||
|
||||
@@ -365,6 +365,7 @@ pn53x_usb_disconnect (nfc_device_t * pnd)
|
||||
if ((res = usb_close (DRIVER_DATA (pnd)->pudh)) < 0) {
|
||||
ERR ("usb_close failed (%i)", res);
|
||||
}
|
||||
pn53x_data_free (pnd);
|
||||
nfc_device_free (pnd);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user