|
smoke 2.2.1
|
Functions | |
| void | smoke_cfg_setup (smoke_cfg_t *cfg) |
| Config Object Initialization function. | |
| SMOKE_RETVAL | smoke_init (smoke_t *ctx, smoke_cfg_t *cfg) |
| Initialization function. | |
| void | smoke_default_cfg (smoke_t *ctx) |
| Click Default Configuration function. | |
| void | smoke_write_data (smoke_t *ctx, uint8_t wr_addr, uint8_t wr_data) |
| Generic write function. | |
| uint8_t | smoke_read_data (smoke_t *ctx, uint8_t rd_addr) |
| Generic read function. | |
| void | smoke_generic_read (smoke_t *ctx, uint8_t rd_addr, uint8_t *buffer, uint8_t cnt) |
| Generic read function. | |
| void | smoke_set_new_value (smoke_t *ctx, smoke_set_new_value_t *new_value_data) |
| Set new value function. | |
| uint8_t | smoke_get_intrrupt (smoke_t *ctx, uint8_t flag) |
| Get desired interrupt function. | |
| uint8_t | smoke_enable_disable_interrupts (smoke_t *ctx, uint8_t interrupt_flag, uint8_t enable_flag) |
| Enable or disable interrupt function. | |
| uint8_t | smoke_read_device_id (smoke_t *ctx) |
| Read device ID function. | |
| void | smoke_reset (smoke_t *ctx) |
| Reset device function. | |
| float | smoke_read_temp (smoke_t *ctx) |
| Read temperature in Centigrade function. | |
| uint8_t | smoke_set_power (smoke_t *ctx, uint8_t state) |
| I2C power setter. | |
| uint8_t | smoke_set_led_mode (smoke_t *ctx, uint8_t mode) |
| Enable leds. | |
| uint8_t | smoke_set_adc_range (smoke_t *ctx, uint8_t adc_range) |
| Set ADC range. | |
| uint8_t | smoke_set_sample_rate (smoke_t *ctx, uint8_t sample_rate) |
| Set sample rate. | |
| uint8_t | smoke_set_pulse_width (smoke_t *ctx, uint8_t pulse_width) |
| Set pulse width. | |
| uint8_t | smoke_set_led_amplitude (smoke_t *ctx, uint8_t led, uint8_t amplitude) |
| Set led amplitude. | |
| uint8_t | smoke_set_proximity_amplitude_threshold (smoke_t *ctx, uint8_t threshold) |
| Set proximity threshold. | |
| uint8_t | smoke_enable_slot (smoke_t *ctx, uint8_t slot_num, uint8_t dev) |
| Define slots in MultiLED mode function. | |
| void | smoke_disable_slots (smoke_t *ctx) |
| Disable slots in MultiLED mode function. | |
| void | smoke_clear_fifo (smoke_t *ctx) |
| Clearing FIFO pointers function. | |
| uint8_t | smoke_get_write_ptr (smoke_t *ctx) |
| Read the FIFO Write Pointer function. | |
| uint8_t | smoke_get_read_ptr (smoke_t *ctx) |
| Read the FIFO Read Pointer function. | |
| uint8_t | smoke_set_rollover_state (smoke_t *ctx, uint8_t state) |
| Set rollover state. | |
| uint8_t | smoke_set_almost_full_trigger (smoke_t *ctx, uint8_t trigger_range) |
| Set almost full trigger. | |
| uint8_t | smoke_set_sample_avarage (smoke_t *ctx, uint8_t samples) |
| Set avarage samples. | |
| uint8_t | smoke_set_registers (smoke_t *ctx, smoke_set_registers_t *registers) |
| Set registers values function. | |
| uint8_t | smoke_read_leds (smoke_t *ctx) |
| Function for reading enabled leds. | |
| uint8_t | smoke_check_int (smoke_t *ctx) |
| Get Interrupt state function. | |
| void smoke_cfg_setup | ( | smoke_cfg_t * | cfg | ) |
Config Object Initialization function.
| cfg | Click configuration structure. |
@description This function initializes Click configuration structure to init state.
| uint8_t smoke_check_int | ( | smoke_t * | ctx | ) |
Get Interrupt state function.
| ctx | Click object. |
@description Function is used to check the state of INT pin.
| void smoke_clear_fifo | ( | smoke_t * | ctx | ) |
Clearing FIFO pointers function.
| ctx | Click object. |
@description Function is used to clear FIFO pointers.
| void smoke_default_cfg | ( | smoke_t * | ctx | ) |
Click Default Configuration function.
| ctx | Click object. |
@description This function executes default configuration for Smoke Click.
| void smoke_disable_slots | ( | smoke_t * | ctx | ) |
Disable slots in MultiLED mode function.
| ctx | Click object. |
@description Function is used to disable all LED-s in each time slot.
| uint8_t 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 | Enable flag |
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;
return status:
0xFE - parameter error;
0x00 - ok
@description Function is used to enable or disable specified interupt.
| uint8_t 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) |
@description Function is used to determine which LED is active in each time slot.
| void smoke_generic_read | ( | smoke_t * | ctx, |
| uint8_t | rd_addr, | ||
| uint8_t * | buffer, | ||
| uint8_t | cnt ) |
Generic read function.
| ctx | Click object. |
| rd_addr | Register address. |
| buffer | Data buf to beread. |
| cnt | Number of bytes to be read. |
@description This function reads n-bytes data from the desired register.
| 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 |
@description Function is used to read desired interrupt specified by flag.
| uint8_t smoke_get_read_ptr | ( | smoke_t * | ctx | ) |
Read the FIFO Read Pointer function.
| ctx | Click object. |
@description Function is used to check read pointer.
| uint8_t smoke_get_write_ptr | ( | smoke_t * | ctx | ) |
Read the FIFO Write Pointer function.
| ctx | Click object. |
@description 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. |
@description This function initializes all necessary pins and peripherals used for this Click.
| uint8_t smoke_read_data | ( | smoke_t * | ctx, |
| uint8_t | rd_addr ) |
Generic read function.
| ctx | Click object. |
| rd_addr | Register address. |
@description 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. |
@description Function is used to read the device's ID number.
| uint8_t smoke_read_leds | ( | smoke_t * | ctx | ) |
Function for reading enabled leds.
| ctx | Click object. |
return status:
0xFF - Init error;
0x00 - OK;
@description Function is used to read enabled led values.
| float smoke_read_temp | ( | smoke_t * | ctx | ) |
Read temperature in Centigrade function.
| ctx | Click object. |
@description Function is used to read current IC�s internal temperature.
| void smoke_reset | ( | smoke_t * | ctx | ) |
Reset device function.
| ctx | Click object. @description Function is used to apply software reset. |
| uint8_t smoke_set_adc_range | ( | smoke_t * | ctx, |
| uint8_t | adc_range ) |
Set ADC range.
| ctx | Click object. |
| adc_range | ADC range |
adc_range:
0x00 - 2048
0x20 - 4096
0x40 - 8192
0x60 - 16384
return status:
0xFE - parameter error;
0x00 - ok
@description Function is used to set adc range.
| uint8_t smoke_set_almost_full_trigger | ( | smoke_t * | ctx, |
| uint8_t | trigger_range ) |
Set almost full trigger.
| ctx | Click object. |
| trigger_range | Trigger range. |
return status:
0xFE - Parameter error;
0x00 - Ok;
@description Function is used to set almost full tregger of FIFO.
| uint8_t smoke_set_led_amplitude | ( | smoke_t * | ctx, |
| uint8_t | led, | ||
| uint8_t | amplitude ) |
Set led amplitude.
| ctx | Click object. |
| led | Flag for leds amplitude |
led:
0x0C - Red
0x0D - IR
0x0E - Green
0x10 - Proximity
return status:
0xFE - parameter error;
0x00 - ok
@description Function is used to set led amplitude.
| uint8_t smoke_set_led_mode | ( | smoke_t * | ctx, |
| uint8_t | mode ) |
Enable leds.
| ctx | Click object. |
| mode | Led Modes |
mode:
0x02 - Red only
0x03 - Red and IR
0x07 - Red, IR and green
return status:
0xFE - parameter error;
0x00 - ok
@description Function is used to enable leds for reading.
| void smoke_set_new_value | ( | smoke_t * | ctx, |
| smoke_set_new_value_t * | new_value_data ) |
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 |
@description Function is used to apply new values.
| uint8_t smoke_set_power | ( | smoke_t * | ctx, |
| uint8_t | state ) |
I2C power setter.
| ctx | Click object. |
| state | Flag for power state |
state:
0x80 - Shutdown
0x00 - Wakeup
return status:
0xFE - parameter error;
0x00 - ok
@description Function is used to shutdown or wakeup device.
| uint8_t smoke_set_proximity_amplitude_threshold | ( | smoke_t * | ctx, |
| uint8_t | threshold ) |
Set proximity threshold.
| ctx | Click object. |
| led | Flag for leds amplitude |
return status:
0xFE - parameter error;
0x00 - ok
@description Function is used to set proximity threshold.
| uint8_t smoke_set_pulse_width | ( | smoke_t * | ctx, |
| uint8_t | pulse_width ) |
Set pulse width.
| ctx | Click object. |
| pulse_width | Pulse width |
pulse_width:
0x00 - 69
0x01 - 118
0x02 - 215
0x03 - 411
return status:
0xFE - parameter error;
0x00 - ok
@description Function is used to set pulse width.
| uint8_t 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 level
return status:
0xFE - parameter error;
0x00 - ok
@description Function is used to apply device settings.
| uint8_t smoke_set_rollover_state | ( | smoke_t * | ctx, |
| uint8_t | state ) |
Set rollover state.
| ctx | Click object. |
| state | State flag |
state:
0x80 - Enable;
0x00 - Disable;
return status:
0xFE - Parameter error;
0x00 - Ok;
@description Function is used to set rollover state of FIFO.
| uint8_t smoke_set_sample_avarage | ( | smoke_t * | ctx, |
| uint8_t | samples ) |
Set avarage samples.
| ctx | Click object. |
| samples | Avarage samples |
samples:
0x00 - 1;
0x20 - 2;
0x40 - 4;
0x60 - 8;
0x80 - 16;
0xA0 - 32;
return status:
0xFE - Parameter error;
0x00 - Ok;
@description Function is used to set avarage samples of FIFO.
| uint8_t smoke_set_sample_rate | ( | smoke_t * | ctx, |
| uint8_t | sample_rate ) |
Set sample rate.
| ctx | Click object. |
| sample_rate | Sample rate |
sample_rate:
0x00 - 50
0x04 - 100
0x08 - 200
0x0C - 400
0x10 - 800
0x14 - 1000
0x18 - 1600
0x1C - 3200
return status:
0xFE - parameter error;
0x00 - ok
@description Function is used to set sample rate.
| 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. |
@description This function writes data to the desired register.