heartrate4 2.0.0.0

Functions

void heartrate4_cfg_setup (heartrate4_cfg_t *cfg)
 Config Object Initialization function.
 
HEARTRATE4_RETVAL heartrate4_init (heartrate4_t *ctx, heartrate4_cfg_t *cfg)
 Initialization function.
 
void heartrate4_default_cfg (heartrate4_t *ctx)
 Click Default Configuration function.
 
void heartrate4_write_data (heartrate4_t *ctx, uint8_t wr_addr, uint8_t wr_data)
 Generic write function.
 
uint8_t heartrate4_read_data (heartrate4_t *ctx, uint8_t rd_addr)
 Generic read function.
 
void heartrate4_multi_read (heartrate4_t *ctx, uint8_t rd_addr, uint8_t *buffer, uint8_t cnt)
 Multi read function.
 
void heartrate4_set_new_value (heartrate4_t *ctx, uint8_t reg, uint8_t mask, uint8_t value)
 Set new value function.
 
uint8_t heartrate4_get_intrrupt (heartrate4_t *ctx, uint8_t flag)
 Get desired interrupt function.
 
void heartrate4_enable_disable_interrupts (heartrate4_t *ctx, uint8_t interrupt_flag, uint8_t enable_flag)
 Enable or disable interrupt function.
 
void heartrate4_setting_function (heartrate4_t *ctx, uint8_t flag, uint8_t mode)
 Set corresponding configuration register function.
 
void heartrate4_setting_prox_and_amp (heartrate4_t *ctx, uint8_t flag, uint8_t write_data)
 Set corresponding amplitude or proximity threshold function.
 
void heartrate4_enable_slot (heartrate4_t *ctx, uint8_t slot_num, uint8_t dev)
 Define slots in MultiLED mode function.
 
void heartrate4_disable_slots (heartrate4_t *ctx)
 Disable slots in MultiLED mode function.
 
void heartrate4_clear_fifo (heartrate4_t *ctx)
 Clearing FIFO pointers function.
 
void heartrate4_fifo_setting (heartrate4_t *ctx, uint8_t flag, uint8_t samp_num)
 Set FIFO configuration register function.
 
uint8_t heartrate4_get_write_ptr (heartrate4_t *ctx)
 Read the FIFO Write Pointer function.
 
uint8_t heartrate4_get_read_ptr (heartrate4_t *ctx)
 Read the FIFO Read Pointer function.
 
float heartrate4_read_temp_c (heartrate4_t *ctx)
 Read temperature in Centigrade function.
 
float heartrate4_read_temp_f (heartrate4_t *ctx)
 Read temperature in Fahrenheit function.
 
void heartrate4_reset (heartrate4_t *ctx)
 Reset device function.
 
uint8_t heartrate4_check_int (heartrate4_t *ctx)
 Get Interrupt state function.
 
uint32_t heartrate4_read_fifo_oldest_sample (heartrate4_t *ctx)
 Read oldest FIFO sample function.
 
uint8_t heartrate4_check_int_pow_and_temp (heartrate4_t *ctx, uint8_t flag)
 Check interrupt, power ready or internal temperature ready flag function.
 
uint16_t heartrate4_read_fifo_all_samples (heartrate4_t *ctx, uint8_t *buff)
 Read all FIFO samples function.
 
uint32_t heartrate4_get_red_val (heartrate4_t *ctx)
 Get Red value function.
 
void heartrate4_set_registers (heartrate4_t *ctx, heartrate4_set_registers_t *registers)
 Set registers values function.
 

Detailed Description

Function Documentation

◆ heartrate4_cfg_setup()

