MAX32620HSP (MAXREFDES100) RPC Example for Graphical User Interface

Dependencies:   USBDevice

Fork of HSP_Release by Jerry Bradshaw

Embed: (wiki syntax)

« Back to documentation index

MAX30001 Class Reference

Maxim Integrated MAX30001 ECG/BIOZ chip. More...

#include <MAX30001.h>

Data Structures

union  max30001_bioz_reg
 CNFG_BIOZ (0x18) More...
union  max30001_cnfg_bmux_reg
 CNFG_BMUX (0x17) More...
union  max30001_cnfg_cal_reg
 CNFG_CAL (0x12) More...
union  max30001_cnfg_ecg_reg
 CNFG_ECG (0x15) More...
union  max30001_cnfg_emux_reg
 CNFG_EMUX (0x14) More...
union  max30001_cnfg_gen_reg
 CNFG_GEN (0x10) More...
union  max30001_cnfg_pace_reg
 CNFG_PACE (0x1A) More...
union  max30001_cnfg_rtor1_reg
 CNFG_RTOR1 (0x1D) More...
union  max30001_cnfg_rtor2_reg
 CNFG_RTOR2 (0x1E) More...
union  max30001_en_int2_reg
 EN_INT2 (0x03) More...
union  max30001_en_int_reg
 EN_INT (0x02) More...
union  max30001_info_reg
 INFO (0x0F) More...
union  max30001_mngr_dyn_reg
 MNGR_DYN (0x05) More...
union  max30001_mngr_int_reg
 MNGR_INT (0x04) More...
union  max30001_status_reg
 STATUS (0x01) More...

Public Types

enum  MAX30001_REG_map_t { STATUS = 0x01 }
enum  max30001_intrpt_Location_t { MAX30001_NO_INT = 0, MAX30001_INT_B = 1, MAX30001_INT_2B = 2 }
enum  max30001_emux_pol_t { MAX30001_NON_INV = 0, MAX30001_INV = 1 }
enum  max30001_emux_openx_t { MAX30001_ECG_CON_AFE = 0, MAX30001_ECG_ISO_AFE = 1 }
enum  max30001_emux_calx_sel_t { MAX30001_NO_CAL_SIG = 0b00, MAX30001_INPT_VMID = 0b01, MAX30001_INPT_VCALP = 0b10, MAX30001_INPT_VCALN = 0b11 }
enum  max30001_en_feature_t { MAX30001_CHANNEL_DISABLED = 0b0 }
typedef union
MAX30001::max30001_status_reg 
max30001_status_t
 STATUS (0x01)
typedef union
MAX30001::max30001_en_int_reg 
max30001_en_int_t
 EN_INT (0x02)
typedef union
MAX30001::max30001_en_int2_reg 
max30001_en_int2_t
 EN_INT2 (0x03)
typedef union
MAX30001::max30001_mngr_int_reg 
max30001_mngr_int_t
 MNGR_INT (0x04)
typedef union
MAX30001::max30001_mngr_dyn_reg 
max30001_mngr_dyn_t
 MNGR_DYN (0x05)
typedef union
MAX30001::max30001_info_reg 
max30001_info_t
 INFO (0x0F)
typedef union
MAX30001::max30001_cnfg_gen_reg 
max30001_cnfg_gen_t
 CNFG_GEN (0x10)
typedef union
MAX30001::max30001_cnfg_cal_reg 
max30001_cnfg_cal_t
 CNFG_CAL (0x12)
typedef union
MAX30001::max30001_cnfg_emux_reg 
max30001_cnfg_emux_t
 CNFG_EMUX (0x14)
typedef union
MAX30001::max30001_cnfg_ecg_reg 
max30001_cnfg_ecg_t
 CNFG_ECG (0x15)
typedef union
MAX30001::max30001_cnfg_bmux_reg 
max30001_cnfg_bmux_t
 CNFG_BMUX (0x17)
typedef union
MAX30001::max30001_bioz_reg 
max30001_cnfg_bioz_t
 CNFG_BIOZ (0x18)
typedef union
MAX30001::max30001_cnfg_pace_reg 
max30001_cnfg_pace_t
 CNFG_PACE (0x1A)
typedef union
MAX30001::max30001_cnfg_rtor1_reg 
max30001_cnfg_rtor1_t
 CNFG_RTOR1 (0x1D)
typedef union
MAX30001::max30001_cnfg_rtor2_reg 
max30001_cnfg_rtor2_t
 CNFG_RTOR2 (0x1E)
typedef void(* PtrFunction )(uint32_t id, uint32_t *buffer, uint32_t length)
 type definition for data interrupt

Public Member Functions

 MAX30001 (SPI *spi)
 Constructor that accepts pin names for the SPI interface.
 MAX30001 (PinName mosi, PinName miso, PinName sclk, PinName cs)
 Constructor that accepts pin names for the SPI interface.
 ~MAX30001 (void)
 MAX30001 destructor.
void FCLK_MaximOnly (void)
 This function is MAXIM Proprietary.
int Rbias_FMSTR_Init (uint8_t En_rbias, uint8_t Rbiasv, uint8_t Rbiasp, uint8_t Rbiasn, uint8_t Fmstr)
 This function sets up the Resistive Bias mode and also selects the master clock frequency.
