Vijayaraghavan Narayanan / VLX6180X_API
Embed: (wiki syntax)

« Back to documentation index

common_driver.h File Reference

common_driver.h File Reference

Application-level methods used for generic, system or identification operations. More...

Go to the source code of this file.

Functions

sensor_error common_set_static_config (uint8_t device_base_address)
 Device setup for Ranging and ALS operations.
.
sensor_error common_get_identification (uint8_t device_base_address)
 Report device Identification Info.
sensor_error common_set_i2c_base_address (uint8_t device_base_address, uint32_t i2c_base_address)
 Set Device I2C Base Address.
sensor_error common_set_i2c_pad_voltage (uint8_t device_base_address, uint8_t pad_voltage)
 Set I2C Pad Voltage.
uint8_t common_get_i2c_pad_voltage (uint8_t device_base_address)
 Report I2C Pad Voltage.
sensor_error common_set_system_mode_gpio0 (uint8_t device_base_address, uint8_t mode, uint8_t select, uint8_t polarity)
 Set GPIO0 Mode.
sensor_error common_set_gpio0_mode (uint8_t device_base_address, uint8_t mode)
 Set GPIO0 Mode.
uint8_t common_get_gpio0_mode (uint8_t device_base_address)
 Report GPIO0 Mode.
sensor_error common_set_gpio0_select (uint8_t device_base_address, uint8_t select)
 Set GPIO0 function configuration.
uint8_t common_get_gpio0_select (uint8_t device_base_address)
 Report GPIO0 functional configuration.
sensor_error common_set_gpio0_polarity (uint8_t device_base_address, uint8_t polarity)
 Set GPIO0 Polarity.
bool_t common_get_gpio0_polarity (uint8_t device_base_address)
 Report GPIO0 Polarity.
sensor_error common_set_system_mode_gpio1 (uint8_t device_base_address, uint8_t mode, uint8_t select, uint8_t polarity)
 Set GPIO1 Mode.
sensor_error common_set_gpio1_mode (uint8_t device_base_address, uint8_t mode)
 Set GPIO1 Mode.
uint8_t common_get_gpio1_mode (uint8_t device_base_address)
 Report GPIO1 Mode.
sensor_error common_set_gpio1_select (uint8_t device_base_address, uint8_t select)
 Set GPIO1 functional configuration.
uint8_t common_get_gpio1_select (uint8_t device_base_address)
 Report GPIO1 functional configuration.
sensor_error common_set_gpio1_polarity (uint8_t device_base_address, uint8_t polarity)
 Set GPIO1 Polarity.
bool_t common_get_gpio1_polarity (uint8_t device_base_address)
 Report GPIO1 Polarity.
sensor_error common_set_history_buffer_enable (uint8_t device_base_address, uint8_t history_buffer_enable)
 Set History Buffer Enable.
bool_t common_get_history_buffer_enable (uint8_t device_base_address)
 Report History Buffer Enable status.
sensor_error common_set_history_buffer_mode (uint8_t device_base_address, uint8_t history_buffer_mode)
 Set History Buffer Mode.
uint8_t common_get_history_buffer_mode (uint8_t device_base_address)
 Report History Buffer Mode.
sensor_error common_set_history_buffer_clear (uint8_t device_base_address)
 Clear history buffer (mode not cleared)
bool_t common_get_history_buffer_clear (uint8_t device_base_address)
 Report History Buffer Clear status.
sensor_error common_set_system_interrupt_clear_error (uint8_t device_base_address)
 Clear 'Error' System Interrupt.
uint8_t common_get_error_result_interrupt_status_gpio (uint8_t device_base_address)
 Report GPIO Interrupt Error Result Status.
sensor_error common_clear_system_fresh_out_of_reset (uint8_t device_base_address)
 Clear System Fresh Out Of Reset flag.
bool_t common_get_system_fresh_out_of_reset (uint8_t device_base_address)
 Report System Fresh Out Of Reset status.
sensor_error common_set_system_group_parameter_hold (uint8_t device_base_address)
 Set System Group Parameter Hold flag.
sensor_error common_clear_system_group_parameter_hold (uint8_t device_base_address)
 Clear System Group Parameter Hold flag.
uint8_t common_get_system_fatal_error_code (uint8_t device_base_address)
 Report System Fatal Error Code flag status.
