LibDriver MFRC522  1.0.0
MFRC522 full-featured driver
driver_mfrc522.c File Reference

driver mfrc522 source file More...

#include "driver_mfrc522.h"

Go to the source code of this file.

Macros

#define CHIP_NAME   "NXP MFRC522"
 chip information definition More...
 
#define MANUFACTURER_NAME   "NXP"
 
#define SUPPLY_VOLTAGE_MIN   2.5f
 
#define SUPPLY_VOLTAGE_MAX   3.6f
 
#define MAX_CURRENT   100.0f
 
#define TEMPERATURE_MIN   -25.0f
 
#define TEMPERATURE_MAX   85.0f
 
#define DRIVER_VERSION   1000
 
#define MFRC522_REG_COMMAND   0x01
 chip register definition More...
 
#define MFRC522_REG_COMIEN   0x02
 
#define MFRC522_REG_DIVIEN   0x03
 
#define MFRC522_REG_COMIRQ   0x04
 
#define MFRC522_REG_DIVIRQ   0x05
 
#define MFRC522_REG_ERROR   0x06
 
#define MFRC522_REG_STATUS1   0x07
 
#define MFRC522_REG_STATUS2   0x08
 
#define MFRC522_REG_FIFO_DATA   0x09
 
#define MFRC522_REG_FIFO_LEVEL   0x0A
 
#define MFRC522_REG_WATER_LEVEL   0x0B
 
#define MFRC522_REG_CONTROL   0x0C
 
#define MFRC522_REG_BIT_FRAMING   0x0D
 
#define MFRC522_REG_COLL   0x0E
 
#define MFRC522_REG_MODE   0x11
 
#define MFRC522_REG_TX_MODE   0x12
 
#define MFRC522_REG_RX_MODE   0x13
 
#define MFRC522_REG_TX_CONTROL   0x14
 
#define MFRC522_REG_TX_ASK   0x15
 
#define MFRC522_REG_TX_SEL   0x16
 
#define MFRC522_REG_RX_SEL   0x17
 
#define MFRC522_REG_RX_THRESHOLD   0x18
 
#define MFRC522_REG_DEMOD   0x19
 
#define MFRC522_REG_MFTX   0x1C
 
#define MFRC522_REG_MFRX   0x1D
 
#define MFRC522_REG_SERIAL_SPEED   0x1F
 
#define MFRC522_REG_CRC_RESULT_H   0x21
 
#define MFRC522_REG_CRC_RESULT_L   0x22
 
#define MFRC522_REG_MOD_WIDTH   0x24
 
#define MFRC522_REG_RFCFG   0x26
 
#define MFRC522_REG_GSN   0x27
 
#define MFRC522_REG_CWGSP   0x28
 
#define MFRC522_REG_MODGSP   0x29
 
#define MFRC522_REG_TMODE   0x2A
 
#define MFRC522_REG_TPRESCALER   0x2B
 
#define MFRC522_REG_TRELOAD_H   0x2C
 
#define MFRC522_REG_TRELOAD_L   0x2D
 
#define MFRC522_REG_TCOUNTER_VAL_H   0x2E
 
#define MFRC522_REG_TCOUNTER_VAL_L   0x2F
 
#define MFRC522_REG_TEST_SEL1   0x31
 
#define MFRC522_REG_TEST_SEL2   0x32
 
#define MFRC522_REG_TEST_PIN_EN   0x33
 
#define MFRC522_REG_TEST_PIN_VALUE   0x34
 
#define MFRC522_REG_TEST_BUS   0x35
 
#define MFRC522_REG_AUTO_TEST   0x36
 
#define MFRC522_REG_VERSION   0x37
 
#define MFRC522_REG_ANALOG_TEST   0x38
 
#define MFRC522_REG_TEST_DAC1   0x39
 
#define MFRC522_REG_TEST_DAC2   0x3A
 
#define MFRC522_REG_TEST_ADC   0x3B
 

Functions

uint8_t mfrc522_set_interface (mfrc522_handle_t *handle, mfrc522_interface_t interface)
 set the chip interface More...
 
uint8_t mfrc522_get_interface (mfrc522_handle_t *handle, mfrc522_interface_t *interface)
 get the chip interface More...
 
uint8_t mfrc522_set_addr_pin (mfrc522_handle_t *handle, uint8_t addr_pin)
 set the iic address pin More...
 
uint8_t mfrc522_get_addr_pin (mfrc522_handle_t *handle, uint8_t *addr_pin)
 get the iic address pin More...
 
uint8_t mfrc522_init (mfrc522_handle_t *handle)
 initialize the chip More...
 
uint8_t mfrc522_deinit (mfrc522_handle_t *handle)
 close the chip More...
 
uint8_t mfrc522_irq_handler (mfrc522_handle_t *handle)
 irq handler More...
 
uint8_t mfrc522_transceiver (mfrc522_handle_t *handle, mfrc522_command_t command, uint8_t *in_buf, uint8_t in_len, uint8_t *out_buf, uint8_t *out_len, uint8_t *err, uint32_t ms)
 mfrc522 transceiver More...
 
uint8_t mfrc522_set_receiver_analog (mfrc522_handle_t *handle, mfrc522_bool_t enable)
 enable or disable the analog part of the receiver More...
 
uint8_t mfrc522_get_receiver_analog (mfrc522_handle_t *handle, mfrc522_bool_t *enable)
 get the analog part of the receiver status More...
 
uint8_t mfrc522_set_power_down (mfrc522_handle_t *handle, mfrc522_bool_t enable)
 enable or disable power down More...
 
uint8_t mfrc522_get_power_down (mfrc522_handle_t *handle, mfrc522_bool_t *enable)
 get power down status More...
 
uint8_t mfrc522_set_command (mfrc522_handle_t *handle, mfrc522_command_t command)
 set the command More...
 
uint8_t mfrc522_get_command (mfrc522_handle_t *handle, mfrc522_command_t *command)
 get the command More...
 
uint8_t mfrc522_set_interrupt1 (mfrc522_handle_t *handle, mfrc522_interrupt1_t type, mfrc522_bool_t enable)
 enable or disable the interrupt1 More...
 
uint8_t mfrc522_get_interrupt1 (mfrc522_handle_t *handle, mfrc522_interrupt1_t type, mfrc522_bool_t *enable)
 get the interrupt1 status More...
 
uint8_t mfrc522_set_interrupt1_pin_invert (mfrc522_handle_t *handle, mfrc522_bool_t enable)
 enable or disable interrupt1 pin invert More...
 
uint8_t mfrc522_get_interrupt1_pin_invert (mfrc522_handle_t *handle, mfrc522_bool_t *enable)
 get the interrupt1 pin invert status More...
 
uint8_t mfrc522_set_interrupt1_mark (mfrc522_handle_t *handle, mfrc522_interrupt_mark_t mark)
 set the interrupt1 mark More...
 
uint8_t mfrc522_set_interrupt2 (mfrc522_handle_t *handle, mfrc522_interrupt2_t type, mfrc522_bool_t enable)
 enable or disable the interrupt2 More...
 
uint8_t mfrc522_get_interrupt2 (mfrc522_handle_t *handle, mfrc522_interrupt2_t type, mfrc522_bool_t *enable)
 get the interrupt2 status More...
 
uint8_t mfrc522_set_interrupt_pin_type (mfrc522_handle_t *handle, mfrc522_interrupt_pin_type_t type)
 set the interrupt pin type More...
 
uint8_t mfrc522_get_interrupt_pin_type (mfrc522_handle_t *handle, mfrc522_interrupt_pin_type_t *type)
 get the interrupt pin type More...
 
uint8_t mfrc522_set_interrupt2_mark (mfrc522_handle_t *handle, mfrc522_interrupt_mark_t mark)
 set the interrupt2 mark More...
 
uint8_t mfrc522_get_interrupt1_status (mfrc522_handle_t *handle, uint8_t *status)
 get the interrupt1 status More...
 
uint8_t mfrc522_get_interrupt2_status (mfrc522_handle_t *handle, uint8_t *status)
 get the interrupt2 status More...
 
uint8_t mfrc522_get_error (mfrc522_handle_t *handle, uint8_t *err)
 get the error More...
 
uint8_t mfrc522_get_status1 (mfrc522_handle_t *handle, uint8_t *status)
 get the status1 More...
 
uint8_t mfrc522_get_status2 (mfrc522_handle_t *handle, uint8_t *status)
 get the status2 More...
 
uint8_t mfrc522_get_modem_state (mfrc522_handle_t *handle, mfrc522_modem_state_t *state)
 get the modem state More...
 
uint8_t mfrc522_set_mifare_crypto1_on (mfrc522_handle_t *handle, mfrc522_bool_t enable)
 enable or disable mifare crypto1 on More...
 
uint8_t mfrc522_set_force_iic_high_speed (mfrc522_handle_t *handle, mfrc522_bool_t enable)
 enable or disable force iic high speed More...
 
uint8_t mfrc522_get_force_iic_high_speed (mfrc522_handle_t *handle, mfrc522_bool_t *enable)
 get the iic high speed status More...
 
uint8_t mfrc522_set_clear_temperature_error (mfrc522_handle_t *handle, mfrc522_bool_t enable)
 enable or disable clear temperature error More...
 
uint8_t mfrc522_get_clear_temperature_error (mfrc522_handle_t *handle, mfrc522_bool_t *enable)
 get the clear temperature error status More...
 
uint8_t mfrc522_set_fifo_data (mfrc522_handle_t *handle, uint8_t *data, uint8_t len)
 set the fifo data More...
 
uint8_t mfrc522_get_fifo_data (mfrc522_handle_t *handle, uint8_t *data, uint8_t len)
 get the fifo data More...
 
uint8_t mfrc522_get_fifo_level (mfrc522_handle_t *handle, uint8_t *level)
 get the fifo level More...
 
uint8_t mfrc522_flush_fifo (mfrc522_handle_t *handle)
 flush the fifo More...
 
uint8_t mfrc522_get_water_level (mfrc522_handle_t *handle, uint8_t *level)
 get the water level More...
 
uint8_t mfrc522_set_water_level (mfrc522_handle_t *handle, uint8_t level)
 set the water level More...
 
uint8_t mfrc522_stop_timer (mfrc522_handle_t *handle)
 stop the timer More...
 
uint8_t mfrc522_start_timer (mfrc522_handle_t *handle)
 start the timer More...
 
uint8_t mfrc522_get_rx_last_bits (mfrc522_handle_t *handle, uint8_t *bits)
 get the rx last bits More...
 
uint8_t mfrc522_start_send (mfrc522_handle_t *handle)
 start the transmission of data More...
 
uint8_t mfrc522_stop_send (mfrc522_handle_t *handle)
 stop the transmission of data More...
 
uint8_t mfrc522_get_tx_last_bits (mfrc522_handle_t *handle, uint8_t *bits)
 get the tx last bits More...
 
uint8_t mfrc522_set_tx_last_bits (mfrc522_handle_t *handle, uint8_t bits)
 set the tx last bits More...
 
uint8_t mfrc522_set_rx_align (mfrc522_handle_t *handle, mfrc522_rx_align_t align)
 set the rx align More...
 
uint8_t mfrc522_get_rx_align (mfrc522_handle_t *handle, mfrc522_rx_align_t *align)
 get the rx align More...
 
uint8_t mfrc522_set_value_clear_after_coll (mfrc522_handle_t *handle, mfrc522_bool_t enable)
 enable or disable value clear after coll More...
 
uint8_t mfrc522_get_value_clear_after_coll (mfrc522_handle_t *handle, mfrc522_bool_t *enable)
 get the value clear after coll status More...
 
uint8_t mfrc522_get_collision_position_not_valid (mfrc522_handle_t *handle, mfrc522_bool_t *enable)
 get the collision position not valid bit status More...
 
uint8_t mfrc522_get_collision_position (mfrc522_handle_t *handle, uint8_t *pos)
 get the collision position More...
 
uint8_t mfrc522_set_crc_msb_first (mfrc522_handle_t *handle, mfrc522_bool_t enable)
 enable or disable the crc msb first More...
 
uint8_t mfrc522_get_crc_msb_first (mfrc522_handle_t *handle, mfrc522_bool_t *enable)
 get the crc msb first More...
 
uint8_t mfrc522_set_tx_wait_rf (mfrc522_handle_t *handle, mfrc522_bool_t enable)
 enable or disable the rf tx wait More...
 
uint8_t mfrc522_get_tx_wait_rf (mfrc522_handle_t *handle, mfrc522_bool_t *enable)
 get the rf tx wait status More...
 
uint8_t mfrc522_set_mfin_polarity (mfrc522_handle_t *handle, mfrc522_mfin_polarity_t polarity)
 set the mfin polarity More...
 
uint8_t mfrc522_get_mfin_polarity (mfrc522_handle_t *handle, mfrc522_mfin_polarity_t *polarity)
 get the mfin polarity More...
 
uint8_t mfrc522_set_crc_preset (mfrc522_handle_t *handle, mfrc522_crc_preset_t preset)
 set the crc preset More...
 
uint8_t mfrc522_get_crc_preset (mfrc522_handle_t *handle, mfrc522_crc_preset_t *preset)
 get the crc preset More...
 
uint8_t mfrc522_set_tx_crc_generation (mfrc522_handle_t *handle, mfrc522_bool_t enable)
 enable or disable tx crc generation More...
 
uint8_t mfrc522_get_tx_crc_generation (mfrc522_handle_t *handle, mfrc522_bool_t *enable)
 get the tx crc generation status More...
 
uint8_t mfrc522_set_tx_speed (mfrc522_handle_t *handle, mfrc522_speed_t speed)
 set the tx speed More...
 
uint8_t mfrc522_get_tx_speed (mfrc522_handle_t *handle, mfrc522_speed_t *speed)
 get the tx speed More...
 
uint8_t mfrc522_set_modulation_invert (mfrc522_handle_t *handle, mfrc522_bool_t enable)
 enable or disable the modulation invert More...
 
uint8_t mfrc522_get_modulation_invert (mfrc522_handle_t *handle, mfrc522_bool_t *enable)
 get the modulation invert status More...
 
uint8_t mfrc522_set_rx_crc_generation (mfrc522_handle_t *handle, mfrc522_bool_t enable)
 enable or disable the rx crc generation More...
 
uint8_t mfrc522_get_rx_crc_generation (mfrc522_handle_t *handle, mfrc522_bool_t *enable)
 get the rx crc generation status More...
 
uint8_t mfrc522_set_rx_speed (mfrc522_handle_t *handle, mfrc522_speed_t speed)
 set the rx speed More...
 
uint8_t mfrc522_get_rx_speed (mfrc522_handle_t *handle, mfrc522_speed_t *speed)
 get the rx speed More...
 
uint8_t mfrc522_set_rx_no_error (mfrc522_handle_t *handle, mfrc522_bool_t enable)
 enable or disable rx no error More...
 
uint8_t mfrc522_get_rx_no_error (mfrc522_handle_t *handle, mfrc522_bool_t *enable)
 get the rx no error status More...
 
uint8_t mfrc522_set_rx_multiple (mfrc522_handle_t *handle, mfrc522_bool_t enable)
 enable or disable rx multiple More...
 
