heartrate4 2.0.0.0
heartrate4.h File Reference

This file contains API for Heart rate 4 Click driver. More...

#include "drv_digital_out.h"
#include "drv_digital_in.h"
#include "drv_i2c_master.h"

Go to the source code of this file.

Data Structures

struct  heartrate4_t
 Click ctx object definition. More...
 
struct  heartrate4_cfg_t
 Click configuration structure definition. More...
 
struct  heartrate4_set_registers_t
 Click registers object definition. More...
 

Macros

#define HEARTRATE4_MAP_MIKROBUS(cfg, mikrobus)
 
#define HEARTRATE4_RETVAL   uint8_t
 
#define HEARTRATE4_OK   0x00
 
#define HEARTRATE4_INIT_ERROR   0xFF
 
#define HEARTRATE4_I2C_ADDRESS   0x57
 
#define HEARTRATE4_INT_STAT1   0x00
 
#define HEARTRATE4_INT_STAT2   0x01
 
#define HEARTRATE4_INT_ENABLE1   0x02
 
#define HEARTRATE4_INT_ENABLE2   0x03
 
#define HEARTRATE4_FIFO_WRITE_PTR   0x04
 
#define HEARTRATE4_FIFO_OVERFLOW   0x05
 
#define HEARTRATE4_FIFO_READ_PTR   0x06
 
#define HEARTRATE4_FIFO_DATA   0x07
 
#define HEARTRATE4_BUFFER_LENGTH   32
 
#define HEARTRATE4_FIFO_CONFIG   0x08
 
#define HEARTRATE4_MODE_CONFIG   0x09
 
#define HEARTRATE4_SPO2_CONFIG   0x0A
 
#define HEARTRATE4_LED1_PULSE_AMP   0x0C
 
#define HEARTRATE4_LED2_PULSE_AMP   0x0D
 
#define HEARTRATE4_LED3_PULSE_AMP   0x0E
 
#define HEARTRATE4_LED_PROX_AMP   0x10
 
#define HEARTRATE4_MULTI_LED_CONFIG1   0x11
 
#define HEARTRATE4_MULTI_LED_CONFIG2   0x12
 
#define HEARTRATE4_MIN_POWER_LEVEL   0x01
 
#define HEARTRATE4_AVG_POWER_LEVEL   0x1F
 
#define HEARTRATE4_MAX_POWER_LEVEL   0xFF
 
#define HEARTRATE4_DIE_TEMP_INT   0x1F
 
#define HEARTRATE4_DIE_TEMP_FRAC   0x20
 
#define HEARTRATE4_DIE_TEMP_CONFIG   0x21
 
#define HEARTRATE4_PROX_INT_THRESH   0x30
 
#define HEARTRATE4_REVISION_ID   0xFE
 
#define HEARTRATE4_PART_ID   0xFF
 
#define HEARTRATE4_INT_A_FULL_MASK   (uint8_t)~0b10000000
 
#define HEARTRATE4_INT_A_FULL_ENABLE   0x80
 
#define HEARTRATE4_INT_A_FULL_DISABLE   0x00
 
#define HEARTRATE4_INT_DATA_RDY_MASK   (uint8_t)~0b01000000
 
#define HEARTRATE4_INT_DATA_RDY_ENABLE   0x40
 
#define HEARTRATE4_INT_DATA_RDY_DISABLE   0x00
 
#define HEARTRATE4_INT_ALC_OVF_MASK   (uint8_t)~0b00100000
 
#define HEARTRATE4_INT_ALC_OVF_ENABLE   0x20
 
#define HEARTRATE4_INT_ALC_OVF_DISABLE   0x00
 
#define HEARTRATE4_INT_PROX_INT_MASK   (uint8_t)~0b00010000
 
#define HEARTRATE4_INT_PROX_INT_ENABLE   0x10
 
#define HEARTRATE4_INT_PROX_INT_DISABLE   0x00
 
#define HEARTRATE4_INT_DIE_TEMP_RDY_MASK   (uint8_t)~0b00000010
 
