smartdof4 2.1.0.0
Loading...
Searching...
No Matches
Smart DOF 4 Click Driver

API for configuring and manipulating Smart DOF 4 Click driver. More...

Topics

 Smart DOF 4 Registers List
 List of registers of Smart DOF 4 Click driver.
 
 Smart DOF 4 Registers Settings
 Settings for registers of Smart DOF 4 Click driver.
 
 Smart DOF 4 MikroBUS Map
 MikroBUS pin mapping of Smart DOF 4 Click driver.
 

Functions

void smartdof4_cfg_setup (smartdof4_cfg_t *cfg)
 Smart DOF 4 configuration object setup function.
 
void smartdof4_drv_interface_sel (smartdof4_cfg_t *cfg, smartdof4_drv_t drv_sel)
 Smart DOF 4 driver interface setup function.
 
err_t smartdof4_init (smartdof4_t *ctx, smartdof4_cfg_t *cfg)
 Smart DOF 4 initialization function.
 
err_t smartdof4_default_cfg (smartdof4_t *ctx)
 Smart DOF 4 default configuration function.
 
err_t smartdof4_send_packet (smartdof4_t *ctx, uint8_t ch_num, uint8_t *payload, uint16_t len)
 Smart DOF 4 send packet function.
 
err_t smartdof4_read_packet (smartdof4_t *ctx)
 Smart DOF 4 read packet function.
 
void smartdof4_set_rst_pin (smartdof4_t *ctx, uint8_t state)
 Smart DOF 4 set rst pin function.
 
void smartdof4_set_wup_pin (smartdof4_t *ctx, uint8_t state)
 Smart DOF 4 set wup pin function.
 
uint8_t smartdof4_get_int_pin (smartdof4_t *ctx)
 Smart DOF 4 get int pin function.
 
void smartdof4_reset_device (smartdof4_t *ctx)
 Smart DOF 4 reset device function.
 
err_t smartdof4_wait_ready (smartdof4_t *ctx, uint16_t timeout_ms)
 Smart DOF 4 wait ready function.
 
err_t smartdof4_read_pid (smartdof4_t *ctx, smartdof4_pid_t *pid)
 Smart DOF 4 read pid function.
 
err_t smartdof4_frs_wr_req (smartdof4_t *ctx, uint16_t rec_id, uint16_t len)
 Smart DOF 4 frs wr req function.
 
err_t smartdof4_frs_wr_data_req (smartdof4_t *ctx, uint16_t offset, uint32_t data0_in, uint32_t data1_in)
 Smart DOF 4 frs wr data req function.
 
err_t smartdof4_frs_wr_resp (smartdof4_t *ctx, uint16_t *offset, uint8_t *status)
 Smart DOF 4 frs wr resp function.
 
err_t smartdof4_frs_rd_req (smartdof4_t *ctx, uint16_t rec_id)
 Smart DOF 4 frs rd req function.
 
err_t smartdof4_frs_rd_resp (smartdof4_t *ctx, uint16_t *offset, uint8_t *status, uint32_t *data0_out, uint32_t *data1_out, uint16_t *rec_id)
 Smart DOF 4 frs rd resp function.
 
err_t smartdof4_cmd_req (smartdof4_t *ctx, uint8_t cmd, uint8_t *params)
 Smart DOF 4 cmd req function.
 
err_t smartdof4_cmd_resp (smartdof4_t *ctx, uint8_t *cmd, uint8_t *params)
 Smart DOF 4 cmd resp function.
 
err_t smartdof4_feature_req (smartdof4_t *ctx, uint8_t rep_id)
 Smart DOF 4 feature req function.
 
err_t smartdof4_feature_set (smartdof4_t *ctx, smartdof4_feature_t *feat)
 Smart DOF 4 feature set function.
 
err_t smartdof4_feature_resp (smartdof4_t *ctx, smartdof4_feature_t *feat)
 Smart DOF 4 feature resp function.
 
err_t smartdof4_read_data (smartdof4_t *ctx, smartdof4_axis_t *accel, smartdof4_axis_t *gyro, smartdof4_axis_t *mag)
 Smart DOF 4 read data function.
 