int CAL_InitStart (uint8_t En_Vcal, uint8_t Vmode, uint8_t Vmag, uint8_t Fcal, uint16_t Thigh, uint8_t Fifty)
 This function uses sets up the calibration signal internally.
int CAL_Stop (void)
 This function disables the VCAL signal.
int INT_assignment (max30001_intrpt_Location_t en_enint_loc, max30001_intrpt_Location_t en_eovf_loc, max30001_intrpt_Location_t en_fstint_loc, max30001_intrpt_Location_t en_dcloffint_loc, max30001_intrpt_Location_t en_bint_loc, max30001_intrpt_Location_t en_bovf_loc, max30001_intrpt_Location_t en_bover_loc, max30001_intrpt_Location_t en_bundr_loc, max30001_intrpt_Location_t en_bcgmon_loc, max30001_intrpt_Location_t en_pint_loc, max30001_intrpt_Location_t en_povf_loc, max30001_intrpt_Location_t en_pedge_loc, max30001_intrpt_Location_t en_lonint_loc, max30001_intrpt_Location_t en_rrint_loc, max30001_intrpt_Location_t en_samp_loc, max30001_intrpt_type_t intb_Type, max30001_intrpt_type_t int2b_Type)
 This function handles the assignment of the two interrupt pins (INTB & INT2B) with various.
int ECG_InitStart (uint8_t En_ecg, uint8_t Openp, uint8_t Openn, uint8_t Pol, uint8_t Calp_sel, uint8_t Caln_sel, uint8_t E_fit, uint8_t Rate, uint8_t Gain, uint8_t Dhpf, uint8_t Dlpf)
 For MAX30001/3 ONLY.
int ECGFast_Init (uint8_t Clr_Fast, uint8_t Fast, uint8_t Fast_Th)
 For MAX30001/3 ONLY.
int Stop_ECG (void)
 For MAX30001/3 ONLY.
int PACE_InitStart (uint8_t En_pace, uint8_t Clr_pedge, uint8_t Pol, uint8_t Gn_diff_off, uint8_t Gain, uint8_t Aout_lbw, uint8_t Aout, uint8_t Dacp, uint8_t Dacn)
 For MAX30001 ONLY.
int Stop_PACE (void)
 For MAX30001 ONLY.
int BIOZ_InitStart (uint8_t En_bioz, uint8_t Openp, uint8_t Openn, uint8_t Calp_sel, uint8_t Caln_sel, uint8_t CG_mode, uint8_t B_fit, uint8_t Rate, uint8_t Ahpf, uint8_t Ext_rbias, uint8_t Gain, uint8_t Dhpf, uint8_t Dlpf, uint8_t Fcgen, uint8_t Cgmon, uint8_t Cgmag, uint8_t Phoff)
 For MAX30001/2 ONLY.
int Stop_BIOZ (void)
 For MAX30001/2 ONLY.
int BIOZ_InitBist (uint8_t En_bist, uint8_t Rnom, uint8_t Rmod, uint8_t Fbist)
 For MAX30001/2 ONLY.
int RtoR_InitStart (uint8_t En_rtor, uint8_t Wndw, uint8_t Gain, uint8_t Pavg, uint8_t Ptsf, uint8_t Hoff, uint8_t Ravg, uint8_t Rhsf, uint8_t Clr_rrint)
 For MAX30001/3/4 ONLY.
int Stop_RtoR (void)
 For MAX30001/3/4 ONLY.
int PLL_lock (void)
 This is a function that waits for the PLL to lock; once a lock is achieved it exits out.
int sw_rst (void)
 This function causes the MAX30001 to reset.
int synch (void)
 This function provides a SYNCH operation.
int fifo_rst (void)
 This function performs a FIFO Reset.
int int_handler (void)
 This is a callback function which collects all the data from the ECG, BIOZ, PACE and RtoR.
int FIFO_LeadONOff_Read (void)
 This is function called from the max30001_int_handler() function and processes all the ECG, BIOZ, PACE.
int reg_write (MAX30001_REG_map_t addr, uint32_t data)
 This function allows writing to a register.
int reg_read (MAX30001_REG_map_t addr, uint32_t *return_data)
 This function allows reading from a register.
int Enable_DcLeadOFF_Init (int8_t En_dcloff, int8_t Ipol, int8_t Imag, int8_t Vth)
 This function enables the DC Lead Off detection.
int Disable_DcLeadOFF (void)
 This function disables the DC Lead OFF feature, whichever is active.
int BIOZ_Enable_ACLeadOFF_Init (uint8_t En_bloff, uint8_t Bloff_hi_it, uint8_t Bloff_lo_it)
 This function sets up the BIOZ for AC Lead Off test.
int BIOZ_Disable_ACleadOFF (void)
 This function Turns of the BIOZ AC Lead OFF feature.
int BIOZ_Enable_BCGMON (void)
 This function enables the Current Gnerator Monitor.
int Enable_LeadON (int8_t Channel)
 This function enables the Lead ON detection.
int Disable_LeadON (void)
 This function turns off the Lead ON feature, whichever one is active.
void ServiceLeadON (uint32_t currentTime)
 This function is toggled every 2 seconds to switch between ECG Lead ON and BIOZ Lead ON detect.
void ServiceLeadoff (uint32_t currentTime)
 This function is toggled every 2 seconds to switch between ECG DC Lead Off and BIOZ DC Lead Off.
void ReadHeartrateData (max30001_bledata_t *_hspValMax30001)
 This function sets current RtoR values and fmstr values in a pointer structure.
void onDataAvailable (PtrFunction _onDataAvailable)
 Used to connect a callback for when interrupt data is available.
void AllowInterrupts (int state)
 Allows Interrupts to be accepted as valid.

Static Public Member Functions

static void Mid_IntB_Handler (void)
 Preventive measure used to dismiss interrupts that fire too early during.
static void Mid_Int2B_Handler (void)
 Preventive measure used to dismiss interrupts that fire too early during.
static void spiHandler (int events)
 Callback handler for SPI async events.

Data Fields

uint32_t max30001_ECG_FIFO_buffer [32]
 (303 for internal test)
uint32_t max30001_BIOZ_FIFO_buffer [8]
 (303 for internal test)
uint32_t max30001_PACE [18]
 Pace Data 0-5.
uint32_t max30001_RtoR_data
 This holds the RtoR data.
uint32_t max30001_DCLeadOff
 This holds the LeadOff data, Last 4 bits give the status, BIT3=LOFF_PH, BIT2=LOFF_PL, BIT1=LOFF_NH, BIT0=LOFF_NL 8th and 9th bits tell Lead off is due to ECG or BIOZ.
uint32_t max30001_ACLeadOff
 This gives the state of the BIOZ AC Lead Off state.
uint32_t max30001_bcgmon
 This holds the BCGMON data, BIT 1 = BCGMP, BIT0 = BCGMN.
uint32_t max30001_LeadOn
 This holds the LeadOn data, BIT1 = BIOZ Lead ON, BIT0 = ECG Lead ON, BIT8= Lead On Status Bit.
uint32_t max30001_timeout
 If the PLL does not respond, timeout and get out.

Static Public Attributes

static event_callback_t functionpointer
 function pointer to the async callback
static volatile int xferFlag = 0
 flag used to indicate an async xfer has taken place

Detailed Description

Maxim Integrated MAX30001 ECG/BIOZ chip.

Definition at line 258 of file MAX30001.h.


Member Typedef Documentation

CNFG_BIOZ (0x18)

EN_INT2 (0x03)

EN_INT (0x02)

INFO (0x0F)

STATUS (0x01)

typedef void(* PtrFunction)(uint32_t id, uint32_t *buffer, uint32_t length)

type definition for data interrupt

Definition at line 1181 of file MAX30001.h.


Member Enumeration Documentation

Enumerator:
MAX30001_NO_CAL_SIG 

EMUX_CALP_SEL & EMUX_CALN_SEL.

No calibration signal is applied

MAX30001_INPT_VMID 

Input is connected to VMID.

MAX30001_INPT_VCALP 

Input is connected to VCALP.

MAX30001_INPT_VCALN 

Input is connected to VCALN.

Definition at line 723 of file MAX30001.h.

Enumerator:
MAX30001_ECG_CON_AFE 

OPENP and OPENN setting.

ECGx is connected to AFE channel

MAX30001_ECG_ISO_AFE 

ECGx is isolated from AFE channel.

Definition at line 718 of file MAX30001.h.

Enumerator:
MAX30001_NON_INV 

Input Polarity selection.

Non-Inverted

MAX30001_INV 

Inverted.

Definition at line 713 of file MAX30001.h.

Enumerator:
MAX30001_CHANNEL_DISABLED 

EN_ECG, EN_BIOZ, EN_PACE.

Definition at line 730 of file MAX30001.h.

Enumerator:
MAX30001_NO_INT 

No interrupt.

MAX30001_INT_B 

INTB selected for interrupt.

MAX30001_INT_2B 

INT2B selected for interrupt.

Definition at line 700 of file MAX30001.h.

Enumerator:
STATUS 

MAX30001 Register addresses.

Definition at line 261 of file MAX30001.h.


Constructor & Destructor Documentation

MAX30001 ( SPI *  spi )

Constructor that accepts pin names for the SPI interface.

Parameters:
spipointer to the mbed SPI object

Definition at line 52 of file MAX30001.cpp.

MAX30001 ( PinName  mosi,
PinName  miso,
PinName  sclk,
PinName  cs 
)

Constructor that accepts pin names for the SPI interface.

Parameters:
mosimaster out slave in pin name
misomaster in slave out pin name
sclkserial clock pin name
cschip select pin name

Definition at line 41 of file MAX30001.cpp.

~MAX30001 ( void   )

MAX30001 destructor.

Definition at line 63 of file MAX30001.cpp.


Member Function Documentation

void AllowInterrupts ( int  state )

Allows Interrupts to be accepted as valid.

Parameters:
state,:1-Allow interrupts, Any-Don't allow interrupts.

Definition at line 1408 of file MAX30001.cpp.

int BIOZ_Disable_ACleadOFF ( void   )

This function Turns of the BIOZ AC Lead OFF feature.

Registers Used: CNFG_GEN-0x10

Returns:
0-if no error. A non-zero value indicates an error.

< CNFG_GEN

Definition at line 876 of file MAX30001.cpp.