#define HEARTRATE4_INT_DIE_TEMP_RDY_ENABLE   0x02
 
#define HEARTRATE4_INT_DIE_TEMP_RDY_DISABLE   0x00
 
#define HEARTRATE4_SAMPLEAVG_MASK   (uint8_t)~0b11100000
 
#define HEARTRATE4_SAMPLEAVG_1   0x00
 
#define HEARTRATE4_SAMPLEAVG_2   0x20
 
#define HEARTRATE4_SAMPLEAVG_4   0x40
 
#define HEARTRATE4_SAMPLEAVG_8   0x60
 
#define HEARTRATE4_SAMPLEAVG_16   0x80
 
#define HEARTRATE4_SAMPLEAVG_32   0xA0
 
#define HEARTRATE4_ROLLOVER_MASK   0xEF
 
#define HEARTRATE4_ROLLOVER_ENABLE   0x10
 
#define HEARTRATE4_ROLLOVER_DISABLE   0x00
 
#define HEARTRATE4_A_FULL_MASK   0xF0
 
#define HEARTRATE4_SHUTDOWN_MASK   0x7F
 
#define HEARTRATE4_SHUTDOWN   0x80
 
#define HEARTRATE4_WAKEUP   0x00
 
#define HEARTRATE4_RESET_MASK   0xBF
 
#define HEARTRATE4_RESET   0x40
 
#define HEARTRATE4_MODE_MASK   0xF8
 
#define HEARTRATE4_MODE_REDONLY   0x02
 
#define HEARTRATE4_MODE_REDIRONLY   0x03
 
#define HEARTRATE4_MODE_MULTILED   0x07
 
#define HEARTRATE4_ADCRANGE_MASK   0x9F
 
#define HEARTRATE4_ADCRANGE_2048   0x00
 
#define HEARTRATE4_ADCRANGE_4096   0x20
 
#define HEARTRATE4_ADCRANGE_8192   0x40
 
#define HEARTRATE4_ADCRANGE_16384   0x60
 
#define HEARTRATE4_SAMPLERATE_MASK   0xE3
 
#define HEARTRATE4_SAMPLERATE_50   0x00
 
#define HEARTRATE4_SAMPLERATE_100   0x04
 
#define HEARTRATE4_SAMPLERATE_200   0x08
 
#define HEARTRATE4_SAMPLERATE_400   0x0C
 
#define HEARTRATE4_SAMPLERATE_800   0x10
 
#define HEARTRATE4_SAMPLERATE_1000   0x14
 
#define HEARTRATE4_SAMPLERATE_1600   0x18
 
#define HEARTRATE4_SAMPLERATE_3200   0x1C
 
#define HEARTRATE4_PULSEWIDTH_MASK   0xFC
 
#define HEARTRATE4_PULSEWIDTH_69   0x00
 
#define HEARTRATE4_PULSEWIDTH_118   0x01
 
#define HEARTRATE4_PULSEWIDTH_215   0x02
 
#define HEARTRATE4_PULSEWIDTH_411   0x03
 
#define HEARTRATE4_SLOT1_MASK   0xF8
 
#define HEARTRATE4_SLOT2_MASK   0x8F
 
#define HEARTRATE4_SLOT3_MASK   0xF8
 
#define HEARTRATE4_SLOT4_MASK   0x8F
 
#define HEARTRATE4_SLOT_NONE   0x00
 
#define HEARTRATE4_SLOT_RED_LED   0x01
 
#define HEARTRATE4_SLOT_IR_LED   0x02
 
#define HEARTRATE4_SLOT_GREEN_LED   0x03
 
#define HEARTRATE4_SLOT_NONE_PILOT   0x04
 
#define HEARTRATE4_SLOT_RED_PILOT   0x05
 
#define HEARTRATE4_SLOT_IR_PILOT   0x06
 
#define HEARTRATE4_SLOT_GREEN_PILOT   0x07
 

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

This file contains API for Heart rate 4 Click driver.