uint8_t common_get_system_fatal_error_status (uint8_t device_base_address)
 Report System Fatal Error Status.
uint8_t common_get_system_health_check (uint8_t device_base_address)
 Report System Health.

Detailed Description

Application-level methods used for generic, system or identification operations.

Definition in file common_driver.h.


Function Documentation

sensor_error common_clear_system_fresh_out_of_reset ( uint8_t  device_base_address )

Clear System Fresh Out Of Reset flag.

The fresh out of reset bit defaults to 1 at boot-up. The user can set this to 0 after initial boot and then use this flag to check for reset conditions.

Parameters:
[in]device_base_address
Return values:
sensor_error

Definition at line 805 of file common_driver.cpp.

sensor_error common_clear_system_group_parameter_hold ( uint8_t  device_base_address )

Clear System Group Parameter Hold flag.

The grouped_parameter_hold flag is set to indicate that device data is being updated.
0: Data is stable - user is safe to copy.
1: Data being updated - user not safe to copy.

Parameters:
[in]device_base_address
Return values:
sensor_error

Definition at line 846 of file common_driver.cpp.

uint8_t common_get_error_result_interrupt_status_gpio ( uint8_t  device_base_address )

Report GPIO Interrupt Error Result Status.

Returns the Error flag portion of the RESULT_INTERRUPT_STATUS_GPIO register.
Possible returns are :
0: No error reported
1: Laser Safety Error
2: PLL error (either PLL1 or PLL2)
3: Measurement error

Parameters:
[in]device_base_address
Return values:
Integer

Definition at line 792 of file common_driver.cpp.

uint8_t common_get_gpio0_mode ( uint8_t  device_base_address )

Report GPIO0 Mode.

Possible results are :
GPIOx_MODE_SELECT_RANGING = 0x00
GPIOx_MODE_SELECT_ALS = 0x01

Parameters:
[in]device_base_address
Return values:
Integer

Definition at line 306 of file common_driver.cpp.

bool_t common_get_gpio0_polarity ( uint8_t  device_base_address )

Report GPIO0 Polarity.

Report the status of the GPIO_0 Polarity select bit in SYSTEM_MODE_GPIO0 register.

Parameters:
[in]device_base_address
Return values:
Boolean

Definition at line 429 of file common_driver.cpp.

uint8_t common_get_gpio0_select ( uint8_t  device_base_address )

Report GPIO0 functional configuration.

Possible results are :
GPIOx_SELECT_OFF = 0x00
GPIOx_SELECT_MEASURE_READY = 0x01
GPIOx_SELECT_THRESHOLD_OUTPUT = 0x02
GPIOx_SELECT_BLANK_IN = 0x03
GPIOx_SELECT_BLANK_OUT = 0x04
GPIOx_SELECT_START_STOP = 0x05
GPIOx_SELECT_DISABLED = 0x06
GPIOx_SELECT_COMBINED_THRESHOLD_OUTPUT = 0x07
GPIOx_SELECT_GPIO_INTERRUPT_OUTPUT = 0x08

Parameters:
[in]device_base_address
Return values:
Integer

Definition at line 359 of file common_driver.cpp.

uint8_t common_get_gpio1_mode ( uint8_t  device_base_address )

Report GPIO1 Mode.

Possible results are :
GPIOx_MODE_SELECT_RANGING = 0x00
GPIOx_MODE_SELECT_ALS = 0x01

Parameters:
[in]device_base_address
Return values:
Integer

Definition at line 522 of file common_driver.cpp.

bool_t common_get_gpio1_polarity ( uint8_t  device_base_address )

Report GPIO1 Polarity.

Report the status of the GPIO_0 Polarity select bit in SYSTEM_MODE_GPIO0 register.

Parameters:
[in]device_base_address
Return values:
Boolean

Definition at line 652 of file common_driver.cpp.

uint8_t common_get_gpio1_select ( uint8_t  device_base_address )

Report GPIO1 functional configuration.

Possible results are :
GPIOx_SELECT_OFF = 0x00
GPIOx_SELECT_MEASURE_READY = 0x01
GPIOx_SELECT_THRESHOLD_OUTPUT = 0x02
GPIOx_SELECT_BLANK_IN = 0x03
GPIOx_SELECT_BLANK_OUT = 0x04
GPIOx_SELECT_START_STOP = 0x05
GPIOx_SELECT_DISABLED = 0x06
GPIOx_SELECT_COMBINED_THRESHOLD_OUTPUT = 0x07
GPIOx_SELECT_GPIO_INTERRUPT_OUTPUT = 0x08

