proximity12 2.0.0.0
|
API for configuring and manipulating Proximity 12 Click driver. More...
Topics | |
Proximity 12 Registers List | |
List of registers of Proximity 12 Click driver. | |
Proximity 12 Registers Settings | |
Settings for registers of Proximity 12 Click driver. | |
Proximity 12 MikroBUS Map | |
MikroBUS pin mapping of Proximity 12 Click driver. | |
Functions | |
void | proximity12_cfg_setup (proximity12_cfg_t *cfg) |
Proximity 12 configuration object setup function. | |
err_t | proximity12_init (proximity12_t *ctx, proximity12_cfg_t *cfg) |
Proximity 12 initialization function. | |
err_t | proximity12_default_cfg (proximity12_t *ctx) |
Proximity 12 default configuration function. | |
err_t | proximity12_generic_write (proximity12_t *ctx, uint8_t reg, uint8_t *tx_buf, uint8_t tx_len) |
Proximity 12 I2C writing function. | |
err_t | proximity12_generic_read (proximity12_t *ctx, uint8_t reg, uint8_t *rx_buf, uint8_t rx_len) |
Proximity 12 I2C reading function. | |
err_t | proximity12_check_device_id (proximity12_t *ctx) |
Proximity 12 check device ID function. | |
err_t | proximity12_read_proximity (proximity12_t *ctx, uint16_t *prox_data) |
Proximity 12 read proximity function. | |
err_t | proximity12_read_als (proximity12_t *ctx, proximity12_als_data_t *als) |
Proximity 12 read als data function. | |
err_t | proximity12_wait_atime (proximity12_t *ctx) |
Proximity 12 wait atime function. | |
err_t | proximity12_wait_ptime (proximity12_t *ctx) |
Proximity 12 wait ptime function. | |
err_t | proximity12_enable (proximity12_t *ctx, uint8_t en_mask) |
Proximity 12 enable function. | |
err_t | proximity12_enable_measurement (proximity12_t *ctx, uint8_t en_mask) |
Proximity 12 enable measurement function. | |
err_t | proximity12_proximity_calibration (proximity12_t *ctx) |
Proximity 12 proximity calibration function. | |
err_t | proximity12_set_proximity_filter (proximity12_t *ctx, uint8_t filter) |
Proximity 12 set proximity filter function. | |
err_t | proximity12_set_led_isink (proximity12_t *ctx, uint8_t scaler, uint8_t current) |
Proximity 12 set led isink function. | |
err_t | proximity12_set_proximity_gain (proximity12_t *ctx, uint8_t gain) |
Proximity 12 set proximity gain function. | |
err_t | proximity12_set_agc_mod_gain (proximity12_t *ctx, uint8_t en_mask, uint8_t gain) |
Proximity 12 set agc modulator gain function. | |
void | proximity12_set_syn_pin (proximity12_t *ctx, uint8_t state) |
Proximity 12 set syn pin state function. | |
void | proximity12_set_gp1_pin (proximity12_t *ctx, uint8_t state) |
Proximity 12 set gp1 pin state function. | |
void | proximity12_set_gp2_pin (proximity12_t *ctx, uint8_t state) |
Proximity 12 set gp2 pin state function. | |
uint8_t | proximity12_get_int_pin (proximity12_t *ctx) |
Proximity 12 get int pin state function. | |
API for configuring and manipulating Proximity 12 Click driver.
Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.
void proximity12_cfg_setup | ( | proximity12_cfg_t * | cfg | ) |
Proximity 12 configuration object setup function.
This function initializes click configuration structure to initial values.
[out] | cfg | : Click configuration structure. See proximity12_cfg_t object definition for detailed explanation. |
err_t proximity12_check_device_id | ( | proximity12_t * | ctx | ) |
Proximity 12 check device ID function.
This function checks the communication by reading and verifying the device ID.
[in] | ctx | : Click context object. See proximity12_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t proximity12_default_cfg | ( | proximity12_t * | ctx | ) |
Proximity 12 default configuration function.
This function executes a default configuration of Proximity 12 click board.
[in] | ctx | : Click context object. See proximity12_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t proximity12_enable | ( | proximity12_t * | ctx, |
uint8_t | en_mask ) |
Proximity 12 enable function.
This function enables desired sensors.
[in] | ctx | : Click context object. See proximity12_t object definition for detailed explanation. |
[in] | en_mask | : Enable mask, refer to ENABLE register settings for more information. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t proximity12_enable_measurement | ( | proximity12_t * | ctx, |
uint8_t | en_mask ) |
Proximity 12 enable measurement function.
This function enables desired diodes for a measurement.
[in] | ctx | : Click context object. See proximity12_t object definition for detailed explanation. |
[in] | en_mask | : Enable mask, refer to MEAS_MODE0 register settings for more information. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t proximity12_generic_read | ( | proximity12_t * | ctx, |
uint8_t | reg, | ||
uint8_t * | rx_buf, | ||
uint8_t | rx_len ) |
Proximity 12 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 proximity12_t object definition for detailed explanation. |
[in] | reg | : Start register address. |
[out] | rx_buf | : Output read data. |
[in] | rx_len | : Number of bytes to be read. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t proximity12_generic_write | ( | proximity12_t * | ctx, |
uint8_t | reg, | ||
uint8_t * | tx_buf, | ||
uint8_t | tx_len ) |
Proximity 12 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 proximity12_t object definition for detailed explanation. |
[in] | reg | : Start register address. |
[in] | tx_buf | : Data to be written. |
[in] | tx_len | : Number of bytes to be written. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. uint8_t proximity12_get_int_pin | ( | proximity12_t * | ctx | ) |
Proximity 12 get int pin state function.
This function returns the int pin logic state.
[in] | ctx | : Click context object. See proximity12_t object definition for detailed explanation. |
err_t proximity12_init | ( | proximity12_t * | ctx, |
proximity12_cfg_t * | cfg ) |
Proximity 12 initialization function.
This function initializes all necessary pins and peripherals used for this click board.
[out] | ctx | : Click context object. See proximity12_t object definition for detailed explanation. |
[in] | cfg | : Click configuration structure. See proximity12_cfg_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t proximity12_proximity_calibration | ( | proximity12_t * | ctx | ) |
Proximity 12 proximity calibration function.
This function performs a proximity calibration and waits until the calibration is finished.
[in] | ctx | : Click context object. See proximity12_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t proximity12_read_als | ( | proximity12_t * | ctx, |
proximity12_als_data_t * | als ) |
Proximity 12 read als data function.
This function reads all als data measured by the click board.
[in] | ctx | : Click context object. See proximity12_t object definition for detailed explanation. |
[out] | als | : Als data structure. See proximity12_als_data_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t proximity12_read_proximity | ( | proximity12_t * | ctx, |
uint16_t * | prox_data ) |
Proximity 12 read proximity function.
This function reads the raw proximity value measured by the click board.
[in] | ctx | : Click context object. See proximity12_t object definition for detailed explanation. |
[out] | prox_data | : Proximity value read. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t proximity12_set_agc_mod_gain | ( | proximity12_t * | ctx, |
uint8_t | en_mask, | ||
uint8_t | gain ) |
Proximity 12 set agc modulator gain function.
This function sets the agc modulator gains.
[in] | ctx | : Click context object. See proximity12_t object definition for detailed explanation. |
[in] | en_mask | : Enable mask, refer to AGC_ENABLE register settings for more information. |
[in] | gain | : Gain mask [0-11]. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. void proximity12_set_gp1_pin | ( | proximity12_t * | ctx, |
uint8_t | state ) |
Proximity 12 set gp1 pin state function.
This function sets the gp1 pin state.
[in] | ctx | : Click context object. See proximity12_t object definition for detailed explanation. |
[in] | state | : Pin logic state. |
void proximity12_set_gp2_pin | ( | proximity12_t * | ctx, |
uint8_t | state ) |
Proximity 12 set gp2 pin state function.
This function sets the gp2 pin state.
[in] | ctx | : Click context object. See proximity12_t object definition for detailed explanation. |
[in] | state | : Pin logic state. |
err_t proximity12_set_led_isink | ( | proximity12_t * | ctx, |
uint8_t | scaler, | ||
uint8_t | current ) |
Proximity 12 set led isink function.
This function sets the LEDs sink scaler and current values.
[in] | ctx | : Click context object. See proximity12_t object definition for detailed explanation. |
[in] | scaler | : Scaler mask [0-3]. |
[in] | current | : Current mask [0-7]. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t proximity12_set_proximity_filter | ( | proximity12_t * | ctx, |
uint8_t | filter ) |
Proximity 12 set proximity filter function.
This function sets the proximity filter by setting the PCFG1 register.
[in] | ctx | : Click context object. See proximity12_t object definition for detailed explanation. |
[in] | filter | : Filter mask [0-15]. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t proximity12_set_proximity_gain | ( | proximity12_t * | ctx, |
uint8_t | gain ) |
Proximity 12 set proximity gain function.
This function sets the proximity gain by setting the PCFG4 register.
[in] | ctx | : Click context object. See proximity12_t object definition for detailed explanation. |
[in] | gain | : Gain mask [0-3]. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. void proximity12_set_syn_pin | ( | proximity12_t * | ctx, |
uint8_t | state ) |
Proximity 12 set syn pin state function.
This function sets the syn pin state.
[in] | ctx | : Click context object. See proximity12_t object definition for detailed explanation. |
[in] | state | : Pin logic state. |
err_t proximity12_wait_atime | ( | proximity12_t * | ctx | ) |
Proximity 12 wait atime function.
This function waits for als integration time which is set in the proper registers.
[in] | ctx | : Click context object. See proximity12_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t proximity12_wait_ptime | ( | proximity12_t * | ctx | ) |
Proximity 12 wait ptime function.
This function waits for proximity sample time which is set in the proper registers.
[in] | ctx | : Click context object. See proximity12_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation.