#ifndef __SENSORLIB_max30100k_H__
#define __SENSORLIB_max30100k_H__

#define MAX_I2C_ADD     0x57    //Max30100  address
//Define register addresses
#define MAX_INT_STA 			0x00
#define MAX_INT_EN 				0x01
#define MAX_FIFO_WR_PTR			0x02
#define MAX_OVF_COUNTER			0x03
#define MAX_FIFO_RD_PTR			0x04
#define MAX_FIFO_DATA			0x05
#define MAX_MODE_CONFIGURATION 	0x06
#define MAX_SPO2_CONFIGURATION 	0x07
#define MAX_LED_CONFIGURATION 	0x09
#define MAX_TEMP_INTERGER 		0x16
#define MAX_TEMP_FRAC 			0x17
#define MAX_REVISONID			0xFE
#define MAX_PARTID				0xFF

#define MAX_MULTI_LED_MODE_CTL1 	0x11
#define MAX_MULTI_LED_MODE_CTL2 	0x12
#define MAX_PROX_MODE_THRESH		0x30
#define MAX_FIFO_CONFIG				0x08

//Mode configuration (0x06)
#define SHDN 			0x80	//Shutdown Control
#define RESET			0X40	//Reset Control
#define TEMP_EN			0x08	//Temperature Enable
#define MODE2			0x04	//Mode Selection
#define MODE1			0x02	//		MODE2	MODE1	MODE0
#define MODE0			0x01	//		0		1		0		HR only
								//		0		1		1		SpO2
								//								*Do not use other combinations

//SpO2 Configuration (0x07)
#define	SPO2_HI_RES_EN  0x40	//SpO2 High Resolution Enable
#define	SPO2_SR2		0x10	//SpO2 Sample Rate Control bit
#define	SPO2_SR1		0x08 	//		SPO2_SR[2:0]	SPS
#define	SPO2_SR0		0x04	//		000				50
								//		001				100
								//		010				167
								//		011				200
								//		100				400
								//		101				600
								//		110				800
								//		111				1000
#define LED_PW1			0x02	//LED Pulse Width Control
#define LED_PW0			0x01	//		LED_PW[1:0]		PULSE WIDTH (us)	ADC RESOLUTION (BITS)#
								//		00				200					13
								//		01				400					14
								//		10				800					15
								//		11				1600				16

//LED Configuration (0x09)
#define RED_PA3			0x80	//
#define RED_PA2			0x40
#define RED_PA1			0x20
#define RED_PA0			0x10
#define IR_PA3			0x08
#define IR_PA2			0x04
#define IR_PA1			0x02
#define IR_PA0			0x01   //Red_PA[3:0] IR_PA[3:0] 	TYPICAL LED CURRENT (mA)*
								//0							0
								//1							4.4
								//10						7.6
								//11						11
								//100						14.2
								//101						17.4
								//110						20.8
								//111						24
								//1000						27.1
								//1001						30.6
								//1010						33.8
								//1011						37
								//1100						40.2
								//1101						43.6
								//1110						46.8
								//1111						50

//Interrupt enable and state
#define A_FULL		0x80
#define	TEMP_RDY	0x40
#define	HR_RDY		0x20
#define	SPO2_RDY	0x10
#define	PWR_RDY		0x01
#define	ENB_A_FULL	0x80
#define	ENB_TEP_RDY	0x40
#define	ENB_HR_RDY	0x20
#define	ENB_SO2_RDY	0x10
#endif //