lightranger 2.0.0.0

Functions

void lightranger_cfg_setup (lightranger_cfg_t *cfg)
 Config Object Initialization function.
 
LIGHTRANGER_RETVAL lightranger_init (lightranger_t *ctx, lightranger_cfg_t *cfg)
 Initialization function.
 
void lightranger_default_cfg (lightranger_t *ctx)
 Click Default Configuration function.
 
void lightranger_interrupts_clear (lightranger_t *ctx)
 Clear Interrupts.
 
void lightranger_poll_range (lightranger_t *ctx)
 Poll range.
 
uint8_t lightranger_get_distance (lightranger_t *ctx)
 Get Distance.
 
float lightranger_get_ambiant_light (lightranger_t *ctx, uint8_t als_gain_check)
 Get ambiant light.
 
void lightranger_start_single_shot_range_mode (lightranger_t *ctx)
 Function Start Single Mode.
 
uint16_t lightranger_read_data (lightranger_t *ctx, uint16_t reg_addr)
 Generic read data function.
 
void lightranger_write_data (lightranger_t *ctx, uint16_t reg_addr, uint16_t write_command)
 Generic write data function.
 
uint8_t lightranger_read_byte (lightranger_t *ctx, uint16_t reg_addr)
 Generic read byte function.
 
void lightranger_write_byte (lightranger_t *ctx, uint16_t reg_addr, uint8_t write_command)
 Generic write byte function.
 

Detailed Description

Function Documentation

◆ lightranger_cfg_setup()

void lightranger_cfg_setup ( lightranger_cfg_t * cfg)

Config Object Initialization function.

Parameters
cfgClick configuration structure.

@description This function initializes click configuration structure to init state.

Note
All used pins will be set to unconnected state.

◆ lightranger_default_cfg()

void lightranger_default_cfg ( lightranger_t * ctx)

Click Default Configuration function.

Parameters
ctxClick object.

@description This function executes default configuration for LightRanger Click.

◆ lightranger_get_ambiant_light()

float lightranger_get_ambiant_light ( lightranger_t * ctx,
uint8_t als_gain_check )

Get ambiant light.

Parameters
lightrangerClick object.
als_gain_checkALS Gain value.
Returns
Data Float light level in lux.

@description This function reads register and calculates the light level in lux.

◆ lightranger_get_distance()

uint8_t lightranger_get_distance ( lightranger_t * ctx)

Get Distance.

Parameters
lightrangerClick object.
Returns
Data 16-bit data range value.

@description This function reads range result from register.

◆ lightranger_init()

LIGHTRANGER_RETVAL lightranger_init ( lightranger_t * ctx,
lightranger_cfg_t * cfg )

Initialization function.

Parameters
lightrangerClick object.
cfgClick configuration structure.

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

◆ lightranger_interrupts_clear()

void lightranger_interrupts_clear ( lightranger_t * ctx)

Clear Interrupts.

Parameters
lightrangerClick object.

@description This function clears interrupts.

◆ lightranger_poll_range()

void lightranger_poll_range ( lightranger_t * ctx)

Poll range.

Parameters
lightrangerClick object.

@description This function waits for new sample to be ready.

◆ lightranger_read_byte()

uint8_t lightranger_read_byte ( lightranger_t * ctx,
uint16_t reg_addr )

Generic read byte function.

Parameters
lightrangerClick object.
reg_addr16-bit register address.
Returns
Data Byte from given address.

@description This function reads a byte of data from given address.

◆ lightranger_read_data()

uint16_t lightranger_read_data ( lightranger_t * ctx,
uint16_t reg_addr )

Generic read data function.

Parameters
lightrangerClick object.
reg_addr16-bit register address.
Returns
Data 16-bit data from given address.

@description This function reads 16-bit data from given address.

◆ lightranger_start_single_shot_range_mode()

void lightranger_start_single_shot_range_mode ( lightranger_t * ctx)

Function Start Single Mode.

Parameters
lightrangerClick object.

@description This function starts single shot range mode.

◆ lightranger_write_byte()

void lightranger_write_byte ( lightranger_t * ctx,
uint16_t reg_addr,
uint8_t write_command )

Generic write byte function.

Parameters
lightrangerClick object.
reg_addr16-bit register address.
write_commandByte of data to write.

@description This function writes a byte of data to given address.

◆ lightranger_write_data()

void lightranger_write_data ( lightranger_t * ctx,
uint16_t reg_addr,
uint16_t write_command )

Generic write data function.

Parameters
lightrangerClick object.
reg_addr16-bit register address.
write_command16-bit command to write.

@description This function writes 16-bit command to given address.