int BIOZ_Enable_ACLeadOFF_Init ( uint8_t  En_bloff,
uint8_t  Bloff_hi_it,
uint8_t  Bloff_lo_it 
)

This function sets up the BIOZ for AC Lead Off test.

Registers Used: CNFG_GEN-0x10, MNGR_DYN-0x05

Parameters:
En_bloff,:BIOZ Digital Lead Off Detection Enable <CNFG_GEN register>="">
Bloff_hi_it,:DC Lead Off Current Polarity (if current sources are enabled/connected) <MNGR_DYN register>="">
Bloff_lo_it,:DC Lead off current Magnitude Selection <MNGR_DYN register>="">
Returns:
0-if no error. A non-zero value indicates an error.

< CNFG_GEN

Definition at line 843 of file MAX30001.cpp.

int BIOZ_Enable_BCGMON ( void   )

This function enables the Current Gnerator Monitor.

Registers Used: CNFG_BIOZ-0x18

Returns:
0-if no error. A non-zero value indicates an error.

< CNFG_BIOZ

Definition at line 895 of file MAX30001.cpp.

int BIOZ_InitBist ( uint8_t  En_bist,
uint8_t  Rnom,
uint8_t  Rmod,
uint8_t  Fbist 
)

For MAX30001/2 ONLY.

BIOZ modulated Resistance Built-in-Self-Test, Registers used: CNFG_BMUX-0x17

Parameters:
En_bist,:Enable Modulated Resistance Built-in-Self-test <CNFG_BMUX register>="">
Rnom,:BIOZ RMOD BIST Nominal Resistance Selection <CNFG_BMUX register>="">
Rmod,:BIOZ RMOD BIST Modulated Resistance Selection <CNFG_BMUX register>="">
Fbist,:BIOZ RMOD BIST Frequency Selection <CNFG_BMUX register>="">
Returns:
0-if no error. A non-zero value indicates an error.

< CNFG_BMUX

Definition at line 619 of file MAX30001.cpp.

int BIOZ_InitStart ( uint8_t  En_bioz,
uint8_t  Openp,
uint8_t  Openn,
uint8_t  Calp_sel,
uint8_t  Caln_sel,
uint8_t  CG_mode,
uint8_t  B_fit,
uint8_t  Rate,
uint8_t  Ahpf,
uint8_t  Ext_rbias,
uint8_t  Gain,
uint8_t  Dhpf,
uint8_t  Dlpf,
uint8_t  Fcgen,
uint8_t  Cgmon,
uint8_t  Cgmag,
uint8_t  Phoff 
)

For MAX30001/2 ONLY.

This function sets up the MAX30001 for BIOZ measurement. Registers used: MNGR_INT-0x04, CNFG_GEN-0X10, CNFG_BMUX-0x17,CNFG_BIOZ-0x18.

Parameters:
En_bioz,:BIOZ Channel Enable <CNFG_GEN register>="">
Openp,:Open the BIP Input Switch <CNFG_BMUX register>="">
Openn,:Open the BIN Input Switch <CNFG_BMUX register>="">
Calp_sel,:BIP Calibration Selection <CNFG_BMUX register>="">
Caln_sel,:BIN Calibration Selection <CNFG_BMUX register>="">
CG_mode,:BIOZ Current Generator Mode Selection <CNFG_BMUX register>="">
B_fit,:BIOZ FIFO Interrupt Threshold (issues BINT based on number of unread FIFO records) <MNGR_INT register>="">
Rate,:BIOZ Data Rate <CNFG_BIOZ register>="">
Ahpf,:BIOZ/PACE Channel Analog High Pass Filter Cutoff Frequency and Bypass <CNFG_BIOZ register>="">
Ext_rbias,:External Resistor Bias Enable <CNFG_BIOZ register>="">
Gain,:BIOZ Channel Gain Setting <CNFG_BIOZ register>="">
Dhpf,:BIOZ Channel Digital High Pass Filter Cutoff Frequency <CNFG_BIOZ register>="">
Dlpf,:BIOZ Channel Digital Low Pass Filter Cutoff Frequency <CNFG_BIOZ register>="">
Fcgen,:BIOZ Current Generator Modulation Frequency <CNFG_BIOZ register>="">
Cgmon,:BIOZ Current Generator Monitor <CNFG_BIOZ register>="">
Cgmag,:BIOZ Current Generator Magnitude <CNFG_BIOZ register>="">
Phoff,:BIOZ Current Generator Modulation Phase Offset <CNFG_BIOZ register>="">
Returns:
0-if no error. A non-zero value indicates an error.

< CNFG_GEN

< fmstr is default

< MNGR_INT

Definition at line 504 of file MAX30001.cpp.

int CAL_InitStart ( uint8_t  En_Vcal,
uint8_t  Vmode,
uint8_t  Vmag,
uint8_t  Fcal,
uint16_t  Thigh,
uint8_t  Fifty 
)

This function uses sets up the calibration signal internally.

If it is desired to use the internal signal, then this function must be called and the registers set, prior to setting the CALP_SEL and CALN_SEL in the ECG_InitStart and BIOZ_InitStart functions. Uses Register: CNFG_CAL-0x12

