New function nfc_idle() to set the NFC device in idle mode.

nfc_disconnect() now switch NFC device into idle before disconnecting;
pn53x_data now have a operating_mode enum to know the current running mode (initiator, target or idle);
new pn53x_PowerDown wrapper for PowerDown (PN532) command;

Note: ARYGON idle mode now to be implemented and ACR122 does not support this mode.
This commit is contained in:
Romuald Conty
2011-05-09 10:09:40 +00:00
parent a2a93e7224
commit be0f0b0828
9 changed files with 96 additions and 7 deletions

View File

@@ -138,10 +138,8 @@ void
nfc_disconnect (nfc_device_t * pnd)
{
if (pnd) {
// Release and deselect all active communications
nfc_initiator_deselect_target (pnd);
// Disable RF field to avoid heating
nfc_configure (pnd, NDO_ACTIVATE_FIELD, false);
// Go in idle mode
nfc_idle (pnd);
// Disconnect, clean up and release the device
pnd->driver->disconnect (pnd);
}
@@ -645,6 +643,22 @@ nfc_target_init (nfc_device_t * pnd, nfc_target_t * pnt, byte_t * pbtRx, size_t
HAL (target_init, pnd, pnt, pbtRx, pszRx);
}
/**
* @brief Turn NFC device in idle mode
* @return Returns \c true if action was successfully performed; otherwise returns \c false.
*
* @param pnd \a nfc_device_t struct pointer that represent currently used device
*
* This function switch the device in idle mode.
* In initiator mode, the RF field is turned off and the device is set to low power mode (if avaible);
* In target mode, the emulation is stoped (no target available from external initiator) and the device is set to low power mode (if avaible).
*/
bool
nfc_idle (nfc_device_t * pnd)
{
HAL (idle, pnd);
}
/**
* @brief Abort current running command
* @return Returns \c true if action was successfully performed; otherwise returns \c false.