ecg3 2.0.0.0
ecg3.h File Reference

This file contains API for ECG 3 Click driver. More...

#include "drv_digital_out.h"
#include "drv_digital_in.h"
#include "drv_spi_master.h"

Go to the source code of this file.

Data Structures

struct  ecg3_t
 Click ctx object definition. More...
 
struct  ecg3_cfg_t
 Click configuration structure definition. More...
 

Macros

#define ECG3_MAP_MIKROBUS(cfg, mikrobus)
 
#define ECG3_RETVAL   uint8_t
 
#define ECG3_OK   0x00
 
#define ECG3_INIT_ERROR   0xFF
 
#define ECG3_NO_OP_REG   0x00
 
#define ECG3_STAT_REG   0x01
 
#define ECG3_EN_INT_REG   0x02
 
#define ECG3_EN_INT2_REG   0x03
 
#define ECG3_MNGR_INT_REG   0x04
 
#define ECG3_MNGR_DYN_REG   0x05
 
#define ECG3_SW_RST_REG   0x08
 
#define ECG3_SYNC_REG   0x09
 
#define ECG3_FIFO_RST_REG   0x0A
 
#define ECG3_INFO_REG   0x0F
 
#define ECG3_CNFG_GEN_REG   0x10
 
#define ECG3_CNFG_CAL_REG   0x12
 
#define ECG3_CNFG_EMUX_REG   0x14
 
#define ECG3_CNFG_ECG_REG   0x15
 
#define ECG3_CNFG_RTOR1_REG   0x1D
 
#define ECG3_CNFG_RTOR2_REG   0x1E
 
#define ECG3_ECG_FIFO_BURST_REG   0x20
 
#define ECG3_ECG_FIFO_REG   0x21
 
#define ECG3_RTOR_REG   0x25
 
#define ECG3_NO_OP2_REG   0x7F
 
#define ECG3_EINT_MASK   0x800000
 
#define ECG3_EOVF_MASK   0x400000
 
#define ECG3_FSTINT_MASK   0x200000
 
#define ECG3_DCLOFF_INT_MASK   0x100000
 
#define ECG3_LONINT_MASK   0x000800
 
#define ECG3_RRINT_MASK   0x000400
 
#define ECG3_SAMP_INT_MASK   0x000200
 
#define ECG3_PLLINT_MASK   0x000100
 
#define ECG3_LDOFF_PH_INT_MASK   0x000008
 
#define ECG3_LDOFF_PL_INT_MASK   0x000004
 
#define ECG3_LDOFF_NH_INT_MASK   0x000002
 
#define ECG3_LDOFF_NL_INT_MASK   0x000001
 
#define ECG3_INTB_DIS   0x000000
 
#define ECG3_INTB_CMOS   0x000001
 
#define ECG3_INTB_OD_NMOS   0x000002
 
#define ECG3_INTB_OD_NMOS_INTER_PULLUP   0x000003
 
#define ECG3_FSINT_CLR_DISENGAGED   0x000000
 
#define ECG3_FSINT_CLR_STAT   0x000040
 
#define ECG3_RRINT_CLR_STAT   0x000000
 
#define ECG3_RRINT_CLR_RTOR   0x000010
 
#define ECG3_RRINT_SELF_CLR   0x000020
 
#define ECG3_SAMP_CLR_STAT   0x000000
 
#define ECG3_SAMP_SELF_CLR   0x000004
 
#define ECG3_SAMP_FREQ_1_SAMP   0x000000
 
#define ECG3_SAMP_FREQ_2_SAMP   0x000001
 
#define ECG3_SAMP_FREQ_4_SAMP   0x000002
 
#define ECG3_SAMP_FREQ_16_SAMP   0x000003
 
#define ECG3_NORMAL_MODE   0x000000
 
#define ECG3_MANUAL_FAST_MODE   0x400000
 
#define ECG3_AUTO_FAST_MODE   0x800000
 
#define ECG3_SW_RST_CMD   0x000000
 
#define ECG3_FIFO_RST_CMD   0x000000
 