Parameters:
En_Vcal,:Calibration Source (VCALP and VCALN) Enable
Vmode,:Calibration Source Mode Selection
Vmag,:Calibration Source Magnitude Selection (VMAG)
Fcal,:Calibration Source Frequency Selection (FCAL)
Thigh,:Calibration Source Time High Selection
Fifty,:Calibration Source Duty Cycle Mode Selection
Returns:
0-if no error. A non-zero value indicates an error.

< CNFG_CAL

RTOS uses a 32768HZ clock. 32768ticks represents 1secs. 1sec/10 = 100msecs.

RTOS uses a 32768HZ clock. 32768ticks represents 1secs. 1sec/10 = 100msecs.

Definition at line 141 of file MAX30001.cpp.

int CAL_Stop ( void   )

This function disables the VCAL signal.

Returns:
0-if no error. A non-zero value indicates an error.

Definition at line 184 of file MAX30001.cpp.

int Disable_DcLeadOFF ( void   )

This function disables the DC Lead OFF feature, whichever is active.

Returns:
0-if no error. A non-zero value indicates an error.

< CNFG_GEN

Definition at line 824 of file MAX30001.cpp.

int Disable_LeadON ( void   )

This function turns off the Lead ON feature, whichever one is active.

Also, retrieves the en_bioz, en_ecg, en_pace and sets it back to as it was.

Parameters:
0-ifeverything is good. A non-zero value indicates an error.

< CNFG_GEN

Definition at line 939 of file MAX30001.cpp.

int ECG_InitStart ( uint8_t  En_ecg,
uint8_t  Openp,
uint8_t  Openn,
uint8_t  Pol,
uint8_t  Calp_sel,
uint8_t  Caln_sel,
uint8_t  E_fit,
uint8_t  Rate,
uint8_t  Gain,
uint8_t  Dhpf,
uint8_t  Dlpf 
)

For MAX30001/3 ONLY.

This function sets up the MAX30001 for the ECG measurements. Registers used: CNFG_EMUX, CNFG_GEN, MNGR_INT, CNFG_ECG.

Parameters:
En_ecg,:ECG Channel Enable <CNFG_GEN register="" bits>="">
Openp,:Open the ECGN Input Switch (most often used for testing and calibration studies) <CNFG_EMUX register="" bits>="">
Openn,:Open the ECGN Input Switch (most often used for testing and calibration studies) <CNFG_EMUX register="" bits>="">
Calp_sel,:ECGP Calibration Selection <CNFG_EMUX register="" bits>="">
Caln_sel,:ECGN Calibration Selection <CNFG_EMUX register="" bits>="">
E_fit,:ECG FIFO Interrupt Threshold (issues EINT based on number of unread FIFO records) <CNFG_GEN register="" bits>="">
Clr_rrint,:RTOR R Detect Interrupt (RRINT) Clear Behavior <CNFG_GEN register="" bits>="">
Rate,:ECG Data Rate
Gain,:ECG Channel Gain Setting
Dhpf,:ECG Channel Digital High Pass Filter Cutoff Frequency
Dlpf,:ECG Channel Digital Low Pass Filter Cutoff Frequency
Returns:
0-if no error. A non-zero value indicates an error.

< CNFG_EMUX

< CNFG_GEN

< fmstr is default

< MNGR_INT

Definition at line 284 of file MAX30001.cpp.

int ECGFast_Init ( uint8_t  Clr_Fast,
uint8_t  Fast,
uint8_t  Fast_Th 
)

For MAX30001/3 ONLY.

This function enables the Fast mode feature of the ECG. Registers used: MNGR_INT-0x04, MNGR_DYN-0x05

Parameters:
Clr_Fast,:FAST MODE Interrupt Clear Behavior <MNGR_INT register>="">
Fast,:ECG Channel Fast Recovery Mode Selection (ECG High Pass Filter Bypass) <MNGR_DYN register>="">
Fast_Th,:Automatic Fast Recovery Threshold
Returns:
0-if no error. A non-zero value indicates an error.

Definition at line 369 of file MAX30001.cpp.

int Enable_DcLeadOFF_Init ( int8_t  En_dcloff,
int8_t  Ipol,
int8_t  Imag,
int8_t  Vth 
)

This function enables the DC Lead Off detection.

Either ECG or BIOZ can be detected, one at a time. Registers Used: CNFG_GEN-0x10

Parameters:
En_dcloff,:BIOZ Digital Lead Off Detection Enable
Ipol,:DC Lead Off Current Polarity (if current sources are enabled/connected)
Imag,:DC Lead off current Magnitude Selection
Vth,:DC Lead Off Voltage Threshold Selection
Returns:
0-if no error. A non-zero value indicates an error.

< the leads are not touching the body

< CNFG_EMUX, Set ECGP and ECGN for external hook up...

Definition at line 799 of file MAX30001.cpp.

int Enable_LeadON ( int8_t  Channel )

This function enables the Lead ON detection.

Either ECG or BIOZ can be detected, one at a time. Also, the en_bioz, en_ecg, en_pace setting is saved so that when this feature is disabled through the max30001_Disable_LeadON() function (or otherwise) the enable/disable state of those features can be retrieved.

Parameters:
Channel,:ECG or BIOZ detection
Returns:
0-if everything is good. A non-zero value indicates an error.

< CNFG_GEN

< BIOZ ULP lead on detection...

Definition at line 915 of file MAX30001.cpp.

void FCLK_MaximOnly ( void   )

This function is MAXIM Proprietary.

It channels the RTC crystal clock to P1.7. Thus providing 32768Hz on FCLK pin of the MAX30001-3

Definition at line 70 of file MAX30001.cpp.

int FIFO_LeadONOff_Read ( void   )

This is function called from the max30001_int_handler() function and processes all the ECG, BIOZ, PACE.

and the RtoR data and sticks them in appropriate arrays and variables each unsigned 32 bits.

Parameters:
ECGdata will be in the array (input): max30001_ECG_FIFO_buffer[]
Pacedata will be in the array (input): max30001_PACE[]
RtoRdatawill be in the variable (input): max30001_RtoR_data
BIOZdata will be in the array (input): max30001_BIOZ_FIFO_buffer[]
globalmax30001_ECG_FIFO_buffer[]
globalmax30001_PACE[]
globalmax30001_BIOZ_FIFO_buffer[]
globalmax30001_RtoR_data
globalmax30001_DCLeadOff
globalmax30001_ACLeadOff
globalmax30001_LeadON
Returns:
0-if no error. A non-zero value indicates an error.

< 32words - 3bytes each

< The SPI routine only sends out data of 32 bytes in size. Therefore the data is being read in smaller chunks in this routine...

< READ mngr_int AND cnfg_gen;

< Put the content of the FIFO based on the EFIT value, We ignore the result[0] and start concatenating indexes: 1,2,3 - 4,5,6 - 7,8,9 -

< index1=23-16 bit, index2=15-8 bit, index3=7-0 bit

< This will prevent extra read of PACE, once group 0-5 is read ONCE.

< For Read Or with 1

< For Read Or with 1

< For Read Or with 1

< For Read Or with 1

< For Read Or with 1

< For Read Or with 1

< Send out the Pace data once only

< [(BFIT+1)*3byte]+1extra byte due to the addr

< Make a copy of the FIFO over here...

< Put the content of the FIFO based on the BFIT value, We ignore the result[0] and start concatenating indexes: 1,2,3 - 4,5,6 - 7,8,9 -

< index1=23-16 bit, index2=15-8 bit, index3=7-0 bit

< ECG/BIOZ Lead Off

< Do a FIFO Reset

< Just send once when it comes out of dc lead off

< BIOZ AC Lead Off

< Do a FIFO Reset

< Just send once when it comes out of ac lead off

< BIOZ BCGMON check

< AC LeadON Check, when lead is on

< 0b01 will mean ECG Lead On, 0b10 will mean BIOZ Lead On

< One shot data will be sent...

< 0b01 will mean ECG Lead On, 0b10 will mean BIOZ Lead On

< One shot data will be sent...

Definition at line 1014 of file MAX30001.cpp.

int fifo_rst ( void   )

This function performs a FIFO Reset.

Uses Register FIFO_RST-0x0A. Please refer to the data sheet for the details on how to use this.

Returns:
0-if no error. A non-zero value indicates an error.

< Resets the FIFO

Definition at line 751 of file MAX30001.cpp.

int INT_assignment ( max30001_intrpt_Location_t  en_enint_loc,
max30001_intrpt_Location_t  en_eovf_loc,
max30001_intrpt_Location_t  en_fstint_loc,
max30001_intrpt_Location_t  en_dcloffint_loc,
max30001_intrpt_Location_t  en_bint_loc,
max30001_intrpt_Location_t  en_bovf_loc,
max30001_intrpt_Location_t  en_bover_loc,
max30001_intrpt_Location_t  en_bundr_loc,
max30001_intrpt_Location_t  en_bcgmon_loc,
max30001_intrpt_Location_t  en_pint_loc,
max30001_intrpt_Location_t  en_povf_loc,
max30001_intrpt_Location_t  en_pedge_loc,
max30001_intrpt_Location_t  en_lonint_loc,
max30001_intrpt_Location_t  en_rrint_loc,
max30001_intrpt_Location_t  en_samp_loc,
max30001_intrpt_type_t  intb_Type,
max30001_intrpt_type_t  int2b_Type 
)

This function handles the assignment of the two interrupt pins (INTB & INT2B) with various.

functions/behaviors of the MAX30001. Also, each pin can be configured for different drive capability. Uses Registers: EN_INT-0x02 and EN_INT2-0x03.

Parameters:
max30001_intrpt_Locatio_t<argument>: All the arguments with the aforementioned enumeration essentially can be configured to generate an interrupt on either INTB or INT2B or NONE.
max30001_intrpt_type_tintb_Type: INTB Port Type (EN_INT Selections).
max30001_intrpt_type_t int2b_Type: INT2B Port Type (EN_INT2 Selections)
Returns:
0-if no error. A non-zero value indicates an error.

< INT1

Definition at line 201 of file MAX30001.cpp.

int int_handler ( void   )

This is a callback function which collects all the data from the ECG, BIOZ, PACE and RtoR.

It also handles Lead On/Off. This function is passed through the argument of max30001_COMMinit().

Returns:
0-if no error. A non-zero value indicates an error.

< Inital Reset and any FIFO over flow invokes a FIFO reset

< Do a FIFO Reset

< The four data handling goes on over here

< ECG Lead ON test: i.e. the leads are touching the body...

Definition at line 1296 of file MAX30001.cpp.

