chip/pn53x: handle PN532 "power down" and "low VBat" power mode instead of a simple "sleep" mode. (Fixes Issue 167)

This commit is contained in:
Romuald Conty
2011-04-27 13:16:36 +00:00
parent 09b18bf6b8
commit 1198a71d64
6 changed files with 73 additions and 31 deletions

View File

@@ -285,7 +285,7 @@ pn53x_usb_connect (const nfc_device_desc_t *pndd)
*DRIVER_DATA (pnd) = data;
pnd->chip_data = malloc(sizeof(struct pn53x_data));
CHIP_DATA (pnd)->state = NORMAL;
CHIP_DATA (pnd)->power_mode = NORMAL;
CHIP_DATA (pnd)->io = &pn53x_usb_io;
switch (DRIVER_DATA (pnd)->model) {
@@ -388,7 +388,7 @@ pn53x_usb_send (nfc_device_t * pnd, const byte_t * pbtData, const size_t szData)
}
if (pn53x_check_ack_frame (pnd, abtRxBuf, res)) {
CHIP_DATA(pnd)->state = EXECUTE;
// The PN53x is running the sent command
} else {
return false;
}
@@ -529,7 +529,7 @@ read:
pnd->iLastError = DEIO;
return -1;
}
CHIP_DATA (pnd)->state = NORMAL;
// The PN53x command is done and we successfully received the reply
return len;
}