#define ECG3_SYNCH_CMD   0x000000
 
#define ECG3_ULP_LON_EN   0x400000
 
#define ECG3_FMSTR_32768HZ_ECG_512HZ   0x000000
 
#define ECG3_FMSTR_32000HZ_ECG_500HZ   0x100000
 
#define ECG3_FMSTR_32000HZ_ECG_200HZ   0x200000
 
#define ECG3_FMSTR_31968HZ_ECG_199HZ   0x300000
 
#define ECG3_ECG_CHANN_EN   0x080000
 
#define ECG3_DCLOFF_EN   0x001000
 
#define ECG3_ECGP_PULLUP   0x000000
 
#define ECG3_ECGP_PULLDOWN   0x000800
 
#define ECG3_DCLOFF_IMAG_0NA   0x000000
 
#define ECG3_DCLOFF_IMAG_5NA   0x000100
 
#define ECG3_DCLOFF_IMAG_10NA   0x000200
 
#define ECG3_DCLOFF_IMAG_20NA   0x000300
 
#define ECG3_DCLOFF_IMAG_50NA   0x000400
 
#define ECG3_DCLOFF_IMAG_100NA   0x000500
 
#define ECG3_DCLOFF_VTH_300MV   0x000000
 
#define ECG3_DCLOFF_VTH_400MV   0x000040
 
#define ECG3_DCLOFF_VTH_450MV   0x000080
 
#define ECG3_DCLOFF_VTH_500MV   0x0000C0
 
#define ECG3_RBIAS_EN   0x000010
 
#define ECG3_RBIAS_50M_OHM   0x000000
 
#define ECG3_RBIAS_100M_OHM   0x000004
 
#define ECG3_RBIAS_200M_OHM   0x000008
 
#define ECG3_RBIASP_EN   0x000002
 
#define ECG3_RBIASN_EN   0x000001
 
#define ECG3_VCAL_EN   0x400000
 
#define ECG3_VMODE_UNIPOL   0x000000
 
#define ECG3_VMODE_BIPOL   0x200000
 
#define ECG3_VMAG_250MICROV   0x000000
 
#define ECG3_VMAG_500MICROV   0x100000
 
#define ECG3_FCAL_256HZ   0x000000
 
#define ECG3_FCAL_64HZ   0x001000
 
#define ECG3_FCAL_16HZ   0x002000
 
#define ECG3_FCAL_4HZ   0x003000
 
#define ECG3_FCAL_1HZ   0x004000
 
#define ECG3_FCAL_1PER4HZ   0x005000
 
#define ECG3_FCAL_1PER16HZ   0x006000
 
#define ECG3_FCAL_1PER64HZ   0x007000
 
#define ECG3_FIFTY_CAL_THIGH   0x000000
 
#define ECG3_FIFTY_50PERCENTS   0x000800
 
#define ECG3_INPUT_NON_INV   0x000000
 
#define ECG3_INPUT_INV   0x800000
 
#define ECG3_ECGP_EN   0x000000
 
#define ECG3_ECGP_DIS   0x200000
 
#define ECG3_ECGN_EN   0x000000
 
#define ECG3_ECGN_DIS   0x100000
 
#define ECG3_ECGP_NO_CAL   0x000000
 
#define ECG3_ECGP_CAL_VMID   0x040000
 
#define ECG3_ECGP_CAL_VCALP   0x080000
 
#define ECG3_ECGP_CAL_VCALN   0x0C0000
 
#define ECG3_ECGN_NO_CAL   0x000000
 
#define ECG3_ECGN_CAL_VMID   0x010000
 
#define ECG3_ECGN_CAL_VCALP   0x020000
 
#define ECG3_ECGN_CAL_VCALN   0x030000
 
#define ECG3_GAIN_20VPERV   0x000000
 
#define ECG3_GAIN_40VPERV   0x010000
 
#define ECG3_GAIN_80VPERV   0x020000
 
#define ECG3_GAIN_160VPERV   0x030000
 
#define ECG3_DHPF_BYPASS_DC   0x000000
 
