lightranger10 2.0.0.0
|
API for configuring and manipulating LightRanger 10 Click driver. More...
Topics | |
LightRanger 10 Registers List | |
List of registers of LightRanger 10 Click driver. | |
LightRanger 10 Registers Settings | |
Settings for registers of LightRanger 10 Click driver. | |
LightRanger 10 MikroBUS Map | |
MikroBUS pin mapping of LightRanger 10 Click driver. | |
Functions | |
void | lightranger10_cfg_setup (lightranger10_cfg_t *cfg) |
LightRanger 10 configuration object setup function. | |
err_t | lightranger10_init (lightranger10_t *ctx, lightranger10_cfg_t *cfg) |
LightRanger 10 initialization function. | |
err_t | lightranger10_default_cfg (lightranger10_t *ctx) |
LightRanger 10 default configuration function. | |
err_t | lightranger10_generic_write (lightranger10_t *ctx, uint16_t reg, uint8_t *data_in, uint8_t len) |
LightRanger 10 I2C writing function. | |
err_t | lightranger10_generic_read (lightranger10_t *ctx, uint16_t reg, uint8_t *data_out, uint8_t len) |
LightRanger 10 I2C reading function. | |
err_t | lightranger10_write_byte (lightranger10_t *ctx, uint16_t reg, uint8_t data_in) |
LightRanger 10 write byte function. | |
err_t | lightranger10_read_byte (lightranger10_t *ctx, uint16_t reg, uint8_t *data_out) |
LightRanger 10 read byte function. | |
err_t | lightranger10_write_word (lightranger10_t *ctx, uint16_t reg, uint16_t data_in) |
LightRanger 10 write word function. | |
err_t | lightranger10_read_word (lightranger10_t *ctx, uint16_t reg, uint16_t *data_out) |
LightRanger 10 read word function. | |
err_t | lightranger10_write_dword (lightranger10_t *ctx, uint16_t reg, uint32_t data_in) |
LightRanger 10 write dword function. | |
err_t | lightranger10_read_dword (lightranger10_t *ctx, uint16_t reg, uint16_t *data_out) |
LightRanger 10 read dword function. | |
err_t | lightranger10_check_communication (lightranger10_t *ctx) |
LightRanger 10 check communication function. | |
uint8_t | lightranger10_get_int_pin (lightranger10_t *ctx) |
LightRanger 10 get int pin function. | |
void | lightranger10_enable_device (lightranger10_t *ctx) |
LightRanger 10 enable device function. | |
void | lightranger10_disable_device (lightranger10_t *ctx) |
LightRanger 10 disable device function. | |
void | lightranger10_reset_device (lightranger10_t *ctx) |
LightRanger 10 reset device function. | |
err_t | lightranger10_soft_reset (lightranger10_t *ctx) |
LightRanger 10 soft reset function. | |
err_t | lightranger10_clear_interrupts (lightranger10_t *ctx) |
LightRanger 10 clear interrupts function. | |
err_t | lightranger10_set_inter_measurement_period_ms (lightranger10_t *ctx, uint32_t period_ms) |
LightRanger 10 set inter measurement period ms function. | |
err_t | lightranger10_set_distance_offset (lightranger10_t *ctx, int16_t offset_mm) |
LightRanger 10 set distance offset function. | |
err_t | lightranger10_calibrate_distance (lightranger10_t *ctx, uint16_t target_distance_mm) |
LightRanger 10 calibrate distance function. | |
err_t | lightranger10_set_distance_mode (lightranger10_t *ctx, uint8_t distance_mode) |
LightRanger 10 set distance mode function. | |
err_t | lightranger10_start_measurement (lightranger10_t *ctx) |
LightRanger 10 start measurement function. | |
err_t | lightranger10_stop_measurement (lightranger10_t *ctx) |
LightRanger 10 stop measurement function. | |
err_t | lightranger10_get_distance (lightranger10_t *ctx, uint16_t *distance_mm) |
LightRanger 10 get distance function. | |
API for configuring and manipulating LightRanger 10 Click driver.
Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.
err_t lightranger10_calibrate_distance | ( | lightranger10_t * | ctx, |
uint16_t | target_distance_mm ) |
LightRanger 10 calibrate distance function.
This function calibrates the distance offset to the selected target distance.
[in] | ctx | : Click context object. See lightranger10_t object definition for detailed explanation. |
[in] | target_distance_mm | : Target distance in millimeters. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. void lightranger10_cfg_setup | ( | lightranger10_cfg_t * | cfg | ) |
LightRanger 10 configuration object setup function.
This function initializes click configuration structure to initial values.
[out] | cfg | : Click configuration structure. See lightranger10_cfg_t object definition for detailed explanation. |
err_t lightranger10_check_communication | ( | lightranger10_t * | ctx | ) |
LightRanger 10 check communication function.
This function checks the communication by reading and verifying the model ID and type.
[in] | ctx | : Click context object. See lightranger10_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t lightranger10_clear_interrupts | ( | lightranger10_t * | ctx | ) |
LightRanger 10 clear interrupts function.
This function clears the interrupts.
[in] | ctx | : Click context object. See lightranger10_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t lightranger10_default_cfg | ( | lightranger10_t * | ctx | ) |
LightRanger 10 default configuration function.
This function executes a default configuration of LightRanger 10 click board.
[in] | ctx | : Click context object. See lightranger10_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. void lightranger10_disable_device | ( | lightranger10_t * | ctx | ) |
LightRanger 10 disable device function.
This function disables the device by setting the EN pin to LOW logic state.
[in] | ctx | : Click context object. See lightranger10_t object definition for detailed explanation. |
void lightranger10_enable_device | ( | lightranger10_t * | ctx | ) |
LightRanger 10 enable device function.
This function enables the device by setting the EN pin to HIGH logic state.
[in] | ctx | : Click context object. See lightranger10_t object definition for detailed explanation. |
err_t lightranger10_generic_read | ( | lightranger10_t * | ctx, |
uint16_t | reg, | ||
uint8_t * | data_out, | ||
uint8_t | len ) |
LightRanger 10 I2C reading function.
This function reads a desired number of data bytes starting from the selected register by using I2C serial interface.
[in] | ctx | : Click context object. See lightranger10_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. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t lightranger10_generic_write | ( | lightranger10_t * | ctx, |
uint16_t | reg, | ||
uint8_t * | data_in, | ||
uint8_t | len ) |
LightRanger 10 I2C writing function.
This function writes a desired number of data bytes starting from the selected register by using I2C serial interface.
[in] | ctx | : Click context object. See lightranger10_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. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t lightranger10_get_distance | ( | lightranger10_t * | ctx, |
uint16_t * | distance_mm ) |
LightRanger 10 get distance function.
This function reads the target object distance in millimeters.
[in] | ctx | : Click context object. See lightranger10_t object definition for detailed explanation. |
[out] | distance_mm | : Distance in millimeters. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. uint8_t lightranger10_get_int_pin | ( | lightranger10_t * | ctx | ) |
LightRanger 10 get int pin function.
This function returns the INT pin logic state.
[in] | ctx | : Click context object. See lightranger10_t object definition for detailed explanation. |
err_t lightranger10_init | ( | lightranger10_t * | ctx, |
lightranger10_cfg_t * | cfg ) |
LightRanger 10 initialization function.
This function initializes all necessary pins and peripherals used for this click board.
[out] | ctx | : Click context object. See lightranger10_t object definition for detailed explanation. |
[in] | cfg | : Click configuration structure. See lightranger10_cfg_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t lightranger10_read_byte | ( | lightranger10_t * | ctx, |
uint16_t | reg, | ||
uint8_t * | data_out ) |
LightRanger 10 read byte function.
This function reads data byte from the selected register by using I2C serial interface.
[in] | ctx | : Click context object. See lightranger10_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 lightranger10_read_dword | ( | lightranger10_t * | ctx, |
uint16_t | reg, | ||
uint16_t * | data_out ) |
LightRanger 10 read dword function.
This function reads double word of data (four bytes) starting from the selected register by using I2C serial interface.
[in] | ctx | : Click context object. See lightranger10_t object definition for detailed explanation. |
[in] | reg | : Start register address. |
[out] | data_out | : Output read data. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t lightranger10_read_word | ( | lightranger10_t * | ctx, |
uint16_t | reg, | ||
uint16_t * | data_out ) |
LightRanger 10 read word function.
This function reads data word (two bytes) starting from the selected register by using I2C serial interface.
[in] | ctx | : Click context object. See lightranger10_t object definition for detailed explanation. |
[in] | reg | : Start register address. |
[out] | data_out | : Output read data. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. void lightranger10_reset_device | ( | lightranger10_t * | ctx | ) |
LightRanger 10 reset device function.
This function resets the device by toggling the EN pin.
[in] | ctx | : Click context object. See lightranger10_t object definition for detailed explanation. |
err_t lightranger10_set_distance_mode | ( | lightranger10_t * | ctx, |
uint8_t | distance_mode ) |
LightRanger 10 set distance mode function.
This function sets the distance mode to medium or long distance.
[in] | ctx | : Click context object. See lightranger10_t object definition for detailed explanation. |
[in] | distance_mode | :
|
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t lightranger10_set_distance_offset | ( | lightranger10_t * | ctx, |
int16_t | offset_mm ) |
LightRanger 10 set distance offset function.
This function sets distance offset in millimeters.
[in] | ctx | : Click context object. See lightranger10_t object definition for detailed explanation. |
[in] | offset_mm | : Distance offset in millimeters. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t lightranger10_set_inter_measurement_period_ms | ( | lightranger10_t * | ctx, |
uint32_t | period_ms ) |
LightRanger 10 set inter measurement period ms function.
This function sets the inter-measurement period in milliseconds.
[in] | ctx | : Click context object. See lightranger10_t object definition for detailed explanation. |
[in] | period_ms | : Inter-measurement period in milliseconds. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t lightranger10_soft_reset | ( | lightranger10_t * | ctx | ) |
LightRanger 10 soft reset function.
This function performs the software reset through the soft reset register.
[in] | ctx | : Click context object. See lightranger10_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t lightranger10_start_measurement | ( | lightranger10_t * | ctx | ) |
LightRanger 10 start measurement function.
This function starts the measurement by enabling ranging.
[in] | ctx | : Click context object. See lightranger10_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t lightranger10_stop_measurement | ( | lightranger10_t * | ctx | ) |
LightRanger 10 stop measurement function.
This function stops the measurement by disabling ranging.
[in] | ctx | : Click context object. See lightranger10_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t lightranger10_write_byte | ( | lightranger10_t * | ctx, |
uint16_t | reg, | ||
uint8_t | data_in ) |
LightRanger 10 write byte function.
This function writes a data byte to the selected register by using I2C serial interface.
[in] | ctx | : Click context object. See lightranger10_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 lightranger10_write_dword | ( | lightranger10_t * | ctx, |
uint16_t | reg, | ||
uint32_t | data_in ) |
LightRanger 10 write dword function.
This function writes a double word of data (four bytes) starting from the selected register by using I2C serial interface.
[in] | ctx | : Click context object. See lightranger10_t object definition for detailed explanation. |
[in] | reg | : Start register address. |
[in] | data_in | : Data to be written. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t lightranger10_write_word | ( | lightranger10_t * | ctx, |
uint16_t | reg, | ||
uint16_t | data_in ) |
LightRanger 10 write word function.
This function writes a data word (two bytes) starting from the selected register by using I2C serial interface.
[in] | ctx | : Click context object. See lightranger10_t object definition for detailed explanation. |
[in] | reg | : Start register address. |
[in] | data_in | : Data to be written. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation.