heartrate 2.0.0.0
heartrate.h File Reference

This file contains API for Heart Rate 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  heartrate_t
 Click ctx object definition. More...
 
struct  heartrate_cfg_t
 Click configuration structure definition. More...
 

Macros

#define HEARTRATE_MAP_MIKROBUS(cfg, mikrobus)
 
#define HEARTRATE_RETVAL   uint8_t
 
#define HEARTRATE_OK   0x00
 
#define HEARTRATE_INIT_ERROR   0xFF
 
#define SLAVE_ADDRESS   0x57
 
#define HEARTRATE_INT_STATUS   0x00
 
#define HEARTRATE_INT_ENABLE   0x01
 
#define HEARTRATE_FIFO_WRITE_PTR   0x02
 
#define HEARTRATE_OVER_FLOW_CNT   0x03
 
#define HEARTRATE_FIFO_READ_PTR   0x04
 
#define HEARTRATE_FIFO_DATA_REG   0x05
 
#define HEARTRATE_MODE_CONFIG   0x06
 
#define HEARTRATE_SPO2_CONFIG   0x07
 
#define HEARTRATE_LED_CONFIG   0x09
 
#define HEARTRATE_TEMP_INTEGER   0x16
 
#define HEARTRATE_TEMP_FRACTION   0x17
 
#define HEARTRATE_REVISION_ID   0xFE
 
#define HEARTRATE_PART_ID   0xFF
 
#define HEARTRATE_TEMP_EN   0x08
 
#define HEARTRATE_HR_ONLY   0x02
 
#define HEARTRATE_SPO2_EN   0x03
 
#define HEARTRATE_SPO2_HI_RES_EN   0x40
 
#define HEARTRATE_ENA_A_FULL   0x80
 
#define HEARTRATE_ENA_TEP_RDY   0x40
 
#define HEARTRATE_ENA_HR_RDY   0x20
 
#define HEARTRATE_ENA_SO2_RDY   0x10
 
#define HEARTRATE_PWR_RDY   0x01
 
#define HEARTRATE_SAMPLES_50   0x00
 
#define HEARTRATE_SAMPLES_100   0x04
 
#define HEARTRATE_SAMPLES_167   0x08
 
#define HEARTRATE_SAMPLES_200   0x0C
 
#define HEARTRATE_SAMPLES_400   0x10
 
#define HEARTRATE_SAMPLES_600   0x14
 
#define HEARTRATE_SAMPLES_800   0x18
 
#define HEARTRATE_SAMPLES_1000   0x1C
 
#define HEARTRATE_PULSE_WIDTH_200   0x00
 
#define HEARTRATE_PULSE_WIDTH_400   0x01
 
#define HEARTRATE_PULSE_WIDTH_800   0x02
 
#define HEARTRATE_PULSE_WIDTH_1600   0x03
 
#define HEARTRATE_IR_CURRENT_0   0x00
 
#define HEARTRATE_IR_CURRENT_44   0x01
 
#define HEARTRATE_IR_CURRENT_76   0x02
 
#define HEARTRATE_IR_CURRENT_110   0x03
 
#define HEARTRATE_IR_CURRENT_142   0x04
 
#define HEARTRATE_IR_CURRENT_174   0x05
 
#define HEARTRATE_IR_CURRENT_208   0x06
 
#define HEARTRATE_IR_CURRENT_240   0x07
 
#define HEARTRATE_IR_CURRENT_271   0x08
 
#define HEARTRATE_IR_CURRENT_306   0x09
 
#define HEARTRATE_IR_CURRENT_338   0x0A
 
#define HEARTRATE_IR_CURRENT_370   0x0B
 
#define HEARTRATE_IR_CURRENT_402   0x0C
 
#define HEARTRATE_IR_CURRENT_436   0x0D
 
#define HEARTRATE_IR_CURRENT_468   0x0E
 
#define HEARTRATE_IR_CURRENT_500   0x0F
 
#define HEARTRATE_RED_CURRENT_0   0x00
 
#define HEARTRATE_RED_CURRENT_44   0x10
 
#define HEARTRATE_RED_CURRENT_76   0x20
 
#define HEARTRATE_RED_CURRENT_110   0x30
 
#define HEARTRATE_RED_CURRENT_142   0x40
 
#define HEARTRATE_RED_CURRENT_174   0x50
 
#define HEARTRATE_RED_CURRENT_208   0x60
 
