ecg6 2.0.0.0
Public function

Functions

void ecg6_cfg_setup (ecg6_cfg_t *cfg)
 Config Object Initialization function.
 
ECG6_RETVAL ecg6_init (ecg6_t *ctx, ecg6_cfg_t *cfg)
 Initialization function.
 
void ecg6_default_cfg (ecg6_t *ctx)
 Default configuration for ECG sensor.
 
void ecg6_write_data (ecg6_t *ctx, uint8_t reg, uint8_t in_data)
 Generic Write function.
 
void ecg6_write_data_buf (ecg6_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
 Generic Write buffer function.
 
uint8_t ecg6_read_data (ecg6_t *ctx, uint8_t reg)
 Generic Read function.
 
void ecg6_read_data_buf (ecg6_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
 Generic Read buffer function.
 
uint8_t ecg6_check_path_id (ecg6_t *ctx)
 Function for check path ID.
 
uint8_t ecg6_ppg_default_config (ecg6_t *ctx)
 Function for configuration sensors to element.
 
void ecg6_get_sample_data (ecg6_t *ctx, ecg6_element_t *element, uint8_t num_sample)
 Get one sample from FIFO.
 
void ecg6_get_all_samples (ecg6_t *ctx, ecg6_fifo_t *fifo_data)
 Get all samples from FIFO.
 
void ecg6_get_interrupt_status (ecg6_t *ctx, ecg6_int_status_t *status)
 Get Interrupt registers status.
 
uint8_t ecg6_int_pin_state (ecg6_t *ctx)
 Get Interrupt pin state.
 

Detailed Description

Function Documentation

◆ ecg6_cfg_setup()

void ecg6_cfg_setup ( ecg6_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.

◆ ecg6_check_path_id()

uint8_t ecg6_check_path_id ( ecg6_t * ctx)

Function for check path ID.

Parameters
ctxClick object.
Returns
0 - OK, 1 - Wrong ID
Note
: Default ID is ECG6_DEF_PART_ID @description Function checks path ID.

◆ ecg6_default_cfg()

void ecg6_default_cfg ( ecg6_t * ctx)

Default configuration for ECG sensor.

Parameters
ctxClick object.
Note
: This function contains:
--  ECG6_REG_INTERRUPT_ENABLE_1
    ----------------------------
    ECG6_INTS1_A_FULL_OFF
    ECG6_INTS1_PPG_RDY_OFF
    ECG6_INTS1_ALC_OVF_OFF
    ECG6_INTS1_PROX_INIT_OFF
    ECG6_INTS1_PWR_RDY_OFF

--  ECG6_REG_INTERRUPT_ENABLE_2
    ---------------------------
    ECG6_INTS2_VDD_OOR_OFF
    ECG6_INTS2_DRDY_ON

--  ECG6_REG_SYSTEM_CTRL
    ---------------------
    ECG6_SYSCTRL_RESET_ENABLE
    Delay - 100ms

--  ECG6_REG_FIFO_CFG
    -----------------
    ECG6_FCFG_A_FULL_CLR
    ECG6_FCFG_A_FULL_TYPE_ONCE
    ECG6_FCFG_FIFO_ROLLS_ON_FULL_ON
    0x0F

--  ----------------------------------
    cfg.element_1 = ECG6_SENSOR_ECG;
    cfg.element_2 = ECG6_SENSOR_NONE;
    cfg.element_3 = ECG6_SENSOR_NONE;
    cfg.element_4 = ECG6_SENSOR_NONE;
    ecg6_cfg_element( &cfg );
    ----------------------------------

--  ECG6_REG_PPG_CFG_1
     -------------------
     ECG6_PPGCFG1_PPG_ADC_RGE_32768nA
     ECG6_PPGCFG1_PPG_SR_100n1
     ECG6_PPGCFG1_PPG_PW_100us

--  ECG6_REG_PPG_CFG_2  ( 0x06 )

--  ECG6_REG_LED_RANGE
     -------------------
     ECG6_LRANG_LED2_SMP_AVE_50
     ECG6_LRANG_LED1_SMP_AVE_50

--  ECG6_REG_SYSTEM_CTRL
     ----------------------
     ECG6_SYSCTRL_FIFO_ENABLE
     ECG6_SYSCTRL_SHUTDOWN_DISABLE
     ECG6_SYSCTRL_RESET_DISABLE

--  ECG6_REG_CONFIG_1
     --------------------
     ECG6_CFG1_ADC_OSR_3200

--  ECG6_REG_CONFIG_3
     ------------------
     ECG6_CFG3_PGA_GAIN_4
     ECG6_CFG3_IA_GAIN_5

--  ecg6_set_led_pulse( 0x00, 0x00 );

--  ECG6_REG_FIFO_WRITE ( 0x00 )
--  ECG6_REG_OVERFLOW_CNT ( 0x00 )
--  ECG6_REG_FIFO_READ ( 0x00 )

     Delay - 100ms

@description This function executes default configuration for Ecg6 click.

◆ ecg6_get_all_samples()

void ecg6_get_all_samples ( ecg6_t * ctx,
ecg6_fifo_t * fifo_data )

Get all samples from FIFO.

Parameters
ctxClick object.
fifo_datasamples ( elements ) structure
Note
: This function reads all samples ( 32 samples per 4 elements ) @description This function gets all samples from FIFO

◆ ecg6_get_interrupt_status()

void ecg6_get_interrupt_status ( ecg6_t * ctx,
ecg6_int_status_t * status )

Get Interrupt registers status.

Parameters
ctxClick object.
statusStatus strusture

@description This function reads all interupt statuses and writes them to the structure.

◆ ecg6_get_sample_data()

void ecg6_get_sample_data ( ecg6_t * ctx,
ecg6_element_t * element,
uint8_t num_sample )

Get one sample from FIFO.

Parameters
ctxClick object.
elementsample ( elements ) structure
num_sampleThe position of the sample being read
Note
: This function reads one sample (of 4 elements) @description This function gets one sample from FIFO

◆ ecg6_init()

ECG6_RETVAL ecg6_init ( ecg6_t * ctx,
ecg6_cfg_t * cfg )

Initialization function.

Parameters
ctxClick object.
cfgClick configuration structure.

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

◆ ecg6_int_pin_state()

uint8_t ecg6_int_pin_state ( ecg6_t * ctx)

Get Interrupt pin state.

Parameters
ctxClick object.
Returns
Interrupt pin state @description This function gets interrupt pin state.

◆ ecg6_ppg_default_config()

uint8_t ecg6_ppg_default_config ( ecg6_t * ctx)

Function for configuration sensors to element.

Parameters
ctxClick object.
cfgConfig structure
Note
: Select sensors.
 
   Depending on the set sensors - reading fifo, use the elements. 
   Example: If you set the ECG to the first element, 
   when you read the ecg it will be given to the first element.
   

   @description
 */
void ecg6_cfg_element( ecg6_t *ctx, ecg6_cfg_element_t *cfg );

/**

Funcrion for set LED pulse

Parameters
ctx
     Click object. 
ir_led
  IR LED pulse ( from 0x00 to 0xFF )
red_led
 RED LED pulse ( from 0x00 to 0xFF )

   
Note
: This function is required to read PPG.

   @description This functions is contains in default configuration for PPG sensor
 */
void ecg6_set_led_pulse( ecg6_t *ctx, uint8_t ir_led, uint8_t red_led );

/**

Default configuration for PPG sensor

Parameters
ctx
     Click object. 

   
Note
: This function contains:
   
   --  ECG6_REG_INTERRUPT_ENABLE_1
       ----------------------------
       ECG6_INTS1_A_FULL_OFF
       ECG6_INTS1_PPG_RDY_ON
       ECG6_INTS1_ALC_OVF_OFF
       ECG6_INTS1_PROX_INIT_OFF
       ECG6_INTS1_PWR_RDY_OFF

   --  ECG6_REG_INTERRUPT_ENABLE_2
       ---------------------------
       ECG6_INTS2_VDD_OOR_OFF
       ECG6_INTS2_DRDY_OFF

   --  ECG6_REG_SYSTEM_CTRL
       ---------------------
       ECG6_SYSCTRL_RESET_ENABLE
       Delay - 100ms

   --  ECG6_REG_FIFO_CFG
       -----------------
       ECG6_FCFG_A_FULL_CLR
       ECG6_FCFG_A_FULL_TYPE_ONCE
       ECG6_FCFG_FIFO_ROLLS_ON_FULL_ON
       0x0F

   --  ----------------------------------
       cfg.element_1 = ECG6_SENSOR_PPG_LED_1;
       cfg.element_2 = ECG6_SENSOR_PPG_LED_2;
       cfg.element_3 = ECG6_SENSOR_ECG;
       cfg.element_4 = ECG6_SENSOR_NONE;
       ecg6_cfg_element( &cfg );
       ----------------------------------

   --  ECG6_REG_PPG_CFG_1
        -------------------
        ECG6_PPGCFG1_PPG_ADC_RGE_32768nA
        ECG6_PPGCFG1_PPG_SR_100n1
        ECG6_PPGCFG1_PPG_PW_100us

   --  ECG6_REG_PPG_CFG_2  ( 0x06 )

   --  ECG6_REG_LED_RANGE
        -------------------
        ECG6_LRANG_LED2_SMP_AVE_50
        ECG6_LRANG_LED1_SMP_AVE_50

   --  ECG6_REG_SYSTEM_CTRL
        ----------------------
        ECG6_SYSCTRL_FIFO_ENABLE
        ECG6_SYSCTRL_SHUTDOWN_DISABLE
        ECG6_SYSCTRL_RESET_DISABLE

   --  ECG6_REG_CONFIG_1
        --------------------
        ECG6_CFG1_ADC_OSR_3200

   --  ECG6_REG_CONFIG_3
        ------------------
        ECG6_CFG3_PGA_GAIN_4
        ECG6_CFG3_IA_GAIN_5

   --  ecg6_set_led_pulse( 0xFF, 0xFF );

   --  ECG6_REG_FIFO_WRITE ( 0x00 )
   --  ECG6_REG_OVERFLOW_CNT ( 0x00 )
   --  ECG6_REG_FIFO_READ ( 0x00 )

        Delay - 100ms
   

@description This function executes default configuration for PPG sensor.

◆ ecg6_read_data()

uint8_t ecg6_read_data ( ecg6_t * ctx,
uint8_t reg )

Generic Read function.

Parameters
ctxClick object.
regAddress which from data be read
Returns
Data byte

@description Function reads data from the register.

◆ ecg6_read_data_buf()

void ecg6_read_data_buf ( ecg6_t * ctx,
uint8_t reg,
uint8_t * data_buf,
uint8_t len )

Generic Read buffer function.

Parameters
ctxClick object.
regAddress which from data be read
data_bufData buffer for data stored
lenNumber of the data for read

@description Function reads data buffer from the register.

◆ ecg6_write_data()

void ecg6_write_data ( ecg6_t * ctx,
uint8_t reg,
uint8_t in_data )

Generic Write function.

Parameters
ctxClick object.
regAddress where data be written
in_dataData to be written

@description Function writes data to the register.

◆ ecg6_write_data_buf()

void ecg6_write_data_buf ( ecg6_t * ctx,
uint8_t reg,
uint8_t * data_buf,
uint8_t len )

Generic Write buffer function.

Parameters
ctxClick object.
regAddress where data be written
data_bufData buffer to be written
lenNumber of the data in buffer

@description Function writes data buffer to the register.