tfmini 2.0.0.0
TFmini Click Driver

API for configuring and manipulating TFmini Click driver. More...

Topics

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

Functions

void tfmini_cfg_setup (tfmini_cfg_t *cfg)
 TFmini configuration object setup function.
 
void tfmini_drv_interface_selection (tfmini_cfg_t *cfg, tfmini_drv_t drv_sel)
 TFmini driver interface setup function.
 
err_t tfmini_init (tfmini_t *ctx, tfmini_cfg_t *cfg)
 TFmini initialization function.
 
err_t tfmini_default_cfg (tfmini_t *ctx)
 TFmini default configuration function.
 
err_t tfmini_send_frame (tfmini_t *ctx, tfmini_frame_t frame)
 TFmini send frame function.
 
err_t tfmini_get_response (tfmini_t *ctx, tfmini_frame_t *frame)
 TFmini get response function.
 
err_t tfmini_get_firmware_version (tfmini_t *ctx, uint32_t *fw_version)
 TFmini get firmware version function.
 
err_t tfmini_system_reset (tfmini_t *ctx)
 TFmini system reset function.
 
err_t tfmini_set_frame_rate (tfmini_t *ctx, uint16_t frame_rate)
 TFmini set frame rate function.
 
err_t tfmini_change_interface (tfmini_t *ctx, tfmini_drv_t drv_sel)
 TFmini change interface function.
 
err_t tfmini_factory_default (tfmini_t *ctx)
 TFmini factory default function.
 
err_t tfmini_save_settings (tfmini_t *ctx)
 TFmini save settings function.
 
err_t tfmini_get_measurement (tfmini_t *ctx, int16_t *distance, int16_t *strength, float *temperature)
 TFmini get measurement function.
 

Detailed Description

API for configuring and manipulating TFmini 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

◆ tfmini_cfg_setup()

void tfmini_cfg_setup ( tfmini_cfg_t * cfg)

TFmini configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ tfmini_change_interface()

err_t tfmini_change_interface ( tfmini_t * ctx,
tfmini_drv_t drv_sel )

TFmini change interface function.

This function sets the communication interface bit of the appropriate register.

Parameters
[in]ctx: Click context object. See tfmini_t object definition for detailed explanation.
[in]drv_sel: Driver interface selection. See tfmini_drv_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
A tfmini_save_settings command must be executed after this function call in order for the changes to take efect. After changing the communication interface reprogram the board with a properly interface selected using tfmini_drv_interface_selection function, and make sure to set the click onboard switch for the proper communication interface.

◆ tfmini_default_cfg()

err_t tfmini_default_cfg ( tfmini_t * ctx)

TFmini default configuration function.

This function executes a default configuration of TFmini click board.

Parameters
[in]ctx: Click context object. See tfmini_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
This function can consist any necessary configuration or setting to put device into operating mode.

◆ tfmini_drv_interface_selection()

void tfmini_drv_interface_selection ( tfmini_cfg_t * cfg,
tfmini_drv_t drv_sel )

TFmini driver interface setup function.

This function sets a serial driver interface which will be used further in the click driver.

Parameters
[out]cfg: Click configuration structure. See tfmini_cfg_t object definition for detailed explanation.
[in]drv_sel: Driver interface selection. See tfmini_drv_t object definition for detailed explanation.
Returns
Nothing.
Note
This driver selection should be call before init function to configure the driver to work with the serial interface which is consistent with the real state of the hardware. If this function is not called, the default driver interface will be set.

◆ tfmini_factory_default()

err_t tfmini_factory_default ( tfmini_t * ctx)

TFmini factory default function.

This function resets the system to factory settings by issuing the factory default command.

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

◆ tfmini_get_firmware_version()

err_t tfmini_get_firmware_version ( tfmini_t * ctx,
uint32_t * fw_version )

TFmini get firmware version function.

This function reads the sensor firmware version.

Parameters
[in]ctx: Click context object. See tfmini_t object definition for detailed explanation.
[out]fw_version: 24bit firmware version value in form V3V2V1.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ tfmini_get_measurement()

err_t tfmini_get_measurement ( tfmini_t * ctx,
int16_t * distance,
int16_t * strength,
float * temperature )

TFmini get measurement function.

This function reads the output data frame and obtains the distance, strength and temperature values from it.

Parameters
[in]ctx: Click context object. See tfmini_t object definition for detailed explanation.
[out]distance: Target object distance in cm.
[out]strength: Signal strength [0-65535].
[out]temperature: Sensor internal temperature in Celsius.
Returns
  • 0 - Success,
  • -1 - Error or low signal strength,
  • -2 - Signal strength saturation,
  • -4 - Ambient light saturation,
  • -5 - No header found,
  • -6 - Wrong checksum.
See #err_t definition for detailed explanation.
Note
None.

◆ tfmini_get_response()

err_t tfmini_get_response ( tfmini_t * ctx,
tfmini_frame_t * frame )

TFmini get response function.

This function reads the command response frame of the sensor.

Parameters
[in]ctx: Click context object. See tfmini_t object definition for detailed explanation.
[out]frame: Command response frame. See tfmini_frame_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error,
  • -5 - No header found,
  • -6 - Wrong checksum.
See #err_t definition for detailed explanation.
Note
None.

◆ tfmini_init()

err_t tfmini_init ( tfmini_t * ctx,
tfmini_cfg_t * cfg )

TFmini initialization function.

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

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

◆ tfmini_save_settings()

err_t tfmini_save_settings ( tfmini_t * ctx)

TFmini save settings function.

This function issues the save settings command.

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

◆ tfmini_send_frame()

err_t tfmini_send_frame ( tfmini_t * ctx,
tfmini_frame_t frame )

TFmini send frame function.

This function sends a command frame to the sensor.

Parameters
[in]ctx: Click context object. See tfmini_t object definition for detailed explanation.
[in]frame: Command frame. See tfmini_frame_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ tfmini_set_frame_rate()

err_t tfmini_set_frame_rate ( tfmini_t * ctx,
uint16_t frame_rate )

TFmini set frame rate function.

This function sets the output data frame rate.

Parameters
[in]ctx: Click context object. See tfmini_t object definition for detailed explanation.
[in]frame_rate: Output data frame rate in Hz.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ tfmini_system_reset()

err_t tfmini_system_reset ( tfmini_t * ctx)

TFmini system reset function.

This function resets the system by issuing the system reset command.

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