#define ECG3_DHPF_500MILIHZ   0x004000
 
#define ECG3_DLPF_BYPASS   0x000000
 
#define ECG3_DLPF_40HZ   0x001000
 
#define ECG3_DLPF_100HZ   0x002000
 
#define ECG3_DLPF_150HZ   0x003000
 
#define ECG3_WNDW_6   0x000000
 
#define ECG3_WNDW_8   0x100000
 
#define ECG3_WNDW_10   0x200000
 
#define ECG3_WNDW_12   0x300000
 
#define ECG3_WNDW_14   0x400000
 
#define ECG3_WNDW_16   0x500000
 
#define ECG3_WNDW_18   0x600000
 
#define ECG3_WNDW_20   0x700000
 
#define ECG3_WNDW_22   0x800000
 
#define ECG3_WNDW_24   0x900000
 
#define ECG3_WNDW_26   0xA00000
 
#define ECG3_WNDW_28   0xB00000
 
#define ECG3_RRGAIN_1   0x000000
 
#define ECG3_RRGAIN_2   0x010000
 
#define ECG3_RRGAIN_4   0x020000
 
#define ECG3_RRGAIN_8   0x030000
 
#define ECG3_RRGAIN_16   0x040000
 
#define ECG3_RRGAIN_32   0x050000
 
#define ECG3_RRGAIN_64   0x060000
 
#define ECG3_RRGAIN_128   0x070000
 
#define ECG3_RRGAIN_256   0x080000
 
#define ECG3_RRGAIN_512   0x090000
 
#define ECG3_RRGAIN_1024   0x0A0000
 
#define ECG3_RRGAIN_2048   0x0B0000
 
#define ECG3_RRGAIN_4096   0x0C0000
 
#define ECG3_RRGAIN_8192   0x0D0000
 
#define ECG3_RRGAIN_16384   0x0E0000
 
#define ECG3_RRGAIN_AUTO_SCALE   0x0F0000
 
#define ECG3_RTOR_EN   0x008000
 
#define ECG3_PAVG_2   0x000000
 
#define ECG3_PAVG_4   0x001000
 
#define ECG3_PAVG_8   0x002000
 
#define ECG3_PAVG_16   0x003000
 
#define ECG3_WRONG_ADDR   0x01
 
#define ECG3_OK   0x00
 
#define ECG3_INT_OCCURRED   0x01
 
#define ECG3_INT_NOT_OCCURRED   0x00
 
#define ECG3_DUMMY_BYTE   0x00
 

Functions

void ecg3_cfg_setup (ecg3_cfg_t *cfg)
 Config Object Initialization function.
 
ECG3_RETVAL ecg3_init (ecg3_t *ctx, ecg3_cfg_t *cfg)
 Initialization function.
 
void ecg3_default_cfg (ecg3_t *ctx)
 Click Default Configuration function.
 
void ecg3_generic_transfer (ecg3_t *ctx, uint8_t *wr_buf, uint16_t wr_len, uint8_t *rd_buf, uint16_t rd_len)
 Generic transfer function.
 
uint8_t ecg3_write_reg (ecg3_t *ctx, uint8_t reg_addr, uint32_t data_in)
 Generic Write function.
 
uint8_t ecg3_read_reg (ecg3_t *ctx, uint8_t reg_addr, uint32_t *data_out)
 Generic Read function.
 
uint8_t ecg3_check_status (ecg3_t *ctx, uint32_t bit_mask)
 Status Check function.
 
void ecg3_sw_reset (ecg3_t *ctx)
 SW Reset function.
 
void ecg3_fifo_reset (ecg3_t *ctx)
 FIFO Reset function.
 
void ecg3_sync (ecg3_t *ctx)
 Synchronization function.
 
void ecg3_get_ecg (ecg3_t *ctx, uint32_t *out_ecg)
 ECG Get function.
 
void ecg3_get_rtor (ecg3_t *ctx, uint16_t *out_hr, uint16_t *out_rr)
 RTOR Get function.
 

Detailed Description

This file contains API for ECG 3 Click driver.