void Mid_Int2B_Handler ( void   ) [static]

Preventive measure used to dismiss interrupts that fire too early during.

initialization on INT2B line

Definition at line 1401 of file MAX30001.cpp.

void Mid_IntB_Handler ( void   ) [static]

Preventive measure used to dismiss interrupts that fire too early during.

initialization on INTB line

Definition at line 1394 of file MAX30001.cpp.

void onDataAvailable ( PtrFunction  _onDataAvailable )

Used to connect a callback for when interrupt data is available.

Definition at line 1375 of file MAX30001.cpp.

int PACE_InitStart ( uint8_t  En_pace,
uint8_t  Clr_pedge,
uint8_t  Pol,
uint8_t  Gn_diff_off,
uint8_t  Gain,
uint8_t  Aout_lbw,
uint8_t  Aout,
uint8_t  Dacp,
uint8_t  Dacn 
)

For MAX30001 ONLY.

This function sets up the MAX30001 for pace signal detection. If both PACE and BIOZ are turned ON, then make sure Fcgen is set for 80K or 40K in the max30001_BIOZ_InitStart() function. However, if Only PACE is on but BIOZ off, then Fcgen can be set for 80K only, in the max30001_BIOZ_InitStart() function Registers used: MNGR_INT-0x04, CNFG_GEN-0x37, CNFG_PACE-0x1A.

Parameters:
En_pace: PACE Channel Enable <CNFG_GEN register>="">
Clr_pedge: PACE Edge Detect Interrupt (PEDGE) Clear Behavior <MNGR_INT register>="">
Pol,:PACE Input Polarity Selection <CNFG_PACE register>="">
Gn_diff_off,:PACE Differentiator Mode <CNFG_PACE register>="">
Gain,:PACE Channel Gain Selection <CNFG_PACE register>="">
Aout_lbw,:PACE Analog Output Buffer Bandwidth Mode <CNFG_PACE register>="">
Aout,:PACE Single Ended Analog Output Buffer Signal Monitoring Selection <CNFG_PACE register>="">
Dacp(4bits): PACE Detector Positive Comparator Threshold <CNFG_PACE register>="">
Dacn(4bits),:PACE Detector Negative Comparator Threshold <CNFG_PACE register>="">
Returns:
0-if no error. A non-zero value indicates an error <CNFG_PACE register>="">

< CNFG_GEN

< MNGR_INT

Definition at line 419 of file MAX30001.cpp.

int PLL_lock ( void   )

This is a function that waits for the PLL to lock; once a lock is achieved it exits out.

(For convenience only)

Returns:
0-if no error. A non-zero value indicates an error.

< Spin to see PLLint become zero to indicate a lock.

< Wait and spin for PLL to lock...

Definition at line 713 of file MAX30001.cpp.

int Rbias_FMSTR_Init ( uint8_t  En_rbias,
uint8_t  Rbiasv,
uint8_t  Rbiasp,
uint8_t  Rbiasn,
uint8_t  Fmstr 
)

This function sets up the Resistive Bias mode and also selects the master clock frequency.

Uses Register: CNFG_GEN-0x10

Parameters:
En_rbias,:Enable and Select Resitive Lead Bias Mode
Rbiasv,:Resistive Bias Mode Value Selection
Rbiasp,:Enables Resistive Bias on Positive Input
Rbiasn,:Enables Resistive Bias on Negative Input
Fmstr,:Selects Master Clock Frequency
Returns:
0-if no error. A non-zero value indicates an error.

Definition at line 118 of file MAX30001.cpp.

void ReadHeartrateData ( max30001_bledata_t *  _hspValMax30001 )

This function sets current RtoR values and fmstr values in a pointer structure.

Parameters:
hspValMax30001- Pointer to a structure where to store the values

Definition at line 1369 of file MAX30001.cpp.

int reg_read ( MAX30001_REG_map_t  addr,
uint32_t *  return_data 
)

This function allows reading from a register.

Parameters:
addr,:Address of the register to read from.
*return_data,:pointer to the value read from the register.
Returns:
0-if no error. A non-zero value indicates an error.

Definition at line 781 of file MAX30001.cpp.

int reg_write ( MAX30001_REG_map_t  addr,
uint32_t  data 
)

This function allows writing to a register.

Parameters:
addr,:Address of the register to write to
data,:24-bit data read from the register.
Returns:
0-if no error. A non-zero value indicates an error.

Definition at line 759 of file MAX30001.cpp.

int RtoR_InitStart ( uint8_t  En_rtor,
uint8_t  Wndw,
uint8_t  Gain,
uint8_t  Pavg,
uint8_t  Ptsf,
uint8_t  Hoff,
uint8_t  Ravg,
uint8_t  Rhsf,
uint8_t  Clr_rrint 
)

For MAX30001/3/4 ONLY.

Sets up the device for RtoR measurement