Parameters:
[in]device_base_address
Return values:
Integer

Definition at line 573 of file common_driver.cpp.

bool_t common_get_history_buffer_clear ( uint8_t  device_base_address )

Report History Buffer Clear status.

Returns True if the SYSTEM_HISTORY_CTRL register is cleared, otherwise False.

Parameters:
[in]device_base_address
Return values:
Boolean

Definition at line 766 of file common_driver.cpp.

bool_t common_get_history_buffer_enable ( uint8_t  device_base_address )

Report History Buffer Enable status.

Returns True if the command completes successfully, otherwise False.

Parameters:
[in]device_base_address
Return values:
Boolean

Definition at line 690 of file common_driver.cpp.

uint8_t common_get_history_buffer_mode ( uint8_t  device_base_address )

Report History Buffer Mode.

Returns the contents of the SYSTEM_HISTORY_CTRL register.
Possible values are :
HISTORY_BUFFER_RANGING_MODE = 0x00
HISTORY_BUFFER_ALS_MODE = 0x01

Parameters:
[in]device_base_address
Return values:
Integer

Definition at line 735 of file common_driver.cpp.

uint8_t common_get_i2c_pad_voltage ( uint8_t  device_base_address )

Report I2C Pad Voltage.

I2C Pad External Bus Supply voltage. Possible values are :
I2C_1v8_PAD_VOLTAGE = 0x01
I2C_2v8_PAD_VOLTAGE = 0x02

Parameters:
[in]device_base_address
Return values:
Integer

Definition at line 206 of file common_driver.cpp.

sensor_error common_get_identification ( uint8_t  device_base_address )

Report device Identification Info.

Return the contents of the Identification block registers, in the following order :

IDENTIFICATION_MODEL_ID
IDENTIFICATION_MODEL_REV_MAJOR
IDENTIFICATION_MODEL_REV_MINOR
IDENTIFICATION_MODULE_REV_MAJOR
IDENTIFICATION_MODULE_REV_MINOR
IDENTIFICATION_NVM_REVISION_ID
IDENTIFICATION_MASK_REVISION_ID
IDENTIFICATION_month
IDENTIFICATION_year
IDENTIFICATION_phase
IDENTIFICATION_day
IDENTIFICATION_time
IDENTIFICATION_code
IDENTIFICATION_FIRMWARE_REVISION_ID

Parameters:
[in]device_base_address
Return values:
List

Definition at line 125 of file common_driver.cpp.

uint8_t common_get_system_fatal_error_code ( uint8_t  device_base_address )

Report System Fatal Error Code flag status.

Returns the contents of the SYSTEM_FATAL_ERROR_CODE register, which is written to when a fatal error occurs.

Parameters:
[in]device_base_address
Return values:
Integer

Definition at line 858 of file common_driver.cpp.

uint8_t common_get_system_fatal_error_status ( uint8_t  device_base_address )

Report System Fatal Error Status.

Returns the contents of the SYSTEM_FATAL_ERROR_STATUS register, which is written to when a fatal error occurs.

Read Only HW status bit, set high when a 1 is written into FATAL_ERROR_CODE.
Checked by FW on bootup to ascertain device status. Can only be rest by a main Go2 reset.

Parameters:
[in]device_base_address
Return values:
Integer

Definition at line 871 of file common_driver.cpp.

bool_t common_get_system_fresh_out_of_reset ( uint8_t  device_base_address )

Report System Fresh Out Of Reset status.

Returns True if the SYSTEM_FRESH_OUT_OF_RESET register status is set, otherwise False.

Parameters:
[in]device_base_address
Return values:
Boolean

Definition at line 817 of file common_driver.cpp.

uint8_t common_get_system_health_check ( uint8_t  device_base_address )

Report System Health.

A combination of fresh_from_reset, fatal_error and laser safety checks

Parameters:
[in]device_base_address
Return values:
Integer.A combined system health flag.

Definition at line 885 of file common_driver.cpp.

sensor_error common_set_gpio0_mode ( uint8_t  device_base_address,
uint8_t  mode 
)

