lightranger10
2.0.0.0
|
API for configuring and manipulating LightRanger 10 Click driver. More...
Modules | |
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. More... | |
err_t | lightranger10_init (lightranger10_t *ctx, lightranger10_cfg_t *cfg) |
LightRanger 10 initialization function. More... | |
err_t | lightranger10_default_cfg (lightranger10_t *ctx) |
LightRanger 10 default configuration function. More... | |
err_t | lightranger10_generic_write (lightranger10_t *ctx, uint16_t reg, uint8_t *data_in, uint8_t len) |
LightRanger 10 I2C writing function. More... | |
err_t | lightranger10_generic_read (lightranger10_t *ctx, uint16_t reg, uint8_t *data_out, uint8_t len) |
LightRanger 10 I2C reading function. More... | |
err_t | lightranger10_write_byte (lightranger10_t *ctx, uint16_t reg, uint8_t data_in) |
LightRanger 10 write byte function. More... | |
err_t | lightranger10_read_byte (lightranger10_t *ctx, uint16_t reg, uint8_t *data_out) |
LightRanger 10 read byte function. More... | |
err_t | lightranger10_write_word (lightranger10_t *ctx, uint16_t reg, uint16_t data_in) |
LightRanger 10 write word function. More... | |
err_t | lightranger10_read_word (lightranger10_t *ctx, uint16_t reg, uint16_t *data_out) |
LightRanger 10 read word function. More... | |
err_t | lightranger10_write_dword (lightranger10_t *ctx, uint16_t reg, uint32_t data_in) |
LightRanger 10 write dword function. More... | |
err_t | lightranger10_read_dword (lightranger10_t *ctx, uint16_t reg, uint16_t *data_out) |
LightRanger 10 read dword function. More... | |
err_t | lightranger10_check_communication (lightranger10_t *ctx) |
LightRanger 10 check communication function. More... | |
uint8_t | lightranger10_get_int_pin (lightranger10_t *ctx) |
LightRanger 10 get int pin function. More... | |
void | lightranger10_enable_device (lightranger10_t *ctx) |
LightRanger 10 enable device function. More... | |
void | lightranger10_disable_device (lightranger10_t *ctx) |
LightRanger 10 disable device function. More... | |
void | lightranger10_reset_device (lightranger10_t *ctx) |
LightRanger 10 reset device function. More... | |
err_t | lightranger10_soft_reset (lightranger10_t *ctx) |
LightRanger 10 soft reset function. More... | |
err_t | lightranger10_clear_interrupts (lightranger10_t *ctx) |
LightRanger 10 clear interrupts function. More... | |
err_t | lightranger10_set_inter_measurement_period_ms (lightranger10_t *ctx, uint32_t period_ms) |
LightRanger 10 set inter measurement period ms function. More... | |
err_t | lightranger10_set_distance_offset (lightranger10_t *ctx, int16_t offset_mm) |
LightRanger 10 set distance offset function. More... | |
err_t | lightranger10_calibrate_distance (lightranger10_t *ctx, uint16_t target_distance_mm) |
LightRanger 10 calibrate distance function. More... | |
err_t | lightranger10_set_distance_mode (lightranger10_t *ctx, uint8_t distance_mode) |
LightRanger 10 set distance mode function. More... | |
err_t | lightranger10_start_measurement (lightranger10_t *ctx) |
LightRanger 10 start measurement function. More... | |
err_t | lightranger10_stop_measurement (lightranger10_t *ctx) |
LightRanger 10 stop measurement function. More... | |
err_t | lightranger10_get_distance (lightranger10_t *ctx, uint16_t *distance_mm) |
LightRanger 10 get distance function. More... | |
API for configuring and manipulating LightRanger 10 Click driver.
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.