Opt in to incorrect UIDs rather than correct ones

pull/22/head
Bracken Dawson 5 years ago
parent df6f1e5307
commit 1de13d528f
No known key found for this signature in database
GPG Key ID: 0A29122E6FE51E41

@ -46,11 +46,11 @@ type config struct {
type configF func(*config) *config type configF func(*config) *config
// WithFixedUID sets the card reader to return correct 4-byte UIDs. Without // WithBogusUID sets the card reader to return incorrect 4-byte UIDs. In
// this setting 4-byte UIDs will be 5-bytes long with bytes 0 to 3 being the // version 3.6.12 and earlier this package ruturned 5-bytes for tags with a
// correct UID and byte 4 being an XOR of bytes 0 to 3. 7-byte UIDs are correct // 4-byte UID with bytes 0 to 3 being the correct UID and byte 4 being an XOR
// regardless of this configuration. // of bytes 0 to 3. 7-byte UIDs are correct regardless of this configuration.
func WithFixedUID() configF { func WithBogusUID() configF {
return func(c *config) *config { return func(c *config) *config {
c.bogusUID = false c.bogusUID = false
return c return c
@ -79,9 +79,6 @@ func WithSync() configF {
func noop() {} func noop() {}
// NewSPI creates and initializes the RFID card reader attached to SPI. // NewSPI creates and initializes the RFID card reader attached to SPI.
// It is recommended to use the WithFixedUID configuration to return correct
// card UIDs. Incorrect UIDs are returned for compatibility but will be removed
// from a future version of this package.
// //
// spiPort the SPI device to use. // spiPort the SPI device to use.
// resetPin reset GPIO pin. // resetPin reset GPIO pin.
@ -143,8 +140,6 @@ func (r *Dev) SetAntennaGain(gain int) error {
} }
// ReadUID reads the 4-byte or 7-byte card UID with IRQ event timeout. // ReadUID reads the 4-byte or 7-byte card UID with IRQ event timeout.
// 4-byte UIDs will include their checksum byte unless Dev was created using
// WithFixedUID.
// //
// timeout the operation timeout // timeout the operation timeout
func (r *Dev) ReadUID(timeout time.Duration) (uid []byte, err error) { func (r *Dev) ReadUID(timeout time.Duration) (uid []byte, err error) {

Loading…
Cancel
Save