Skip to content

File syn_rfid.c

FileList > drivers > syn_rfid.c

Go to the source code of this file

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

  • #include "syn_rfid.h"
  • #include "../util/syn_assert.h"
  • #include <string.h>

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 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.c