Parameters:
EN_rtor,:ECG RTOR Detection Enable <RTOR1 register>="">
Wndw,:R to R Window Averaging (Window Width = RTOR_WNDW[3:0]*8mS) <RTOR1 register>="">
Gain,:R to R Gain (where Gain = 2^RTOR_GAIN[3:0], plus an auto-scale option) <RTOR1 register>="">
Pavg,:R to R Peak Averaging Weight Factor <RTOR1 register>="">
Ptsf,:R to R Peak Threshold Scaling Factor <RTOR1 register>="">
Hoff,:R to R minimum Hold Off <RTOR2 register>="">
Ravg,:R to R Interval Averaging Weight Factor <RTOR2 register>="">
Rhsf,:R to R Interval Hold Off Scaling Factor <RTOR2 register>="">
Clr_rrint,:RTOR Detect Interrupt Clear behaviour <MNGR_INT register>="">
Returns:
0-if no error. A non-zero value indicates an error.

< MNGR_INT

< 0b01 & 0b00 are for interrupt mode... 0b10 is for monitoring mode... it just overwrites the data...

Definition at line 642 of file MAX30001.cpp.

void ServiceLeadoff ( uint32_t  currentTime )

This function is toggled every 2 seconds to switch between ECG DC Lead Off and BIOZ DC Lead Off.

Adjust LEADOFF_SERVICE_TIME to determine the duration between the toggles.

Parameters:
CurrentTime- This gets fed the time by RTC_GetValue function

< switch to ECG DC Lead OFF

< switch to BIOZ DC Lead OFF

Definition at line 961 of file MAX30001.cpp.

void ServiceLeadON ( uint32_t  currentTime )

This function is toggled every 2 seconds to switch between ECG Lead ON and BIOZ Lead ON detect.

Adjust LEADOFF_SERVICE_TIME to determine the duration between the toggles.

Parameters:
CurrentTime- This gets fed the time by RTC_GetValue function

< switch to ECG DC Lead ON

< switch to BIOZ DC Lead ON

Definition at line 989 of file MAX30001.cpp.

void spiHandler ( int  events ) [static]

Callback handler for SPI async events.

Parameters:
eventsdescription of event that occurred

Definition at line 1387 of file MAX30001.cpp.

int Stop_BIOZ ( void   )

For MAX30001/2 ONLY.

This function disables the BIOZ. Uses Register CNFG_GEN-0x10.

Returns:
0-if no error. A non-zero value indicates an error.
0-if no error. A non-zero value indicates an error.

< CNFG_GEN

Definition at line 599 of file MAX30001.cpp.

int Stop_ECG ( void   )

For MAX30001/3 ONLY.

This function disables the ECG. Uses Register CNFG_GEN-0x10.

Returns:
0-if no error. A non-zero value indicates an error.

< Stop ECG

< fmstr is default

Definition at line 399 of file MAX30001.cpp.

int Stop_PACE ( void   )

For MAX30001 ONLY.

Parameters:
Thisfunction disables the PACE. Uses Register CNFG_GEN-0x10.
Returns:
0-if no error. A non-zero value indicates an error.

< Stop PACE

Definition at line 486 of file MAX30001.cpp.

int Stop_RtoR ( void   )

For MAX30001/3/4 ONLY.

This function disables the RtoR. Uses Register CNFG_RTOR1-0x1D

Returns:
0-if no error. A non-zero value indicates an error.

< Stop RtoR

Definition at line 695 of file MAX30001.cpp.

int sw_rst ( void   )

This function causes the MAX30001 to reset.

Uses Register SW_RST-0x08

Returns:
0-if no error. A non-zero value indicates an error.

< SW reset for the MAX30001 chip

Definition at line 732 of file MAX30001.cpp.

int synch ( void   )

This function provides a SYNCH operation.

Uses Register SYCNH-0x09. Please refer to the data sheet for the details on how to use this.

Returns:
0-if no error. A non-zero value indicates an error.

< For synchronization

Definition at line 743 of file MAX30001.cpp.


Field Documentation

event_callback_t functionpointer [static]

function pointer to the async callback

Definition at line 1213 of file MAX30001.h.

This gives the state of the BIOZ AC Lead Off state.

BIT 1 = BOVER, BIT 0 = BUNDR

Definition at line 750 of file MAX30001.h.

uint32_t max30001_bcgmon

This holds the BCGMON data, BIT 1 = BCGMP, BIT0 = BCGMN.

Definition at line 753 of file MAX30001.h.

(303 for internal test)

Definition at line 738 of file MAX30001.h.

This holds the LeadOff data, Last 4 bits give the status, BIT3=LOFF_PH, BIT2=LOFF_PL, BIT1=LOFF_NH, BIT0=LOFF_NL 8th and 9th bits tell Lead off is due to ECG or BIOZ.

0b01 = ECG Lead Off and 0b10 = BIOZ Lead off

Definition at line 744 of file MAX30001.h.

(303 for internal test)

Definition at line 737 of file MAX30001.h.

uint32_t max30001_LeadOn

This holds the LeadOn data, BIT1 = BIOZ Lead ON, BIT0 = ECG Lead ON, BIT8= Lead On Status Bit.

Definition at line 756 of file MAX30001.h.

uint32_t max30001_PACE[18]

Pace Data 0-5.

Definition at line 740 of file MAX30001.h.

This holds the RtoR data.

Definition at line 742 of file MAX30001.h.

uint32_t max30001_timeout

If the PLL does not respond, timeout and get out.

Definition at line 759 of file MAX30001.h.

volatile int xferFlag = 0 [static]

flag used to indicate an async xfer has taken place

Definition at line 1216 of file MAX30001.h.