|
lightranger13 2.2.0
|
API for configuring and manipulating LightRanger 13 Click driver. More...
Topics | |
| LightRanger 13 Registers List | |
| List of registers of LightRanger 13 Click driver. | |
| LightRanger 13 Registers Settings | |
| Settings for registers of LightRanger 13 Click driver. | |
| LightRanger 13 MikroBUS Map | |
| MikroBUS pin mapping of LightRanger 13 Click driver. | |
Functions | |
| void | lightranger13_cfg_setup (lightranger13_cfg_t *cfg) |
| LightRanger 13 configuration object setup function. | |
| err_t | lightranger13_init (lightranger13_t *ctx, lightranger13_cfg_t *cfg) |
| LightRanger 13 initialization function. | |
| err_t | lightranger13_default_cfg (lightranger13_t *ctx) |
| LightRanger 13 default configuration function. | |
| err_t | lightranger13_write_regs (lightranger13_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len) |
| LightRanger 13 write regs function. | |
| err_t | lightranger13_read_regs (lightranger13_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len) |
| LightRanger 13 read regs function. | |
| err_t | lightranger13_write_reg (lightranger13_t *ctx, uint8_t reg, uint8_t data_in) |
| LightRanger 13 write reg function. | |
| err_t | lightranger13_read_reg (lightranger13_t *ctx, uint8_t reg, uint8_t *data_out) |
| LightRanger 13 read reg function. | |
| err_t | lightranger13_send_cmd (lightranger13_t *ctx, uint8_t cmd, uint8_t *payload, uint8_t payload_len, uint16_t timeout_ms) |
| LightRanger 13 send cmd function. | |
| err_t | lightranger13_wait_reg_state (lightranger13_t *ctx, uint8_t reg, uint8_t mask, uint8_t state, uint16_t timeout_ms) |
| LightRanger 13 wait reg state function. | |
| void | lightranger13_enable_device (lightranger13_t *ctx) |
| LightRanger 13 enable device function. | |
| void | lightranger13_disable_device (lightranger13_t *ctx) |
| LightRanger 13 disable device function. | |
| uint8_t | lightranger13_get_int_pin (lightranger13_t *ctx) |
| LightRanger 13 get int pin function. | |
| err_t | lightranger13_power_up (lightranger13_t *ctx) |
| LightRanger 13 power up function. | |
| err_t | lightranger13_read_info (lightranger13_t *ctx) |
| LightRanger 13 read info function. | |
| err_t | lightranger13_clear_interrupts (lightranger13_t *ctx) |
| LightRanger 13 clear interrupts function. | |
| err_t | lightranger13_factory_calib (lightranger13_t *ctx) |
| LightRanger 13 factory calib function. | |
| err_t | lightranger13_set_threshold (lightranger13_t *ctx, uint16_t t_low, uint16_t t_high, uint8_t persistance) |
| LightRanger 13 set threshold function. | |
| err_t | lightranger13_start_measurement (lightranger13_t *ctx) |
| LightRanger 13 start measurement function. | |
| err_t | lightranger13_stop_measurement (lightranger13_t *ctx) |
| LightRanger 13 stop measurement function. | |
| err_t | lightranger13_read_result (lightranger13_t *ctx, lightranger13_meas_result_t *result) |
| LightRanger 13 read result function. | |
API for configuring and manipulating LightRanger 13 Click driver.
Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.
| void lightranger13_cfg_setup | ( | lightranger13_cfg_t * | cfg | ) |
LightRanger 13 configuration object setup function.
This function initializes Click configuration structure to initial values.
| [out] | cfg | : Click configuration structure. See lightranger13_cfg_t object definition for detailed explanation. |
| err_t lightranger13_clear_interrupts | ( | lightranger13_t * | ctx | ) |
LightRanger 13 clear interrupts function.
This function reads and clears the interrupt status register.
| [in] | ctx | : Click context object. See lightranger13_t object definition for detailed explanation. |
0 - Success, -1 - Error. See #err_t definition for detailed explanation. | err_t lightranger13_default_cfg | ( | lightranger13_t * | ctx | ) |
LightRanger 13 default configuration function.
This function executes a default configuration of LightRanger 13 Click board.
| [in] | ctx | : Click context object. See lightranger13_t object definition for detailed explanation. |
0 - Success, -1 - Error. See #err_t definition for detailed explanation. | void lightranger13_disable_device | ( | lightranger13_t * | ctx | ) |
LightRanger 13 disable device function.
This function disables the device by setting the EN pin to low logic state.
| [in] | ctx | : Click context object. See lightranger13_t object definition for detailed explanation. |
| void lightranger13_enable_device | ( | lightranger13_t * | ctx | ) |
LightRanger 13 enable device function.
This function enables the device by setting the EN pin to high logic state.
| [in] | ctx | : Click context object. See lightranger13_t object definition for detailed explanation. |
| err_t lightranger13_factory_calib | ( | lightranger13_t * | ctx | ) |
LightRanger 13 factory calib function.
This function performs a factory calibration.
| [in] | ctx | : Click context object. See lightranger13_t object definition for detailed explanation. |
0 - Success, -1 - Error. See #err_t definition for detailed explanation. | uint8_t lightranger13_get_int_pin | ( | lightranger13_t * | ctx | ) |
LightRanger 13 get int pin function.
This function returns the INT pin logic state.
| [in] | ctx | : Click context object. See lightranger13_t object definition for detailed explanation. |
| err_t lightranger13_init | ( | lightranger13_t * | ctx, |
| lightranger13_cfg_t * | cfg ) |
LightRanger 13 initialization function.
This function initializes all necessary pins and peripherals used for this Click board.
| [out] | ctx | : Click context object. See lightranger13_t object definition for detailed explanation. |
| [in] | cfg | : Click configuration structure. See lightranger13_cfg_t object definition for detailed explanation. |
0 - Success, -1 - Error. See #err_t definition for detailed explanation. | err_t lightranger13_power_up | ( | lightranger13_t * | ctx | ) |
LightRanger 13 power up function.
This function enables the device and switches it to ROM application state.
| [in] | ctx | : Click context object. See lightranger13_t object definition for detailed explanation. |
0 - Success, -1 - Error. See #err_t definition for detailed explanation. | err_t lightranger13_read_info | ( | lightranger13_t * | ctx | ) |
LightRanger 13 read info function.
This function reads the device information and stores it in ctx->info structure.
| [in] | ctx | : Click context object. See lightranger13_t object definition for detailed explanation. |
0 - Success, -1 - Error. See #err_t definition for detailed explanation. | err_t lightranger13_read_reg | ( | lightranger13_t * | ctx, |
| uint8_t | reg, | ||
| uint8_t * | data_out ) |
LightRanger 13 read reg function.
This function reads data from the selected register by using I2C serial interface.
| [in] | ctx | : Click context object. See lightranger13_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 lightranger13_read_regs | ( | lightranger13_t * | ctx, |
| uint8_t | reg, | ||
| uint8_t * | data_out, | ||
| uint8_t | len ) |
LightRanger 13 read regs 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 lightranger13_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 lightranger13_read_result | ( | lightranger13_t * | ctx, |
| lightranger13_meas_result_t * | result ) |
LightRanger 13 read result function.
This function reads the measurement results.
| [in] | ctx | : Click context object. See lightranger13_t object definition for detailed explanation. |
| [in] | result | : Click context object. See lightranger13_meas_result_t object definition for detailed explanation. |
0 - Success, -1 - Error. See #err_t definition for detailed explanation. | err_t lightranger13_send_cmd | ( | lightranger13_t * | ctx, |
| uint8_t | cmd, | ||
| uint8_t * | payload, | ||
| uint8_t | payload_len, | ||
| uint16_t | timeout_ms ) |
LightRanger 13 send cmd function.
This function sends a desired App0 command with or without payload, and waits a desired period for a command execution.
| [in] | ctx | : Click context object. See lightranger13_t object definition for detailed explanation. |
| [in] | cmd | : App0 command list. |
| [in] | payload | : Command payload buffer. |
| [in] | payload_len | : Command payload len. |
| [in] | timeout_ms | : Response timeout in milliseconds. |
0 - Success, -1 - Error. See #err_t definition for detailed explanation. | err_t lightranger13_set_threshold | ( | lightranger13_t * | ctx, |
| uint16_t | t_low, | ||
| uint16_t | t_high, | ||
| uint8_t | persistance ) |
LightRanger 13 set threshold function.
This function sets a threshold level and interrupt persistance.
| [in] | ctx | : Click context object. See lightranger13_t object definition for detailed explanation. |
| [in] | t_low | : Threshold low in millimeters. |
| [in] | t_high | : Threshold high in millimeters. |
| [in] | persistance | : 0 - ignore threshold, >=1 - number of consecutive results in threshold range. |
0 - Success, -1 - Error. See #err_t definition for detailed explanation. | err_t lightranger13_start_measurement | ( | lightranger13_t * | ctx | ) |
LightRanger 13 start measurement function.
This function starts a measurement (the configuration, factory calibration and state data are used from context object).
| [in] | ctx | : Click context object. See lightranger13_t object definition for detailed explanation. |
0 - Success, -1 - Error. See #err_t definition for detailed explanation. | err_t lightranger13_stop_measurement | ( | lightranger13_t * | ctx | ) |
LightRanger 13 stop measurement function.
This function stops a measurement.
| [in] | ctx | : Click context object. See lightranger13_t object definition for detailed explanation. |
0 - Success, -1 - Error. See #err_t definition for detailed explanation. | err_t lightranger13_wait_reg_state | ( | lightranger13_t * | ctx, |
| uint8_t | reg, | ||
| uint8_t | mask, | ||
| uint8_t | state, | ||
| uint16_t | timeout_ms ) |
LightRanger 13 wait reg state function.
This function waits a desired period for selected register bit mask state.
| [in] | ctx | : Click context object. See lightranger13_t object definition for detailed explanation. |
| [in] | reg | : Register address. |
| [in] | mask | : Register bit mask. |
| [in] | state | : Register bit state. |
| [in] | timeout_ms | : Response timeout in milliseconds. |
0 - Success, -1 - Error. See #err_t definition for detailed explanation. | err_t lightranger13_write_reg | ( | lightranger13_t * | ctx, |
| uint8_t | reg, | ||
| uint8_t | data_in ) |
LightRanger 13 write reg function.
This function writes a desired data to the selected register by using I2C serial interface.
| [in] | ctx | : Click context object. See lightranger13_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 lightranger13_write_regs | ( | lightranger13_t * | ctx, |
| uint8_t | reg, | ||
| uint8_t * | data_in, | ||
| uint8_t | len ) |
LightRanger 13 write regs 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 lightranger13_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.