spectrometer2 2.0.0.0
|
API for configuring and manipulating Spectrometer 2 Click driver. More...
Topics | |
Spectrometer 2 Registers List | |
List of registers of Spectrometer 2 Click driver. | |
Spectrometer 2 Registers Settings | |
Settings for registers of Spectrometer 2 Click driver. | |
Spectrometer 2 MikroBUS Map | |
MikroBUS pin mapping of Spectrometer 2 Click driver. | |
Functions | |
void | spectrometer2_cfg_setup (spectrometer2_cfg_t *cfg) |
Spectrometer 2 configuration object setup function. | |
err_t | spectrometer2_init (spectrometer2_t *ctx, spectrometer2_cfg_t *cfg) |
Spectrometer 2 initialization function. | |
err_t | spectrometer2_default_cfg (spectrometer2_t *ctx) |
Spectrometer 2 default configuration function. | |
err_t | spectrometer2_generic_write (spectrometer2_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len) |
Spectrometer 2 I2C writing function. | |
err_t | spectrometer2_generic_read (spectrometer2_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len) |
Spectrometer 2 I2C reading function. | |
err_t | spectrometer2_write_register (spectrometer2_t *ctx, uint8_t reg, uint8_t data_in) |
Spectrometer 2 write register function. | |
err_t | spectrometer2_read_register (spectrometer2_t *ctx, uint8_t reg, uint8_t *data_out) |
Spectrometer 2 read register function. | |
err_t | spectrometer2_check_communication (spectrometer2_t *ctx) |
Spectrometer 2 check communication function. | |
uint8_t | spectrometer2_get_int_pin (spectrometer2_t *ctx) |
Spectrometer 2 get int pin function. | |
uint8_t | spectrometer2_get_an_pin (spectrometer2_t *ctx) |
Spectrometer 2 get an pin function. | |
err_t | spectrometer2_get_data (spectrometer2_t *ctx, spectrometer2_als_channels_t *als_channels) |
Spectrometer 2 get data function. | |
err_t | spectrometer2_clear_interrupt (spectrometer2_t *ctx) |
Spectrometer 2 clear interrupt function. | |
err_t | spectrometer2_set_exposure_time (spectrometer2_t *ctx, float exp_time) |
Spectrometer 2 set exposure time function. | |
err_t | spectrometer2_set_inter_measurement_period (spectrometer2_t *ctx, float im_period) |
Spectrometer 2 set inter measurement period function. | |
uint8_t | spectrometer2_get_color (spectrometer2_hsl_t *hsl) |
Spectrometer 2 get color function. | |
void | spectrometer2_rgbc_to_hsl (spectrometer2_als_channels_t *rgbc, spectrometer2_hsl_t *hsl) |
Spectrometer 2 rgbc to hsl function. | |
API for configuring and manipulating Spectrometer 2 Click driver.
Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.
void spectrometer2_cfg_setup | ( | spectrometer2_cfg_t * | cfg | ) |
Spectrometer 2 configuration object setup function.
This function initializes click configuration structure to initial values.
[out] | cfg | : Click configuration structure. See spectrometer2_cfg_t object definition for detailed explanation. |
err_t spectrometer2_check_communication | ( | spectrometer2_t * | ctx | ) |
Spectrometer 2 check communication function.
This function checks the communication by reading and verifying the device ID.
[in] | ctx | : Click context object. See spectrometer2_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t spectrometer2_clear_interrupt | ( | spectrometer2_t * | ctx | ) |
Spectrometer 2 clear interrupt function.
This function clears the interrupts by writing to the INTERRUPT_CTRL register.
[in] | ctx | : Click context object. See spectrometer2_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t spectrometer2_default_cfg | ( | spectrometer2_t * | ctx | ) |
Spectrometer 2 default configuration function.
This function executes a default configuration of Spectrometer 2 click board.
[in] | ctx | : Click context object. See spectrometer2_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t spectrometer2_generic_read | ( | spectrometer2_t * | ctx, |
uint8_t | reg, | ||
uint8_t * | data_out, | ||
uint8_t | len ) |
Spectrometer 2 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 spectrometer2_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 spectrometer2_generic_write | ( | spectrometer2_t * | ctx, |
uint8_t | reg, | ||
uint8_t * | data_in, | ||
uint8_t | len ) |
Spectrometer 2 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 spectrometer2_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. uint8_t spectrometer2_get_an_pin | ( | spectrometer2_t * | ctx | ) |
Spectrometer 2 get an pin function.
This function returns the AN pin logic state.
[in] | ctx | : Click context object. See spectrometer2_t object definition for detailed explanation. |
uint8_t spectrometer2_get_color | ( | spectrometer2_hsl_t * | hsl | ) |
Spectrometer 2 get color function.
This function returns the color name flag from the input HSL color.
[out] | hsl | : HSL (hue, saturation, lightness) input value. See spectrometer2_hsl_t object definition for detailed explanation. |
err_t spectrometer2_get_data | ( | spectrometer2_t * | ctx, |
spectrometer2_als_channels_t * | als_channels ) |
Spectrometer 2 get data function.
This function reads data from 6 ALS channels (Red, Visible, Blue, Green, IR, Clear).
[in] | ctx | : Click context object. See spectrometer2_t object definition for detailed explanation. |
[out] | als_channels | : ALS channels (Red, Visible, Blue, Green, IR, Clear). See spectrometer2_als_channels_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. uint8_t spectrometer2_get_int_pin | ( | spectrometer2_t * | ctx | ) |
Spectrometer 2 get int pin function.
This function returns the INT pin logic state.
[in] | ctx | : Click context object. See spectrometer2_t object definition for detailed explanation. |
err_t spectrometer2_init | ( | spectrometer2_t * | ctx, |
spectrometer2_cfg_t * | cfg ) |
Spectrometer 2 initialization function.
This function initializes all necessary pins and peripherals used for this click board.
[out] | ctx | : Click context object. See spectrometer2_t object definition for detailed explanation. |
[in] | cfg | : Click configuration structure. See spectrometer2_cfg_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t spectrometer2_read_register | ( | spectrometer2_t * | ctx, |
uint8_t | reg, | ||
uint8_t * | data_out ) |
Spectrometer 2 read register function.
This function reads a desired data from the selected register by using I2C serial interface.
[in] | ctx | : Click context object. See spectrometer2_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. void spectrometer2_rgbc_to_hsl | ( | spectrometer2_als_channels_t * | rgbc, |
spectrometer2_hsl_t * | hsl ) |
Spectrometer 2 rgbc to hsl function.
This function converts RGBC (red, green, blue, clear) to HSL (hue, saturation, lightness) color value.
[out] | rgbc | : RGBC (red, green, blue, clear) input value. See spectrometer2_als_channels_t object definition for detailed explanation. |
[out] | hsl | : HSL (hue, saturation, lightness) input value. See spectrometer2_hsl_t object definition for detailed explanation. |
err_t spectrometer2_set_exposure_time | ( | spectrometer2_t * | ctx, |
float | exp_time ) |
Spectrometer 2 set exposure time function.
This function sets the exposure time.
[in] | ctx | : Click context object. See spectrometer2_t object definition for detailed explanation. |
[in] | exp_time | : Exposure time in milliseconds [1.6-1638.4]. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t spectrometer2_set_inter_measurement_period | ( | spectrometer2_t * | ctx, |
float | im_period ) |
Spectrometer 2 set inter measurement period function.
This function sets the inter measurement period.
[in] | ctx | : Click context object. See spectrometer2_t object definition for detailed explanation. |
[in] | im_period | : Inter measurement period in milliseconds [0.0-5227.5]. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t spectrometer2_write_register | ( | spectrometer2_t * | ctx, |
uint8_t | reg, | ||
uint8_t | data_in ) |
Spectrometer 2 write register function.
This function writes a desired data to the selected register by using I2C serial interface.
[in] | ctx | : Click context object. See spectrometer2_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.