nfc4 2.0.0.0
|
API for configuring and manipulating NFC 4 Click driver. More...
Topics | |
NFC 4 Registers List | |
List of registers of NFC 4 Click driver. | |
NFC 4 Registers Settings | |
Settings for registers of NFC 4 Click driver. | |
NFC 4 MikroBUS Map | |
MikroBUS pin mapping of NFC 4 Click driver. | |
Functions | |
void | nfc4_cfg_setup (nfc4_cfg_t *cfg) |
NFC 4 configuration object setup function. | |
void | nfc4_drv_interface_selection (nfc4_cfg_t *cfg, nfc4_drv_t drv_sel) |
NFC 4 driver interface setup function. | |
err_t | nfc4_init (nfc4_t *ctx, nfc4_cfg_t *cfg) |
NFC 4 initialization function. | |
err_t | nfc4_default_cfg (nfc4_t *ctx) |
NFC 4 default configuration function. | |
err_t | nfc4_generic_write (nfc4_t *ctx, uint8_t reg, uint8_t *data_in, uint16_t len) |
NFC 4 data writing function. | |
err_t | nfc4_generic_read (nfc4_t *ctx, uint8_t reg, uint8_t *data_out, uint16_t len) |
NFC 4 data reading function. | |
err_t | nfc4_send_direct_command (nfc4_t *ctx, uint8_t cmd) |
NFC 4 send direct command function. | |
err_t | nfc4_send_direct_command_with_result (nfc4_t *ctx, uint8_t cmd, uint8_t result_reg, uint32_t timeout, uint8_t *result) |
NFC 4 send direct command with result function. | |
err_t | nfc4_write_register (nfc4_t *ctx, uint8_t reg, uint8_t data_in) |
NFC 4 write register function. | |
err_t | nfc4_read_register (nfc4_t *ctx, uint8_t reg, uint8_t *data_out) |
NFC 4 read register function. | |
err_t | nfc4_write_multiple_registers (nfc4_t *ctx, uint8_t reg, uint8_t *data_in, uint16_t len) |
NFC 4 write multiple registers function. | |
err_t | nfc4_read_multiple_registers (nfc4_t *ctx, uint8_t reg, uint8_t *data_out, uint16_t len) |
NFC 4 read multiple registers function. | |
err_t | nfc4_clear_register_bits (nfc4_t *ctx, uint8_t reg, uint8_t clr_mask) |
NFC 4 clear register bits function. | |
err_t | nfc4_set_register_bits (nfc4_t *ctx, uint8_t reg, uint8_t set_mask) |
NFC 4 set register bits function. | |
err_t | nfc4_modify_register_bits (nfc4_t *ctx, uint8_t reg, uint8_t clr_mask, uint8_t set_mask) |
NFC 4 modify register bits function. | |
err_t | nfc4_write_fifo (nfc4_t *ctx, uint8_t *data_in, uint16_t len) |
NFC 4 write fifo function. | |
err_t | nfc4_read_fifo (nfc4_t *ctx, uint8_t *data_out, uint16_t len) |
NFC 4 read fifo function. | |
err_t | nfc4_write_test_register (nfc4_t *ctx, uint8_t reg, uint8_t data_in) |
NFC 4 write test register function. | |
err_t | nfc4_read_test_register (nfc4_t *ctx, uint8_t reg, uint8_t *data_out) |
NFC 4 read test register function. | |
err_t | nfc4_modify_test_register_bits (nfc4_t *ctx, uint8_t reg, uint8_t clr_mask, uint8_t set_mask) |
NFC 4 modify test register bits function. | |
err_t | nfc4_enable_interrupt (nfc4_t *ctx, uint32_t mask) |
NFC 4 enable interrupt function. | |
err_t | nfc4_disable_interrupt (nfc4_t *ctx, uint32_t mask) |
NFC 4 disable interrupt function. | |
err_t | nfc4_clear_interrupts (nfc4_t *ctx) |
NFC 4 clear interrupts function. | |
err_t | nfc4_check_for_received_interrupts (nfc4_t *ctx) |
NFC 4 check for received interrupts function. | |
uint32_t | nfc4_wait_for_interrupt (nfc4_t *ctx, uint32_t mask, uint32_t timeout) |
NFC 4 wait for interrupt function. | |
uint32_t | nfc4_get_interrupt (nfc4_t *ctx, uint32_t mask) |
NFC 4 get interrupt function. | |
err_t | nfc4_check_chip_id (nfc4_t *ctx, uint8_t *revision) |
NFC 4 check chip ID function. | |
err_t | nfc4_enable_osc (nfc4_t *ctx) |
NFC 4 enable oscillator and regulator function. | |
err_t | nfc4_measure_voltage (nfc4_t *ctx, uint8_t mpsv_src, uint16_t *res_mv) |
NFC 4 measure voltage function. | |
uint8_t | nfc4_get_irq_pin (nfc4_t *ctx) |
NFC 4 get irq pin function. | |
err_t | nfc4_get_mifare_tag_uid (nfc4_t *ctx, uint8_t *uid, uint8_t *uid_len) |
NFC 4 get mifare tag UID function. | |
API for configuring and manipulating NFC 4 Click driver.
Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.
void nfc4_cfg_setup | ( | nfc4_cfg_t * | cfg | ) |
NFC 4 configuration object setup function.
This function initializes click configuration structure to initial values.
[out] | cfg | : Click configuration structure. See nfc4_cfg_t object definition for detailed explanation. |
err_t nfc4_check_chip_id | ( | nfc4_t * | ctx, |
uint8_t * | revision ) |
NFC 4 check chip ID function.
This function checks if the chip ID is as expected. 5 bit IC type code for ST25R3916: 00101, the 3 lsb contain the IC revision code.
[in] | ctx | : Click context object. See nfc4_t object definition for detailed explanation. |
[out] | revision | : The IC revision code. |
0
- Success, -1
- Error.err_t nfc4_check_for_received_interrupts | ( | nfc4_t * | ctx | ) |
NFC 4 check for received interrupts function.
This function checks the received interrupts and saves the result into the int_status variable of the click context object structure.
[in] | ctx | : Click context object. See nfc4_t object definition for detailed explanation. |
0
- Success, -1
- Error.err_t nfc4_clear_interrupts | ( | nfc4_t * | ctx | ) |
NFC 4 clear interrupts function.
This function clears all interrupt flags.
[in] | ctx | : Click context object. See nfc4_t object definition for detailed explanation. |
0
- Success, -1
- Error.err_t nfc4_clear_register_bits | ( | nfc4_t * | ctx, |
uint8_t | reg, | ||
uint8_t | clr_mask ) |
NFC 4 clear register bits function.
This function clears the given bitmask on the selected register.
[in] | ctx | : Click context object. See nfc4_t object definition for detailed explanation. |
[in] | reg | : Register address. |
[in] | clr_mask | : Bitmask of bits to be cleared. |
0
- Success, -1
- Error.err_t nfc4_default_cfg | ( | nfc4_t * | ctx | ) |
NFC 4 default configuration function.
This function executes a default configuration of NFC 4 click board.
[in] | ctx | : Click context object. See nfc4_t object definition for detailed explanation. |
0
- Success, -1
- Error.err_t nfc4_disable_interrupt | ( | nfc4_t * | ctx, |
uint32_t | mask ) |
NFC 4 disable interrupt function.
This function disables all interrupts given by mask, NFC4_IRQ_MASK_ALL disables all interrupts.
[in] | ctx | : Click context object. See nfc4_t object definition for detailed explanation. |
[in] | mask | : Mask indicating the interrupts to be disabled. |
0
- Success, -1
- Error.void nfc4_drv_interface_selection | ( | nfc4_cfg_t * | cfg, |
nfc4_drv_t | drv_sel ) |
NFC 4 driver interface setup function.
This function sets a serial driver interface which will be used further in the click driver.
[out] | cfg | : Click configuration structure. See nfc4_cfg_t object definition for detailed explanation. |
[in] | drv_sel | : Driver interface selection. See nfc4_drv_t object definition for detailed explanation. |
err_t nfc4_enable_interrupt | ( | nfc4_t * | ctx, |
uint32_t | mask ) |
NFC 4 enable interrupt function.
This function enables all interrupts given by mask, NFC4_IRQ_MASK_ALL enables all interrupts.
[in] | ctx | : Click context object. See nfc4_t object definition for detailed explanation. |
[in] | mask | : Mask indicating the interrupts to be enabled. |
0
- Success, -1
- Error.err_t nfc4_enable_osc | ( | nfc4_t * | ctx | ) |
NFC 4 enable oscillator and regulator function.
This function turns on oscillator and regulator and waits for the oscillator to become stable.
[in] | ctx | : Click context object. See nfc4_t object definition for detailed explanation. |
0
- Success, -1
- Error.err_t nfc4_generic_read | ( | nfc4_t * | ctx, |
uint8_t | reg, | ||
uint8_t * | data_out, | ||
uint16_t | len ) |
NFC 4 data reading function.
This function reads a desired number of data bytes starting from the selected register.
[in] | ctx | : Click context object. See nfc4_t object definition for detailed explanation. |
[in] | reg | : Start register address. |
[out] | data_out | : Output read data. |
[in] | len | : Number of bytes to be read. |
0
- Success, -1
- Error.err_t nfc4_generic_write | ( | nfc4_t * | ctx, |
uint8_t | reg, | ||
uint8_t * | data_in, | ||
uint16_t | len ) |
NFC 4 data writing function.
This function writes a desired number of data bytes starting from the selected register.
[in] | ctx | : Click context object. See nfc4_t object definition for detailed explanation. |
[in] | reg | : Start register address. |
[in] | data_in | : Data to be written. |
[in] | len | : Number of bytes to be written. |
0
- Success, -1
- Error.uint32_t nfc4_get_interrupt | ( | nfc4_t * | ctx, |
uint32_t | mask ) |
NFC 4 get interrupt function.
This function is used to check whether the interrupt given by mask is set in the int_status variable of the click context object structure. If yes the interrupt gets cleared. This function returns only status bits which are inside mask.
[in] | ctx | : Click context object. See nfc4_t object definition for detailed explanation. |
[in] | mask | : Mask indicating the interrupts to check for. |
0
- Success, -1
- Error.uint8_t nfc4_get_irq_pin | ( | nfc4_t * | ctx | ) |
NFC 4 get irq pin function.
This function returns the IRQ pin logic state.
[in] | ctx | : Click context object. See nfc4_t object definition for detailed explanation. |
err_t nfc4_get_mifare_tag_uid | ( | nfc4_t * | ctx, |
uint8_t * | uid, | ||
uint8_t * | uid_len ) |
NFC 4 get mifare tag UID function.
This function reads the UID of a mifare tag.
[in] | ctx | : Click context object. See nfc4_t object definition for detailed explanation. |
[out] | uid | : Mifare tag UID (up to 10 bytes). |
[out] | uid_len | : Tag UID length in bytes. |
0
- Success - Tag UID read successfully, -1
- Error - There's no tag detected.err_t nfc4_init | ( | nfc4_t * | ctx, |
nfc4_cfg_t * | cfg ) |
NFC 4 initialization function.
This function initializes all necessary pins and peripherals used for this click board.
[out] | ctx | : Click context object. See nfc4_t object definition for detailed explanation. |
[in] | cfg | : Click configuration structure. See nfc4_cfg_t object definition for detailed explanation. |
0
- Success, -1
- Error.err_t nfc4_measure_voltage | ( | nfc4_t * | ctx, |
uint8_t | mpsv_src, | ||
uint16_t * | res_mv ) |
NFC 4 measure voltage function.
This function measures the voltage on one of VDD and VDD_* and returns the result in mV.
[in] | ctx | : Click context object. See nfc4_t object definition for detailed explanation. |
[in] | mpsv_src | : one of NFC4_REGULATOR_CTRL_MPSV_VDD, NFC4_REGULATOR_CTRL_MPSV_VDD_A, NFC4_REGULATOR_CTRL_MPSV_VDD_D, NFC4_REGULATOR_CTRL_MPSV_VDD_RF, NFC4_REGULATOR_CTRL_MPSV_VDD_AM. |
[out] | res_mv | : The measured voltage in mV. |
0
- Success, -1
- Error.err_t nfc4_modify_register_bits | ( | nfc4_t * | ctx, |
uint8_t | reg, | ||
uint8_t | clr_mask, | ||
uint8_t | set_mask ) |
NFC 4 modify register bits function.
This function modifies desired bits of the selected register.
[in] | ctx | : Click context object. See nfc4_t object definition for detailed explanation. |
[in] | reg | : Register address. |
[in] | clr_mask | : Bitmask of bits to be cleared. |
[in] | set_mask | : Bitmask of bits to be set. |
0
- Success, -1
- Error.err_t nfc4_modify_test_register_bits | ( | nfc4_t * | ctx, |
uint8_t | reg, | ||
uint8_t | clr_mask, | ||
uint8_t | set_mask ) |
NFC 4 modify test register bits function.
This function modifies desired bits of the selected test register.
[in] | ctx | : Click context object. See nfc4_t object definition for detailed explanation. |
[in] | reg | : Test register address. |
[in] | clr_mask | : Bitmask of bits to be cleared. |
[in] | set_mask | : Bitmask of bits to be set. |
0
- Success, -1
- Error.err_t nfc4_read_fifo | ( | nfc4_t * | ctx, |
uint8_t * | data_out, | ||
uint16_t | len ) |
NFC 4 read fifo function.
This function reads a desired number of data bytes from FIFO.
[in] | ctx | : Click context object. See nfc4_t object definition for detailed explanation. |
[out] | data_out | : Output read data. |
[in] | len | : Number of data bytes (up to 512). |
0
- Success, -1
- Error.err_t nfc4_read_multiple_registers | ( | nfc4_t * | ctx, |
uint8_t | reg, | ||
uint8_t * | data_out, | ||
uint16_t | len ) |
NFC 4 read multiple registers function.
This function reads a desired number of data bytes starting from the selected register.
[in] | ctx | : Click context object. See nfc4_t object definition for detailed explanation. |
[in] | reg | : Start register address. |
[out] | data_out | : Output read data. |
[in] | len | : Number of bytes to be read. |
0
- Success, -1
- Error.err_t nfc4_read_register | ( | nfc4_t * | ctx, |
uint8_t | reg, | ||
uint8_t * | data_out ) |
NFC 4 read register function.
This function reads a desired data from the selected register.
[in] | ctx | : Click context object. See nfc4_t object definition for detailed explanation. |
[in] | reg | : Register address. |
[out] | data_out | : Output data read. |
0
- Success, -1
- Error.err_t nfc4_read_test_register | ( | nfc4_t * | ctx, |
uint8_t | reg, | ||
uint8_t * | data_out ) |
NFC 4 read test register function.
This function reads a desired data from the selected test register.
[in] | ctx | : Click context object. See nfc4_t object definition for detailed explanation. |
[in] | reg | : Test register address. |
[out] | data_out | : Output data read. |
0
- Success, -1
- Error.err_t nfc4_send_direct_command | ( | nfc4_t * | ctx, |
uint8_t | cmd ) |
NFC 4 send direct command function.
This function is used to start so-called direct command. These commands are implemented inside the chip and each command has unique code (see datasheet).
[in] | ctx | : Click context object. See nfc4_t object definition for detailed explanation. |
[in] | cmd | : Code of the direct command to be executed. |
0
- Success, -1
- Error.err_t nfc4_send_direct_command_with_result | ( | nfc4_t * | ctx, |
uint8_t | cmd, | ||
uint8_t | result_reg, | ||
uint32_t | timeout, | ||
uint8_t * | result ) |
NFC 4 send direct command with result function.
This function executes the direct command given by cmd waits for timeout for I_dct and returns the result read from register result_reg. The value of cmd is not checked.
[in] | ctx | : Click context object. See nfc4_t object definition for detailed explanation. |
[in] | cmd | : Code of the direct command to be executed. |
[in] | result_reg | : Address of the register containing the result. |
[in] | timeout | : Time in microseconds to wait before reading the result. |
[out] | result | Result. |
0
- Success, -1
- Error.err_t nfc4_set_register_bits | ( | nfc4_t * | ctx, |
uint8_t | reg, | ||
uint8_t | set_mask ) |
NFC 4 set register bits function.
This function sets the given bitmask on the selected register.
[in] | ctx | : Click context object. See nfc4_t object definition for detailed explanation. |
[in] | reg | : Register address. |
[in] | set_mask | : Bitmask of bits to be set. |
0
- Success, -1
- Error.uint32_t nfc4_wait_for_interrupt | ( | nfc4_t * | ctx, |
uint32_t | mask, | ||
uint32_t | timeout ) |
NFC 4 wait for interrupt function.
This function checks the received interrupts and waits for maximal timeout ( microseconds ) for the first interrupt indicated with mask to occur.
[in] | ctx | : Click context object. See nfc4_t object definition for detailed explanation. |
[in] | mask | : Mask indicating the interrupts to wait for. |
[in] | timeout | : Time in microseconds until timeout occurs. |
0
- Success, -1
- Error.err_t nfc4_write_fifo | ( | nfc4_t * | ctx, |
uint8_t * | data_in, | ||
uint16_t | len ) |
NFC 4 write fifo function.
This function writes a desired number of data bytes to FIFO.
[in] | ctx | : Click context object. See nfc4_t object definition for detailed explanation. |
[in] | data_in | : Data to be written. |
[in] | len | : Number of data bytes (up to 512). |
0
- Success, -1
- Error.err_t nfc4_write_multiple_registers | ( | nfc4_t * | ctx, |
uint8_t | reg, | ||
uint8_t * | data_in, | ||
uint16_t | len ) |
NFC 4 write multiple registers function.
This function writes a desired number of data bytes starting from the selected register.
[in] | ctx | : Click context object. See nfc4_t object definition for detailed explanation. |
[in] | reg | : Start register address. |
[in] | data_in | : Data to be written. |
[in] | len | : Number of bytes to be written. |
0
- Success, -1
- Error.err_t nfc4_write_register | ( | nfc4_t * | ctx, |
uint8_t | reg, | ||
uint8_t | data_in ) |
NFC 4 write register function.
This function writes a desired data to the selected register.
[in] | ctx | : Click context object. See nfc4_t object definition for detailed explanation. |
[in] | reg | : Register address. |
[in] | data_in | : Data to be written. |
0
- Success, -1
- Error.err_t nfc4_write_test_register | ( | nfc4_t * | ctx, |
uint8_t | reg, | ||
uint8_t | data_in ) |
NFC 4 write test register function.
This function writes a desired data to the selected test register.
[in] | ctx | : Click context object. See nfc4_t object definition for detailed explanation. |
[in] | reg | : Test register address. |
[in] | data_in | : Data to be written. |
0
- Success, -1
- Error.