tfmini 2.0.0.0
tfmini.h File Reference

This file contains API for TFmini Click Driver. More...

#include "drv_digital_out.h"
#include "drv_digital_in.h"
#include "drv_i2c_master.h"
#include "drv_uart.h"

Go to the source code of this file.

Data Structures

struct  tfmini_frame_t
 TFmini Click command frame definition structure. More...
 
struct  tfmini_t
 TFmini Click context object. More...
 
struct  tfmini_cfg_t
 TFmini Click configuration object. More...
 

Macros

#define TFMINI_CMD_HEADER   0x5A
 TFmini command frame macros.
 
#define TFMINI_CMD_ID_FW_VERSION   0x01
 
#define TFMINI_CMD_ID_SYSTEM_RESET   0x02
 
#define TFMINI_CMD_ID_FRAME_RATE   0x03
 
#define TFMINI_CMD_ID_TRIGGER_DETECTION   0x04
 
#define TFMINI_CMD_ID_OUTPUT_FORMAT   0x05
 
#define TFMINI_CMD_ID_BAUD_RATE   0x06
 
#define TFMINI_CMD_ID_ENABLE_OUTPUT   0x07
 
#define TFMINI_CMD_ID_COM_SELECTION   0x0A
 
#define TFMINI_CMD_ID_SLAVE_ADDRESS   0x0B
 
#define TFMINI_CMD_ID_DATA_FRAME   0x00
 
#define TFMINI_CMD_ID_IO_MODE_ENABLE   0x3B
 
#define TFMINI_CMD_ID_RESTORE_FACTORY   0x10
 
#define TFMINI_CMD_ID_SAVE_SETTINGS   0x11
 
#define TFMINI_HEADER   0x59
 TFmini output data frame macros.
 
#define TFMINI_FRAME_SIZE   0x07
 
#define TFMINI_MAX_BYTES_BEFORE_HEADER   100
 
#define TFMINI_LOW_SIGNAL_STRENGTH   -1
 
#define TFMINI_SIGNAL_STRENGTH_SATURATION   -2
 
#define TFMINI_AMBIENT_LIGHT_SATURATION   -4
 
#define TFMINI_NO_HEADER_FOUND   -5
 
#define TFMINI_WRONG_CHECKSUM   -6
 
#define DRV_BUFFER_SIZE   500
 TFmini driver buffer size.
 
#define TFMINI_SET_DEV_ADDR   0x10
 TFmini device address setting.
 
#define TFMINI_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping.
 

Enumerations

enum  tfmini_drv_t { TFMINI_DRV_SEL_UART , TFMINI_DRV_SEL_I2C }
 TFmini Click driver selector. More...
 
enum  tfmini_return_value_t { TFMINI_OK = 0 , TFMINI_ERROR = -1 }
 TFmini Click return value data. More...
 

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

This file contains API for TFmini Click Driver.

Enumeration Type Documentation

◆ tfmini_drv_t

TFmini Click driver selector.

Selects target driver interface of TFmini Click driver.

Enumerator
TFMINI_DRV_SEL_UART 

UART driver descriptor.

TFMINI_DRV_SEL_I2C 

I2C driver descriptor.

◆ tfmini_return_value_t

TFmini Click return value data.

Predefined enum values for driver return values.

Enumerator
TFMINI_OK 
TFMINI_ERROR