Skip to content

File syn_rfid.h

FileList > drivers > syn_rfid.h

Go to the source code of this file

Generic RFID & NFC Card Reader Driver (MFRC522 13.56MHz, PN532, RDM6300 125kHz).

  • #include "../common/syn_defs.h"
  • #include "../port/syn_port_gpio.h"
  • #include <stdbool.h>
  • #include <stddef.h>
  • #include <stdint.h>

Classes

Type Name
struct SYN_RFID
Generic RFID Instance Context.

Public Types

Type Name
enum SYN_RFIDType
RFID Reader Type.

Public Functions

Type Name
void syn_rfid_clear_card (SYN_RFID * rfid)
Clear card presence state (card removed).
void syn_rfid_feed_card (SYN_RFID * rfid, const uint8_t * uid, uint8_t len)
Feed raw UID scan bytes.
const uint8_t * syn_rfid_get_uid (const SYN_RFID * rfid, uint8_t * len)
Get last scanned UID byte array.
SYN_Status syn_rfid_init (SYN_RFID * rfid, SYN_GPIO_Pin ss_pin, SYN_GPIO_Pin rst_pin, SYN_RFIDType type)
Initialize RFID Reader context.
bool syn_rfid_is_card_present (const SYN_RFID * rfid)
Check if a card is present.

Public Types Documentation

enum SYN_RFIDType

RFID Reader Type.

enum SYN_RFIDType {
    SYN_RFID_MFRC522 = 0,
    SYN_RFID_PN532 = 1,
    SYN_RFID_RDM6300 = 2
};


Public Functions Documentation

function syn_rfid_clear_card

Clear card presence state (card removed).

void syn_rfid_clear_card (
    SYN_RFID * rfid
) 

Parameters:

  • rfid RFID context.

function syn_rfid_feed_card

Feed raw UID scan bytes.

void syn_rfid_feed_card (
    SYN_RFID * rfid,
    const uint8_t * uid,
    uint8_t len
) 

Parameters:

  • rfid RFID context.
  • uid UID byte buffer.
  • len UID byte count (4, 7, or 10).

function syn_rfid_get_uid

Get last scanned UID byte array.

const uint8_t * syn_rfid_get_uid (
    const SYN_RFID * rfid,
    uint8_t * len
) 

Parameters:

  • rfid RFID context.
  • len Pointer to receive UID length.

Returns:

Pointer to UID bytes (or NULL).


function syn_rfid_init

Initialize RFID Reader context.

SYN_Status syn_rfid_init (
    SYN_RFID * rfid,
    SYN_GPIO_Pin ss_pin,
    SYN_GPIO_Pin rst_pin,
    SYN_RFIDType type
) 

Parameters:

  • rfid RFID context.
  • ss_pin SPI SS / I2C SDA pin.
  • rst_pin Reset GPIO pin.
  • type RFID IC type (MFRC522, PN532, RDM6300).

Returns:

SYN_OK on success.


function syn_rfid_is_card_present

Check if a card is present.

bool syn_rfid_is_card_present (
    const SYN_RFID * rfid
) 

Parameters:

  • rfid RFID context.

Returns:

True if card present.



The documentation for this class was generated from the following file src/syntropic/drivers/syn_rfid.h