smoke
2.0.0.0
|
Functions | |
void | smoke_cfg_setup (smoke_cfg_t *cfg) |
Config Object Initialization function. More... | |
SMOKE_RETVAL | smoke_init (smoke_t *ctx, smoke_cfg_t *cfg) |
Initialization function. More... | |
void | smoke_default_cfg (smoke_t *ctx) |
Click Default Configuration function. More... | |
void | smoke_write_data (smoke_t *ctx, uint8_t wr_addr, uint8_t wr_data) |
Generic write function. More... | |
uint8_t | smoke_read_data (smoke_t *ctx, uint8_t rd_addr) |
Generic read function. More... | |
void | smoke_multi_read (smoke_t *ctx, uint8_t rd_addr, uint8_t *buffer, uint8_t cnt) |
Multi read function. More... | |
void | smoke_set_new_value (smoke_t *ctx, uint8_t reg, uint8_t mask, uint8_t value) |
Set new value function. More... | |
uint8_t | smoke_get_intrrupt (smoke_t *ctx, uint8_t flag) |
Get desired interrupt function. More... | |
void | smoke_enable_disable_interrupts (smoke_t *ctx, uint8_t interrupt_flag, uint8_t enable_flag) |
Enable or disable interrupt function. More... | |
void | smoke_setting_function (smoke_t *ctx, uint8_t flag, uint8_t mode) |
Set corresponding configuration register function. More... | |
void | smoke_setting_prox_and_amp (smoke_t *ctx, uint8_t flag, uint8_t write_data) |
Set corresponding amplitude or proximity threshold function. More... | |
void | smoke_enable_slot (smoke_t *ctx, uint8_t slot_num, uint8_t dev) |
Define slots in MultiLED mode function. More... | |
void | smoke_disable_slots (smoke_t *ctx) |
Disable slots in MultiLED mode function. More... | |
void | smoke_clear_fifo (smoke_t *ctx) |
Clearing FIFO pointers function. More... | |
void | smoke_fifo_setting (smoke_t *ctx, uint8_t flag, uint8_t samp_num) |
Set FIFO configuration register function. More... | |
uint8_t | smoke_get_write_ptr (smoke_t *ctx) |
Read the FIFO Write Pointer function. More... | |
uint8_t | smoke_get_read_ptr (smoke_t *ctx) |
Read the FIFO Read Pointer function. More... | |
float | smoke_read_temp_c (smoke_t *ctx) |
Read temperature in Centigrade function. More... | |
float | smoke_read_temp_f (smoke_t *ctx) |
Read temperature in Fahrenheit function. More... | |
void | smoke_reset (smoke_t *ctx) |
Reset device function. More... | |
uint8_t | smoke_read_device_id (smoke_t *ctx) |
Read device ID function. More... | |
uint32_t | smoke_get_red_val (smoke_t *ctx) |
Get Red value function. More... | |
uint32_t | smoke_get_ir_val (smoke_t *ctx) |
Get IR value function. More... | |
uint32_t | smoke_get_green_val (smoke_t *ctx) |
Get Green value function. More... | |
void | smoke_set_registers (smoke_t *ctx, smoke_set_registers_t *registers) |
Set registers values function. More... | |
uint8_t | smoke_check_int (smoke_t *ctx) |
Get Interrupt state function. More... | |
void smoke_cfg_setup | ( | smoke_cfg_t * | cfg | ) |
Config Object Initialization function.
cfg | Click configuration structure. |
This function initializes click configuration structure to init state.
uint8_t smoke_check_int | ( | smoke_t * | ctx | ) |
Get Interrupt state function.
ctx | Click object. |
Function is used to check the state of INT pin.
void smoke_clear_fifo | ( | smoke_t * | ctx | ) |
Clearing FIFO pointers function.
ctx | Click object. |
Function is used to clear FIFO pointers.
void smoke_default_cfg | ( | smoke_t * | ctx | ) |
Click Default Configuration function.
ctx | Click object. |
This function executes default configuration for Smoke click.
void smoke_disable_slots | ( | smoke_t * | ctx | ) |
Disable slots in MultiLED mode function.
ctx | Click object. |
Function is used to disable all LED-s in each time slot.
void smoke_enable_disable_interrupts | ( | smoke_t * | ctx, |
uint8_t | interrupt_flag, | ||
uint8_t | enable_flag | ||
) |
Enable or disable interrupt function.
ctx | Click object. |
interrupt_flag | Flag that specifie interrupt |
enable_flag | 1 - enable; 0 - disable |
Function is used to enable or disable specified interupt.
interrupt_flag state: 0 - A full 1 - FIFO data ready interrupt 2 - Ambient Light Cancellation Overflow 3 - Proximity Threshold 4 - Temperature conversion interrupt enable_flag state: 1 - enable; 0 - disable; One may consult datasheet in order to discern what to write into register or use predefined values.Consult datasheet in order to discern what to write into register or use predefined values.
void smoke_enable_slot | ( | smoke_t * | ctx, |
uint8_t | slot_num, | ||
uint8_t | dev | ||
) |
Define slots in MultiLED mode function.
ctx | Click object. |
slot_num | 8-bit data representing the slot number |
dev | 8-bit data representing the device(LED) |
Function is used to determine which LED is active in each time slot.
void smoke_fifo_setting | ( | smoke_t * | ctx, |
uint8_t | flag, | ||
uint8_t | samp_num | ||
) |
Set FIFO configuration register function.
ctx | Click object. |
flag | Flag that specifie amplitude or proximity threshold |
samp_num | 8-bit data representing the number of samples |
Function is used to set number of samples by writning into FIFO configuration register. Or to enable or disable FIFO Rolls on Full
flag state: 0 - Disable roll over 1 - Enable roll over 2 - Set sample average 3 - Set number of trigger samples One may consult datasheet in order to discern what to write into register or use predefined values.
uint32_t smoke_get_green_val | ( | smoke_t * | ctx | ) |
Get Green value function.
ctx | Click object. |
Function is used to read the oldest Green value.
uint8_t smoke_get_intrrupt | ( | smoke_t * | ctx, |
uint8_t | flag | ||
) |
Get desired interrupt function.
ctx | Click object. |
flag | 1 - Get the main interrupt group; 2 - Get the temporary ready interrupt |
Function is used to read desired interrupt specified by flag.
uint32_t smoke_get_ir_val | ( | smoke_t * | ctx | ) |
Get IR value function.
ctx | Click object. |
Function is used to read the oldest IR value.
uint8_t smoke_get_read_ptr | ( | smoke_t * | ctx | ) |
Read the FIFO Read Pointer function.
ctx | Click object. |
Function is used to check read pointer.
uint32_t smoke_get_red_val | ( | smoke_t * | ctx | ) |
Get Red value function.
ctx | Click object. |
Function is used to read the oldest RED value.
uint8_t smoke_get_write_ptr | ( | smoke_t * | ctx | ) |
Read the FIFO Write Pointer function.
ctx | Click object. |
Function is used to check write pointer.
SMOKE_RETVAL smoke_init | ( | smoke_t * | ctx, |
smoke_cfg_t * | cfg | ||
) |
Initialization function.
ctx | Click object. |
cfg | Click configuration structure. |
This function initializes all necessary pins and peripherals used for this click.
void smoke_multi_read | ( | smoke_t * | ctx, |
uint8_t | rd_addr, | ||
uint8_t * | buffer, | ||
uint8_t | cnt | ||
) |
Multi read function.
ctx | Click object. |
rd_addr | Register address. |
buffer | Data buf to beread. |
cnt | Number of bytes to be read. |
This function reads n-bytes data from the desired register.
uint8_t smoke_read_data | ( | smoke_t * | ctx, |
uint8_t | rd_addr | ||
) |
Generic read function.
ctx | Click object. |
rd_addr | Register address. |
This function reads 8-bit data from the desired register.
uint8_t smoke_read_device_id | ( | smoke_t * | ctx | ) |
Read device ID function.
ctx | Click object. |
Function is used to read the device's ID number.
float smoke_read_temp_c | ( | smoke_t * | ctx | ) |
Read temperature in Centigrade function.
ctx | Click object. |
Function is used to read current IC�s internal temperature.
float smoke_read_temp_f | ( | smoke_t * | ctx | ) |
Read temperature in Fahrenheit function.
ctx | Click object. |
Function is used to read current IC�s internal temperature.
void smoke_reset | ( | smoke_t * | ctx | ) |
Reset device function.
ctx | Click object. Function is used to apply software reset. |
void smoke_set_new_value | ( | smoke_t * | ctx, |
uint8_t | reg, | ||
uint8_t | mask, | ||
uint8_t | value | ||
) |
Set new value function.
ctx | Click object. |
reg | 8-bit register address |
mask | 8-bit value used as a mask |
value | 8-bit data to be written into register |
Function is used to apply new values.
void smoke_set_registers | ( | smoke_t * | ctx, |
smoke_set_registers_t * | registers | ||
) |
Set registers values function.
ctx | Click object. |
registers | Click registers object. Registers structure fields avg_samp - 8-bit data representing the number of samples mode - 8-bit data representing led mode adc_range - 8-bit data representing ADC range samp_rate - 8-bit data representing sample rate pulse_width - 8-bit data representing the puls width led_pow_lvl - 8-bit data representing the power levelFunction is used to apply device settings. |
void smoke_setting_function | ( | smoke_t * | ctx, |
uint8_t | flag, | ||
uint8_t | mode | ||
) |
Set corresponding configuration register function.
ctx | Click object. |
flag | Flag that specifie interrupt |
mode | 8-bit data representing desired mode |
Function is used to write specified mode into corresponding configuration register.
flag state: 0 - Soft shut down 1 - Soft wake up 2 - Set LED Mode For Sampling 3 - Set ADC Range 4 - Set sample rate 5 - Set pulse width One may consult datasheet in order to discern what to write into register or use predefined values.
void smoke_setting_prox_and_amp | ( | smoke_t * | ctx, |
uint8_t | flag, | ||
uint8_t | write_data | ||
) |
Set corresponding amplitude or proximity threshold function.
ctx | Click object. |
flag | Flag that specifie amplitude or proximity threshold |
write_data | 8-bit data representing amplitude or the proximity mode interrupt threshold |
Function is used to set specified amplitude or proximity threshold.
flag state: 0 - Set RED LED Pulse Amplitude 1 - Set IR LED Pulse Amplitude 2 - Set GREEN LED Pulse Amplitude 3 - Set Proximity Pulse Amplitude 4 - Set Proximity Threshold One may consult datasheet in order to discern what to write into register or use predefined values.
void smoke_write_data | ( | smoke_t * | ctx, |
uint8_t | wr_addr, | ||
uint8_t | wr_data | ||
) |
Generic write function.
ctx | Click object. |
wr_addr | Register address. |
wr_data | Data buf to be written. |
This function writes data to the desired register.