Detailed Description

API for configuring and manipulating Smart DOF 4 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

◆ smartdof4_cfg_setup()

void smartdof4_cfg_setup ( smartdof4_cfg_t * cfg)

Smart DOF 4 configuration object setup function.

This function initializes Click configuration structure to initial values.

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

◆ smartdof4_cmd_req()

err_t smartdof4_cmd_req ( smartdof4_t * ctx,
uint8_t cmd,
uint8_t * params )

Smart DOF 4 cmd req function.

This function sends a CMD request with specified command parameters.

Parameters
[in]ctx: Click context object. See smartdof4_t object definition for detailed explanation.
[in]cmd: Command byte.
[in]params: 9 bytes command parameters.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ smartdof4_cmd_resp()

err_t smartdof4_cmd_resp ( smartdof4_t * ctx,
uint8_t * cmd,
uint8_t * params )

Smart DOF 4 cmd resp function.

This function reads the command response with parameters.

Parameters
[in]ctx: Click context object. See smartdof4_t object definition for detailed explanation.
[out]cmd: Command byte.
[out]params: 11 bytes command parameters.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ smartdof4_default_cfg()

err_t smartdof4_default_cfg ( smartdof4_t * ctx)

Smart DOF 4 default configuration function.

This function executes a default configuration of Smart DOF 4 Click board.

Parameters
[in]ctx: Click context object. See smartdof4_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.

◆ smartdof4_drv_interface_sel()

void smartdof4_drv_interface_sel ( smartdof4_cfg_t * cfg,
smartdof4_drv_t drv_sel )

Smart DOF 4 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 smartdof4_cfg_t object definition for detailed explanation.
[in]drv_sel: Driver interface selection. See smartdof4_drv_t object definition for detailed explanation.
Returns
Nothing.
Note
This driver selection should be called 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.

◆ smartdof4_feature_req()

err_t smartdof4_feature_req ( smartdof4_t * ctx,
uint8_t rep_id )

Smart DOF 4 feature req function.

This function sends a get feature request for the selected report ID.

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

◆ smartdof4_feature_resp()

err_t smartdof4_feature_resp ( smartdof4_t * ctx,
smartdof4_feature_t * feat )

Smart DOF 4 feature resp function.

This function retrieves a full feature report that was requested.

Parameters
[in]ctx: Click context object. See smartdof4_t object definition for detailed explanation.
[out]feat: Feature report object. See smartdof4_feature_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ smartdof4_feature_set()

err_t smartdof4_feature_set ( smartdof4_t * ctx,
smartdof4_feature_t * feat )

Smart DOF 4 feature set function.

This function sets a full feature report.

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

◆ smartdof4_frs_rd_req()

err_t smartdof4_frs_rd_req ( smartdof4_t * ctx,
uint16_t rec_id )

Smart DOF 4 frs rd req function.

This function sends a FRS read request for the selected FRS record ID.

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

◆ smartdof4_frs_rd_resp()

err_t smartdof4_frs_rd_resp ( smartdof4_t * ctx,
uint16_t * offset,
uint8_t * status,
uint32_t * data0_out,
uint32_t * data1_out,
uint16_t * rec_id )

Smart DOF 4 frs rd resp function.

This function reads the contents of an FRS record.

Parameters
[in]ctx: Click context object. See smartdof4_t object definition for detailed explanation.
[out]offset: Offset, in 32-bit words, from the beginning of the record.
[out]status: Data Len / Status byte read.
[out]data0_out: 32-bit data 0 word read from the FRS record.
[out]data1_out: 32-bit data 1 word read from the FRS record.
[out]rec_id: FRS record ID read.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ smartdof4_frs_wr_data_req()

err_t smartdof4_frs_wr_data_req ( smartdof4_t * ctx,
uint16_t offset,
uint32_t data0_in,
uint32_t data1_in )

Smart DOF 4 frs wr data req function.

This function writes FRS data to the record indicated by a previous write request.

Parameters
[in]ctx: Click context object. See smartdof4_t object definition for detailed explanation.
[in]offset: Offset, in 32-bit words, from the beginning of the record.
[in]data0_in: 32-bit data 0 word to be written to the FRS record.
[in]data1_in: 32-bit data 1 word to be written to the FRS record.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ smartdof4_frs_wr_req()