uint8_t mfrc522_get_rx_multiple (mfrc522_handle_t *handle, mfrc522_bool_t *enable)
 get the rx multiple status More...
 
uint8_t mfrc522_set_antenna_driver (mfrc522_handle_t *handle, mfrc522_antenna_driver_t driver, mfrc522_bool_t enable)
 enable or disable the antenna driver More...
 
uint8_t mfrc522_get_antenna_driver (mfrc522_handle_t *handle, mfrc522_antenna_driver_t driver, mfrc522_bool_t *enable)
 get the antenna driver status More...
 
uint8_t mfrc522_set_force_100_ask (mfrc522_handle_t *handle, mfrc522_bool_t enable)
 enable or disable force 100 ask More...
 
uint8_t mfrc522_get_force_100_ask (mfrc522_handle_t *handle, mfrc522_bool_t *enable)
 get the force 100 ask status More...
 
uint8_t mfrc522_set_tx_input (mfrc522_handle_t *handle, mfrc522_tx_input_t input)
 set the tx input More...
 
uint8_t mfrc522_get_tx_input (mfrc522_handle_t *handle, mfrc522_tx_input_t *input)
 get the tx input More...
 
uint8_t mfrc522_set_mfout_input (mfrc522_handle_t *handle, mfrc522_mfout_input_t input)
 set the mfout input More...
 
uint8_t mfrc522_get_mfout_input (mfrc522_handle_t *handle, mfrc522_mfout_input_t *input)
 get the mfout input More...
 
uint8_t mfrc522_set_contactless_uart_input (mfrc522_handle_t *handle, mfrc522_contactless_uart_input_t input)
 set the contactless uart input More...
 
uint8_t mfrc522_get_contactless_uart_input (mfrc522_handle_t *handle, mfrc522_contactless_uart_input_t *input)
 get the contactless uart input More...
 
uint8_t mfrc522_set_rx_wait (mfrc522_handle_t *handle, uint8_t t)
 set the rx wait More...
 
uint8_t mfrc522_get_rx_wait (mfrc522_handle_t *handle, uint8_t *t)
 get the rx wait More...
 
uint8_t mfrc522_set_min_level (mfrc522_handle_t *handle, uint8_t level)
 set the min level More...
 
uint8_t mfrc522_get_min_level (mfrc522_handle_t *handle, uint8_t *level)
 get the min level More...
 
uint8_t mfrc522_set_collision_level (mfrc522_handle_t *handle, uint8_t level)
 set the collision level More...
 
uint8_t mfrc522_get_collision_level (mfrc522_handle_t *handle, uint8_t *level)
 get the collision level More...
 
uint8_t mfrc522_set_channel_reception (mfrc522_handle_t *handle, mfrc522_channel_reception_t reception)
 set the channel reception More...
 
uint8_t mfrc522_get_channel_reception (mfrc522_handle_t *handle, mfrc522_channel_reception_t *reception)
 get the channel reception More...
 
uint8_t mfrc522_set_fix_iq (mfrc522_handle_t *handle, mfrc522_bool_t enable)
 enable or disable fix iq More...
 
uint8_t mfrc522_get_fix_iq (mfrc522_handle_t *handle, mfrc522_bool_t *enable)
 get the fix iq status More...
 
uint8_t mfrc522_set_timer_prescal_even (mfrc522_handle_t *handle, mfrc522_bool_t enable)
 enable or disable timer prescal even More...
 
uint8_t mfrc522_get_timer_prescal_even (mfrc522_handle_t *handle, mfrc522_bool_t *enable)
 get the timer prescal even status More...
 
uint8_t mfrc522_set_timer_constant_reception (mfrc522_handle_t *handle, uint8_t t)
 set the timer constant reception More...
 
uint8_t mfrc522_get_timer_constant_reception (mfrc522_handle_t *handle, uint8_t *t)
 get the timer constant reception More...
 
uint8_t mfrc522_set_timer_constant_sync (mfrc522_handle_t *handle, uint8_t t)
 set the timer constant sync More...
 
uint8_t mfrc522_get_timer_constant_sync (mfrc522_handle_t *handle, uint8_t *t)
 get the timer constant sync More...
 
uint8_t mfrc522_set_tx_wait (mfrc522_handle_t *handle, uint8_t t)
 set the tx wait More...
 
uint8_t mfrc522_get_tx_wait (mfrc522_handle_t *handle, uint8_t *t)
 get the tx wait More...
 
uint8_t mfrc522_set_parity_disable (mfrc522_handle_t *handle, mfrc522_bool_t enable)
 enable or disable parity disable More...
 
uint8_t mfrc522_get_parity_disable (mfrc522_handle_t *handle, mfrc522_bool_t *enable)
 get the parity disable status More...
 
uint8_t mfrc522_set_serial_speed (mfrc522_handle_t *handle, uint8_t t0, uint8_t t1)
 set the serial speed More...
 
uint8_t mfrc522_get_serial_speed (mfrc522_handle_t *handle, uint8_t *t0, uint8_t *t1)
 get the serial speed More...
 
uint8_t mfrc522_get_crc (mfrc522_handle_t *handle, uint16_t *crc)
 get the crc More...
 