#define HEARTRATE_RED_CURRENT_240   0x70
 
#define HEARTRATE_RED_CURRENT_271   0x80
 
#define HEARTRATE_RED_CURRENT_306   0x90
 
#define HEARTRATE_RED_CURRENT_338   0xA0
 
#define HEARTRATE_RED_CURRENT_370   0xB0
 
#define HEARTRATE_RED_CURRENT_402   0xC0
 
#define HEARTRATE_RED_CURRENT_436   0xD0
 
#define HEARTRATE_RED_CURRENT_468   0xE0
 
#define HEARTRATE_RED_CURRENT_500   0xF0
 

Functions

void heartrate_cfg_setup (heartrate_cfg_t *cfg)
 Config Object Initialization function.
 
HEARTRATE_RETVAL heartrate_init (heartrate_t *ctx, heartrate_cfg_t *cfg)
 Initialization function.
 
void heartrate_default_cfg (heartrate_t *ctx)
 Click Default Configuration function.
 
uint8_t heartrate_get_revision_id (heartrate_t *ctx)
 Function for getting revision ID.
 
uint8_t heartrate_get_part_id (heartrate_t *ctx)
 Function for getting part ID.
 
uint8_t heartrate_get_config (heartrate_t *ctx)
 Function for getting configuration of the chip.
 
uint8_t heartrate_get_status (heartrate_t *ctx)
 Function for getting status of heartrate click.
 
void heartrate_set_config (heartrate_t *ctx, uint8_t cfg)
 Function for configuration heartrate chip.
 
void heartrate_set_interrupt (heartrate_t *ctx, uint8_t intrpts)
 Function for setting interrupt for heartrate click.
 
uint8_t heartrate_read_ir_red (heartrate_t *ctx, uint16_t *ir_buff, uint16_t *red_buff)
 Function for reading IR and RED values.
 
void heartrate_read_temp (heartrate_t *ctx, uint16_t *temp_value)
 Function for reading temperature.
 
uint8_t heartrate_data_ready (heartrate_t *ctx)
 Function checking if the data is ready for reading.
 
void heartrate_generic_write (heartrate_t *ctx, uint8_t reg, uint16_t len, uint8_t *data_buf)
 Generic write function.
 
void heartrate_generic_read (heartrate_t *ctx, uint8_t reg, uint16_t len, uint8_t *data_buf)
 Generic read function.
 
void hr_shut_down (heartrate_t *ctx, bool enable)
 Shut down function.
 
void hr_reset (heartrate_t *ctx)
 Reset function.
 
void hr_temp_enable (heartrate_t *ctx, bool enable)
 Single temperature reading function.
 
int8_t hr_set_mode (heartrate_t *ctx, uint8_t mode)
 Set mode function.
 
void hr_spo2_high_res_enable (heartrate_t *ctx, bool enable)
 Function for setting the SpO2 ADC resolution.
 
uint8_t hr_spo2_set_sample_rate (heartrate_t *ctx, uint8_t sample_rate)
 Function for setting.
 
uint8_t hr_set_led_pulse_width (heartrate_t *ctx, uint8_t _value)
 Function for setting LED pulse width.
 
uint8_t hr_set_red_current_level (heartrate_t *ctx, uint8_t level)
 Function for setting Red LED.
 
uint8_t hr_set_ir_current_level (heartrate_t *ctx, uint8_t level)
 Function for setting.
 
void hr_fifo_almost_full_int_enable (heartrate_t *ctx, bool enable)
 Function to enable/disable the FIFO almost full interrupt.
 
void hr_temp_ready_int_enable (heartrate_t *ctx, bool enable)
 Function to enable/disable the temperature data ready interrupt.
 
void hr_heartrate_data_ready_int_enable (heartrate_t *ctx, bool enable)
 Function to enable/disable heart rate data ready interrupt.
 
void hr_heartrate_spo2_data_ready_int_enable (heartrate_t *ctx, bool enable)
 Function to enable/disable the SpO2 data ready.
 
uint8_t hr_read_diodes (heartrate_t *ctx, uint16_t *ir_buff, uint16_t *red_buff)
 Function for reading the ADC values of the IR and RED LEDs from the FIFO buffer.
 
uint8_t hr_get_status (heartrate_t *ctx)
 Function for getting the value read from the interrupt status register.
 

Detailed Description

This file contains API for Heart Rate Click driver.