Set GPIO0 Mode.

Possible values for mode are :
GPIOx_MODE_SELECT_RANGING = 0x00
GPIOx_MODE_SELECT_ALS = 0x01

Parameters:
[in]device_base_address
[in]mode,:Operating mode to be selected.
Return values:
sensor_error

Definition at line 284 of file common_driver.cpp.

sensor_error common_set_gpio0_polarity ( uint8_t  device_base_address,
uint8_t  polarity 
)

Set GPIO0 Polarity.

Possible settings are :
GPIOx_POLARITY_SELECT_OFF = 0x00
GPIOx_POLARITY_SELECT_ON = 0x01

Parameters:
[in]device_base_address
[in]polarity,:
Return values:
sensor_error

Definition at line 405 of file common_driver.cpp.

sensor_error common_set_gpio0_select ( uint8_t  device_base_address,
uint8_t  select 
)

Set GPIO0 function configuration.

Possible settings are :
GPIOx_SELECT_OFF = 0x00
GPIOx_SELECT_MEASURE_READY = 0x01
GPIOx_SELECT_THRESHOLD_OUTPUT = 0x02
GPIOx_SELECT_BLANK_IN = 0x03
GPIOx_SELECT_BLANK_OUT = 0x04
GPIOx_SELECT_START_STOP = 0x05
GPIOx_SELECT_DISABLED = 0x06
GPIOx_SELECT_COMBINED_THRESHOLD_OUTPUT = 0x07
GPIOx_SELECT_GPIO_INTERRUPT_OUTPUT = 0x08

Parameters:
[in]device_base_address
[in]select,:
Return values:
sensor_error

Definition at line 326 of file common_driver.cpp.

sensor_error common_set_gpio1_mode ( uint8_t  device_base_address,
uint8_t  mode 
)

Set GPIO1 Mode.

Possible mode settings are :
GPIOx_MODE_SELECT_RANGING = 0x00
GPIOx_MODE_SELECT_ALS = 0x01

Parameters:
[in]device_base_address
[in]mode,:
Return values:
sensor_error

Definition at line 500 of file common_driver.cpp.

sensor_error common_set_gpio1_polarity ( uint8_t  device_base_address,
uint8_t  polarity 
)

Set GPIO1 Polarity.

GPIOx_POLARITY_SELECT_OFF = 0x00
GPIOx_POLARITY_SELECT_ON = 0x01

Parameters:
[in]device_base_address
[in]polarity,:
Return values:
sensor_error

Definition at line 621 of file common_driver.cpp.

sensor_error common_set_gpio1_select ( uint8_t  device_base_address,
uint8_t  select 
)

Set GPIO1 functional configuration.

Possible settings are :
GPIOx_SELECT_OFF = 0x00
GPIOx_SELECT_MEASURE_READY = 0x01
GPIOx_SELECT_THRESHOLD_OUTPUT = 0x02
GPIOx_SELECT_BLANK_IN = 0x03
GPIOx_SELECT_BLANK_OUT = 0x04
GPIOx_SELECT_START_STOP = 0x05
GPIOx_SELECT_DISABLED = 0x06
GPIOx_SELECT_COMBINED_THRESHOLD_OUTPUT = 0x07
GPIOx_SELECT_GPIO_INTERRUPT_OUTPUT = 0x08

Parameters:
[in]device_base_address
[in]select,:
Return values:
sensor_error

Definition at line 538 of file common_driver.cpp.

sensor_error common_set_history_buffer_clear ( uint8_t  device_base_address )

Clear history buffer (mode not cleared)

Parameters:
[in]device_base_address
Return values:
sensor_error

Definition at line 751 of file common_driver.cpp.

sensor_error common_set_history_buffer_enable ( uint8_t  device_base_address,
uint8_t  history_buffer_enable 
)

Set History Buffer Enable.

Possible settings are :
HISTORY_BUFFER_ENABLE = 0x01
HISTORY_BUFFER_DISABLE = 0x00

Parameters:
[in]device_base_address
[in]history_buffer_enable,:
Return values:
sensor_error

Definition at line 668 of file common_driver.cpp.

sensor_error common_set_history_buffer_mode ( uint8_t  device_base_address,
uint8_t  history_buffer_mode 
)

Set History Buffer Mode.

