Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed OB1203_example_driver
main.cpp@16:0a113303c3ed, 2018-09-28 (annotated)
- Committer:
- laserdad
- Date:
- Fri Sep 28 21:55:21 2018 +0000
- Revision:
- 16:0a113303c3ed
- Parent:
- 14:ae0be10b73cd
- Child:
- 17:81a9df351dcd
fixed setPSThreshold. changed default PS_INT mode to LOGIC
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
laserdad | 0:e9ae48b7f6f6 | 1 | #include "mbed.h" |
laserdad | 0:e9ae48b7f6f6 | 2 | #include "OB1203.h" |
laserdad | 0:e9ae48b7f6f6 | 3 | #include "math.h" |
laserdad | 4:3aee2ca931b8 | 4 | //#include "SoftI2C.h" |
laserdad | 0:e9ae48b7f6f6 | 5 | |
laserdad | 14:ae0be10b73cd | 6 | |
laserdad | 14:ae0be10b73cd | 7 | //normal |
laserdad | 14:ae0be10b73cd | 8 | I2C i2c(I2C_SDA,I2C_SCL); //instantiate an i2c object from its class |
laserdad | 0:e9ae48b7f6f6 | 9 | #define intb_pin D3 |
laserdad | 0:e9ae48b7f6f6 | 10 | |
laserdad | 14:ae0be10b73cd | 11 | //slave board// |
laserdad | 14:ae0be10b73cd | 12 | //I2C i2c(D12,PA_7); |
laserdad | 14:ae0be10b73cd | 13 | //#define intb_pin D10 |
laserdad | 14:ae0be10b73cd | 14 | |
laserdad | 14:ae0be10b73cd | 15 | InterruptIn intb(intb_pin); //declare an interrupt pin for INTB |
laserdad | 0:e9ae48b7f6f6 | 16 | |
laserdad | 14:ae0be10b73cd | 17 | //setting three 3 pins high to function as pullups for SDA, SCL and INTB |
laserdad | 14:ae0be10b73cd | 18 | //Connect these pins to SDA, SCL and INTB by 2.7K resistors. |
laserdad | 14:ae0be10b73cd | 19 | //5K resistors also work usually |
laserdad | 16:0a113303c3ed | 20 | DigitalOut sda_pullup(D10,1); |
laserdad | 16:0a113303c3ed | 21 | DigitalOut scl_pullup(D11,1); |
laserdad | 16:0a113303c3ed | 22 | DigitalOut intb_pullup(D12,1); |
laserdad | 13:5ce84c68066e | 23 | |
laserdad | 14:ae0be10b73cd | 24 | OB1203 ob1203(&i2c); //instantiate the OB1203 object from its class and pass i2c object |
laserdad | 14:ae0be10b73cd | 25 | Serial pc(USBTX, USBRX,256000); //create a serial port for printing data to a pc |
laserdad | 14:ae0be10b73cd | 26 | Timer t; //use a microsecond timer for time stamping data |
laserdad | 0:e9ae48b7f6f6 | 27 | |
laserdad | 1:fb6b2b4d5d8a | 28 | |
laserdad | 6:aaa2f8fb5123 | 29 | //USER CONFIGURABLE********* |
laserdad | 16:0a113303c3ed | 30 | bool mode = 1; //0 for PS_LS, 1 for PPG (ignores PS, LS and temp) |
laserdad | 7:3ed0f0522b43 | 31 | bool meas_ps = 1; |
laserdad | 12:5de5f550e765 | 32 | bool spo2 = 1; //0 for HR, 1 for SpO2 |
laserdad | 4:3aee2ca931b8 | 33 | bool afull = 1; //use Afull interrupt--otherwise PPG new data interrupt |
laserdad | 14:ae0be10b73cd | 34 | bool meas_temp = 0; |
laserdad | 13:5ce84c68066e | 35 | bool printAvg = 0; //default 0 print raw data |
laserdad | 13:5ce84c68066e | 36 | bool redAGC = 1; |
laserdad | 13:5ce84c68066e | 37 | bool IRAGC = 1; |
laserdad | 14:ae0be10b73cd | 38 | bool trim_oscillator = 1; |
laserdad | 14:ae0be10b73cd | 39 | bool printCurrent = 1; |
laserdad | 6:aaa2f8fb5123 | 40 | //**************************** |
laserdad | 6:aaa2f8fb5123 | 41 | |
laserdad | 6:aaa2f8fb5123 | 42 | //internal settings |
laserdad | 6:aaa2f8fb5123 | 43 | bool intFlagged =0; |
laserdad | 6:aaa2f8fb5123 | 44 | int sample_delay = 25; //ms |
laserdad | 1:fb6b2b4d5d8a | 45 | |
laserdad | 14:ae0be10b73cd | 46 | void defaultConfig() //populate the default settings here |
laserdad | 0:e9ae48b7f6f6 | 47 | { |
laserdad | 14:ae0be10b73cd | 48 | //high accuracy oscillator trim overwrite option |
laserdad | 14:ae0be10b73cd | 49 | ob1203.osc_trim = 0x3F; //max trim code =0x3F |
laserdad | 14:ae0be10b73cd | 50 | //temperature sensor settings (hidden registers) |
laserdad | 4:3aee2ca931b8 | 51 | meas_temp ? ob1203.temp_en = TEMP_ON : ob1203.temp_en = TEMP_OFF; |
laserdad | 14:ae0be10b73cd | 52 | //LS settings |
laserdad | 12:5de5f550e765 | 53 | ob1203.ls_res = LS_RES(2); //2= 18bit 100ms, 0= max res |
laserdad | 12:5de5f550e765 | 54 | ob1203.ls_rate = LS_RATE(2); //2 =100ms, 4 = 500ms |
laserdad | 4:3aee2ca931b8 | 55 | ob1203.ls_gain = LS_GAIN(3); //gain 3 default (range) |
laserdad | 1:fb6b2b4d5d8a | 56 | ob1203.ls_thres_hi = 0x000FFFFF; |
laserdad | 0:e9ae48b7f6f6 | 57 | ob1203.ls_thres_lo = 0; |
laserdad | 0:e9ae48b7f6f6 | 58 | ob1203.ls_sai = LS_SAI_OFF; |
laserdad | 0:e9ae48b7f6f6 | 59 | ob1203.ls_mode = RGB_MODE; |
laserdad | 0:e9ae48b7f6f6 | 60 | ob1203.ls_en = LS_ON; |
laserdad | 14:ae0be10b73cd | 61 | //PS and PPG settings |
laserdad | 0:e9ae48b7f6f6 | 62 | ob1203.ps_sai_en = PS_SAI_OFF; |
laserdad | 5:ebe305e08430 | 63 | // ob1203.ps_sai_en = PS_SAI_ON; |
laserdad | 1:fb6b2b4d5d8a | 64 | if(mode) |
laserdad | 1:fb6b2b4d5d8a | 65 | { |
laserdad | 3:d3a1fc19bee6 | 66 | if (spo2) |
laserdad | 3:d3a1fc19bee6 | 67 | { |
laserdad | 3:d3a1fc19bee6 | 68 | ob1203.ppg_ps_mode = SPO2_MODE; |
laserdad | 3:d3a1fc19bee6 | 69 | } |
laserdad | 3:d3a1fc19bee6 | 70 | else |
laserdad | 3:d3a1fc19bee6 | 71 | { |
laserdad | 3:d3a1fc19bee6 | 72 | ob1203.ppg_ps_mode = HR_MODE; |
laserdad | 3:d3a1fc19bee6 | 73 | } |
laserdad | 3:d3a1fc19bee6 | 74 | |
laserdad | 1:fb6b2b4d5d8a | 75 | } |
laserdad | 1:fb6b2b4d5d8a | 76 | else |
laserdad | 1:fb6b2b4d5d8a | 77 | { |
laserdad | 1:fb6b2b4d5d8a | 78 | ob1203.ppg_ps_mode = PS_MODE; |
laserdad | 1:fb6b2b4d5d8a | 79 | } |
laserdad | 12:5de5f550e765 | 80 | ob1203.ps_pulses = PS_PULSES(3); |
laserdad | 1:fb6b2b4d5d8a | 81 | // pc.printf("ps_pulses = %02X\r\n",ob1203.ps_pulses); |
laserdad | 7:3ed0f0522b43 | 82 | ob1203.ps_pwidth = PS_PWIDTH(1); |
laserdad | 7:3ed0f0522b43 | 83 | ob1203.ps_rate = PS_RATE(4); |
laserdad | 1:fb6b2b4d5d8a | 84 | // pc.printf("ps_rate = %02X\r\n",ob1203.ps_rate); |
laserdad | 12:5de5f550e765 | 85 | ob1203.ps_avg_en = PS_AVG_OFF; |
laserdad | 0:e9ae48b7f6f6 | 86 | ob1203.ps_can_ana = PS_CAN_ANA_0; |
laserdad | 14:ae0be10b73cd | 87 | ob1203.ps_digital_can = 150; |
laserdad | 0:e9ae48b7f6f6 | 88 | ob1203.ps_hys_level = 0; |
laserdad | 14:ae0be10b73cd | 89 | meas_ps ? ob1203.ps_current = 0x1FF : ob1203.ps_current = 0x000; |
laserdad | 4:3aee2ca931b8 | 90 | // ob1203.ps_current = 0; |
laserdad | 16:0a113303c3ed | 91 | //ob1203.ps_thres_hi = 0xFF; |
laserdad | 16:0a113303c3ed | 92 | //ob1203.ps_thres_lo = 0x00; |
laserdad | 16:0a113303c3ed | 93 | |
laserdad | 16:0a113303c3ed | 94 | ob1203.ps_thres_hi = 2000; |
laserdad | 16:0a113303c3ed | 95 | ob1203.ps_thres_lo = 1000; |
laserdad | 16:0a113303c3ed | 96 | |
laserdad | 0:e9ae48b7f6f6 | 97 | |
laserdad | 0:e9ae48b7f6f6 | 98 | //interrupts |
laserdad | 0:e9ae48b7f6f6 | 99 | ob1203.ls_int_sel = LS_INT_SEL_W; |
laserdad | 0:e9ae48b7f6f6 | 100 | ob1203.ls_var_mode = LS_THRES_INT_MODE; |
laserdad | 16:0a113303c3ed | 101 | //ob1203.ls_int_en = LS_INT_ON; |
laserdad | 16:0a113303c3ed | 102 | ob1203.ls_int_en = LS_INT_OFF; |
laserdad | 16:0a113303c3ed | 103 | |
laserdad | 16:0a113303c3ed | 104 | ob1203.ppg_ps_en = PPG_PS_ON; //enable measurements |
laserdad | 4:3aee2ca931b8 | 105 | |
laserdad | 0:e9ae48b7f6f6 | 106 | ob1203.ps_logic_mode = PS_INT_READ_CLEARS; |
laserdad | 0:e9ae48b7f6f6 | 107 | ob1203.ps_int_en = PS_INT_ON; |
laserdad | 0:e9ae48b7f6f6 | 108 | ob1203.ls_persist = LS_PERSIST(2); |
laserdad | 0:e9ae48b7f6f6 | 109 | ob1203.ps_persist = PS_PERSIST(2); |
laserdad | 11:640cced1ee5d | 110 | |
laserdad | 11:640cced1ee5d | 111 | |
laserdad | 11:640cced1ee5d | 112 | //BIO SETTINGS |
laserdad | 4:3aee2ca931b8 | 113 | //int |
laserdad | 4:3aee2ca931b8 | 114 | if(afull) |
laserdad | 4:3aee2ca931b8 | 115 | { |
laserdad | 4:3aee2ca931b8 | 116 | ob1203.afull_int_en = AFULL_INT_ON; |
laserdad | 4:3aee2ca931b8 | 117 | ob1203.ppg_int_en = PPG_INT_OFF; |
laserdad | 4:3aee2ca931b8 | 118 | } |
laserdad | 4:3aee2ca931b8 | 119 | else |
laserdad | 4:3aee2ca931b8 | 120 | { |
laserdad | 4:3aee2ca931b8 | 121 | ob1203.afull_int_en = AFULL_INT_OFF; |
laserdad | 4:3aee2ca931b8 | 122 | ob1203.ppg_int_en = PPG_INT_ON; |
laserdad | 4:3aee2ca931b8 | 123 | } |
laserdad | 0:e9ae48b7f6f6 | 124 | //PPG |
laserdad | 13:5ce84c68066e | 125 | ob1203.ir_current = 0x1AF; //max 1023. 3FF |
laserdad | 3:d3a1fc19bee6 | 126 | if (spo2) |
laserdad | 3:d3a1fc19bee6 | 127 | { |
laserdad | 4:3aee2ca931b8 | 128 | // ob1203.r_current = 0x0FF; |
laserdad | 13:5ce84c68066e | 129 | ob1203.r_current = 0x1AF; //max 511. 1FF |
laserdad | 3:d3a1fc19bee6 | 130 | } |
laserdad | 3:d3a1fc19bee6 | 131 | else |
laserdad | 3:d3a1fc19bee6 | 132 | { |
laserdad | 3:d3a1fc19bee6 | 133 | ob1203.r_current = 0; |
laserdad | 3:d3a1fc19bee6 | 134 | } |
laserdad | 10:7fbf298ee05f | 135 | ob1203.ppg_ps_gain = PPG_PS_GAIN_1; |
laserdad | 0:e9ae48b7f6f6 | 136 | ob1203.ppg_pow_save = PPG_POW_SAVE_OFF; |
laserdad | 0:e9ae48b7f6f6 | 137 | ob1203.led_flip = LED_FLIP_OFF; |
laserdad | 11:640cced1ee5d | 138 | ob1203.ch1_can_ana = PPG_CH1_CAN(0); |
laserdad | 11:640cced1ee5d | 139 | ob1203.ch2_can_ana = PPG_CH2_CAN(0); |
laserdad | 14:ae0be10b73cd | 140 | //use rate 1 with pulse width 3 and average 4, or rate 3 with pulse width 4 and average 3 for 100 sps (50Hz basis) or 120 sps sample rate (60Hz basis) |
laserdad | 14:ae0be10b73cd | 141 | ob1203.ppg_avg = PPG_AVG(4); //2^n averages |
laserdad | 14:ae0be10b73cd | 142 | ob1203.ppg_rate = PPG_RATE(1); |
laserdad | 12:5de5f550e765 | 143 | ob1203.ppg_pwidth = PPG_PWIDTH(3); |
laserdad | 12:5de5f550e765 | 144 | ob1203.ppg_freq = PPG_FREQ_50HZ; |
laserdad | 12:5de5f550e765 | 145 | // ob1203.ppg_freq = PPG_FREQ_60HZ; |
laserdad | 14:ae0be10b73cd | 146 | ob1203.bio_trim = 3; //max 3 --this dims the ADC sensitivity, but reduces noise |
laserdad | 14:ae0be10b73cd | 147 | ob1203.led_trim = 0x00; //can use to overwrite trim setting and max out the current |
laserdad | 14:ae0be10b73cd | 148 | ob1203.ppg_LED_settling = PPG_LED_SETTLING(2); //hidden regstier for adjusting LED setting time (not a factor for noise) |
laserdad | 14:ae0be10b73cd | 149 | ob1203.ppg_ALC_track = PPG_ALC_TRACK(2); //hidden register for adjusting ALC track and hold time (not a factor for noise) |
laserdad | 14:ae0be10b73cd | 150 | ob1203.diff = DIFF_ON; //hidden register for turning off subtraction of residual ambient light after ALC |
laserdad | 14:ae0be10b73cd | 151 | ob1203.alc = ALC_ON; //hidden register for turning off ambient light cancelleation track and hold circuit |
laserdad | 14:ae0be10b73cd | 152 | ob1203.sig_out = SIGNAL_OUT; //hidden register for selecting ambient sample or LED sample if DIFF is off |
laserdad | 0:e9ae48b7f6f6 | 153 | ob1203.fifo_rollover_en = FIFO_ROLL_ON; |
laserdad | 13:5ce84c68066e | 154 | ob1203.fifo_afull_advance_warning = AFULL_ADVANCE_WARNING(0x0F); //warn as quickly as possible (after 17 samples with 0x0F) |
laserdad | 13:5ce84c68066e | 155 | |
laserdad | 14:ae0be10b73cd | 156 | //run initialization according to user compile settings |
laserdad | 14:ae0be10b73cd | 157 | |
laserdad | 0:e9ae48b7f6f6 | 158 | if(mode) |
laserdad | 0:e9ae48b7f6f6 | 159 | { |
laserdad | 16:0a113303c3ed | 160 | spo2 ? ob1203.init_spo2() : ob1203.init_hr(); |
laserdad | 0:e9ae48b7f6f6 | 161 | } |
laserdad | 0:e9ae48b7f6f6 | 162 | else |
laserdad | 0:e9ae48b7f6f6 | 163 | { |
laserdad | 5:ebe305e08430 | 164 | meas_ps ? ob1203.init_ps_rgb() : ob1203.init_rgb(); |
laserdad | 0:e9ae48b7f6f6 | 165 | } |
laserdad | 14:ae0be10b73cd | 166 | if(trim_oscillator) |
laserdad | 14:ae0be10b73cd | 167 | ob1203.setOscTrim(); |
laserdad | 14:ae0be10b73cd | 168 | |
laserdad | 0:e9ae48b7f6f6 | 169 | } |
laserdad | 0:e9ae48b7f6f6 | 170 | |
laserdad | 1:fb6b2b4d5d8a | 171 | void regDump(uint8_t Addr, uint8_t startByte, uint8_t endByte) |
laserdad | 1:fb6b2b4d5d8a | 172 | { |
laserdad | 1:fb6b2b4d5d8a | 173 | /*print the values of up to 20 registers--buffer limit, e.g.*/ |
laserdad | 1:fb6b2b4d5d8a | 174 | char regData[20]; |
laserdad | 1:fb6b2b4d5d8a | 175 | int numBytes; |
laserdad | 1:fb6b2b4d5d8a | 176 | if (endByte>=startByte) { |
laserdad | 1:fb6b2b4d5d8a | 177 | numBytes = (endByte-startByte+1) < 20 ? (endByte-startByte+1) : 20; |
laserdad | 1:fb6b2b4d5d8a | 178 | } else { |
laserdad | 1:fb6b2b4d5d8a | 179 | numBytes=1; |
laserdad | 1:fb6b2b4d5d8a | 180 | } |
laserdad | 1:fb6b2b4d5d8a | 181 | |
laserdad | 1:fb6b2b4d5d8a | 182 | regData[0] = startByte; |
laserdad | 1:fb6b2b4d5d8a | 183 | i2c.write(Addr,regData,1,true); |
laserdad | 1:fb6b2b4d5d8a | 184 | i2c.read(Addr, regData, numBytes); |
laserdad | 1:fb6b2b4d5d8a | 185 | for(int n=0; n<numBytes; n++) { |
laserdad | 1:fb6b2b4d5d8a | 186 | pc.printf("%02X, %02X \r\n", startByte+n, regData[n]); |
laserdad | 1:fb6b2b4d5d8a | 187 | } |
laserdad | 1:fb6b2b4d5d8a | 188 | } |
laserdad | 1:fb6b2b4d5d8a | 189 | |
laserdad | 0:e9ae48b7f6f6 | 190 | |
laserdad | 0:e9ae48b7f6f6 | 191 | void intEvent(void) |
laserdad | 0:e9ae48b7f6f6 | 192 | { |
laserdad | 0:e9ae48b7f6f6 | 193 | intFlagged = 1; |
laserdad | 0:e9ae48b7f6f6 | 194 | } |
laserdad | 0:e9ae48b7f6f6 | 195 | |
laserdad | 0:e9ae48b7f6f6 | 196 | int main() |
laserdad | 14:ae0be10b73cd | 197 | /*This program is messy bacause it allows several different print options and interrupt modes |
laserdad | 14:ae0be10b73cd | 198 | Most of the variables are associated with an optional FIR filter to make data pretty. |
laserdad | 14:ae0be10b73cd | 199 | */ |
laserdad | 0:e9ae48b7f6f6 | 200 | { |
laserdad | 4:3aee2ca931b8 | 201 | int numInts = 0; |
laserdad | 10:7fbf298ee05f | 202 | uint32_t running_avg = 10; |
laserdad | 10:7fbf298ee05f | 203 | uint32_t ps_running_avg = 100; |
laserdad | 7:3ed0f0522b43 | 204 | uint32_t ps_avg_ptr = 0; |
laserdad | 3:d3a1fc19bee6 | 205 | char avg_ptr = 0; |
laserdad | 4:3aee2ca931b8 | 206 | int baseline_ptr = 0; |
laserdad | 10:7fbf298ee05f | 207 | uint32_t running_baseline = 240; |
laserdad | 3:d3a1fc19bee6 | 208 | int first = 1; |
laserdad | 3:d3a1fc19bee6 | 209 | uint32_t IRavg = 0; |
laserdad | 3:d3a1fc19bee6 | 210 | uint32_t Ravg = 0; |
laserdad | 3:d3a1fc19bee6 | 211 | uint32_t IRprev = 0; |
laserdad | 3:d3a1fc19bee6 | 212 | uint32_t Rprev = 0; |
laserdad | 3:d3a1fc19bee6 | 213 | uint32_t prevAvg = 0; |
laserdad | 3:d3a1fc19bee6 | 214 | uint32_t IR_avg_buffer[running_avg]; |
laserdad | 3:d3a1fc19bee6 | 215 | uint32_t R_avg_buffer[running_avg]; |
laserdad | 4:3aee2ca931b8 | 216 | uint32_t IR_baseline_buffer[running_baseline]; |
laserdad | 4:3aee2ca931b8 | 217 | uint32_t R_baseline_buffer[running_baseline]; |
laserdad | 4:3aee2ca931b8 | 218 | uint32_t IRbaseline_prev=0;; |
laserdad | 4:3aee2ca931b8 | 219 | uint32_t Rbaseline_prev=0;; |
laserdad | 4:3aee2ca931b8 | 220 | uint32_t IRbaseline=0; |
laserdad | 4:3aee2ca931b8 | 221 | uint32_t Rbaseline=0; |
laserdad | 4:3aee2ca931b8 | 222 | uint32_t prevBaseline=0; |
laserdad | 7:3ed0f0522b43 | 223 | uint32_t PSavg = 0; |
laserdad | 7:3ed0f0522b43 | 224 | uint32_t PSprev = 0; |
laserdad | 7:3ed0f0522b43 | 225 | uint32_t PS_avg_buffer[ps_running_avg]; |
laserdad | 7:3ed0f0522b43 | 226 | |
laserdad | 13:5ce84c68066e | 227 | uint32_t targetIRcounts = 196608; //0.75 of full scale |
laserdad | 13:5ce84c68066e | 228 | uint32_t targetRcounts = 196608; //0.75 of full scale |
laserdad | 13:5ce84c68066e | 229 | // uint32_t tol1 = 8192; //1 5 bit increment |
laserdad | 16:0a113303c3ed | 230 | uint32_t tol1 = 8192; //1 5 bit increment |
laserdad | 13:5ce84c68066e | 231 | uint32_t tol2 = 39321; //for 90% and 60% large limits |
laserdad | 13:5ce84c68066e | 232 | uint32_t step = 8; |
laserdad | 13:5ce84c68066e | 233 | uint32_t IR_in_range = 0; |
laserdad | 13:5ce84c68066e | 234 | uint32_t R_in_range = 0; |
laserdad | 13:5ce84c68066e | 235 | bool update = 0; |
laserdad | 14:ae0be10b73cd | 236 | uint32_t in_range_persist = 4; |
laserdad | 14:ae0be10b73cd | 237 | uint16_t maxIRcurrent =0x2AF; |
laserdad | 14:ae0be10b73cd | 238 | |
laserdad | 7:3ed0f0522b43 | 239 | for (int n=0;n<ps_running_avg;n++) |
laserdad | 7:3ed0f0522b43 | 240 | { |
laserdad | 7:3ed0f0522b43 | 241 | PS_avg_buffer[n] =0; |
laserdad | 7:3ed0f0522b43 | 242 | } |
laserdad | 7:3ed0f0522b43 | 243 | |
laserdad | 14:ae0be10b73cd | 244 | i2c.frequency( 400000 ); //always use max speed I2C |
laserdad | 0:e9ae48b7f6f6 | 245 | char valid; |
laserdad | 14:ae0be10b73cd | 246 | uint32_t ps_ls_data[7]; //array for storing parsed samples |
laserdad | 14:ae0be10b73cd | 247 | char samples2Read = 6; //FIFO samples, e.g. 4 samples * 3 bytes = 12 bytes (or 2 SpO2 samples) |
laserdad | 2:ee175f471ecb | 248 | char fifoBuffer[samples2Read*3]; |
laserdad | 0:e9ae48b7f6f6 | 249 | uint32_t ppgData[samples2Read]; |
laserdad | 0:e9ae48b7f6f6 | 250 | |
laserdad | 1:fb6b2b4d5d8a | 251 | |
laserdad | 1:fb6b2b4d5d8a | 252 | pc.printf("register settings\r\n"); |
laserdad | 1:fb6b2b4d5d8a | 253 | regDump(OB1203_ADDR,0,19); |
laserdad | 1:fb6b2b4d5d8a | 254 | regDump(OB1203_ADDR,20,39); |
laserdad | 1:fb6b2b4d5d8a | 255 | regDump(OB1203_ADDR,40,59); |
laserdad | 1:fb6b2b4d5d8a | 256 | regDump(OB1203_ADDR,60,77); |
laserdad | 1:fb6b2b4d5d8a | 257 | |
laserdad | 1:fb6b2b4d5d8a | 258 | pc.printf("do initial config\r\n"); |
laserdad | 14:ae0be10b73cd | 259 | defaultConfig(); //do the ASIC configuration now |
laserdad | 1:fb6b2b4d5d8a | 260 | |
laserdad | 1:fb6b2b4d5d8a | 261 | pc.printf("print new register config\r\n"); |
laserdad | 1:fb6b2b4d5d8a | 262 | regDump(OB1203_ADDR,0,19); |
laserdad | 1:fb6b2b4d5d8a | 263 | regDump(OB1203_ADDR,20,39); |
laserdad | 1:fb6b2b4d5d8a | 264 | regDump(OB1203_ADDR,40,59); |
laserdad | 1:fb6b2b4d5d8a | 265 | regDump(OB1203_ADDR,60,77); |
laserdad | 1:fb6b2b4d5d8a | 266 | |
laserdad | 0:e9ae48b7f6f6 | 267 | |
laserdad | 14:ae0be10b73cd | 268 | intb.fall(&intEvent); //attach a falling interrupt |
laserdad | 14:ae0be10b73cd | 269 | t.start(); //start microsecond timer for datalogging |
laserdad | 5:ebe305e08430 | 270 | |
laserdad | 0:e9ae48b7f6f6 | 271 | while(1) |
laserdad | 0:e9ae48b7f6f6 | 272 | { |
laserdad | 14:ae0be10b73cd | 273 | if(mode) //PPG case******************************************************* |
laserdad | 0:e9ae48b7f6f6 | 274 | { |
laserdad | 14:ae0be10b73cd | 275 | if(!intb.read()) //check the intb to see if it is low (or could check variable set by ISR here) |
laserdad | 2:ee175f471ecb | 276 | { |
laserdad | 14:ae0be10b73cd | 277 | if(!afull) //if you are using sample completion interrupts |
laserdad | 4:3aee2ca931b8 | 278 | { |
laserdad | 14:ae0be10b73cd | 279 | numInts++; //increment counter to get data every so many interrupts if ppg new data interrupt mode |
laserdad | 4:3aee2ca931b8 | 280 | } |
laserdad | 4:3aee2ca931b8 | 281 | else |
laserdad | 4:3aee2ca931b8 | 282 | { |
laserdad | 4:3aee2ca931b8 | 283 | numInts = samples2Read; |
laserdad | 4:3aee2ca931b8 | 284 | } |
laserdad | 2:ee175f471ecb | 285 | intFlagged = 1; |
laserdad | 4:3aee2ca931b8 | 286 | if( (numInts < samples2Read) && !afull) |
laserdad | 4:3aee2ca931b8 | 287 | { |
laserdad | 14:ae0be10b73cd | 288 | ob1203.get_status(); //clear interrupt--not time to get data yet |
laserdad | 4:3aee2ca931b8 | 289 | } |
laserdad | 14:ae0be10b73cd | 290 | else if(intFlagged && (numInts==samples2Read) ) //time to get data |
laserdad | 3:d3a1fc19bee6 | 291 | { |
laserdad | 4:3aee2ca931b8 | 292 | numInts = 0; |
laserdad | 4:3aee2ca931b8 | 293 | ob1203.getFifoSamples(samples2Read,fifoBuffer); |
laserdad | 4:3aee2ca931b8 | 294 | // for (int n=0;n<samples2Read*3;n++) |
laserdad | 4:3aee2ca931b8 | 295 | // { |
laserdad | 4:3aee2ca931b8 | 296 | // pc.printf("%02X ",fifoBuffer[n]); |
laserdad | 4:3aee2ca931b8 | 297 | // } |
laserdad | 4:3aee2ca931b8 | 298 | // pc.printf("\r\n"); |
laserdad | 4:3aee2ca931b8 | 299 | ob1203.parseFifoSamples(samples2Read,fifoBuffer,ppgData); |
laserdad | 4:3aee2ca931b8 | 300 | // for (int n=0;n<samples2Read;n++) |
laserdad | 4:3aee2ca931b8 | 301 | // { |
laserdad | 4:3aee2ca931b8 | 302 | // pc.printf("%d ",ppgData[n]); |
laserdad | 4:3aee2ca931b8 | 303 | // } |
laserdad | 4:3aee2ca931b8 | 304 | // pc.printf("\r\n"); |
laserdad | 4:3aee2ca931b8 | 305 | if(first) //populate average and baseline buffers the first time we run |
laserdad | 3:d3a1fc19bee6 | 306 | { |
laserdad | 4:3aee2ca931b8 | 307 | for(int n=0;n<running_avg;n++) |
laserdad | 4:3aee2ca931b8 | 308 | { |
laserdad | 4:3aee2ca931b8 | 309 | IR_avg_buffer[n] = ppgData[0]; |
laserdad | 4:3aee2ca931b8 | 310 | IRavg += IR_avg_buffer[n]; |
laserdad | 4:3aee2ca931b8 | 311 | if(spo2) |
laserdad | 4:3aee2ca931b8 | 312 | { |
laserdad | 4:3aee2ca931b8 | 313 | R_avg_buffer[n] = ppgData[1]; |
laserdad | 4:3aee2ca931b8 | 314 | Ravg += R_avg_buffer[n]; |
laserdad | 4:3aee2ca931b8 | 315 | } |
laserdad | 4:3aee2ca931b8 | 316 | |
laserdad | 4:3aee2ca931b8 | 317 | } |
laserdad | 4:3aee2ca931b8 | 318 | for( int n=0;n<running_baseline;n++) |
laserdad | 4:3aee2ca931b8 | 319 | { |
laserdad | 4:3aee2ca931b8 | 320 | IR_baseline_buffer[n] = 0; |
laserdad | 4:3aee2ca931b8 | 321 | if(spo2) |
laserdad | 4:3aee2ca931b8 | 322 | { |
laserdad | 4:3aee2ca931b8 | 323 | R_baseline_buffer[n] = 0; |
laserdad | 4:3aee2ca931b8 | 324 | } |
laserdad | 4:3aee2ca931b8 | 325 | } |
laserdad | 4:3aee2ca931b8 | 326 | first = 0; |
laserdad | 13:5ce84c68066e | 327 | }//end if first |
laserdad | 13:5ce84c68066e | 328 | |
laserdad | 4:3aee2ca931b8 | 329 | for (int n=0;n<samples2Read/2;n++) |
laserdad | 4:3aee2ca931b8 | 330 | { |
laserdad | 4:3aee2ca931b8 | 331 | ( avg_ptr+1 == running_avg ) ? avg_ptr = 0 : avg_ptr++; |
laserdad | 4:3aee2ca931b8 | 332 | ( baseline_ptr+1 == running_baseline) ? baseline_ptr = 0 : baseline_ptr++; |
laserdad | 4:3aee2ca931b8 | 333 | IRprev = IR_avg_buffer[avg_ptr]; //load the sample you are about to write over |
laserdad | 4:3aee2ca931b8 | 334 | IR_avg_buffer[avg_ptr] = ppgData[2*n]; //load the new sample in the buffer |
laserdad | 4:3aee2ca931b8 | 335 | IRavg += (IR_avg_buffer[avg_ptr] - IRprev); //update the average by removing the old sample and adding the new |
laserdad | 4:3aee2ca931b8 | 336 | |
laserdad | 4:3aee2ca931b8 | 337 | IRbaseline_prev = IR_baseline_buffer[baseline_ptr]; //load the sample you are about to write over |
laserdad | 4:3aee2ca931b8 | 338 | IR_baseline_buffer[baseline_ptr] = ppgData[2*n]; //load the new sample in the buffer |
laserdad | 4:3aee2ca931b8 | 339 | IRbaseline += (IR_baseline_buffer[baseline_ptr] - IRbaseline_prev); //update the average by removing the old sample and adding the new |
laserdad | 4:3aee2ca931b8 | 340 | |
laserdad | 14:ae0be10b73cd | 341 | if(spo2) //print two columsn of data |
laserdad | 3:d3a1fc19bee6 | 342 | { |
laserdad | 4:3aee2ca931b8 | 343 | Rprev = R_avg_buffer[avg_ptr]; |
laserdad | 4:3aee2ca931b8 | 344 | R_avg_buffer[avg_ptr] = ppgData[2*n+1]; |
laserdad | 4:3aee2ca931b8 | 345 | Ravg += (R_avg_buffer[avg_ptr] - Rprev); |
IDTsanjoseuser | 8:21738f9c5835 | 346 | |
laserdad | 4:3aee2ca931b8 | 347 | // pc.printf("%d, %d, %d, %d\r\n",IRavg/running_avg,Ravg/running_avg, IR_avg_buffer[avg_ptr],R_avg_buffer[avg_ptr]); |
laserdad | 4:3aee2ca931b8 | 348 | |
laserdad | 4:3aee2ca931b8 | 349 | Rbaseline_prev = R_baseline_buffer[baseline_ptr]; |
laserdad | 4:3aee2ca931b8 | 350 | R_baseline_buffer[baseline_ptr] = ppgData[2*n+1]; |
laserdad | 4:3aee2ca931b8 | 351 | Rbaseline += (R_baseline_buffer[baseline_ptr] - Rbaseline_prev); |
laserdad | 4:3aee2ca931b8 | 352 | |
laserdad | 13:5ce84c68066e | 353 | if(printAvg) |
laserdad | 13:5ce84c68066e | 354 | { |
IDTsanjoseuser | 8:21738f9c5835 | 355 | //PRINT AVG DATA |
laserdad | 13:5ce84c68066e | 356 | pc.printf("%d,%d,%d\r\n",t.read_us(),IRavg/running_avg,Ravg/running_avg); |
laserdad | 4:3aee2ca931b8 | 357 | // pc.printf("%d,%d\r\n",IRavg/running_avg-IRbaseline/running_baseline, Ravg/running_avg-Rbaseline/running_baseline); |
laserdad | 4:3aee2ca931b8 | 358 | // pc.printf("%d,%d,%d,%d\r\n",Ravg/running_avg,Rbaseline/running_baseline,Rbaseline_prev,Ravg/running_avg-Rbaseline/running_baseline); |
laserdad | 13:5ce84c68066e | 359 | } |
laserdad | 13:5ce84c68066e | 360 | else |
laserdad | 13:5ce84c68066e | 361 | { |
laserdad | 13:5ce84c68066e | 362 | //PRINT RAW DATA |
laserdad | 14:ae0be10b73cd | 363 | if(printCurrent) |
laserdad | 14:ae0be10b73cd | 364 | { |
laserdad | 14:ae0be10b73cd | 365 | pc.printf("%d, %d, %d, %d, %d\r\n",t.read_us(),ppgData[2*n],ppgData[2*n+1],ob1203.ir_current,ob1203.r_current); //print with us counter time stamp (use only with slower data rates or averaging as this slows down the data printing); |
laserdad | 14:ae0be10b73cd | 366 | } |
laserdad | 14:ae0be10b73cd | 367 | else |
laserdad | 14:ae0be10b73cd | 368 | { |
laserdad | 14:ae0be10b73cd | 369 | pc.printf("%d, %d, %d\r\n",t.read_us(),ppgData[2*n],ppgData[2*n+1]); //print with us counter time stamp (use only with slower data rates or averaging as this slows down the data printing); |
laserdad | 13:5ce84c68066e | 370 | // pc.printf("%d, %d\r\n",ppgData[2*n],ppgData[2*n+1]); //print without us timer (faster) |
laserdad | 14:ae0be10b73cd | 371 | } |
laserdad | 13:5ce84c68066e | 372 | } |
laserdad | 13:5ce84c68066e | 373 | }//end SpO2 case |
laserdad | 14:ae0be10b73cd | 374 | else //HR mode print one column of data |
laserdad | 4:3aee2ca931b8 | 375 | { |
laserdad | 4:3aee2ca931b8 | 376 | ( avg_ptr+1 == running_avg ) ? avg_ptr = 0 : avg_ptr++; |
laserdad | 4:3aee2ca931b8 | 377 | ( baseline_ptr+1 == running_baseline) ? baseline_ptr = 0 : baseline_ptr++; |
laserdad | 4:3aee2ca931b8 | 378 | IRprev = IR_avg_buffer[avg_ptr]; |
laserdad | 4:3aee2ca931b8 | 379 | IR_avg_buffer[avg_ptr] = ppgData[2*n+1]; |
laserdad | 4:3aee2ca931b8 | 380 | prevAvg = IRavg; |
laserdad | 4:3aee2ca931b8 | 381 | IRavg += (IR_avg_buffer[avg_ptr] - IRprev); |
laserdad | 4:3aee2ca931b8 | 382 | |
laserdad | 4:3aee2ca931b8 | 383 | IRbaseline_prev = IR_baseline_buffer[baseline_ptr]; //load the sample you are about to write over |
laserdad | 4:3aee2ca931b8 | 384 | IR_baseline_buffer[baseline_ptr] = ppgData[2*n]; //load the new sample in the buffer |
laserdad | 4:3aee2ca931b8 | 385 | prevBaseline = IRbaseline; |
laserdad | 4:3aee2ca931b8 | 386 | IRbaseline += (IR_baseline_buffer[baseline_ptr] - IRbaseline_prev); //update the average by removing the old sample and adding the new |
IDTsanjoseuser | 8:21738f9c5835 | 387 | |
laserdad | 4:3aee2ca931b8 | 388 | |
laserdad | 13:5ce84c68066e | 389 | if(printAvg) |
laserdad | 13:5ce84c68066e | 390 | { |
IDTsanjoseuser | 8:21738f9c5835 | 391 | //PRINT AVG DATA |
laserdad | 13:5ce84c68066e | 392 | pc.printf("%d\r\n%d\r\n",prevAvg/running_avg-prevBaseline/running_baseline,IRavg/running_avg-IRbaseline/running_baseline); |
laserdad | 13:5ce84c68066e | 393 | } |
laserdad | 13:5ce84c68066e | 394 | else |
laserdad | 13:5ce84c68066e | 395 | { |
laserdad | 13:5ce84c68066e | 396 | //PRINT RAW DATA |
laserdad | 13:5ce84c68066e | 397 | pc.printf("%d\r\n%d\r\n",ppgData[2*n],ppgData[2*n+1]); |
laserdad | 13:5ce84c68066e | 398 | // pc.printf("%d, %d, %d\r\n",t.read_us(),ppgData[2*n],ppgData[2*n+1]); //print with us counter time stamp (use only with slower data rates or averaging as this slows down the data printing); |
laserdad | 13:5ce84c68066e | 399 | |
laserdad | 13:5ce84c68066e | 400 | } |
laserdad | 13:5ce84c68066e | 401 | }//HR case |
laserdad | 13:5ce84c68066e | 402 | if(n+1==samples2Read/2) |
laserdad | 13:5ce84c68066e | 403 | { |
laserdad | 13:5ce84c68066e | 404 | if(IRAGC) |
laserdad | 13:5ce84c68066e | 405 | { |
laserdad | 13:5ce84c68066e | 406 | if( ppgData[2*n] > targetIRcounts + (IR_in_range>in_range_persist ? tol2: tol1) ) |
laserdad | 13:5ce84c68066e | 407 | { |
laserdad | 13:5ce84c68066e | 408 | if(ppgData[2*n]>targetIRcounts + tol2) |
laserdad | 13:5ce84c68066e | 409 | IR_in_range=0; |
laserdad | 13:5ce84c68066e | 410 | if(ob1203.ir_current>step) |
laserdad | 13:5ce84c68066e | 411 | { |
laserdad | 14:ae0be10b73cd | 412 | // pc.printf("IR %d, IRc %d--, IR_in_range %d\r\n",ppgData[2*n],ob1203.ir_current,IR_in_range); |
laserdad | 13:5ce84c68066e | 413 | ob1203.ir_current -= step; |
laserdad | 13:5ce84c68066e | 414 | update = 1; |
laserdad | 13:5ce84c68066e | 415 | |
laserdad | 13:5ce84c68066e | 416 | } |
laserdad | 13:5ce84c68066e | 417 | } |
laserdad | 13:5ce84c68066e | 418 | else if( ppgData[2*n] < targetIRcounts - (IR_in_range>in_range_persist ? tol2 : tol1) ) |
laserdad | 13:5ce84c68066e | 419 | { |
laserdad | 13:5ce84c68066e | 420 | if(ppgData[2*n]<targetIRcounts - tol2) |
laserdad | 13:5ce84c68066e | 421 | IR_in_range=0; |
laserdad | 14:ae0be10b73cd | 422 | if(ob1203.ir_current+step<maxIRcurrent) //no need to go to full current |
laserdad | 13:5ce84c68066e | 423 | { |
laserdad | 13:5ce84c68066e | 424 | ob1203.ir_current += step; |
laserdad | 13:5ce84c68066e | 425 | update = 1; |
laserdad | 14:ae0be10b73cd | 426 | // pc.printf("IR %d, IRc %d++, IR_in range %d\r\n", ppgData[2*n],ob1203.ir_current,IR_in_range); |
laserdad | 13:5ce84c68066e | 427 | } |
laserdad | 13:5ce84c68066e | 428 | } |
laserdad | 13:5ce84c68066e | 429 | else |
laserdad | 13:5ce84c68066e | 430 | { |
laserdad | 14:ae0be10b73cd | 431 | if( (ppgData[2*n] > (targetRcounts-tol1) ) && (ppgData[2*n] < (targetRcounts+tol1)) ) |
laserdad | 14:ae0be10b73cd | 432 | IR_in_range++; |
laserdad | 13:5ce84c68066e | 433 | } |
laserdad | 13:5ce84c68066e | 434 | }//end IR AGC case |
laserdad | 13:5ce84c68066e | 435 | |
laserdad | 13:5ce84c68066e | 436 | if(spo2 && redAGC) |
laserdad | 13:5ce84c68066e | 437 | { |
laserdad | 13:5ce84c68066e | 438 | if( ppgData[2*n+1] > targetRcounts + (R_in_range>in_range_persist ? tol2 : tol1) ) |
laserdad | 13:5ce84c68066e | 439 | { |
laserdad | 13:5ce84c68066e | 440 | if(ppgData[2*n+1]>targetRcounts + tol2) |
laserdad | 13:5ce84c68066e | 441 | R_in_range=0; |
laserdad | 13:5ce84c68066e | 442 | if(ob1203.r_current>step) |
laserdad | 13:5ce84c68066e | 443 | { |
laserdad | 14:ae0be10b73cd | 444 | // pc.printf("R %d, Rc %d--,R_in_range %d\r\n", ppgData[2*n+1],ob1203.r_current,R_in_range); |
laserdad | 13:5ce84c68066e | 445 | ob1203.r_current -= step; |
laserdad | 13:5ce84c68066e | 446 | update = 1; |
laserdad | 13:5ce84c68066e | 447 | } |
laserdad | 13:5ce84c68066e | 448 | } |
laserdad | 13:5ce84c68066e | 449 | else if( ppgData[2*n+1] < targetRcounts - (R_in_range>in_range_persist ? tol2 : tol1) ) |
laserdad | 13:5ce84c68066e | 450 | { |
laserdad | 13:5ce84c68066e | 451 | if(ppgData[2*n+1]<targetRcounts - tol2) |
laserdad | 13:5ce84c68066e | 452 | R_in_range=0; |
laserdad | 13:5ce84c68066e | 453 | if(ob1203.r_current+step<0x1FF) |
laserdad | 13:5ce84c68066e | 454 | { |
laserdad | 13:5ce84c68066e | 455 | |
laserdad | 14:ae0be10b73cd | 456 | // pc.printf("R %d, Rc %d++,R_in_range %d\r\n", ppgData[2*n+1],ob1203.r_current,R_in_range); |
laserdad | 13:5ce84c68066e | 457 | ob1203.r_current += step; |
laserdad | 13:5ce84c68066e | 458 | update = 1; |
laserdad | 13:5ce84c68066e | 459 | } |
laserdad | 13:5ce84c68066e | 460 | } |
laserdad | 13:5ce84c68066e | 461 | else |
laserdad | 13:5ce84c68066e | 462 | { |
laserdad | 14:ae0be10b73cd | 463 | if( (ppgData[2*n+1] > (targetRcounts-tol1) ) && (ppgData[2*n+1] < (targetRcounts+tol1)) ) |
laserdad | 14:ae0be10b73cd | 464 | R_in_range++; |
laserdad | 13:5ce84c68066e | 465 | } |
laserdad | 13:5ce84c68066e | 466 | if(update) |
laserdad | 13:5ce84c68066e | 467 | { |
laserdad | 13:5ce84c68066e | 468 | ob1203.setPPGcurrent(); |
laserdad | 13:5ce84c68066e | 469 | ob1203.resetFIFO(); |
laserdad | 13:5ce84c68066e | 470 | update=0; |
laserdad | 13:5ce84c68066e | 471 | } |
laserdad | 14:ae0be10b73cd | 472 | }//end R AGC case |
laserdad | 4:3aee2ca931b8 | 473 | } |
laserdad | 13:5ce84c68066e | 474 | }//end sample loop |
laserdad | 13:5ce84c68066e | 475 | |
laserdad | 13:5ce84c68066e | 476 | |
laserdad | 13:5ce84c68066e | 477 | |
laserdad | 13:5ce84c68066e | 478 | intFlagged = 0; |
laserdad | 13:5ce84c68066e | 479 | |
laserdad | 13:5ce84c68066e | 480 | }//end if time to read samples |
laserdad | 4:3aee2ca931b8 | 481 | } //end if !intb |
laserdad | 14:ae0be10b73cd | 482 | }// end mode (PPG case) |
laserdad | 14:ae0be10b73cd | 483 | //********************************************************************* |
laserdad | 14:ae0be10b73cd | 484 | else //LS and PS measurement case |
laserdad | 0:e9ae48b7f6f6 | 485 | { |
laserdad | 1:fb6b2b4d5d8a | 486 | wait_ms(sample_delay); |
laserdad | 16:0a113303c3ed | 487 | |
laserdad | 16:0a113303c3ed | 488 | if( meas_ps ? ob1203.psIsNew() : ob1203.lsIsNew() ) |
laserdad | 1:fb6b2b4d5d8a | 489 | { |
laserdad | 5:ebe305e08430 | 490 | meas_ps ? valid = ob1203.get_ps_ls_data(ps_ls_data) : valid = ob1203.get_ls_data(ps_ls_data); |
laserdad | 7:3ed0f0522b43 | 491 | if(meas_ps) |
laserdad | 7:3ed0f0522b43 | 492 | { |
laserdad | 7:3ed0f0522b43 | 493 | ( ps_avg_ptr+1 == ps_running_avg ) ? ps_avg_ptr = 0 : ps_avg_ptr++; |
laserdad | 7:3ed0f0522b43 | 494 | PSprev = PS_avg_buffer[ps_avg_ptr]; //load the sample you are about to write over |
laserdad | 7:3ed0f0522b43 | 495 | PS_avg_buffer[ps_avg_ptr] = ps_ls_data[0]; //load the new sample in the buffer |
laserdad | 7:3ed0f0522b43 | 496 | PSavg += (PS_avg_buffer[ps_avg_ptr] - PSprev); //update the average by removing the old sample and adding the new |
laserdad | 7:3ed0f0522b43 | 497 | // pc.printf("%d %d %d %d %d ",ps_avg_ptr, PSprev, PS_avg_buffer[ps_avg_ptr],ps_ls_data[0],PSavg); |
laserdad | 7:3ed0f0522b43 | 498 | } |
laserdad | 5:ebe305e08430 | 499 | if (meas_temp) |
laserdad | 5:ebe305e08430 | 500 | { |
laserdad | 5:ebe305e08430 | 501 | ob1203.setMainConfig(); |
laserdad | 5:ebe305e08430 | 502 | } |
laserdad | 12:5de5f550e765 | 503 | pc.printf("%d, %d %d %d %d %d\r\n",ps_ls_data[0],ps_ls_data[1],ps_ls_data[2],ps_ls_data[3],ps_ls_data[4],ps_ls_data[5]); |
laserdad | 12:5de5f550e765 | 504 | // pc.printf("%d, %d %d %d %d %d %d %d\r\n",(PSavg/ps_running_avg),ps_ls_data[0],ps_ls_data[1],ps_ls_data[2],ps_ls_data[3],ps_ls_data[4],ps_ls_data[5],ps_ls_data[6]); |
laserdad | 4:3aee2ca931b8 | 505 | |
laserdad | 1:fb6b2b4d5d8a | 506 | } |
laserdad | 2:ee175f471ecb | 507 | // else |
laserdad | 2:ee175f471ecb | 508 | // { |
laserdad | 2:ee175f471ecb | 509 | // pc.printf("status = %04X\r\n",ob1203.get_status() ); |
laserdad | 2:ee175f471ecb | 510 | // } |
laserdad | 0:e9ae48b7f6f6 | 511 | } |
laserdad | 1:fb6b2b4d5d8a | 512 | }//end while |
laserdad | 1:fb6b2b4d5d8a | 513 | }//end main |