lightranger9 2.0.0.0
LightRanger 9 Click Driver

API for configuring and manipulating LightRanger 9 Click driver. More...

Topics

 LightRanger 9 Registers List
 List of registers of LightRanger 9 Click driver.
 
 LightRanger 9 Registers Settings
 Settings for registers of LightRanger 9 Click driver.
 
 LightRanger 9 MikroBUS Map
 MikroBUS pin mapping of LightRanger 9 Click driver.
 

Functions

void lightranger9_cfg_setup (lightranger9_cfg_t *cfg)
 LightRanger 9 configuration object setup function.
 
err_t lightranger9_init (lightranger9_t *ctx, lightranger9_cfg_t *cfg)
 LightRanger 9 initialization function.
 
err_t lightranger9_default_cfg (lightranger9_t *ctx)
 LightRanger 9 default configuration function.
 
err_t lightranger9_generic_write (lightranger9_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
 LightRanger 9 I2C writing function.
 
err_t lightranger9_generic_read (lightranger9_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
 LightRanger 9 I2C reading function.
 
err_t lightranger9_write_register (lightranger9_t *ctx, uint8_t reg, uint8_t data_in)
 LightRanger 9 write register function.
 
err_t lightranger9_read_register (lightranger9_t *ctx, uint8_t reg, uint8_t *data_out)
 LightRanger 9 read register function.
 
err_t lightranger9_write_bl_cmd (lightranger9_t *ctx, uint8_t cmd, uint8_t *data_in, uint8_t len)
 LightRanger 9 write bl cmd function.
 
err_t lightranger9_read_bl_cmd_status (lightranger9_t *ctx, uint8_t *status)
 LightRanger 9 read bl cmd status function.
 
err_t lightranger9_check_communication (lightranger9_t *ctx)
 LightRanger 9 check communication function.
 
void lightranger9_set_gpio0_pin (lightranger9_t *ctx, uint8_t state)
 LightRanger 9 set gpio0 pin function.
 
void lightranger9_set_gpio1_pin (lightranger9_t *ctx, uint8_t state)
 LightRanger 9 set gpio1 pin function.
 
void lightranger9_enable_device (lightranger9_t *ctx)
 LightRanger 9 enable device function.
 
void lightranger9_disable_device (lightranger9_t *ctx)
 LightRanger 9 disable device function.
 
uint8_t lightranger9_get_int_pin (lightranger9_t *ctx)
 LightRanger 9 get int pin function.
 
err_t lightranger9_download_fw_bin (lightranger9_t *ctx)
 LightRanger 9 download fw bin function.
 
err_t lightranger9_clear_interrupts (lightranger9_t *ctx)
 LightRanger 9 clear interrupts function.
 
err_t lightranger9_get_capture (lightranger9_t *ctx, lightranger9_capture_t *capture)
 LightRanger 9 get capture function.
 

Detailed Description

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

◆ lightranger9_cfg_setup()

void lightranger9_cfg_setup ( lightranger9_cfg_t * cfg)

LightRanger 9 configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ lightranger9_check_communication()

err_t lightranger9_check_communication ( lightranger9_t * ctx)

LightRanger 9 check communication function.

This function checks the communication by reading and verifying the device ID.

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

◆ lightranger9_clear_interrupts()

err_t lightranger9_clear_interrupts ( lightranger9_t * ctx)

LightRanger 9 clear interrupts function.

This function reads and clears the interrupt status register.

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

◆ lightranger9_default_cfg()

err_t lightranger9_default_cfg ( lightranger9_t * ctx)

LightRanger 9 default configuration function.

This function executes a default configuration of LightRanger 9 click board.

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

◆ lightranger9_disable_device()

void lightranger9_disable_device ( lightranger9_t * ctx)

LightRanger 9 disable device function.

This function disables the device by setting the EN pin to low logic state.

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

◆ lightranger9_download_fw_bin()

err_t lightranger9_download_fw_bin ( lightranger9_t * ctx)

LightRanger 9 download fw bin function.

This function checks if the bootloader is running and then writes the tof_bin_image FW image to the device.

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

◆ lightranger9_enable_device()

void lightranger9_enable_device ( lightranger9_t * ctx)

LightRanger 9 enable device function.

This function enables the device by setting the EN pin to high logic state.

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

◆ lightranger9_generic_read()

err_t lightranger9_generic_read ( lightranger9_t * ctx,
uint8_t reg,
uint8_t * data_out,
uint8_t len )

LightRanger 9 I2C reading function.

This function reads a desired number of data bytes starting from the selected register by using I2C serial interface.

Parameters
[in]ctx: Click context object. See lightranger9_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.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ lightranger9_generic_write()

err_t lightranger9_generic_write ( lightranger9_t * ctx,
uint8_t reg,
uint8_t * data_in,
uint8_t len )

LightRanger 9 I2C writing function.

This function writes a desired number of data bytes starting from the selected register by using I2C serial interface.

Parameters
[in]ctx: Click context object. See lightranger9_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.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ lightranger9_get_capture()

err_t lightranger9_get_capture ( lightranger9_t * ctx,
lightranger9_capture_t * capture )

LightRanger 9 get capture function.

This function reads and parses a single sub-capture block of 132 bytes.

Parameters
[in]ctx: Click context object. See lightranger9_t object definition for detailed explanation.
[out]capture: Capture data object. See lightranger9_capture_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
Increase the LIGHTRANGER9_CONFIDENCE_THRESHOLD in order to improve the distance measurement accuracy.

◆ lightranger9_get_int_pin()

uint8_t lightranger9_get_int_pin ( lightranger9_t * ctx)

LightRanger 9 get int pin function.

This function returns the INT pin logic state.

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

◆ lightranger9_init()

err_t lightranger9_init ( lightranger9_t * ctx,
lightranger9_cfg_t * cfg )

LightRanger 9 initialization function.

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

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

◆ lightranger9_read_bl_cmd_status()

err_t lightranger9_read_bl_cmd_status ( lightranger9_t * ctx,
uint8_t * status )

LightRanger 9 read bl cmd status function.

This function reads a bootloader command status by using I2C serial interface.

Parameters
[in]ctx: Click context object. See lightranger9_t object definition for detailed explanation.
[out]status: Bootloader command status byte.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ lightranger9_read_register()

err_t lightranger9_read_register ( lightranger9_t * ctx,
uint8_t reg,
uint8_t * data_out )

LightRanger 9 read register function.

This function reads data from the selected register by using I2C serial interface.

Parameters
[in]ctx: Click context object. See lightranger9_t object definition for detailed explanation.
[in]reg: Register address.
[out]data_out: Output read data.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ lightranger9_set_gpio0_pin()

void lightranger9_set_gpio0_pin ( lightranger9_t * ctx,
uint8_t state )

LightRanger 9 set gpio0 pin function.

This function sets the GPIO 0 pin logic state.

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

◆ lightranger9_set_gpio1_pin()

void lightranger9_set_gpio1_pin ( lightranger9_t * ctx,
uint8_t state )

LightRanger 9 set gpio1 pin function.

This function sets the GPIO 1 pin logic state.

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

◆ lightranger9_write_bl_cmd()

err_t lightranger9_write_bl_cmd ( lightranger9_t * ctx,
uint8_t cmd,
uint8_t * data_in,
uint8_t len )

LightRanger 9 write bl cmd function.

This function writes a desired number of data bytes to the selected bootloader command by using I2C serial interface.

Parameters
[in]ctx: Click context object. See lightranger9_t object definition for detailed explanation.
[in]cmd: Command byte.
[in]data_in: Data to be written.
[in]len: Number of bytes to be written.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ lightranger9_write_register()

err_t lightranger9_write_register ( lightranger9_t * ctx,
uint8_t reg,
uint8_t data_in )

LightRanger 9 write register function.

This function writes a desired data to the selected register by using I2C serial interface.

Parameters
[in]ctx: Click context object. See lightranger9_t object definition for detailed explanation.
[in]reg: Register address.
[in]data_in: Data to be written.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.