OB1203 basic mbed driver
OB1203.h@16:d5fe5debb5d2, 2018-09-28 (annotated)
- Committer:
- laserdad
- Date:
- Fri Sep 28 21:54:57 2018 +0000
- Revision:
- 16:d5fe5debb5d2
- Parent:
- 12:573f7ce91a0d
- Child:
- 18:85dd16f99c3a
fixed setPSThreshold
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
laserdad | 0:2da1f69b38fd | 1 | #ifndef __OB1203_H__ |
laserdad | 0:2da1f69b38fd | 2 | #define __OB1203_H__ |
laserdad | 0:2da1f69b38fd | 3 | |
laserdad | 0:2da1f69b38fd | 4 | #include "mbed.h" |
laserdad | 4:f25ca600a0e6 | 5 | //#include "SoftI2C.h" |
laserdad | 0:2da1f69b38fd | 6 | |
laserdad | 1:99ca9c464503 | 7 | //#define DEBUG |
laserdad | 0:2da1f69b38fd | 8 | |
laserdad | 0:2da1f69b38fd | 9 | #define OB1203_ADDR 0xA6 |
laserdad | 0:2da1f69b38fd | 10 | |
laserdad | 0:2da1f69b38fd | 11 | //Define registers |
laserdad | 0:2da1f69b38fd | 12 | #define REG_STATUS_0 0x00 |
laserdad | 0:2da1f69b38fd | 13 | #define REG_STATUS_1 0x01 |
laserdad | 0:2da1f69b38fd | 14 | #define REG_PS_DATA 0x02 |
laserdad | 0:2da1f69b38fd | 15 | #define REG_LS_W_DATA 0x04 |
laserdad | 0:2da1f69b38fd | 16 | #define REG_LS_G_DATA 0x07 |
laserdad | 0:2da1f69b38fd | 17 | #define REG_LS_B_DATA 0x0A |
laserdad | 0:2da1f69b38fd | 18 | #define REG_LS_R_DATA 0x0D |
laserdad | 0:2da1f69b38fd | 19 | #define REG_LS_C_DATA 0x10 |
laserdad | 4:f25ca600a0e6 | 20 | #define REG_TEMP_DATA 0x13 |
laserdad | 0:2da1f69b38fd | 21 | #define REG_MAIN_CTRL_0 0x15 |
laserdad | 0:2da1f69b38fd | 22 | #define REG_MAIN_CTRL_1 0x16 |
laserdad | 0:2da1f69b38fd | 23 | #define REG_PS_LED_CURR 0x17 |
laserdad | 0:2da1f69b38fd | 24 | #define REG_PS_CAN_PULSES 0x19 |
laserdad | 0:2da1f69b38fd | 25 | #define REG_PS_PWIDTH_RATE 0x1A |
laserdad | 0:2da1f69b38fd | 26 | #define REG_PS_CAN_DIG 0x1B |
laserdad | 0:2da1f69b38fd | 27 | #define REG_PS_MOV_AVG_HYS 0x1D |
laserdad | 0:2da1f69b38fd | 28 | #define REG_PS_THRES_HI 0x1E |
laserdad | 0:2da1f69b38fd | 29 | #define REG_PS_THRES_LO 0x20 |
laserdad | 0:2da1f69b38fd | 30 | #define REG_LS_RES_RATE 0x22 |
laserdad | 0:2da1f69b38fd | 31 | #define REG_LS_GAIN 0x23 |
laserdad | 0:2da1f69b38fd | 32 | #define REG_LS_THRES_HI 0x24 |
laserdad | 0:2da1f69b38fd | 33 | #define REG_LS_THRES_LO 0x27 |
laserdad | 0:2da1f69b38fd | 34 | #define REG_LS_THRES_VAR 0x2A |
laserdad | 0:2da1f69b38fd | 35 | #define REG_INT_CFG_0 0x2B |
laserdad | 0:2da1f69b38fd | 36 | #define REG_PS_INT_CFG_1 0x2C |
laserdad | 0:2da1f69b38fd | 37 | #define REG_INT_PST 0x2D |
laserdad | 0:2da1f69b38fd | 38 | #define REG_PPG_PS_GAIN 0x2E |
laserdad | 0:2da1f69b38fd | 39 | #define REG_PPG_PS_CFG 0x2F |
laserdad | 0:2da1f69b38fd | 40 | #define REG_PPG_IRLED_CURR 0x30 |
laserdad | 0:2da1f69b38fd | 41 | #define REG_PPG_RLED_CURR 0x32 |
laserdad | 0:2da1f69b38fd | 42 | #define REG_PPG_CAN_ANA 0x34 |
laserdad | 0:2da1f69b38fd | 43 | #define REG_PPG_AVG 0x35 |
laserdad | 0:2da1f69b38fd | 44 | #define REG_PPG_PWIDTH_RATE 0x36 |
laserdad | 0:2da1f69b38fd | 45 | #define REG_FIFO_CFG 0x37 |
laserdad | 0:2da1f69b38fd | 46 | #define REG_FIFO_WR_PTR 0x38 |
laserdad | 0:2da1f69b38fd | 47 | #define REG_FIFO_RD_PTR 0x39 |
laserdad | 0:2da1f69b38fd | 48 | #define REG_FIFO_OVF_CNT 0x3A |
laserdad | 0:2da1f69b38fd | 49 | #define REG_FIFO_DATA 0x3B |
laserdad | 0:2da1f69b38fd | 50 | #define REG_PART_ID 0x3D |
laserdad | 0:2da1f69b38fd | 51 | #define REG_DEVICE_CFG 0x4D |
laserdad | 8:6c19c052b053 | 52 | #define REG_OSC_TRIM 0x3E |
laserdad | 9:0c3d2eea1c79 | 53 | #define REG_LED_TRIM 0x3F |
laserdad | 9:0c3d2eea1c79 | 54 | #define REG_BIO_TRIM 0x40 |
laserdad | 9:0c3d2eea1c79 | 55 | |
laserdad | 0:2da1f69b38fd | 56 | |
laserdad | 0:2da1f69b38fd | 57 | //Define settings |
laserdad | 0:2da1f69b38fd | 58 | //STATUS_0 |
laserdad | 4:f25ca600a0e6 | 59 | #define POR_STATUS 0x80 |
laserdad | 4:f25ca600a0e6 | 60 | #define LS_INT_STATUS 0x02 |
laserdad | 0:2da1f69b38fd | 61 | #define LS_NEW_DATA 0x01 |
laserdad | 0:2da1f69b38fd | 62 | //STATUS_1 |
laserdad | 0:2da1f69b38fd | 63 | #define LED_DRIVER_STATUS 0x40 |
laserdad | 0:2da1f69b38fd | 64 | #define FIFO_AFULL_STATUS 0x20 |
laserdad | 0:2da1f69b38fd | 65 | #define PPG_DATA_STATUS 0x10 |
laserdad | 0:2da1f69b38fd | 66 | #define PS_LOGIC_STATUS 0x04 |
laserdad | 0:2da1f69b38fd | 67 | #define PS_INT_STATUS 0x02 |
laserdad | 0:2da1f69b38fd | 68 | #define PS_NEW_DATA 0x01 |
laserdad | 0:2da1f69b38fd | 69 | //MAIN_CTRL_0 |
laserdad | 0:2da1f69b38fd | 70 | #define SW_RESET 0x01<<7 |
laserdad | 0:2da1f69b38fd | 71 | #define LS_SAI_ON 0x01<<3 |
laserdad | 0:2da1f69b38fd | 72 | #define LS_SAI_OFF 0x00 |
laserdad | 0:2da1f69b38fd | 73 | #define ALS_MODE 0x00 |
laserdad | 0:2da1f69b38fd | 74 | #define RGB_MODE 0x01<<1 |
laserdad | 0:2da1f69b38fd | 75 | #define LS_OFF 0x00 |
laserdad | 0:2da1f69b38fd | 76 | #define LS_ON 0x01 |
laserdad | 0:2da1f69b38fd | 77 | //MAIN_CTRL_1 |
laserdad | 0:2da1f69b38fd | 78 | #define PS_SAI_ON 0x01<<3 |
laserdad | 0:2da1f69b38fd | 79 | #define PS_SAI_OFF 0x00 |
laserdad | 0:2da1f69b38fd | 80 | #define PS_MODE 0x00 |
laserdad | 0:2da1f69b38fd | 81 | #define HR_MODE 0x01<<1 |
laserdad | 0:2da1f69b38fd | 82 | #define SPO2_MODE 0x02<<1 |
laserdad | 0:2da1f69b38fd | 83 | #define PPG_PS_ON 0x01 |
laserdad | 0:2da1f69b38fd | 84 | #define PPG_PS_OFF 0x00 |
laserdad | 4:f25ca600a0e6 | 85 | #define TEMP_ON 0x01<<7 |
laserdad | 4:f25ca600a0e6 | 86 | #define TEMP_OFF 0x00 |
laserdad | 0:2da1f69b38fd | 87 | //PS_CAN_PULSES |
laserdad | 0:2da1f69b38fd | 88 | #define PS_CAN_ANA_0 0x00 //off |
laserdad | 0:2da1f69b38fd | 89 | #define PS_CAN_ANA_1 0x01<<6 //50% of FS |
laserdad | 0:2da1f69b38fd | 90 | #define PS_CAN_ANA_2 0x02<<6 //100% of FS |
laserdad | 0:2da1f69b38fd | 91 | #define PS_CAN_ANA_3 0x03<<6 //150% of FS |
laserdad | 1:99ca9c464503 | 92 | #define PS_PULSES(x) (( (x) & (0x07) )<<3) //where x = 0..5 and num pulses = 2^x |
laserdad | 0:2da1f69b38fd | 93 | //PS_PWIDTH_RATE |
laserdad | 0:2da1f69b38fd | 94 | #define PS_PWIDTH(x) (x & 0x03)<<4 //where x = 0..3 |
laserdad | 0:2da1f69b38fd | 95 | #define PS_RATE(x) (x & 0x07) //where x = 0..7 |
laserdad | 0:2da1f69b38fd | 96 | //PS_MOV_AVG_HYS |
laserdad | 0:2da1f69b38fd | 97 | #define PS_AVG_ON 1<<7 |
laserdad | 0:2da1f69b38fd | 98 | #define PS_AVG_OFF 0 |
laserdad | 0:2da1f69b38fd | 99 | #define PS_HYS_LEVEL(x) x>>1 //where x=0..256 |
laserdad | 0:2da1f69b38fd | 100 | //LS_RES_RATE |
laserdad | 0:2da1f69b38fd | 101 | #define LS_RES(x) (x & 0x07)<<4 //where x=0..7 |
laserdad | 0:2da1f69b38fd | 102 | #define LS_RATE(x) (x & 0x07) //where x=0..7 |
laserdad | 16:d5fe5debb5d2 | 103 | |
laserdad | 16:d5fe5debb5d2 | 104 | #define LS_RES_20 0x00 |
laserdad | 16:d5fe5debb5d2 | 105 | #define LS_RES_19 0x01 |
laserdad | 16:d5fe5debb5d2 | 106 | #define LS_RES_18 0x02 |
laserdad | 16:d5fe5debb5d2 | 107 | #define LS_RES_17 0x03 |
laserdad | 16:d5fe5debb5d2 | 108 | #define LS_RES_16` 0x04 |
laserdad | 16:d5fe5debb5d2 | 109 | #define LS_RES_13 0x05 |
laserdad | 16:d5fe5debb5d2 | 110 | |
laserdad | 0:2da1f69b38fd | 111 | //LS_GAIN |
laserdad | 0:2da1f69b38fd | 112 | #define LS_GAIN(x) (x & 0x03) |
laserdad | 16:d5fe5debb5d2 | 113 | #define LS_GAIN_1 0x00 |
laserdad | 16:d5fe5debb5d2 | 114 | #define LS_GAIN_3 0x01 |
laserdad | 16:d5fe5debb5d2 | 115 | #define LS_GAIN_6 0x10 |
laserdad | 16:d5fe5debb5d2 | 116 | #define LS_GAIN_20 0x11 |
laserdad | 16:d5fe5debb5d2 | 117 | |
laserdad | 0:2da1f69b38fd | 118 | //LS_THRES_VAR |
laserdad | 0:2da1f69b38fd | 119 | #define LS_THRES_VAR(x) (x & 0x07) |
laserdad | 0:2da1f69b38fd | 120 | //INT_CFG_0 |
laserdad | 0:2da1f69b38fd | 121 | #define LS_INT_SEL_W 0 |
laserdad | 0:2da1f69b38fd | 122 | #define LS_INT_SEL_G 1<<4 |
laserdad | 0:2da1f69b38fd | 123 | #define LS_INT_SEL_R 2<<4 |
laserdad | 0:2da1f69b38fd | 124 | #define LS_INT_SEL_B 3<<4 |
laserdad | 0:2da1f69b38fd | 125 | #define LS_THRES_INT_MODE 0 |
laserdad | 0:2da1f69b38fd | 126 | #define LS_VAR_INT_MODE 1<<1 |
laserdad | 0:2da1f69b38fd | 127 | #define LS_INT_ON 1 |
laserdad | 0:2da1f69b38fd | 128 | #define LS_INT_OFF 0 |
laserdad | 0:2da1f69b38fd | 129 | //INT_CFG_1 |
laserdad | 0:2da1f69b38fd | 130 | #define AFULL_INT_ON 1<<5 |
laserdad | 0:2da1f69b38fd | 131 | #define AFULL_INT_OFF 0 |
laserdad | 0:2da1f69b38fd | 132 | #define PPG_INT_ON 1<<4 |
laserdad | 0:2da1f69b38fd | 133 | #define PPG_INT_OFF 0 |
laserdad | 2:3cba0fe6db60 | 134 | #define PS_INT_READ_CLEARS 0<<1 |
laserdad | 16:d5fe5debb5d2 | 135 | #define PS_INT_LOGIC 1 |
laserdad | 0:2da1f69b38fd | 136 | #define PS_INT_ON 1 |
laserdad | 0:2da1f69b38fd | 137 | #define PS_INT_OFF 0 |
laserdad | 16:d5fe5debb5d2 | 138 | |
laserdad | 0:2da1f69b38fd | 139 | //INT_PST |
laserdad | 0:2da1f69b38fd | 140 | #define LS_PERSIST(x) (x & 0x0F)<<4 |
laserdad | 0:2da1f69b38fd | 141 | #define PS_PERSIST(x) (x & 0x0F) |
laserdad | 0:2da1f69b38fd | 142 | //PPG_PS_GAIN |
laserdad | 0:2da1f69b38fd | 143 | #define PPG_PS_GAIN_1 0 |
laserdad | 0:2da1f69b38fd | 144 | #define PPG_PS_GAIN_1P5 1<<4 |
laserdad | 0:2da1f69b38fd | 145 | #define PPG_PS_GAIN_2 2<<4 |
laserdad | 0:2da1f69b38fd | 146 | #define PPG_PS_GAIN_4 3<<4 |
laserdad | 8:6c19c052b053 | 147 | #define PPG_LED_SETTLING(x) (x & 0x03)<<2 // 0=0us, 1 = 5us, 2 = 10us (Default), 3=20us |
laserdad | 8:6c19c052b053 | 148 | #define PPG_ALC_TRACK(x) (x & 0x03) // 0 = 10us, 1 (20us) DEFAULT ,2 = 30us, 3 = 60us |
laserdad | 0:2da1f69b38fd | 149 | //PPG_PS_CFG |
laserdad | 0:2da1f69b38fd | 150 | #define PPG_POW_SAVE_ON 1<<6 |
laserdad | 0:2da1f69b38fd | 151 | #define PPG_POW_SAVE_OFF 0 |
laserdad | 0:2da1f69b38fd | 152 | #define LED_FLIP_ON 1<<3 |
laserdad | 0:2da1f69b38fd | 153 | #define LED_FLIP_OFF 0 |
laserdad | 10:6703d2cdeabc | 154 | #define DIFF_OFF 2 |
laserdad | 10:6703d2cdeabc | 155 | #define ALC_OFF 1 |
laserdad | 10:6703d2cdeabc | 156 | #define DIFF_ON 0 |
laserdad | 10:6703d2cdeabc | 157 | #define ALC_ON 0 |
laserdad | 10:6703d2cdeabc | 158 | #define SIGNAL_OUT 1<<2 |
laserdad | 10:6703d2cdeabc | 159 | #define OFFSET_OUT 0 |
laserdad | 0:2da1f69b38fd | 160 | //PPG_CAN_ANA |
laserdad | 0:2da1f69b38fd | 161 | #define PPG_CH1_CAN(x) (x & 0x03)<<2 |
laserdad | 0:2da1f69b38fd | 162 | #define PPG_CH2_CAN(x) (x & 0x03) |
laserdad | 0:2da1f69b38fd | 163 | //PPG_AVG |
laserdad | 0:2da1f69b38fd | 164 | #define PPG_AVG(x) (x & 0x07)<<4 |
laserdad | 0:2da1f69b38fd | 165 | //PPG_PWIDTH_RATE |
laserdad | 0:2da1f69b38fd | 166 | #define PPG_PWIDTH(x) (x & 0x07)<<4 |
laserdad | 0:2da1f69b38fd | 167 | #define PPG_FREQ_60HZ 0 |
laserdad | 0:2da1f69b38fd | 168 | #define PPG_FREQ_50HZ 1<<3 |
laserdad | 0:2da1f69b38fd | 169 | #define PPG_RATE(x) (x & 0x07) |
laserdad | 0:2da1f69b38fd | 170 | //FIFO_CFG |
laserdad | 0:2da1f69b38fd | 171 | #define FIFO_ROLL_ON 1<<4 |
laserdad | 0:2da1f69b38fd | 172 | #define FIFO_ROLL_OFF 0 |
laserdad | 12:573f7ce91a0d | 173 | #define AFULL_ADVANCE_WARNING(x) (x & 0x0F) |
laserdad | 0:2da1f69b38fd | 174 | |
laserdad | 0:2da1f69b38fd | 175 | |
laserdad | 0:2da1f69b38fd | 176 | |
laserdad | 0:2da1f69b38fd | 177 | |
laserdad | 0:2da1f69b38fd | 178 | |
laserdad | 0:2da1f69b38fd | 179 | #define POR_TIME_MS 5 //a guess |
laserdad | 0:2da1f69b38fd | 180 | |
laserdad | 0:2da1f69b38fd | 181 | |
laserdad | 0:2da1f69b38fd | 182 | |
laserdad | 0:2da1f69b38fd | 183 | class OB1203 |
laserdad | 0:2da1f69b38fd | 184 | { |
laserdad | 0:2da1f69b38fd | 185 | I2C *i2c; |
laserdad | 4:f25ca600a0e6 | 186 | // SoftI2C *i2c; |
laserdad | 0:2da1f69b38fd | 187 | |
laserdad | 4:f25ca600a0e6 | 188 | public: |
laserdad | 8:6c19c052b053 | 189 | char osc_trim; |
laserdad | 4:f25ca600a0e6 | 190 | char ls_res; |
laserdad | 4:f25ca600a0e6 | 191 | char ls_rate; |
laserdad | 4:f25ca600a0e6 | 192 | char ls_gain; |
laserdad | 4:f25ca600a0e6 | 193 | uint32_t ls_thres_hi; |
laserdad | 4:f25ca600a0e6 | 194 | uint32_t ls_thres_lo; |
laserdad | 4:f25ca600a0e6 | 195 | char ls_sai; |
laserdad | 4:f25ca600a0e6 | 196 | char ls_mode; |
laserdad | 4:f25ca600a0e6 | 197 | char ls_en; |
laserdad | 4:f25ca600a0e6 | 198 | char ls_int_sel; |
laserdad | 4:f25ca600a0e6 | 199 | char ls_var_mode; |
laserdad | 4:f25ca600a0e6 | 200 | char ps_sai_en; |
laserdad | 4:f25ca600a0e6 | 201 | char temp_en; |
laserdad | 4:f25ca600a0e6 | 202 | char ppg_ps_mode; |
laserdad | 4:f25ca600a0e6 | 203 | char ppg_ps_en; |
laserdad | 4:f25ca600a0e6 | 204 | char ps_can_ana; |
laserdad | 4:f25ca600a0e6 | 205 | char afull_int_en; |
laserdad | 4:f25ca600a0e6 | 206 | char ppg_int_en; |
laserdad | 4:f25ca600a0e6 | 207 | char ps_logic_mode; |
laserdad | 4:f25ca600a0e6 | 208 | uint16_t ps_digital_can; |
laserdad | 4:f25ca600a0e6 | 209 | char ps_int_en; |
laserdad | 4:f25ca600a0e6 | 210 | char ls_persist; |
laserdad | 4:f25ca600a0e6 | 211 | char ps_persist; |
laserdad | 4:f25ca600a0e6 | 212 | uint16_t ps_thres_hi; |
laserdad | 4:f25ca600a0e6 | 213 | uint16_t ps_thres_lo; |
laserdad | 4:f25ca600a0e6 | 214 | uint16_t ps_current; |
laserdad | 4:f25ca600a0e6 | 215 | uint16_t ir_current; |
laserdad | 4:f25ca600a0e6 | 216 | uint16_t r_current; |
laserdad | 4:f25ca600a0e6 | 217 | char ppg_ps_gain; |
laserdad | 4:f25ca600a0e6 | 218 | char ppg_pow_save; |
laserdad | 4:f25ca600a0e6 | 219 | char led_flip; |
laserdad | 4:f25ca600a0e6 | 220 | char ch1_can_ana; |
laserdad | 4:f25ca600a0e6 | 221 | char ch2_can_ana; |
laserdad | 4:f25ca600a0e6 | 222 | char ppg_avg; |
laserdad | 4:f25ca600a0e6 | 223 | char ppg_pwidth; |
laserdad | 4:f25ca600a0e6 | 224 | char ppg_freq; |
laserdad | 4:f25ca600a0e6 | 225 | char ppg_rate; |
laserdad | 8:6c19c052b053 | 226 | char ppg_LED_settling; |
laserdad | 8:6c19c052b053 | 227 | char ppg_ALC_track; |
laserdad | 4:f25ca600a0e6 | 228 | char ps_pulses; |
laserdad | 4:f25ca600a0e6 | 229 | char ps_pwidth; |
laserdad | 4:f25ca600a0e6 | 230 | char ps_rate; |
laserdad | 4:f25ca600a0e6 | 231 | char ps_avg_en; |
laserdad | 4:f25ca600a0e6 | 232 | char ps_hys_level; |
laserdad | 4:f25ca600a0e6 | 233 | char ls_int_en; |
laserdad | 4:f25ca600a0e6 | 234 | char fifo_rollover_en; |
laserdad | 12:573f7ce91a0d | 235 | char fifo_afull_advance_warning; |
laserdad | 4:f25ca600a0e6 | 236 | char writePointer; |
laserdad | 4:f25ca600a0e6 | 237 | char readPointer; |
laserdad | 4:f25ca600a0e6 | 238 | char fifoOverflow; |
laserdad | 9:0c3d2eea1c79 | 239 | char bio_trim; |
laserdad | 9:0c3d2eea1c79 | 240 | char led_trim; |
laserdad | 10:6703d2cdeabc | 241 | char diff; |
laserdad | 10:6703d2cdeabc | 242 | char alc; |
laserdad | 10:6703d2cdeabc | 243 | char sig_out; |
laserdad | 9:0c3d2eea1c79 | 244 | |
laserdad | 4:f25ca600a0e6 | 245 | OB1203 (I2C *); |
laserdad | 4:f25ca600a0e6 | 246 | // OB1203(SoftI2C *); |
laserdad | 0:2da1f69b38fd | 247 | |
laserdad | 4:f25ca600a0e6 | 248 | // Low-level operations |
laserdad | 4:f25ca600a0e6 | 249 | void reset(); |
laserdad | 4:f25ca600a0e6 | 250 | uint16_t get_status(); |
laserdad | 4:f25ca600a0e6 | 251 | void writeRegister(int, char, char); |
laserdad | 4:f25ca600a0e6 | 252 | void writeBlock(int, char, char *, char); |
laserdad | 4:f25ca600a0e6 | 253 | void readBlock(int, char, char *, int); |
laserdad | 4:f25ca600a0e6 | 254 | uint32_t bytes2uint32(char *, int); |
laserdad | 6:337ee64ca7ab | 255 | uint32_t twoandhalfBytes2uint32(char *, int); |
laserdad | 4:f25ca600a0e6 | 256 | |
laserdad | 4:f25ca600a0e6 | 257 | // High-level operations |
laserdad | 8:6c19c052b053 | 258 | void setOscTrim(); |
laserdad | 4:f25ca600a0e6 | 259 | bool dataIsNew(); |
laserdad | 6:337ee64ca7ab | 260 | bool lsIsNew(); |
laserdad | 6:337ee64ca7ab | 261 | bool psIsNew(); |
laserdad | 6:337ee64ca7ab | 262 | bool tempIsNew(); |
laserdad | 5:527556d05aa8 | 263 | bool bioIsNew(); |
laserdad | 4:f25ca600a0e6 | 264 | void setMainConfig(); |
laserdad | 4:f25ca600a0e6 | 265 | void setIntConfig(); |
laserdad | 4:f25ca600a0e6 | 266 | void setLSthresh(); |
laserdad | 4:f25ca600a0e6 | 267 | void setPSthresh(); |
laserdad | 4:f25ca600a0e6 | 268 | void setPScurrent(); |
laserdad | 4:f25ca600a0e6 | 269 | void setPPGcurrent(); |
laserdad | 4:f25ca600a0e6 | 270 | void setPPG_PSgain_cfg(); |
laserdad | 4:f25ca600a0e6 | 271 | void setPPGana_can(); |
laserdad | 4:f25ca600a0e6 | 272 | void setDigitalCan(); |
laserdad | 4:f25ca600a0e6 | 273 | void setPPGavg_and_rate(); |
laserdad | 4:f25ca600a0e6 | 274 | void setFifoConfig(); |
laserdad | 9:0c3d2eea1c79 | 275 | void setBioTrim(); |
laserdad | 9:0c3d2eea1c79 | 276 | void setLEDTrim(); |
laserdad | 4:f25ca600a0e6 | 277 | char get_ps_data(uint32_t *); |
laserdad | 4:f25ca600a0e6 | 278 | char get_ls_data(uint32_t *); |
laserdad | 4:f25ca600a0e6 | 279 | char get_ps_ls_data(uint32_t *); |
laserdad | 12:573f7ce91a0d | 280 | void resetFIFO(); |
laserdad | 4:f25ca600a0e6 | 281 | void init_ps(); |
laserdad | 4:f25ca600a0e6 | 282 | void init_rgb(); |
laserdad | 4:f25ca600a0e6 | 283 | void init_ps_rgb(); |
laserdad | 4:f25ca600a0e6 | 284 | void init_hr(); |
laserdad | 4:f25ca600a0e6 | 285 | void init_spo2(); |
laserdad | 4:f25ca600a0e6 | 286 | void getFifoInfo(char *fifo_info); |
laserdad | 4:f25ca600a0e6 | 287 | uint8_t getNumFifoSamplesAvailable(); |
laserdad | 4:f25ca600a0e6 | 288 | void getFifoSamples(uint8_t, char *); |
laserdad | 4:f25ca600a0e6 | 289 | void parseFifoSamples(char, char *, uint32_t *); |
laserdad | 4:f25ca600a0e6 | 290 | char get_part_ID(char *); |
laserdad | 4:f25ca600a0e6 | 291 | |
laserdad | 4:f25ca600a0e6 | 292 | //variables |
laserdad | 4:f25ca600a0e6 | 293 | uint16_t rate; |
laserdad | 4:f25ca600a0e6 | 294 | char res; |
laserdad | 4:f25ca600a0e6 | 295 | char gain; |
laserdad | 4:f25ca600a0e6 | 296 | uint32_t data_max; |
laserdad | 4:f25ca600a0e6 | 297 | uint32_t reg_max; |
laserdad | 0:2da1f69b38fd | 298 | |
laserdad | 0:2da1f69b38fd | 299 | }; |
laserdad | 0:2da1f69b38fd | 300 | |
laserdad | 0:2da1f69b38fd | 301 | |
laserdad | 0:2da1f69b38fd | 302 | #endif |