void heartrate4_cfg_setup ( heartrate4_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.

◆ heartrate4_check_int()

uint8_t heartrate4_check_int ( heartrate4_t * ctx)

Get Interrupt state function.

Parameters
ctxClick object.

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

◆ heartrate4_check_int_pow_and_temp()

uint8_t heartrate4_check_int_pow_and_temp ( heartrate4_t * ctx,
uint8_t flag )

Check interrupt, power ready or internal temperature ready flag function.

Parameters
ctxClick object.
flagFlag that specifie interrupt, power ready or internal temperature
Returns
1 - Interrupt has not occured; 0 - Interrupt has occured

@description Function is used to check if desired interrupt, power ready or internal temperature ready flag has occured

Note
 
flag state: 
     0 - Check FIFO full interrupt 
     1 - Check FIFO data readdy interrupt
     2 - Check ambient light cancellation overflow interrupt 
     3 - Check proximity threshold triggered interrupt
     4 - Check power ready flag
     5 - Check internal temperature ready flag   

◆ heartrate4_clear_fifo()

void heartrate4_clear_fifo ( heartrate4_t * ctx)

Clearing FIFO pointers function.

Parameters
ctxClick object.

@description Function is used to clear FIFO pointers.

◆ heartrate4_default_cfg()

void heartrate4_default_cfg ( heartrate4_t * ctx)

Click Default Configuration function.

Parameters
ctxClick object.

@description This function executes default configuration for HeartRate4 click.

◆ heartrate4_disable_slots()

void heartrate4_disable_slots ( heartrate4_t * ctx)

Disable slots in MultiLED mode function.

Parameters
ctxClick object.

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

◆ heartrate4_enable_disable_interrupts()

void heartrate4_enable_disable_interrupts ( heartrate4_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

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

◆ heartrate4_enable_slot()

void heartrate4_enable_slot ( heartrate4_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)

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

◆ heartrate4_fifo_setting()

void heartrate4_fifo_setting ( heartrate4_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

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

◆ heartrate4_get_intrrupt()

uint8_t heartrate4_get_intrrupt ( heartrate4_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.

◆ heartrate4_get_read_ptr()

uint8_t heartrate4_get_read_ptr ( heartrate4_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.

◆ heartrate4_get_red_val()

uint32_t heartrate4_get_red_val ( heartrate4_t * ctx)

Get Red value function.

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

@description Function is used to read the oldest RED value.

◆ heartrate4_get_write_ptr()

uint8_t heartrate4_get_write_ptr ( heartrate4_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.

◆ heartrate4_init()

HEARTRATE4_RETVAL heartrate4_init ( heartrate4_t * ctx,
heartrate4_cfg_t * cfg )

Initialization function.

Parameters
ctxClick object.
cfgClick configuration structure.

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

◆ heartrate4_multi_read()

void heartrate4_multi_read ( heartrate4_t * ctx,
uint8_t rd_addr,
uint8_t * buffer,
uint8_t cnt )

Multi read function.

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

@description This function reads user defined number byte of data .

◆ heartrate4_read_data()

uint8_t heartrate4_read_data ( heartrate4_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 single byte of data from specified register.

◆ heartrate4_read_fifo_all_samples()

uint16_t heartrate4_read_fifo_all_samples ( heartrate4_t * ctx,
uint8_t * buff )

Read all FIFO samples function.

Parameters
ctxClick object.
buffoutput buffer
Returns
16-bit data representing the number of samples to read

@description Function is used to read all FIFO data samples and returns average value.

◆ heartrate4_read_fifo_oldest_sample()

uint32_t heartrate4_read_fifo_oldest_sample ( heartrate4_t * ctx)

Read oldest FIFO sample function.

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

@description Function is used to read the oldest RED value from FIFO.

◆ heartrate4_read_temp_c()

float heartrate4_read_temp_c ( heartrate4_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.

◆ heartrate4_read_temp_f()

float heartrate4_read_temp_f ( heartrate4_t * ctx)

Read temperature in Fahrenheit function.

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

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

◆ heartrate4_reset()

void heartrate4_reset ( heartrate4_t * ctx)

Reset device function.

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

◆ heartrate4_set_new_value()

void heartrate4_set_new_value ( heartrate4_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

@description Function is used to apply new values.

◆ heartrate4_set_registers()

void heartrate4_set_registers ( heartrate4_t * ctx,
heartrate4_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
@description Function is used to apply device settings.
Note
Consult datasheet in order to discern what to write into register or use predefined values.

◆ heartrate4_setting_function()

void heartrate4_setting_function ( heartrate4_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

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

◆ heartrate4_setting_prox_and_amp()

void heartrate4_setting_prox_and_amp ( heartrate4_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

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

◆ heartrate4_write_data()

void heartrate4_write_data ( heartrate4_t * ctx,
uint8_t wr_addr,
uint8_t wr_data )

Generic write function.

Parameters
ctxClick object.
wr_addrRegister address.
wr_data8-bit data to be written into register.

@description This function writes single byte of data into specified register.