err_t smartdof4_frs_wr_req ( smartdof4_t * ctx,
uint16_t rec_id,
uint16_t len )

Smart DOF 4 frs wr req function.

This function sends a FRS write request for the selected FRS record ID and length.

Parameters
[in]ctx: Click context object. See smartdof4_t object definition for detailed explanation.
[in]rec_id: FRS record ID.
[in]len: Length in 32-bit words of the record to be written.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ smartdof4_frs_wr_resp()

err_t smartdof4_frs_wr_resp ( smartdof4_t * ctx,
uint16_t * offset,
uint8_t * status )

Smart DOF 4 frs wr resp function.

This function reads the status of a FRS write operation.

Parameters
[in]ctx: Click context object. See smartdof4_t object definition for detailed explanation.
[out]offset: Offset, in 32-bit words, from the beginning of the record.
[out]status: Status/Error byte read.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ smartdof4_get_int_pin()

uint8_t smartdof4_get_int_pin ( smartdof4_t * ctx)

Smart DOF 4 get int pin function.

This function returns the INT pin logic state.

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

◆ smartdof4_init()

err_t smartdof4_init ( smartdof4_t * ctx,
smartdof4_cfg_t * cfg )

Smart DOF 4 initialization function.

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

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

◆ smartdof4_read_data()

err_t smartdof4_read_data ( smartdof4_t * ctx,
smartdof4_axis_t * accel,
smartdof4_axis_t * gyro,
smartdof4_axis_t * mag )

Smart DOF 4 read data function.

This function reads the accelerometer (g), gyroscope (dps), and magnetometer (uT) 3-axis data from input report.

Parameters
[in]ctx: Click context object. See smartdof4_t object definition for detailed explanation.
[out]accel: Accelerometer data [g]. See smartdof4_axis_t object definition for detailed explanation.
[out]gyro: Gyroscope data [dps]. See smartdof4_axis_t object definition for detailed explanation.
[out]mag: Magnetometer data [uT]. See smartdof4_axis_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ smartdof4_read_packet()

err_t smartdof4_read_packet ( smartdof4_t * ctx)

Smart DOF 4 read packet function.

This function waits for a data ready indication from INT pin, then reads the received SHTP packet and stores it in the ctx->shtp.

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

◆ smartdof4_read_pid()

err_t smartdof4_read_pid ( smartdof4_t * ctx,
smartdof4_pid_t * pid )

Smart DOF 4 read pid function.

This function reads the product ID information.

Parameters
[in]ctx: Click context object. See smartdof4_t object definition for detailed explanation.
[out]pid: Product ID information read. See smartdof4_pid_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ smartdof4_reset_device()

void smartdof4_reset_device ( smartdof4_t * ctx)

Smart DOF 4 reset device function.

This function resets the device by toggling the RST pin state.

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

◆ smartdof4_send_packet()

err_t smartdof4_send_packet ( smartdof4_t * ctx,
uint8_t ch_num,
uint8_t * payload,
uint16_t len )

Smart DOF 4 send packet function.

This function forms a SHTP packet and sends it over the serial interface.

Parameters
[in]ctx: Click context object. See smartdof4_t object definition for detailed explanation.
[in]ch_num: Channel number [0-5].
[in]payload: Data payload buffer.
[in]len: Number of payload bytes to be written (up to 128).
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ smartdof4_set_rst_pin()

void smartdof4_set_rst_pin ( smartdof4_t * ctx,
uint8_t state )

Smart DOF 4 set rst pin function.

This function sets the RST pin logic state.

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

◆ smartdof4_set_wup_pin()

void smartdof4_set_wup_pin ( smartdof4_t * ctx,
uint8_t state )

Smart DOF 4 set wup pin function.

This function sets the WUP pin logic state.

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

◆ smartdof4_wait_ready()

err_t smartdof4_wait_ready ( smartdof4_t * ctx,
uint16_t timeout_ms )

Smart DOF 4 wait ready function.

This function waits a desired period for a data ready indication from INT pin.

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