lightranger11
2.1.0.0
|
API for configuring and manipulating LightRanger 11 Click driver. More...
Modules | |
LightRanger 11 Registers List | |
List of registers of LightRanger 11 Click driver. | |
LightRanger 11 Registers Settings | |
Settings for registers of LightRanger 11 Click driver. | |
LightRanger 11 MikroBUS Map | |
MikroBUS pin mapping of LightRanger 11 Click driver. | |
Functions | |
void | lightranger11_cfg_setup (lightranger11_cfg_t *cfg) |
LightRanger 11 configuration object setup function. More... | |
err_t | lightranger11_init (lightranger11_t *ctx, lightranger11_cfg_t *cfg) |
LightRanger 11 initialization function. More... | |
err_t | lightranger11_default_cfg (lightranger11_t *ctx) |
LightRanger 11 default configuration function. More... | |
err_t | lightranger11_write_multi (lightranger11_t *ctx, uint16_t reg, uint8_t *data_in, uint8_t len) |
LightRanger 11 write multi function. More... | |
err_t | lightranger11_read_multi (lightranger11_t *ctx, uint16_t reg, uint8_t *data_out, uint16_t len) |
LightRanger 11 read multi function. More... | |
err_t | lightranger11_write_byte (lightranger11_t *ctx, uint16_t reg, uint8_t data_in) |
LightRanger 11 write byte function. More... | |
err_t | lightranger11_read_byte (lightranger11_t *ctx, uint16_t reg, uint8_t *data_out) |
LightRanger 11 read byte function. More... | |
err_t | lightranger11_write_data (lightranger11_t *ctx, uint8_t *data_in, uint16_t len) |
LightRanger 11 write data function. More... | |
err_t | lightranger11_check_comm (lightranger11_t *ctx) |
LightRanger 11 check communication function. More... | |
uint8_t | lightranger11_get_int_pin (lightranger11_t *ctx) |
LightRanger 11 get int pin function. More... | |
void | lightranger11_set_i2c_rst_pin (lightranger11_t *ctx, uint8_t state) |
LightRanger 11 set i2c rst function. More... | |
void | lightranger11_set_lpn_pin (lightranger11_t *ctx, uint8_t state) |
LightRanger 11 set lpn function. More... | |
void | lightranger11_reset_i2c (lightranger11_t *ctx) |
LightRanger 11 reset i2c function. More... | |
err_t | lightranger11_sensor_init (lightranger11_t *ctx) |
LightRanger 11 sensor init function. More... | |
err_t | lightranger11_dci_write_data (lightranger11_t *ctx, uint16_t index, uint8_t *data_in, uint16_t data_size) |
LightRanger 11 dci write data function. More... | |
err_t | lightranger11_dci_read_data (lightranger11_t *ctx, uint16_t index, uint8_t *data_out, uint16_t data_size) |
LightRanger 11 dci read data function. More... | |
err_t | lightranger11_dci_replace_data (lightranger11_t *ctx, uint16_t index, uint8_t *data_in, uint16_t data_size, uint8_t *new_data, uint16_t new_data_size, uint16_t new_data_pos) |
LightRanger 11 dci replace data function. More... | |
err_t | lightranger11_set_resolution (lightranger11_t *ctx, uint8_t resolution) |
LightRanger 11 set resolution function. More... | |
err_t | lightranger11_get_resolution (lightranger11_t *ctx, uint8_t *resolution) |
LightRanger 11 get resolution function. More... | |
err_t | lightranger11_set_rang_freq_hz (lightranger11_t *ctx, uint8_t frequency_hz) |
LightRanger 11 set ranging frequency hz function. More... | |
err_t | lightranger11_get_rang_freq_hz (lightranger11_t *ctx, uint8_t *frequency_hz) |
LightRanger 11 get ranging frequency hz function. More... | |
err_t | lightranger11_set_integ_time_ms (lightranger11_t *ctx, uint32_t integration_time_ms) |
LightRanger 11 set integration time ms function. More... | |
err_t | lightranger11_get_integ_time_ms (lightranger11_t *ctx, uint32_t *integration_time_ms) |
LightRanger 11 get integration time ms function. More... | |
err_t | lightranger11_set_ranging_mode (lightranger11_t *ctx, uint8_t ranging_mode) |
LightRanger 11 set ranging mode function. More... | |
err_t | lightranger11_get_ranging_mode (lightranger11_t *ctx, uint8_t *ranging_mode) |
LightRanger 11 get ranging mode function. More... | |
err_t | lightranger11_start_ranging (lightranger11_t *ctx) |
LightRanger 11 start ranging function. More... | |
err_t | lightranger11_stop_ranging (lightranger11_t *ctx) |
LightRanger 11 stop ranging function. More... | |
err_t | lightranger11_get_ranging_data (lightranger11_t *ctx, lightranger11_results_data_t *results) |
LightRanger 11 get ranging data function. More... | |
API for configuring and manipulating LightRanger 11 Click driver.
void lightranger11_cfg_setup | ( | lightranger11_cfg_t * | cfg | ) |
LightRanger 11 configuration object setup function.
This function initializes click configuration structure to initial values.
[out] | cfg | : Click configuration structure. See lightranger11_cfg_t object definition for detailed explanation. |
err_t lightranger11_check_comm | ( | lightranger11_t * | ctx | ) |
LightRanger 11 check communication function.
This function checks the communication by reading and verifying the device ID.
[in] | ctx | : Click context object. See lightranger11_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t lightranger11_dci_read_data | ( | lightranger11_t * | ctx, |
uint16_t | index, | ||
uint8_t * | data_out, | ||
uint16_t | data_size | ||
) |
LightRanger 11 dci read data function.
This function reads 'extra data' from DCI. Using a known index, the function fills the casted structure passed in argument.
[in] | ctx | : Click context object. See lightranger11_t object definition for detailed explanation. |
[in] | index | : DCI register address. |
[out] | data_out | : This field can be a casted structure, or a simple array. Please note that the FW only accept data of 32 bits. So field data can only have a size of 32, 64, 96, 128, bits.. |
[in] | data_size | : This field must be the structure or array size. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t lightranger11_dci_replace_data | ( | lightranger11_t * | ctx, |
uint16_t | index, | ||
uint8_t * | data_in, | ||
uint16_t | data_size, | ||
uint8_t * | new_data, | ||
uint16_t | new_data_size, | ||
uint16_t | new_data_pos | ||
) |
LightRanger 11 dci replace data function.
This function replaces 'extra data' in DCI. The data can be simple data, or casted structure.
[in] | ctx | : Click context object. See lightranger11_t object definition for detailed explanation. |
[in] | index | : DCI register address. |
[in] | data_in | : This field can be a casted structure, or a simple array. Please note that the FW only accept data of 32 bits. So field data can only have a size of 32, 64, 96, 128, bits.. |
[in] | data_size | : This field must be the structure or array size. |
[in] | new_data | : Contains the new fields. |
[in] | new_data_size | : New data size. |
[in] | new_data_pos | : New data position into the buffer. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t lightranger11_dci_write_data | ( | lightranger11_t * | ctx, |
uint16_t | index, | ||
uint8_t * | data_in, | ||
uint16_t | data_size | ||
) |
LightRanger 11 dci write data function.
This function writes 'extra data' to DCI. The data can be simple data, or casted structure.
[in] | ctx | : Click context object. See lightranger11_t object definition for detailed explanation. |
[in] | index | : DCI register address. |
[in] | data_in | : This field can be a casted structure, or a simple array. Please note that the FW only accept data of 32 bits. So field data can only have a size of 32, 64, 96, 128, bits.. |
[in] | data_size | : This field must be the structure or array size. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t lightranger11_default_cfg | ( | lightranger11_t * | ctx | ) |
LightRanger 11 default configuration function.
This function executes a default configuration of LightRanger 11 click board.
[in] | ctx | : Click context object. See lightranger11_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. uint8_t lightranger11_get_int_pin | ( | lightranger11_t * | ctx | ) |
LightRanger 11 get int pin function.
This function returns the INT pin logic state.
[in] | ctx | : Click context object. See lightranger11_t object definition for detailed explanation. |
err_t lightranger11_get_integ_time_ms | ( | lightranger11_t * | ctx, |
uint32_t * | integration_time_ms | ||
) |
LightRanger 11 get integration time ms function.
This function gets the current integration time in ms.
[in] | ctx | : Click context object. See lightranger11_t object definition for detailed explanation. |
[out] | integration_time_ms | : Contains integration time in ms. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t lightranger11_get_rang_freq_hz | ( | lightranger11_t * | ctx, |
uint8_t * | frequency_hz | ||
) |
LightRanger 11 get ranging frequency hz function.
This function gets the current ranging frequency in Hz. Ranging frequency corresponds to the time between each measurement.
[in] | ctx | : Click context object. See lightranger11_t object definition for detailed explanation. |
[out] | frequency_hz | : Contains the ranging frequency in Hz. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t lightranger11_get_ranging_data | ( | lightranger11_t * | ctx, |
lightranger11_results_data_t * | results | ||
) |
LightRanger 11 get ranging data function.
This function gets the ranging data, using the selected output and the resolution.
[in] | ctx | : Click context object. See lightranger11_t object definition for detailed explanation. |
[out] | results | : LightRanger 11 results structure. See lightranger11_results_data_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t lightranger11_get_ranging_mode | ( | lightranger11_t * | ctx, |
uint8_t * | ranging_mode | ||
) |
LightRanger 11 get ranging mode function.
This function gets the ranging mode. Two modes are available using ULD : Continuous and autonomous. The default mode is Autonomous.
[in] | ctx | : Click context object. See lightranger11_t object definition for detailed explanation. |
[out] | ranging_mode | : Current ranging mode. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t lightranger11_get_resolution | ( | lightranger11_t * | ctx, |
uint8_t * | resolution | ||
) |
LightRanger 11 get resolution function.
This function gets the current resolution (4x4 or 8x8).
[in] | ctx | : Click context object. See lightranger11_t object definition for detailed explanation. |
[out] | resolution | : Value of this pointer will be equal to 16 for 4x4 mode, and 64 for 8x8 mode. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t lightranger11_init | ( | lightranger11_t * | ctx, |
lightranger11_cfg_t * | cfg | ||
) |
LightRanger 11 initialization function.
This function initializes all necessary pins and peripherals used for this click board.
[out] | ctx | : Click context object. See lightranger11_t object definition for detailed explanation. |
[in] | cfg | : Click configuration structure. See lightranger11_cfg_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t lightranger11_read_byte | ( | lightranger11_t * | ctx, |
uint16_t | reg, | ||
uint8_t * | data_out | ||
) |
LightRanger 11 read byte function.
This function reads data byte from the selected register by using I2C serial interface.
[in] | ctx | : Click context object. See lightranger11_t object definition for detailed explanation. |
[in] | reg | : Register address. |
[out] | data_out | : Output read data. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t lightranger11_read_multi | ( | lightranger11_t * | ctx, |
uint16_t | reg, | ||
uint8_t * | data_out, | ||
uint16_t | len | ||
) |
LightRanger 11 read multi function.
This function reads a desired number of data bytes from the selected register by using I2C serial interface.
[in] | ctx | : Click context object. See lightranger11_t object definition for detailed explanation. |
[in] | reg | : Register address. |
[out] | data_out | : Output read data. |
[in] | len | : Number of bytes to be read. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. void lightranger11_reset_i2c | ( | lightranger11_t * | ctx | ) |
LightRanger 11 reset i2c function.
This function resets the I2C communication by toggling the I2C RST pin.
[in] | ctx | : Click context object. See lightranger11_t object definition for detailed explanation. |
err_t lightranger11_sensor_init | ( | lightranger11_t * | ctx | ) |
LightRanger 11 sensor init function.
This function initializes the sensor. It must be called after a power on, to load the firmware into the sensor.
[in] | ctx | : Click context object. See lightranger11_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. void lightranger11_set_i2c_rst_pin | ( | lightranger11_t * | ctx, |
uint8_t | state | ||
) |
LightRanger 11 set i2c rst function.
This function sets the I2C RST pin logic state.
[in] | ctx | : Click context object. See lightranger11_t object definition for detailed explanation. |
[in] | state | : Pin logic state. |
err_t lightranger11_set_integ_time_ms | ( | lightranger11_t * | ctx, |
uint32_t | integration_time_ms | ||
) |
LightRanger 11 set integration time ms function.
This function sets a new integration time in ms. Integration time must be computed to be lower than the ranging period, for a selected resolution.
[in] | ctx | : Click context object. See lightranger11_t object definition for detailed explanation. |
[in] | integration_time_ms | : Contains the integration time in ms. For all resolutions and frequency, the minimum value is 2ms, and the maximum is 1000ms. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. void lightranger11_set_lpn_pin | ( | lightranger11_t * | ctx, |
uint8_t | state | ||
) |
LightRanger 11 set lpn function.
This function sets the LPn pin logic state.
[in] | ctx | : Click context object. See lightranger11_t object definition for detailed explanation. |
[in] | state | : Pin logic state. |
err_t lightranger11_set_rang_freq_hz | ( | lightranger11_t * | ctx, |
uint8_t | frequency_hz | ||
) |
LightRanger 11 set ranging frequency hz function.
This function sets a new ranging frequency in Hz. Ranging frequency corresponds to the measurements frequency. This setting depends of the resolution, so please select your resolution before using this function.
[in] | ctx | : Click context object. See lightranger11_t object definition for detailed explanation. |
[in] | frequency_hz | : Contains the ranging frequency in Hz. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t lightranger11_set_ranging_mode | ( | lightranger11_t * | ctx, |
uint8_t | ranging_mode | ||
) |
LightRanger 11 set ranging mode function.
This function sets the ranging mode. Two modes are available using ULD : Continuous and autonomous. The default mode is Autonomous.
[in] | ctx | : Click context object. See lightranger11_t object definition for detailed explanation. |
[in] | ranging_mode | : Use macros LIGHTRANGER11_RANGING_MODE_CONTINUOUS, LIGHTRANGER11_RANGING_MODE_CONTINUOUS. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t lightranger11_set_resolution | ( | lightranger11_t * | ctx, |
uint8_t | resolution | ||
) |
LightRanger 11 set resolution function.
This function sets a new data resolution (4x4 or 8x8).
[in] | ctx | : Click context object. See lightranger11_t object definition for detailed explanation. |
[in] | resolution | : Use macro LIGHTRANGER11_RESOLUTION_4X4 or LIGHTRANGER11_RESOLUTION_8X8 to set the resolution. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t lightranger11_start_ranging | ( | lightranger11_t * | ctx | ) |
LightRanger 11 start ranging function.
This function starts a ranging session. When the sensor streams, host cannot change settings 'on-the-fly'.
[in] | ctx | : Click context object. See lightranger11_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t lightranger11_stop_ranging | ( | lightranger11_t * | ctx | ) |
LightRanger 11 stop ranging function.
This function stops the ranging session. It must be used when the sensor streams, after calling lightranger11_start_ranging( ).
[in] | ctx | : Click context object. See lightranger11_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t lightranger11_write_byte | ( | lightranger11_t * | ctx, |
uint16_t | reg, | ||
uint8_t | data_in | ||
) |
LightRanger 11 write byte function.
This function writes a data byte to the selected register by using I2C serial interface.
[in] | ctx | : Click context object. See lightranger11_t object definition for detailed explanation. |
[in] | reg | : Register address. |
[in] | data_in | : Data to be written. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t lightranger11_write_data | ( | lightranger11_t * | ctx, |
uint8_t * | data_in, | ||
uint16_t | len | ||
) |
LightRanger 11 write data function.
This function writes a desired number of data bytes by using I2C serial interface.
[in] | ctx | : Click context object. See lightranger11_t object definition for detailed explanation. |
[in] | data_in | : Data to be written. |
[in] | len | : Number of bytes to be written. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t lightranger11_write_multi | ( | lightranger11_t * | ctx, |
uint16_t | reg, | ||
uint8_t * | data_in, | ||
uint8_t | len | ||
) |
LightRanger 11 write multi function.
This function writes a desired number of data bytes to the selected register by using I2C serial interface.
[in] | ctx | : Click context object. See lightranger11_t object definition for detailed explanation. |
[in] | reg | : Register address. |
[in] | data_in | : Data to be written. |
[in] | len | : Number of bytes to be written (up to 16 bytes). |
0
- Success, -1
- Error. See #err_t definition for detailed explanation.