smartnfc 2.2.0
Loading...
Searching...
No Matches
Smart NFC Click Driver

API for configuring and manipulating Smart NFC Click driver. More...

Topics

 Smart NFC Device Settings
 Settings for registers of Smart NFC Click driver.
 Smart NFC MikroBUS Map
 MikroBUS pin mapping of Smart NFC Click driver.

Functions

void smartnfc_cfg_setup (smartnfc_cfg_t *cfg)
 Smart NFC configuration object setup function.
err_t smartnfc_init (smartnfc_t *ctx, smartnfc_cfg_t *cfg)
 Smart NFC initialization function.
err_t smartnfc_generic_write (smartnfc_t *ctx, uint8_t *data_in, uint16_t len)
 Smart NFC data writing function.
err_t smartnfc_generic_read (smartnfc_t *ctx, uint8_t *data_out, uint16_t len)
 Smart NFC data reading function.
void smartnfc_set_rst_pin (smartnfc_t *ctx, uint8_t state)
 Smart NFC set RST pin function.
err_t smartnfc_reset_device (smartnfc_t *ctx)
 Smart NFC reset device function.
err_t smartnfc_send_frame (smartnfc_t *ctx)
 Smart NFC send frame function.
err_t smartnfc_read_frame (smartnfc_t *ctx)
 Smart NFC read frame function.
err_t smartnfc_read_ack_frame (smartnfc_t *ctx, uint8_t cmd)
 Smart NFC read ack frame function.
void smartnfc_clear_buffers (smartnfc_t *ctx)
 Smart NFC clear buffers function.

Detailed Description

API for configuring and manipulating Smart NFC Click driver.

Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.

Function Documentation

◆ smartnfc_cfg_setup()

void smartnfc_cfg_setup ( smartnfc_cfg_t * cfg)

Smart NFC configuration object setup function.

This function initializes Click configuration structure to initial values.

Parameters
[out]cfg: Click configuration structure. See smartnfc_cfg_t object definition for detailed explanation.
Returns
Nothing.
Note
The all used pins will be set to unconnected state.

◆ smartnfc_clear_buffers()

void smartnfc_clear_buffers ( smartnfc_t * ctx)

Smart NFC clear buffers function.

This function clears the ring buffers and the response frame object.

Parameters
[in]ctx: Click context object. See smartnfc_t object definition for detailed explanation.
Returns
None.
Note
None.

◆ smartnfc_generic_read()

err_t smartnfc_generic_read ( smartnfc_t * ctx,
uint8_t * data_out,
uint16_t len )

Smart NFC data reading function.

This function reads a desired number of data bytes by using UART serial interface.

Parameters
[in]ctx: Click context object. See smartnfc_t object definition for detailed explanation.
[out]data_out: Output read data.
[in]len: Number of bytes to be read.
Returns
  • >0 - Number of data bytes read,
  • <=0 - Error/Empty Ring buffer. See #err_t definition for detailed explanation.
Note
None.

◆ smartnfc_generic_write()

err_t smartnfc_generic_write ( smartnfc_t * ctx,
uint8_t * data_in,
uint16_t len )

Smart NFC data writing function.

This function writes a desired number of data bytes by using UART serial interface.

Parameters
[in]ctx: Click context object. See smartnfc_t object definition for detailed explanation.
[in]data_in: Data buffer for sending.
[in]len: Number of bytes for sending.
Returns
  • >=0 - Success,
  • <0 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ smartnfc_init()

err_t smartnfc_init ( smartnfc_t * ctx,
smartnfc_cfg_t * cfg )

Smart NFC initialization function.

This function initializes all necessary pins and peripherals used for this Click board.

Parameters
[out]ctx: Click context object. See smartnfc_t object definition for detailed explanation.
[in]cfg: Click configuration structure. See smartnfc_cfg_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ smartnfc_read_ack_frame()

err_t smartnfc_read_ack_frame ( smartnfc_t * ctx,
uint8_t cmd )

Smart NFC read ack frame function.

This function waits for the desired acknowledge frame to arrive and stores it in the Click context object.

Parameters
[in]ctx: Click context object. See smartnfc_t object definition for detailed explanation.
[in]cmd: Expected frame command byte.
Returns
  • 0 - Correct frame received,
  • -1 - Error.
Note
None.

◆ smartnfc_read_frame()

err_t smartnfc_read_frame ( smartnfc_t * ctx)

Smart NFC read frame function.

This function reads response frame from the ring buffer and stores it in the Click context object. It waits up to 1 second for a frame, and if there's no frame received it returns an error.

Parameters
[in]ctx: Click context object. See smartnfc_t object definition for detailed explanation.
Returns
  • 0 - Correct frame received,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ smartnfc_reset_device()

err_t smartnfc_reset_device ( smartnfc_t * ctx)

Smart NFC reset device function.

This function resets the device by toggling the reset pin logic state.

Parameters
[in]ctx: Click context object. See smartnfc_t object definition for detailed explanation.
Returns
  • 0 - Correct frame received,
  • -1 - Error.
Note
None.

◆ smartnfc_send_frame()

err_t smartnfc_send_frame ( smartnfc_t * ctx)

Smart NFC send frame function.

This function sends a desired command frame from the Click context object.

Parameters
[in]ctx: Click context object. See smartnfc_t object definition for detailed explanation.
Returns
  • 0 - Frame is sent,
  • -1 - Timeout error.
Note
None.

◆ smartnfc_set_rst_pin()

void smartnfc_set_rst_pin ( smartnfc_t * ctx,
uint8_t state )

Smart NFC set RST pin function.

This function sets the RESET pin logic state.

Parameters
[in]ctx: Click context object. See smartnfc_t object definition for detailed explanation.
[in]state: Pin logic state.
Returns
None.
Note
None.