uint8_t mfrc522_set_modulation_width (mfrc522_handle_t *handle, uint8_t width)
 set the modulation width More...
 
uint8_t mfrc522_get_modulation_width (mfrc522_handle_t *handle, uint8_t *width)
 get the modulation width More...
 
uint8_t mfrc522_set_rx_gain (mfrc522_handle_t *handle, mfrc522_rx_gain_t gain)
 set the rx gain More...
 
uint8_t mfrc522_get_rx_gain (mfrc522_handle_t *handle, mfrc522_rx_gain_t *gain)
 get the rx gain More...
 
uint8_t mfrc522_set_cwgsn (mfrc522_handle_t *handle, uint8_t n)
 set the cwgsn More...
 
uint8_t mfrc522_get_cwgsn (mfrc522_handle_t *handle, uint8_t *n)
 get the cwgsn More...
 
uint8_t mfrc522_set_modgsn (mfrc522_handle_t *handle, uint8_t n)
 set the modgsn More...
 
uint8_t mfrc522_get_modgsn (mfrc522_handle_t *handle, uint8_t *n)
 get the modgsn More...
 
uint8_t mfrc522_set_cwgsp (mfrc522_handle_t *handle, uint8_t n)
 set the cwgsp More...
 
uint8_t mfrc522_get_cwgsp (mfrc522_handle_t *handle, uint8_t *n)
 get the cwgsp More...
 
uint8_t mfrc522_set_modgsp (mfrc522_handle_t *handle, uint8_t n)
 set the modgsp More...
 
uint8_t mfrc522_get_modgsp (mfrc522_handle_t *handle, uint8_t *n)
 get the modgsp More...
 
uint8_t mfrc522_set_timer_auto (mfrc522_handle_t *handle, mfrc522_bool_t enable)
 enable or disable timer auto More...
 
uint8_t mfrc522_get_timer_auto (mfrc522_handle_t *handle, mfrc522_bool_t *enable)
 get the timer auto status More...
 
uint8_t mfrc522_set_timer_gated_mode (mfrc522_handle_t *handle, mfrc522_timer_gated_mode_t mode)
 set the timer gated mode More...
 
uint8_t mfrc522_get_timer_gated_mode (mfrc522_handle_t *handle, mfrc522_timer_gated_mode_t *mode)
 get the timer gated mode More...
 
uint8_t mfrc522_set_timer_auto_restart (mfrc522_handle_t *handle, mfrc522_bool_t enable)
 enable or disable timer auto restart More...
 
uint8_t mfrc522_get_timer_auto_restart (mfrc522_handle_t *handle, mfrc522_bool_t *enable)
 get the timer auto restart status More...
 
uint8_t mfrc522_set_timer_prescaler (mfrc522_handle_t *handle, uint16_t t)
 set the timer prescaler More...
 
uint8_t mfrc522_get_timer_prescaler (mfrc522_handle_t *handle, uint16_t *t)
 get the timer prescaler More...
 
uint8_t mfrc522_set_timer_reload (mfrc522_handle_t *handle, uint16_t reload)
 set the timer reload More...
 
uint8_t mfrc522_get_timer_reload (mfrc522_handle_t *handle, uint16_t *reload)
 get the timer reload More...
 
uint8_t mfrc522_get_timer_counter (mfrc522_handle_t *handle, uint16_t *cnt)
 get the timer counter More...
 
uint8_t mfrc522_set_test_bus_signal_1 (mfrc522_handle_t *handle, uint8_t s)
 set the test bus signal 1 More...
 
uint8_t mfrc522_get_test_bus_signal_1 (mfrc522_handle_t *handle, uint8_t *s)
 get the test bus signal 1 More...
 
uint8_t mfrc522_set_test_bus_signal_2 (mfrc522_handle_t *handle, uint8_t s)
 set the test bus signal 2 More...
 
uint8_t mfrc522_get_test_bus_signal_2 (mfrc522_handle_t *handle, uint8_t *s)
 get the test bus signal 2 More...
 
uint8_t mfrc522_set_test_bus_flip (mfrc522_handle_t *handle, mfrc522_bool_t enable)
 enable or disable test bus flip More...
 
uint8_t mfrc522_get_test_bus_flip (mfrc522_handle_t *handle, mfrc522_bool_t *enable)
 get the test bus flip status More...
 
uint8_t mfrc522_set_test_prbs9 (mfrc522_handle_t *handle, mfrc522_bool_t enable)
 enable or disable test prbs9 More...
 
uint8_t mfrc522_get_test_prbs9 (mfrc522_handle_t *handle, mfrc522_bool_t *enable)
 get the test prbs9 status More...
 
uint8_t mfrc522_set_test_prbs15 (mfrc522_handle_t *handle, mfrc522_bool_t enable)
 enable or disable test prbs15 More...
 
uint8_t mfrc522_get_test_prbs15 (mfrc522_handle_t *handle, mfrc522_bool_t *enable)
 get the test prbs15 status More...
 
uint8_t mfrc522_set_test_rs232_line (mfrc522_handle_t *handle, mfrc522_bool_t enable)
 enable or disable test rs232 line More...
 
uint8_t mfrc522_get_test_rs232_line (mfrc522_handle_t *handle, mfrc522_bool_t *enable)
 get the test rs232 line status More...
 
uint8_t mfrc522_set_test_pin_enable (mfrc522_handle_t *handle, uint8_t pin)
 set the test pin enable More...
 
uint8_t mfrc522_get_test_pin_enable (mfrc522_handle_t *handle, uint8_t *pin)
 get the test pin enable More...
 
uint8_t mfrc522_set_test_port_io (mfrc522_handle_t *handle, mfrc522_bool_t enable)
 enable or disable test port io More...
 
uint8_t mfrc522_get_test_port_io (mfrc522_handle_t *handle, mfrc522_bool_t *enable)
 get the test port io status More...
 
uint8_t mfrc522_set_test_pin_value (mfrc522_handle_t *handle, uint8_t value)
 set the test pin value More...
 
uint8_t mfrc522_get_test_pin_value (mfrc522_handle_t *handle, uint8_t *value)
 get the test pin value More...
 
uint8_t mfrc522_get_test_bus (mfrc522_handle_t *handle, uint8_t *bus)
 get the test bus More...
 
uint8_t mfrc522_set_test_amp_rcv (mfrc522_handle_t *handle, mfrc522_bool_t enable)
 enable or disable test amp rcv More...
 
uint8_t mfrc522_get_test_amp_rcv (mfrc522_handle_t *handle, mfrc522_bool_t *enable)
 get the test amp rcv status More...
 
uint8_t mfrc522_set_self_test (mfrc522_handle_t *handle, uint8_t test)
 set the self test More...
 
uint8_t mfrc522_get_self_test (mfrc522_handle_t *handle, uint8_t *test)
 get the self test More...
 
uint8_t mfrc522_get_version (mfrc522_handle_t *handle, uint8_t *id, uint8_t *version)
 get the version More...
 
uint8_t mfrc522_set_test_analog_control_aux_1 (mfrc522_handle_t *handle, mfrc522_test_analog_control_t control)
 set the test analog control aux 1 More...
 
uint8_t mfrc522_get_test_analog_control_aux_1 (mfrc522_handle_t *handle, mfrc522_test_analog_control_t *control)
 get the test analog control aux 1 More...
 
uint8_t mfrc522_set_test_analog_control_aux_2 (mfrc522_handle_t *handle, mfrc522_test_analog_control_t control)
 set the test analog control aux 2 More...
 
uint8_t mfrc522_get_test_analog_control_aux_2 (mfrc522_handle_t *handle, mfrc522_test_analog_control_t *control)
 get the test analog control aux 2 More...
 
uint8_t mfrc522_set_test_dac_1 (mfrc522_handle_t *handle, uint8_t dac)
 set the test dac 1 More...
 
uint8_t mfrc522_get_test_dac_1 (mfrc522_handle_t *handle, uint8_t *dac)
 get the test dac 1 More...
 
uint8_t mfrc522_set_test_dac_2 (mfrc522_handle_t *handle, uint8_t dac)
 set the test dac 2 More...
 
uint8_t mfrc522_get_test_dac_2 (mfrc522_handle_t *handle, uint8_t *dac)
 get the test dac 2 More...
 
uint8_t mfrc522_get_test_adc (mfrc522_handle_t *handle, uint8_t *adc_i, uint8_t *adc_q)
 get the test adc More...
 
uint8_t mfrc522_set_reg (mfrc522_handle_t *handle, uint8_t reg, uint8_t *buf, uint16_t len)
 set the chip register More...
 
uint8_t mfrc522_get_reg (mfrc522_handle_t *handle, uint8_t reg, uint8_t *buf, uint16_t len)
 get the chip register More...
 
uint8_t mfrc522_info (mfrc522_info_t *info)
 get chip information More...
 

Detailed Description

driver mfrc522 source file

Copyright (c) 2015 - present LibDriver All rights reserved

The MIT License (MIT)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Version
1.0.0
Author
Shifeng Li
Date
2022-05-31

history

Date Version Author Description
2022/05/31 1.0 Shifeng Li first upload

Definition in file driver_mfrc522.c.

Macro Definition Documentation

◆ CHIP_NAME

#define CHIP_NAME   "NXP MFRC522"

chip information definition

chip name

Definition at line 42 of file driver_mfrc522.c.

◆ DRIVER_VERSION

#define DRIVER_VERSION   1000

driver version

Definition at line 49 of file driver_mfrc522.c.

◆ MANUFACTURER_NAME

#define MANUFACTURER_NAME   "NXP"

manufacturer name

Definition at line 43 of file driver_mfrc522.c.

◆ MAX_CURRENT

#define MAX_CURRENT   100.0f

chip max current

Definition at line 46 of file driver_mfrc522.c.

◆ MFRC522_REG_ANALOG_TEST

#define MFRC522_REG_ANALOG_TEST   0x38

controls the pins AUX1 and AUX2 register

Definition at line 100 of file driver_mfrc522.c.

◆ MFRC522_REG_AUTO_TEST

#define MFRC522_REG_AUTO_TEST   0x36

controls the digital self test register

Definition at line 98 of file driver_mfrc522.c.

◆ MFRC522_REG_BIT_FRAMING

#define MFRC522_REG_BIT_FRAMING   0x0D

