smoke 2.0.0.0
Public function

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.
 

Detailed Description

Function Documentation

◆ smoke_cfg_setup()

void smoke_cfg_setup ( smoke_cfg_t * cfg)

Config Object Initialization function.

Parameters
cfgClick configuration structure.

@description This function initializes click configuration structure to init state.

Note
All used pins will be set to unconnected state.

◆ smoke_check_int()

uint8_t smoke_check_int ( smoke_t * ctx)

Get Interrupt state function.

Parameters
ctxClick object.

@description Function is used to check the state of INT pin.

◆ smoke_clear_fifo()

void smoke_clear_fifo ( smoke_t * ctx)

Clearing FIFO pointers function.

Parameters
ctxClick object.

@description Function is used to clear FIFO pointers.

◆ smoke_default_cfg()

void smoke_default_cfg ( smoke_t * ctx)

Click Default Configuration function.

Parameters
ctxClick object.

@description This function executes default configuration for Smoke click.

◆ smoke_disable_slots()

void smoke_disable_slots ( smoke_t * ctx)

Disable slots in MultiLED mode function.

Parameters
ctxClick object.

@description Function is used to disable all LED-s in each time slot.

◆ smoke_enable_disable_interrupts()

uint8_t smoke_enable_disable_interrupts ( smoke_t * ctx,
uint8_t interrupt_flag,
uint8_t enable_flag )

Enable or disable interrupt function.

Parameters
ctxClick object.
interrupt_flagFlag that specifie interrupt
enable_flagEnable flag
Returns
Function status.
 
 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.

Note
Consult datasheet in order to discern what to write into register or use predefined values.

◆ smoke_enable_slot()

uint8_t smoke_enable_slot ( smoke_t * ctx,
uint8_t slot_num,
uint8_t dev )

Define slots in MultiLED mode function.

Parameters
ctxClick object.
slot_num8-bit data representing the slot number
dev8-bit data representing the device(LED)
Returns
Function status.

@description Function is used to determine which LED is active in each time slot.

◆ smoke_generic_read()

void smoke_generic_read ( smoke_t * ctx,
uint8_t rd_addr,
uint8_t * buffer,
uint8_t cnt )

Generic read function.

Parameters
ctxClick object.
rd_addrRegister address.
bufferData buf to beread.
cntNumber of bytes to be read.

@description This function reads n-bytes data from the desired register.

◆ smoke_get_intrrupt()

uint8_t smoke_get_intrrupt ( smoke_t * ctx,
uint8_t flag )

Get desired interrupt function.

Parameters
ctxClick object.
flag1 - Get the main interrupt group; 2 - Get the temporary ready interrupt
Returns
result 8-bit data representing the desired interrupt.

@description Function is used to read desired interrupt specified by flag.

Note
Use datasheet to discerm what value from register represents.

◆ smoke_get_read_ptr()

uint8_t smoke_get_read_ptr ( smoke_t * ctx)

Read the FIFO Read Pointer function.

Parameters
ctxClick object.
Returns
result 8-bit data that points to the location from where the processor gets the next sample from the FIFO

@description Function is used to check read pointer.

Note
The read pointer is incremented every time a sample is read from the FIFO.

◆ smoke_get_write_ptr()

uint8_t smoke_get_write_ptr ( smoke_t * ctx)

Read the FIFO Write Pointer function.

Parameters
ctxClick object.
Returns
result 8-bit data that points to the location where the MAX30105 writes the next sample

@description Function is used to check write pointer.

Note
The write pointer increments every time a new sample is added to the FIFO.

◆ smoke_init()

SMOKE_RETVAL smoke_init ( smoke_t * ctx,
smoke_cfg_t * cfg )

Initialization function.

Parameters
ctxClick object.
cfgClick configuration structure.

@description This function initializes all necessary pins and peripherals used for this click.

◆ smoke_read_data()

uint8_t smoke_read_data ( smoke_t * ctx,
uint8_t rd_addr )

Generic read function.

Parameters
ctxClick object.
rd_addrRegister address.
Returns
8-bit data from address specified register

@description This function reads 8-bit data from the desired register.

◆ smoke_read_device_id()

uint8_t smoke_read_device_id ( smoke_t * ctx)

Read device ID function.

Parameters
ctxClick object.
Returns
result 8-bit value representing the device's ID number

@description Function is used to read the device's ID number.

◆ smoke_read_leds()

uint8_t smoke_read_leds ( smoke_t * ctx)

Function for reading enabled leds.

Parameters
ctxClick object.
Returns
Function status.
 
  return status:
         0xFF - Init error;
         0x00 - OK;

@description Function is used to read enabled led values.

Note
Consult datasheet in order to discern what to write into register or use predefined values.

◆ smoke_read_temp()

float smoke_read_temp ( smoke_t * ctx)

Read temperature in Centigrade function.

Parameters
ctxClick object.
Returns
result float value of temperature in Celsius

@description Function is used to read current IC�s internal temperature.

◆ smoke_reset()

void smoke_reset ( smoke_t * ctx)

Reset device function.

