proximity21
2.1.0.0
|
API for configuring and manipulating Proximity 21 Click driver. More...
Modules | |
Proximity 21 Registers List | |
List of registers of Proximity 21 Click driver. | |
Proximity 21 Registers Settings | |
Settings for registers of Proximity 21 Click driver. | |
Proximity 21 MikroBUS Map | |
MikroBUS pin mapping of Proximity 21 Click driver. | |
Functions | |
void | proximity21_cfg_setup (proximity21_cfg_t *cfg) |
Proximity 21 configuration object setup function. More... | |
err_t | proximity21_init (proximity21_t *ctx, proximity21_cfg_t *cfg) |
Proximity 21 initialization function. More... | |
err_t | proximity21_default_cfg (proximity21_t *ctx) |
Proximity 21 default configuration function. More... | |
err_t | proximity21_reg_write_bytes (proximity21_t *ctx, uint16_t reg, uint8_t *data_in, uint8_t len) |
Proximity 21 reg write bytes function. More... | |
err_t | proximity21_reg_read_bytes (proximity21_t *ctx, uint16_t reg, uint8_t *data_out, uint8_t len) |
Proximity 21 reg read bytes function. More... | |
err_t | proximity21_reg_write_byte (proximity21_t *ctx, uint16_t reg, uint8_t data_in) |
Proximity 21 reg write byte function. More... | |
err_t | proximity21_reg_read_byte (proximity21_t *ctx, uint16_t reg, uint8_t *data_out) |
Proximity 21 reg read byte function. More... | |
err_t | proximity21_reg_write_word (proximity21_t *ctx, uint16_t reg, uint16_t data_in) |
Proximity 21 reg write word function. More... | |
err_t | proximity21_reg_read_word (proximity21_t *ctx, uint16_t reg, uint16_t *data_out) |
Proximity 21 reg read word function. More... | |
err_t | proximity21_reg_write_dword (proximity21_t *ctx, uint16_t reg, uint32_t data_in) |
Proximity 21 reg write dword function. More... | |
err_t | proximity21_reg_read_dword (proximity21_t *ctx, uint16_t reg, uint32_t *data_out) |
Proximity 21 reg read dword function. More... | |
void | proximity21_disable_device (proximity21_t *ctx) |
Proximity 21 disable device function. More... | |
void | proximity21_enable_device (proximity21_t *ctx) |
Proximity 21 enable device function. More... | |
uint8_t | proximity21_get_gpio1_pin (proximity21_t *ctx) |
Proximity 21 get GPIO1 pin function. More... | |
err_t | proximity21_check_comm (proximity21_t *ctx) |
Proximity 21 check comm function. More... | |
err_t | proximity21_set_i2c_address (proximity21_t *ctx, uint8_t address) |
Proximity 21 set I2C address function. More... | |
err_t | proximity21_clear_interrupt (proximity21_t *ctx) |
Proximity 21 clear interrupt function. More... | |
err_t | proximity21_start_ranging (proximity21_t *ctx) |
Proximity 21 start ranging function. More... | |
err_t | proximity21_stop_ranging (proximity21_t *ctx) |
Proximity 21 stop ranging function. More... | |
err_t | proximity21_set_range_timing (proximity21_t *ctx, uint32_t timing_budget_ms, uint32_t inter_measurement_ms) |
Proximity 21 set range timing function. More... | |
err_t | proximity21_get_result (proximity21_t *ctx, proximity21_data_t *results) |
Proximity 21 get result function. More... | |
API for configuring and manipulating Proximity 21 Click driver.
Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.
void proximity21_cfg_setup | ( | proximity21_cfg_t * | cfg | ) |
Proximity 21 configuration object setup function.
This function initializes click configuration structure to initial values.
[out] | cfg | : Click configuration structure. See proximity21_cfg_t object definition for detailed explanation. |
err_t proximity21_check_comm | ( | proximity21_t * | ctx | ) |
Proximity 21 check comm function.
This function checks the communication by reading and verifying the device ID.
[in] | ctx | : Click context object. See proximity21_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t proximity21_clear_interrupt | ( | proximity21_t * | ctx | ) |
Proximity 21 clear interrupt function.
This function clears the data ready interrupt.
[in] | ctx | : Click context object. See proximity21_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t proximity21_default_cfg | ( | proximity21_t * | ctx | ) |
Proximity 21 default configuration function.
This function executes a default configuration of Proximity 21 click board.
[in] | ctx | : Click context object. See proximity21_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. void proximity21_disable_device | ( | proximity21_t * | ctx | ) |
Proximity 21 disable device function.
This function disables the device by setting the XSHUT pin to low logic state.
[in] | ctx | : Click context object. See proximity21_t object definition for detailed explanation. |
void proximity21_enable_device | ( | proximity21_t * | ctx | ) |
Proximity 21 enable device function.
This function enables the device by setting the XSHUT pin to high logic state.
[in] | ctx | : Click context object. See proximity21_t object definition for detailed explanation. |
uint8_t proximity21_get_gpio1_pin | ( | proximity21_t * | ctx | ) |
Proximity 21 get GPIO1 pin function.
This function returns the GPIO1 (interrupt) pin logic state.
[in] | ctx | : Click context object. See proximity21_t object definition for detailed explanation. |
err_t proximity21_get_result | ( | proximity21_t * | ctx, |
proximity21_data_t * | results | ||
) |
Proximity 21 get result function.
This function gets the results reported by the sensor.
[in] | ctx | : Click context object. See proximity21_t object definition for detailed explanation. |
[in] | results | : Click context object. See proximity21_data_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t proximity21_init | ( | proximity21_t * | ctx, |
proximity21_cfg_t * | cfg | ||
) |
Proximity 21 initialization function.
This function initializes all necessary pins and peripherals used for this click board.
[out] | ctx | : Click context object. See proximity21_t object definition for detailed explanation. |
[in] | cfg | : Click configuration structure. See proximity21_cfg_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t proximity21_reg_read_byte | ( | proximity21_t * | ctx, |
uint16_t | reg, | ||
uint8_t * | data_out | ||
) |
Proximity 21 reg read byte function.
This function reads a data byte from the selected register by using I2C serial interface.
[in] | ctx | : Click context object. See proximity21_t object definition for detailed explanation. |
[in] | reg | : Register address. |
[out] | data_out | : 8-bit output read data. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t proximity21_reg_read_bytes | ( | proximity21_t * | ctx, |
uint16_t | reg, | ||
uint8_t * | data_out, | ||
uint8_t | len | ||
) |
Proximity 21 reg read bytes 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 proximity21_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 proximity21_reg_read_dword | ( | proximity21_t * | ctx, |
uint16_t | reg, | ||
uint32_t * | data_out | ||
) |
Proximity 21 reg read dword function.
This function reads a data dword starting from the selected register by using I2C serial interface.
[in] | ctx | : Click context object. See proximity21_t object definition for detailed explanation. |
[in] | reg | : Start register address. |
[out] | data_out | : 32-bit output read data. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t proximity21_reg_read_word | ( | proximity21_t * | ctx, |
uint16_t | reg, | ||
uint16_t * | data_out | ||
) |
Proximity 21 reg read word function.
This function reads a data word starting from the selected register by using I2C serial interface.
[in] | ctx | : Click context object. See proximity21_t object definition for detailed explanation. |
[in] | reg | : Start register address. |
[out] | data_out | : 16-bit output read data. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t proximity21_reg_write_byte | ( | proximity21_t * | ctx, |
uint16_t | reg, | ||
uint8_t | data_in | ||
) |
Proximity 21 reg write byte function.
This function writes a data byte to the selected register by using I2C serial interface.
[in] | ctx | : Click context object. See proximity21_t object definition for detailed explanation. |
[in] | reg | : Register address. |
[in] | data_in | : 8-bit data to be written. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t proximity21_reg_write_bytes | ( | proximity21_t * | ctx, |
uint16_t | reg, | ||
uint8_t * | data_in, | ||
uint8_t | len | ||
) |
Proximity 21 reg write bytes 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 proximity21_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 proximity21_reg_write_dword | ( | proximity21_t * | ctx, |
uint16_t | reg, | ||
uint32_t | data_in | ||
) |
Proximity 21 reg write dword function.
This function writes a data dword starting from the selected register by using I2C serial interface.
[in] | ctx | : Click context object. See proximity21_t object definition for detailed explanation. |
[in] | reg | : Start register address. |
[in] | data_in | : 32-bit data to be written. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t proximity21_reg_write_word | ( | proximity21_t * | ctx, |
uint16_t | reg, | ||
uint16_t | data_in | ||
) |
Proximity 21 reg write word function.
This function writes a data word starting from the selected register by using I2C serial interface.
[in] | ctx | : Click context object. See proximity21_t object definition for detailed explanation. |
[in] | reg | : Start register address. |
[in] | data_in | : 16-bit data to be written. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t proximity21_set_i2c_address | ( | proximity21_t * | ctx, |
uint8_t | address | ||
) |
Proximity 21 set I2C address function.
This function sets a new 7-bit I2C address for the click sensor.
[in] | ctx | : Click context object. See proximity21_t object definition for detailed explanation. |
[in] | address | : 7-bit I2C address to be set. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t proximity21_set_range_timing | ( | proximity21_t * | ctx, |
uint32_t | timing_budget_ms, | ||
uint32_t | inter_measurement_ms | ||
) |
Proximity 21 set range timing function.
This function sets the VCSEL enabled time, and the time between two measurements.
[in] | ctx | : Click context object. See proximity21_t object definition for detailed explanation. |
[in] | timing_budget_ms | : VCSEL enabled time in milliseconds (10 to 200ms), default 50ms. |
[in] | inter_measurement_ms | : The time between two measurements in milliseconds. If the value is equal to 0, the time is defined by timing_budget_ms. Otherwise, it must be > timing_budget_ms, default 200ms. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t proximity21_start_ranging | ( | proximity21_t * | ctx | ) |
Proximity 21 start ranging function.
This function starts a continuous ranging session.
[in] | ctx | : Click context object. See proximity21_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t proximity21_stop_ranging | ( | proximity21_t * | ctx | ) |
Proximity 21 stop ranging function.
This function stops the ranging session.
[in] | ctx | : Click context object. See proximity21_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation.