miguelbalboa/rfid — pull request #47 by mdxs (2014-11-10 12:42:29+00:00)
Title: Adding AttennaOff and get/set of AntennaGain

Implementation for changing the MFRC522 Receiver Gain (RxGain) as discussed in #43. Allowing the Sketch to change the detection/interaction range (distance at which the PCD can interact with the PICCs).

Adding the following functions:
* `PCD_GetAntennaGain()` - Get the current MFRC522 Receiver Gain (RxGain[2:0]) value.
* `PCD_SetAntennaGain()` - Set the MFRC522 Receiver Gain (RxGain[2:0]) to given mask.
* and also (just to complement the above and the already existing `PCD_AntennaOn()`:
* `PCD_AntennaOff()` - Turns the antenna off by disabling pins TX1 and TX2.

Where `RxGain[2:0]` is configured via the `RFCfgReg` register as described in 9.3.3.6 / table 98 of the datasheet at http://www.nxp.com/documents/data_sheet/MFRC522.pdf

To support the Sketch developers, a `PCD_RxGain` enum is added to define the allowed values for `RxGain[2:0]` (a 3 bit pattern within the `RFCfgReg` register). Note that 9.3.3.6 of the datasheet shows that the `RFCfgReg` register has some reserved bits as well.