adjustments for bit-oriented frames register

Definition at line 66 of file driver_mfrc522.c.

◆ MFRC522_REG_COLL

#define MFRC522_REG_COLL   0x0E

bit position of the first bit-collision detected on the RF interface register

Definition at line 67 of file driver_mfrc522.c.

◆ MFRC522_REG_COMIEN

#define MFRC522_REG_COMIEN   0x02

enable and disable interrupt request control bits register

Definition at line 55 of file driver_mfrc522.c.

◆ MFRC522_REG_COMIRQ

#define MFRC522_REG_COMIRQ   0x04

interrupt request bits register

Definition at line 57 of file driver_mfrc522.c.

◆ MFRC522_REG_COMMAND

#define MFRC522_REG_COMMAND   0x01

chip register definition

starts and stops command execution register

Definition at line 54 of file driver_mfrc522.c.

◆ MFRC522_REG_CONTROL

#define MFRC522_REG_CONTROL   0x0C

miscellaneous control registers register

Definition at line 65 of file driver_mfrc522.c.

◆ MFRC522_REG_CRC_RESULT_H

#define MFRC522_REG_CRC_RESULT_H   0x21

shows the MSB and LSB values of the CRC calculation high register

Definition at line 80 of file driver_mfrc522.c.

◆ MFRC522_REG_CRC_RESULT_L

#define MFRC522_REG_CRC_RESULT_L   0x22

shows the MSB and LSB values of the CRC calculation low register

Definition at line 81 of file driver_mfrc522.c.

◆ MFRC522_REG_CWGSP

#define MFRC522_REG_CWGSP   0x28

defines the conductance of the p-driver output during periods of no modulation register

Definition at line 85 of file driver_mfrc522.c.

◆ MFRC522_REG_DEMOD

#define MFRC522_REG_DEMOD   0x19

defines demodulator settings register

Definition at line 76 of file driver_mfrc522.c.

◆ MFRC522_REG_DIVIEN

#define MFRC522_REG_DIVIEN   0x03

enable and disable interrupt request control bits register

Definition at line 56 of file driver_mfrc522.c.

◆ MFRC522_REG_DIVIRQ

#define MFRC522_REG_DIVIRQ   0x05

interrupt request bits register

Definition at line 58 of file driver_mfrc522.c.

◆ MFRC522_REG_ERROR

#define MFRC522_REG_ERROR   0x06

error bits showing the error status of the last command executed register

Definition at line 59 of file driver_mfrc522.c.

◆ MFRC522_REG_FIFO_DATA

#define MFRC522_REG_FIFO_DATA   0x09

input and output of 64 byte FIFO buffer register

Definition at line 62 of file driver_mfrc522.c.

◆ MFRC522_REG_FIFO_LEVEL

#define MFRC522_REG_FIFO_LEVEL   0x0A

number of bytes stored in the FIFO buffer register

Definition at line 63 of file driver_mfrc522.c.

◆ MFRC522_REG_GSN

#define MFRC522_REG_GSN   0x27

selects the conductance of the antenna driver pins TX1 and TX2 for modulation register

Definition at line 84 of file driver_mfrc522.c.

◆ MFRC522_REG_MFRX

#define MFRC522_REG_MFRX   0x1D

controls some MIFARE communication receive parameters register

Definition at line 78 of file driver_mfrc522.c.

◆ MFRC522_REG_MFTX

#define MFRC522_REG_MFTX   0x1C

controls some MIFARE communication transmit parameters register

Definition at line 77 of file driver_mfrc522.c.

◆ MFRC522_REG_MOD_WIDTH

#define MFRC522_REG_MOD_WIDTH   0x24

controls the ModWidth setting register

Definition at line 82 of file driver_mfrc522.c.

◆ MFRC522_REG_MODE

#define MFRC522_REG_MODE   0x11

defines general modes for transmitting and receiving register

Definition at line 68 of file driver_mfrc522.c.

◆ MFRC522_REG_MODGSP

#define MFRC522_REG_MODGSP   0x29

defines the conductance of the p-driver output during periods of modulation register

Definition at line 86 of file driver_mfrc522.c.

◆ MFRC522_REG_RFCFG

#define MFRC522_REG_RFCFG   0x26

configures the receiver gain register

Definition at line 83 of file driver_mfrc522.c.

◆ MFRC522_REG_RX_MODE

#define MFRC522_REG_RX_MODE   0x13

defines reception data rate and framing register

Definition at line 70 of file driver_mfrc522.c.

◆ MFRC522_REG_RX_SEL

#define MFRC522_REG_RX_SEL   0x17

selects internal receiver settings register

Definition at line 74 of file driver_mfrc522.c.

◆ MFRC522_REG_RX_THRESHOLD

#define MFRC522_REG_RX_THRESHOLD   0x18

selects thresholds for the bit decoder register

Definition at line 75 of file driver_mfrc522.c.

◆ MFRC522_REG_SERIAL_SPEED

#define MFRC522_REG_SERIAL_SPEED   0x1F

selects the speed of the serial UART interface register

Definition at line 79 of file driver_mfrc522.c.

◆ MFRC522_REG_STATUS1

#define MFRC522_REG_STATUS1   0x07

communication status bits register

Definition at line 60 of file driver_mfrc522.c.

◆ MFRC522_REG_STATUS2

#define MFRC522_REG_STATUS2   0x08

receiver and transmitter status bits register

Definition at line 61 of file driver_mfrc522.c.

◆ MFRC522_REG_TCOUNTER_VAL_H

#define MFRC522_REG_TCOUNTER_VAL_H   0x2E

shows the 16-bit timer value high register

Definition at line 91 of file driver_mfrc522.c.

◆ MFRC522_REG_TCOUNTER_VAL_L

#define MFRC522_REG_TCOUNTER_VAL_L   0x2F

shows the 16-bit timer value low register

Definition at line 92 of file driver_mfrc522.c.

◆ MFRC522_REG_TEST_ADC

#define MFRC522_REG_TEST_ADC   0x3B

shows the value of ADC I and Q channels register

Definition at line 103 of file driver_mfrc522.c.

◆ MFRC522_REG_TEST_BUS

#define MFRC522_REG_TEST_BUS   0x35

shows the status of the internal test bus register

Definition at line 97 of file driver_mfrc522.c.

◆ MFRC522_REG_TEST_DAC1

#define MFRC522_REG_TEST_DAC1   0x39

defines the test value for TestDAC1 register

Definition at line 101 of file driver_mfrc522.c.

◆ MFRC522_REG_TEST_DAC2

#define MFRC522_REG_TEST_DAC2   0x3A

defines the test value for TestDAC2 register

Definition at line 102 of file driver_mfrc522.c.

◆ MFRC522_REG_TEST_PIN_EN

#define MFRC522_REG_TEST_PIN_EN   0x33

enables pin output driver on pins D1 to D7 register

Definition at line 95 of file driver_mfrc522.c.

◆ MFRC522_REG_TEST_PIN_VALUE

#define MFRC522_REG_TEST_PIN_VALUE   0x34

defines the values for D1 to D7 when it is used as an I/O bus register

Definition at line 96 of file driver_mfrc522.c.

◆ MFRC522_REG_TEST_SEL1

#define MFRC522_REG_TEST_SEL1   0x31

general test signal configuration register

Definition at line 93 of file driver_mfrc522.c.

◆ MFRC522_REG_TEST_SEL2

#define MFRC522_REG_TEST_SEL2   0x32

general test signal configuration and PRBS control register

Definition at line 94 of file driver_mfrc522.c.

◆ MFRC522_REG_TMODE

#define MFRC522_REG_TMODE   0x2A

defines settings for the internal timer register

Definition at line 87 of file driver_mfrc522.c.

◆ MFRC522_REG_TPRESCALER

#define MFRC522_REG_TPRESCALER   0x2B

defines settings for the internal timer register

Definition at line 88 of file driver_mfrc522.c.

◆ MFRC522_REG_TRELOAD_H

#define MFRC522_REG_TRELOAD_H   0x2C

defines the 16-bit timer reload value high register

Definition at line 89 of file driver_mfrc522.c.

◆ MFRC522_REG_TRELOAD_L

#define MFRC522_REG_TRELOAD_L   0x2D

defines the 16-bit timer reload value low register

Definition at line 90 of file driver_mfrc522.c.

◆ MFRC522_REG_TX_ASK

#define MFRC522_REG_TX_ASK   0x15

controls the setting of the transmission modulation register

Definition at line 72 of file driver_mfrc522.c.

◆ MFRC522_REG_TX_CONTROL

#define MFRC522_REG_TX_CONTROL   0x14

controls the logical behavior of the antenna driver pins TX1 and TX 2 register

Definition at line 71 of file driver_mfrc522.c.

◆ MFRC522_REG_TX_MODE

#define MFRC522_REG_TX_MODE   0x12

defines transmission data rate and framing register

Definition at line 69 of file driver_mfrc522.c.

◆ MFRC522_REG_TX_SEL

#define MFRC522_REG_TX_SEL   0x16

selects the internal sources for the antenna driver register

Definition at line 73 of file driver_mfrc522.c.

◆ MFRC522_REG_VERSION

#define MFRC522_REG_VERSION   0x37

shows the software version register

Definition at line 99 of file driver_mfrc522.c.

◆ MFRC522_REG_WATER_LEVEL

#define MFRC522_REG_WATER_LEVEL   0x0B

level for FIFO underflow and overflow warning register

Definition at line 64 of file driver_mfrc522.c.

◆ SUPPLY_VOLTAGE_MAX

#define SUPPLY_VOLTAGE_MAX   3.6f

chip max supply voltage

Definition at line 45 of file driver_mfrc522.c.

◆ SUPPLY_VOLTAGE_MIN

#define SUPPLY_VOLTAGE_MIN   2.5f

chip min supply voltage

Definition at line 44 of file driver_mfrc522.c.

◆ TEMPERATURE_MAX

#define TEMPERATURE_MAX   85.0f

chip max operating temperature

Definition at line 48 of file driver_mfrc522.c.

◆ TEMPERATURE_MIN

#define TEMPERATURE_MIN   -25.0f

chip min operating temperature

Definition at line 47 of file driver_mfrc522.c.