Parameters
ctxClick object. @description Function is used to apply software reset.

◆ smoke_set_adc_range()

uint8_t smoke_set_adc_range ( smoke_t * ctx,
uint8_t adc_range )

Set ADC range.

Parameters
ctxClick object.
adc_rangeADC range
Returns
Function status.
 
 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.

Note
Consult datasheet in order to discern what to write into register or use predefined values.

◆ smoke_set_almost_full_trigger()

uint8_t smoke_set_almost_full_trigger ( smoke_t * ctx,
uint8_t trigger_range )

Set almost full trigger.

Parameters
ctxClick object.
trigger_rangeTrigger range.
Returns
Function status.
 
 return status:
        0xFE - Parameter error;
        0x00 - Ok;
 

@description Function is used to set almost full tregger of FIFO.

Note
Consult datasheet in order to discern what to write into register or use predefined values.

◆ smoke_set_led_amplitude()

uint8_t smoke_set_led_amplitude ( smoke_t * ctx,
uint8_t led,
uint8_t amplitude )

Set led amplitude.

Parameters
ctxClick object.
ledFlag for leds amplitude
Returns
Function status.
 
 led: 
       0x0C - Red
       0x0D - IR
       0x0E - Green
       0x10 - Proximity
 return status:
        0xFE - parameter error;
        0x00 - ok
 

@description Function is used to set led amplitude.

Note
Consult datasheet in order to discern what to write into register or use predefined values.

◆ smoke_set_led_mode()

uint8_t smoke_set_led_mode ( smoke_t * ctx,
uint8_t mode )

Enable leds.

Parameters
ctxClick object.
modeLed Modes
Returns
Function status.
 
 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.

Note
Consult datasheet in order to discern what to write into register or use predefined values.

◆ smoke_set_new_value()

void smoke_set_new_value ( smoke_t * ctx,
smoke_set_new_value_t * new_value_data )

Set new value function.

Parameters
ctxClick object.
reg8-bit register address
mask8-bit value used as a mask
value8-bit data to be written into register

@description Function is used to apply new values.

◆ smoke_set_power()

uint8_t smoke_set_power ( smoke_t * ctx,
uint8_t state )

I2C power setter.

Parameters
ctxClick object.
stateFlag for power state
Returns
Function status.
 
 state: 
       0x80 - Shutdown
       0x00 - Wakeup
 return status:
        0xFE - parameter error;
        0x00 - ok
 

@description Function is used to shutdown or wakeup device.

Note
Consult datasheet in order to discern what to write into register or use predefined values.

◆ smoke_set_proximity_amplitude_threshold()

uint8_t smoke_set_proximity_amplitude_threshold ( smoke_t * ctx,
uint8_t threshold )

Set proximity threshold.

Parameters
ctxClick object.
ledFlag for leds amplitude
Returns
Function status.
 
 return status:
        0xFE - parameter error;
        0x00 - ok
 

@description Function is used to set proximity threshold.

Note
Consult datasheet in order to discern what to write into register or use predefined values.

◆ smoke_set_pulse_width()

uint8_t smoke_set_pulse_width ( smoke_t * ctx,
uint8_t pulse_width )

Set pulse width.

Parameters
ctxClick object.
pulse_widthPulse width
Returns
Function status.
 
 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.

Note
Consult datasheet in order to discern what to write into register or use predefined values.

◆ smoke_set_registers()

uint8_t smoke_set_registers ( smoke_t * ctx,
smoke_set_registers_t * registers )

Set registers values function.

Parameters
ctxClick object.
registersClick registers object.
Returns
Function status.
 
 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.

Note
Consult datasheet in order to discern what to write into register or use predefined values.

◆ smoke_set_rollover_state()

uint8_t smoke_set_rollover_state ( smoke_t * ctx,
uint8_t state )

Set rollover state.

Parameters
ctxClick object.
stateState flag
Returns
Function status.
 
 state: 
       0x80 - Enable;
       0x00 - Disable;
 return status:
        0xFE - Parameter error;
        0x00 - Ok;
 

@description Function is used to set rollover state of FIFO.

Note
Consult datasheet in order to discern what to write into register or use predefined values.

◆ smoke_set_sample_avarage()

uint8_t smoke_set_sample_avarage ( smoke_t * ctx,
uint8_t samples )

Set avarage samples.

Parameters
ctxClick object.
samplesAvarage samples
Returns
Function status.
 
 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.

Note
Consult datasheet in order to discern what to write into register or use predefined values.

◆ smoke_set_sample_rate()

uint8_t smoke_set_sample_rate ( smoke_t * ctx,
uint8_t sample_rate )

Set sample rate.

Parameters
ctxClick object.
sample_rateSample rate
Returns
Function status.
 
 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.

Note
Consult datasheet in order to discern what to write into register or use predefined values.

◆ smoke_write_data()

void smoke_write_data ( smoke_t * ctx,
uint8_t wr_addr,
uint8_t wr_data )

Generic write function.

Parameters
ctxClick object.
wr_addrRegister address.
wr_dataData buf to be written.

@description This function writes data to the desired register.