Possible modes are :
HISTORY_BUFFER_RANGING_MODE = 0x00
HISTORY_BUFFER_ALS_MODE = 0x01

Parameters:
[in]device_base_address
[in]history_buffer_mode,:
Return values:
sensor_error

Definition at line 706 of file common_driver.cpp.

sensor_error common_set_i2c_base_address ( uint8_t  device_base_address,
uint32_t  i2c_base_address 
)

Set Device I2C Base Address.

Uses I2C_Slave_Device_address register at 0x0212. Can be over-written by a value read from NVM.
Defaults to 0x52 (8-bit address)/0x29 (7-bit). Register reports a 7-bit value.

Parameters:
[in]device_base_address
[in]i2c_base_address8-bit I2C Slave device base address.
Return values:
sensor_error

Definition at line 172 of file common_driver.cpp.

sensor_error common_set_i2c_pad_voltage ( uint8_t  device_base_address,
uint8_t  pad_voltage 
)

Set I2C Pad Voltage.

I2C Pad External Bus Supply voltage (applies to both pads). Can be overridden by a value read from in NVM.

Possible values are :
I2C_1v8_PAD_VOLTAGE = 0x01
I2C_2v8_PAD_VOLTAGE = 0x02

Parameters:
[in]device_base_address
[in]pad_voltageI2C Pad External Bus Supply voltage.
Return values:
sensor_error

Definition at line 184 of file common_driver.cpp.

sensor_error common_set_static_config ( uint8_t  device_base_address )

Device setup for Ranging and ALS operations.
.

To apply these settings the operation bits (bit 0) in the SYSRANGE_START SYSALS_START Registers must be cleared.

Parameters:
[in]device_base_address
Return values:
sensor_error

Definition at line 56 of file common_driver.cpp.

sensor_error common_set_system_group_parameter_hold ( uint8_t  device_base_address )

Set System Group Parameter Hold flag.

The grouped_parameter_hold flag is set to indicate that device data is being updated.
0: Data is stable - user is safe to copy.
1: Data being updated - user not safe to copy.

Parameters:
[in]device_base_address
Return values:
sensor_error

Definition at line 834 of file common_driver.cpp.

sensor_error common_set_system_interrupt_clear_error ( uint8_t  device_base_address )

Clear 'Error' System Interrupt.

Parameters:
[in]device_base_address
Return values:
sensor_error

Definition at line 780 of file common_driver.cpp.

sensor_error common_set_system_mode_gpio0 ( uint8_t  device_base_address,
uint8_t  mode,
uint8_t  select,
uint8_t  polarity 
)

Set GPIO0 Mode.

Possible values for mode are :
GPIOx_MODE_SELECT_RANGING = 0x00
GPIOx_MODE_SELECT_ALS = 0x01

Possible settings for select are :
GPIOx_SELECT_OFF = 0x00
GPIOx_SELECT_MEASURE_READY = 0x01
GPIOx_SELECT_DISABLED = 0x06
GPIOx_SELECT_GPIO_INTERRUPT_OUTPUT = 0x08

Possible settings for polarity are :
GPIOx_POLARITY_SELECT_OFF = 0x00
GPIOx_POLARITY_SELECT_ON = 0x01

Parameters:
[in]device_base_address
[in]modeOperating mode to be selected.
[in]select
[in]polarity
Return values:
sensor_error

Definition at line 226 of file common_driver.cpp.

sensor_error common_set_system_mode_gpio1 ( uint8_t  device_base_address,
uint8_t  mode,
uint8_t  select,
uint8_t  polarity 
)

Set GPIO1 Mode.

Possible values for mode are :
GPIOx_MODE_SELECT_RANGING = 0x00
GPIOx_MODE_SELECT_ALS = 0x01

Possible settings for select are :
GPIOx_SELECT_OFF = 0x00
GPIOx_SELECT_MEASURE_READY = 0x01
GPIOx_SELECT_DISABLED = 0x06
GPIOx_SELECT_GPIO_INTERRUPT_OUTPUT = 0x08

Possible settings for polarity are :
GPIOx_POLARITY_SELECT_OFF = 0x00
GPIOx_POLARITY_SELECT_ON = 0x01

Parameters:
[in]device_base_address
[in]mode,:Operating mode to be selected.
[in]select,:
[in]polarity,:
Return values:
sensor_error

Definition at line 443 of file common_driver.cpp.