smoke  2.0.0.0
Functions
Public function

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...
 

Detailed Description

Function Documentation

◆ smoke_cfg_setup()

void smoke_cfg_setup ( smoke_cfg_t cfg)

Config Object Initialization function.

Parameters
cfgClick configuration structure.

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.

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.

Function is used to clear FIFO pointers.

◆ smoke_default_cfg()

void smoke_default_cfg ( smoke_t ctx)

Click Default Configuration function.

Parameters
ctxClick object.

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.

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

◆ smoke_enable_disable_interrupts()

void 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_flag1 - enable; 0 - disable

Function is used to enable or disable specified interupt.

Note
 
 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.

◆ smoke_enable_slot()

void 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)

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

◆ smoke_fifo_setting()

void smoke_fifo_setting ( smoke_t ctx,
uint8_t  flag,
uint8_t  samp_num 
)

Set FIFO configuration register function.

Parameters
ctxClick object.
flagFlag that specifie amplitude or proximity threshold
samp_num8-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

Note
 
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.

◆ smoke_get_green_val()

uint32_t smoke_get_green_val ( smoke_t ctx)

Get Green value function.

Parameters
ctxClick object.
Returns
result 32-bit value representing the oldest Green value

Function is used to read the oldest Green value.

◆ 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.

Function is used to read desired interrupt specified by flag.

Note
Use datasheet to discerm what value from register represents.

◆ smoke_get_ir_val()

uint32_t smoke_get_ir_val ( smoke_t ctx)

Get IR value function.

Parameters
ctxClick object.
Returns
result 32-bit value representing the oldest IR value

Function is used to read the oldest IR value.

◆ 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

Function is used to check read pointer.

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

◆ smoke_get_red_val()

uint32_t smoke_get_red_val ( smoke_t ctx)

Get Red value function.

Parameters
ctxClick object.
Returns
result 32-bit value representing the oldest RED value

Function is used to read the oldest RED value.

◆ 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

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.

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

◆ smoke_multi_read()

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

Multi read function.

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

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

◆ 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

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

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

◆ smoke_read_temp_c()

float smoke_read_temp_c ( smoke_t ctx)

Read temperature in Centigrade function.

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

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

◆ smoke_read_temp_f()

float smoke_read_temp_f ( smoke_t ctx)

Read temperature in Fahrenheit function.

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

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

◆ smoke_reset()

void smoke_reset ( smoke_t ctx)

Reset device function.

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

◆ smoke_set_new_value()

void smoke_set_new_value ( smoke_t ctx,
uint8_t  reg,
uint8_t  mask,
uint8_t  value 
)

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

Function is used to apply new values.

◆ smoke_set_registers()

void smoke_set_registers ( smoke_t ctx,
smoke_set_registers_t registers 
)

Set registers values function.

Parameters
ctxClick object.
registersClick 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
Function is used to apply device settings.
Note
Consult datasheet in order to discern what to write into register or use predefined values.

◆ smoke_setting_function()

void smoke_setting_function ( smoke_t ctx,
uint8_t  flag,
uint8_t  mode 
)

Set corresponding configuration register function.

Parameters
ctxClick object.
flagFlag that specifie interrupt
mode8-bit data representing desired mode

Function is used to write specified mode into corresponding configuration register.

Note
 
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. 

◆ smoke_setting_prox_and_amp()

void smoke_setting_prox_and_amp ( smoke_t ctx,
uint8_t  flag,
uint8_t  write_data 
)

Set corresponding amplitude or proximity threshold function.

Parameters
ctxClick object.
flagFlag that specifie amplitude or proximity threshold
write_data8-bit data representing amplitude or the proximity mode interrupt threshold

Function is used to set specified amplitude or proximity threshold.

Note
 
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.

◆ 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.

This function writes data to the desired register.