P422_Labs
/
elevator
lab 7 code
main.cpp@0:4350259cf0d0, 2018-03-08 (annotated)
- Committer:
- m0t0
- Date:
- Thu Mar 08 16:58:55 2018 +0000
- Revision:
- 0:4350259cf0d0
- Child:
- 1:2a6907395c5d
l7
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
m0t0 | 0:4350259cf0d0 | 1 | #include "mbed.h" |
m0t0 | 0:4350259cf0d0 | 2 | #include "MPL3115A2.h" |
m0t0 | 0:4350259cf0d0 | 3 | |
m0t0 | 0:4350259cf0d0 | 4 | Serial pc(SERIAL_TX, SERIAL_RX); |
m0t0 | 0:4350259cf0d0 | 5 | DigitalOut myled(LED1); |
m0t0 | 0:4350259cf0d0 | 6 | |
m0t0 | 0:4350259cf0d0 | 7 | // Selects SDA as I2C1_SDA on pin PB_7 |
m0t0 | 0:4350259cf0d0 | 8 | // Selects SCL on I2C1_SCL on pin PB_6 |
m0t0 | 0:4350259cf0d0 | 9 | // The I2C address of the pressure sensor is fixed at 0x60. |
m0t0 | 0:4350259cf0d0 | 10 | MPL3115A2 pressure_sensor(PB_7,PB_6,0x60); |
m0t0 | 0:4350259cf0d0 | 11 | |
m0t0 | 0:4350259cf0d0 | 12 | struct dataPoints |
m0t0 | 0:4350259cf0d0 | 13 | { |
m0t0 | 0:4350259cf0d0 | 14 | double pres; |
m0t0 | 0:4350259cf0d0 | 15 | double tmp; |
m0t0 | 0:4350259cf0d0 | 16 | |
m0t0 | 0:4350259cf0d0 | 17 | }; |
m0t0 | 0:4350259cf0d0 | 18 | |
m0t0 | 0:4350259cf0d0 | 19 | |
m0t0 | 0:4350259cf0d0 | 20 | //Solution entails |
m0t0 | 0:4350259cf0d0 | 21 | |
m0t0 | 0:4350259cf0d0 | 22 | int main() { |
m0t0 | 0:4350259cf0d0 | 23 | |
m0t0 | 0:4350259cf0d0 | 24 | dataPoints data[100]; |
m0t0 | 0:4350259cf0d0 | 25 | |
m0t0 | 0:4350259cf0d0 | 26 | uint8_t id; |
m0t0 | 0:4350259cf0d0 | 27 | pc.printf("\n\r*** MPL3115A2 Pressure/Temperature Sensor Test *** \n\r"); |
m0t0 | 0:4350259cf0d0 | 28 | while ((id=pressure_sensor.getID())!=0xC4) { |
m0t0 | 0:4350259cf0d0 | 29 | pc.printf("Status read unsuccessful: Value = 0x%02x\n\r",id); |
m0t0 | 0:4350259cf0d0 | 30 | pc.printf("Check wiring to the pressure sensor\n\r",id); |
m0t0 | 0:4350259cf0d0 | 31 | pc.printf("Retesting for correct ID in 1 second...\n\r"); |
m0t0 | 0:4350259cf0d0 | 32 | wait(1); |
m0t0 | 0:4350259cf0d0 | 33 | } |
m0t0 | 0:4350259cf0d0 | 34 | //uint8_t tmp[2]; |
m0t0 | 0:4350259cf0d0 | 35 | //tmp[0] = 0x26; |
m0t0 | 0:4350259cf0d0 | 36 | // pressure_sensor.readRegs(0x26, &tmp[1], 1); |
m0t0 | 0:4350259cf0d0 | 37 | // tmp[1] = tmp[1] & 0xC6; |
m0t0 | 0:4350259cf0d0 | 38 | // pressure_sensor.writeRegs(tmp,2); |
m0t0 | 0:4350259cf0d0 | 39 | pc.printf("Status read successfully: Value = 0x%02x\n\r",id); |
m0t0 | 0:4350259cf0d0 | 40 | pc.printf("***1hz readings from the pressure sensor***\n\r"); |
m0t0 | 0:4350259cf0d0 | 41 | |
m0t0 | 0:4350259cf0d0 | 42 | int counter= 0; |
m0t0 | 0:4350259cf0d0 | 43 | while(1) { |
m0t0 | 0:4350259cf0d0 | 44 | //this is where I would check for the GPIO pin if implemented |
m0t0 | 0:4350259cf0d0 | 45 | if(counter!=100){ |
m0t0 | 0:4350259cf0d0 | 46 | dataPoints p1 = {0,0}; |
m0t0 | 0:4350259cf0d0 | 47 | //pc.printf("%f hPA; %f m\n\r",pressure_sensor.getPressure(),pressure_sensor.getAltitude()); |
m0t0 | 0:4350259cf0d0 | 48 | p1.pres = pressure_sensor.getPressure(); |
m0t0 | 0:4350259cf0d0 | 49 | p1.tmp = pressure_sensor.getTemperature(); |
m0t0 | 0:4350259cf0d0 | 50 | data[counter] = p1; |
m0t0 | 0:4350259cf0d0 | 51 | //pc.printf("STORED VALUES: \n\r Pressure: %f hPA, Altitude: %f m\n\r",data[0].pres,data[0].alt); |
m0t0 | 0:4350259cf0d0 | 52 | pc.printf("DATA STORED\n\r"); |
m0t0 | 0:4350259cf0d0 | 53 | |
m0t0 | 0:4350259cf0d0 | 54 | //if the counter is going to go over the 100 limit reset it to zero and then |
m0t0 | 0:4350259cf0d0 | 55 | if(counter+1<=100){ |
m0t0 | 0:4350259cf0d0 | 56 | counter++; |
m0t0 | 0:4350259cf0d0 | 57 | } |
m0t0 | 0:4350259cf0d0 | 58 | else{ |
m0t0 | 0:4350259cf0d0 | 59 | counter=0; |
m0t0 | 0:4350259cf0d0 | 60 | } |
m0t0 | 0:4350259cf0d0 | 61 | myled = !myled; |
m0t0 | 0:4350259cf0d0 | 62 | wait(1); |
m0t0 | 0:4350259cf0d0 | 63 | } |
m0t0 | 0:4350259cf0d0 | 64 | else{ |
m0t0 | 0:4350259cf0d0 | 65 | pc.printf("STORED VALUES: \n\r Pressure: %f hPA, Altitude: %f m\n\r",data[0].pres,data[0].tmp); |
m0t0 | 0:4350259cf0d0 | 66 | for(int i=1; i<=counter; i++){ |
m0t0 | 0:4350259cf0d0 | 67 | pc.printf("Pressure: %f hPA, Altitude: %f m\n\r",data[i].pres,data[i].tmp); |
m0t0 | 0:4350259cf0d0 | 68 | } |
m0t0 | 0:4350259cf0d0 | 69 | for(int i=0; i<=100; i++){ |
m0t0 | 0:4350259cf0d0 | 70 | data[i].pres=NULL; |
m0t0 | 0:4350259cf0d0 | 71 | data[i].tmp=NULL; |
m0t0 | 0:4350259cf0d0 | 72 | } |
m0t0 | 0:4350259cf0d0 | 73 | pc.printf("Cleared Data \n\r"); |
m0t0 | 0:4350259cf0d0 | 74 | } |
m0t0 | 0:4350259cf0d0 | 75 | } |
m0t0 | 0:4350259cf0d0 | 76 | } |
m0t0 | 0:4350259cf0d0 | 77 | |
m0t0 | 0:4350259cf0d0 | 78 | int mpl3115_reg_print(int start, int length) { |
m0t0 | 0:4350259cf0d0 | 79 | |
m0t0 | 0:4350259cf0d0 | 80 | if(0x00 <= start && start <=0x2D){ |
m0t0 | 0:4350259cf0d0 | 81 | if(length==0){ |
m0t0 | 0:4350259cf0d0 | 82 | length=46; |
m0t0 | 0:4350259cf0d0 | 83 | uint8_t data[1]; |
m0t0 | 0:4350259cf0d0 | 84 | for(int i=start; i<length; i++){ |
m0t0 | 0:4350259cf0d0 | 85 | pressure_sensor.readRegs(i, data, 1); |
m0t0 | 0:4350259cf0d0 | 86 | switch(i){ |
m0t0 | 0:4350259cf0d0 | 87 | case(0x00): |
m0t0 | 0:4350259cf0d0 | 88 | printf("0x%x: MPL_STATUS=0x%x\r\n",i,data[0]); |
m0t0 | 0:4350259cf0d0 | 89 | break; |
m0t0 | 0:4350259cf0d0 | 90 | case(0x01): |
m0t0 | 0:4350259cf0d0 | 91 | printf("0x%x: MPL_OUT_P_MSB=0x%x\r\n",i,data[0]); |
m0t0 | 0:4350259cf0d0 | 92 | break; |
m0t0 | 0:4350259cf0d0 | 93 | case(0x02): |
m0t0 | 0:4350259cf0d0 | 94 | printf("0x%x: MPL_OUT_P_CSB=0x%x\r\n",i,data[0]); |
m0t0 | 0:4350259cf0d0 | 95 | break; |
m0t0 | 0:4350259cf0d0 | 96 | case(0x03): |
m0t0 | 0:4350259cf0d0 | 97 | printf("0x%x: MPL_OUT_P_LSB=0x%x\r\n",i,data[0]); |
m0t0 | 0:4350259cf0d0 | 98 | break; |
m0t0 | 0:4350259cf0d0 | 99 | case(0x04): |
m0t0 | 0:4350259cf0d0 | 100 | printf("0x%x: MPL_OUT_T_MSB=0x%x\r\n",i,data[0]); |
m0t0 | 0:4350259cf0d0 | 101 | break; |
m0t0 | 0:4350259cf0d0 | 102 | case(0x05): |
m0t0 | 0:4350259cf0d0 | 103 | printf("0x%x: MPL_OUT_T_LSB=0x%x\r\n",i,data[0]); |
m0t0 | 0:4350259cf0d0 | 104 | break; |
m0t0 | 0:4350259cf0d0 | 105 | case(0x06): |
m0t0 | 0:4350259cf0d0 | 106 | printf("0x%x: MPL_DR_STATUS=0x%x\r\n",i,data[0]); |
m0t0 | 0:4350259cf0d0 | 107 | break; |
m0t0 | 0:4350259cf0d0 | 108 | case(0x07): |
m0t0 | 0:4350259cf0d0 | 109 | printf("0x%x: MPL_OUT_P_DELTA_MSB=0x%x\r\n",i,data[0]); |
m0t0 | 0:4350259cf0d0 | 110 | break; |
m0t0 | 0:4350259cf0d0 | 111 | case(0x08): |
m0t0 | 0:4350259cf0d0 | 112 | printf("0x%x: MPL_OUT_P_DELTA_CSB=0x%x\r\n",i,data[0]); |
m0t0 | 0:4350259cf0d0 | 113 | break; |
m0t0 | 0:4350259cf0d0 | 114 | case(0x09): |
m0t0 | 0:4350259cf0d0 | 115 | printf("0x%x: MPL_OUT_P_DELTA_LSB=0x%x\r\n",i,data[0]); |
m0t0 | 0:4350259cf0d0 | 116 | break; |
m0t0 | 0:4350259cf0d0 | 117 | case(0x0A): |
m0t0 | 0:4350259cf0d0 | 118 | printf("0x%x: MPL_OUT_T_DELTA_MSB=0x%x\r\n",i,data[0]); |
m0t0 | 0:4350259cf0d0 | 119 | break; |
m0t0 | 0:4350259cf0d0 | 120 | case(0x0B): |
m0t0 | 0:4350259cf0d0 | 121 | printf("0x%x: MPL_OUT_T_DELTA_LSB=0x%x\r\n",i,data[0]); |
m0t0 | 0:4350259cf0d0 | 122 | break; |
m0t0 | 0:4350259cf0d0 | 123 | case(0x0C): |
m0t0 | 0:4350259cf0d0 | 124 | printf("0x%x: MPL_WHO_AM_I=0x%x\r\n",i,data[0]); |
m0t0 | 0:4350259cf0d0 | 125 | break; |
m0t0 | 0:4350259cf0d0 | 126 | case(0x0D): |
m0t0 | 0:4350259cf0d0 | 127 | printf("0x%x: MPL_F_STATUS=0x%x\r\n",i,data[0]); |
m0t0 | 0:4350259cf0d0 | 128 | break; |
m0t0 | 0:4350259cf0d0 | 129 | case(0x0E): |
m0t0 | 0:4350259cf0d0 | 130 | printf("0x%x: MPL_F_DATA=0x%x\r\n",i,data[0]); |
m0t0 | 0:4350259cf0d0 | 131 | break; |
m0t0 | 0:4350259cf0d0 | 132 | case(0x0F): |
m0t0 | 0:4350259cf0d0 | 133 | printf("0x%x: MPL_F_SETUP=0x%x\r\n",i,data[0]); |
m0t0 | 0:4350259cf0d0 | 134 | break; |
m0t0 | 0:4350259cf0d0 | 135 | case(0x10): |
m0t0 | 0:4350259cf0d0 | 136 | printf("0x%x: MPL_TIME_DLY=0x%x\r\n",i,data[0]); |
m0t0 | 0:4350259cf0d0 | 137 | break; |
m0t0 | 0:4350259cf0d0 | 138 | case(0x11): |
m0t0 | 0:4350259cf0d0 | 139 | printf("0x%x: MPL_SYSMOD=0x%x\r\n",i,data[0]); |
m0t0 | 0:4350259cf0d0 | 140 | break; |
m0t0 | 0:4350259cf0d0 | 141 | case(0x12): |
m0t0 | 0:4350259cf0d0 | 142 | printf("0x%x: MPL_INT_SOURCE=0x%x\r\n",i,data[0]); |
m0t0 | 0:4350259cf0d0 | 143 | break; |
m0t0 | 0:4350259cf0d0 | 144 | case(0x13): |
m0t0 | 0:4350259cf0d0 | 145 | printf("0x%x: MPL_PT_DATA_CFG=0x%x\r\n",i,data[0]); |
m0t0 | 0:4350259cf0d0 | 146 | break; |
m0t0 | 0:4350259cf0d0 | 147 | case(0x14): |
m0t0 | 0:4350259cf0d0 | 148 | printf("0x%x: MPL_BAR_IN_MSB=0x%x\r\n",i,data[0]); |
m0t0 | 0:4350259cf0d0 | 149 | break; |
m0t0 | 0:4350259cf0d0 | 150 | case(0x15): |
m0t0 | 0:4350259cf0d0 | 151 | printf("0x%x: MPL_BAR_IN_LSB=0x%x\r\n",i,data[0]); |
m0t0 | 0:4350259cf0d0 | 152 | break; |
m0t0 | 0:4350259cf0d0 | 153 | case(0x16): |
m0t0 | 0:4350259cf0d0 | 154 | printf("0x%x: MPL_P_TGT_MSB=0x%x\r\n",i,data[0]); |
m0t0 | 0:4350259cf0d0 | 155 | break; |
m0t0 | 0:4350259cf0d0 | 156 | case(0x17): |
m0t0 | 0:4350259cf0d0 | 157 | printf("0x%x: MPL_P_TGT_LSB=0x%x\r\n",i,data[0]); |
m0t0 | 0:4350259cf0d0 | 158 | break; |
m0t0 | 0:4350259cf0d0 | 159 | case(0x18): |
m0t0 | 0:4350259cf0d0 | 160 | printf("0x%x: MPL_T_TGT=0x%x\r\n",i,data[0]); |
m0t0 | 0:4350259cf0d0 | 161 | break; |
m0t0 | 0:4350259cf0d0 | 162 | case(0x19): |
m0t0 | 0:4350259cf0d0 | 163 | printf("0x%x: MPL_P_WND_MSB=0x%x\r\n",i,data[0]); |
m0t0 | 0:4350259cf0d0 | 164 | break; |
m0t0 | 0:4350259cf0d0 | 165 | case(0x1A): |
m0t0 | 0:4350259cf0d0 | 166 | printf("0x%x: MPL_P_WND_LSB=0x%x\r\n",i,data[0]); |
m0t0 | 0:4350259cf0d0 | 167 | break; |
m0t0 | 0:4350259cf0d0 | 168 | case(0x1B): |
m0t0 | 0:4350259cf0d0 | 169 | printf("0x%x: MPL_T_WND=0x%x\r\n",i,data[0]); |
m0t0 | 0:4350259cf0d0 | 170 | break; |
m0t0 | 0:4350259cf0d0 | 171 | case(0x1C): |
m0t0 | 0:4350259cf0d0 | 172 | printf("0x%x: MPL_P_MIN_MSB=0x%x\r\n",i,data[0]); |
m0t0 | 0:4350259cf0d0 | 173 | break; |
m0t0 | 0:4350259cf0d0 | 174 | case(0x1D): |
m0t0 | 0:4350259cf0d0 | 175 | printf("0x%x: MPL_P_MIN_CSB=0x%x\r\n",i,data[0]); |
m0t0 | 0:4350259cf0d0 | 176 | break; |
m0t0 | 0:4350259cf0d0 | 177 | case(0x1E): |
m0t0 | 0:4350259cf0d0 | 178 | printf("0x%x: MPL_P_MIN_LSB=0x%x\r\n",i,data[0]); |
m0t0 | 0:4350259cf0d0 | 179 | break; |
m0t0 | 0:4350259cf0d0 | 180 | case(0x1F): |
m0t0 | 0:4350259cf0d0 | 181 | printf("0x%x: MPL_T_MIN_MSB=0x%x\r\n",i,data[0]); |
m0t0 | 0:4350259cf0d0 | 182 | break; |
m0t0 | 0:4350259cf0d0 | 183 | case(0x20): |
m0t0 | 0:4350259cf0d0 | 184 | printf("0x%x: MPL_T_MIN_LSB=0x%x\r\n",i,data[0]); |
m0t0 | 0:4350259cf0d0 | 185 | break; |
m0t0 | 0:4350259cf0d0 | 186 | case(0x21): |
m0t0 | 0:4350259cf0d0 | 187 | printf("0x%x: MPL_P_MAX_MSB=0x%x\r\n",i,data[0]); |
m0t0 | 0:4350259cf0d0 | 188 | break; |
m0t0 | 0:4350259cf0d0 | 189 | case(0x22): |
m0t0 | 0:4350259cf0d0 | 190 | printf("0x%x: MPL_P_MAX_CSB=0x%x\r\n",i,data[0]); |
m0t0 | 0:4350259cf0d0 | 191 | break; |
m0t0 | 0:4350259cf0d0 | 192 | case(0x23): |
m0t0 | 0:4350259cf0d0 | 193 | printf("0x%x: MPL_P_MAX_LSB=0x%x\r\n",i,data[0]); |
m0t0 | 0:4350259cf0d0 | 194 | break; |
m0t0 | 0:4350259cf0d0 | 195 | case(0x24): |
m0t0 | 0:4350259cf0d0 | 196 | printf("0x%x: MPL_T_MAX_MSB=0x%x\r\n",i,data[0]); |
m0t0 | 0:4350259cf0d0 | 197 | break; |
m0t0 | 0:4350259cf0d0 | 198 | case(0x25): |
m0t0 | 0:4350259cf0d0 | 199 | printf("0x%x: MPL_T_MAX_LSB=0x%x\r\n",i,data[0]); |
m0t0 | 0:4350259cf0d0 | 200 | break; |
m0t0 | 0:4350259cf0d0 | 201 | case(0x26): |
m0t0 | 0:4350259cf0d0 | 202 | printf("0x%x: MPL_CTRL_REG1=0x%x\r\n",i,data[0]); |
m0t0 | 0:4350259cf0d0 | 203 | break; |
m0t0 | 0:4350259cf0d0 | 204 | case(0x27): |
m0t0 | 0:4350259cf0d0 | 205 | printf("0x%x: MPL_CTRL_REG2=0x%x\r\n",i,data[0]); |
m0t0 | 0:4350259cf0d0 | 206 | break; |
m0t0 | 0:4350259cf0d0 | 207 | case(0x28): |
m0t0 | 0:4350259cf0d0 | 208 | printf("0x%x: MPL_CTRL_REG3=0x%x\r\n",i,data[0]); |
m0t0 | 0:4350259cf0d0 | 209 | break; |
m0t0 | 0:4350259cf0d0 | 210 | case(0x29): |
m0t0 | 0:4350259cf0d0 | 211 | printf("0x%x: MPL_CTRL_REG4=0x%x\r\n",i,data[0]); |
m0t0 | 0:4350259cf0d0 | 212 | break; |
m0t0 | 0:4350259cf0d0 | 213 | case(0x2A): |
m0t0 | 0:4350259cf0d0 | 214 | printf("0x%x: MPL_CTRL_REG5=0x%x\r\n",i,data[0]); |
m0t0 | 0:4350259cf0d0 | 215 | break; |
m0t0 | 0:4350259cf0d0 | 216 | case(0x2B): |
m0t0 | 0:4350259cf0d0 | 217 | printf("0x%x: MPL_OFF_P=0x%x\r\n",i,data[0]); |
m0t0 | 0:4350259cf0d0 | 218 | break; |
m0t0 | 0:4350259cf0d0 | 219 | case(0x2C): |
m0t0 | 0:4350259cf0d0 | 220 | printf("0x%x: MPL_OFF_T=0x%x\r\n",i,data[0]); |
m0t0 | 0:4350259cf0d0 | 221 | break; |
m0t0 | 0:4350259cf0d0 | 222 | case(0x2D): |
m0t0 | 0:4350259cf0d0 | 223 | printf("0x%x: MPL_OFF_H=0x%x\r\n",i,data[0]); |
m0t0 | 0:4350259cf0d0 | 224 | break; |
m0t0 | 0:4350259cf0d0 | 225 | case(0x2E): |
m0t0 | 0:4350259cf0d0 | 226 | printf("0x%x: MPL_T_MIN_MSB=0x%x\r\n",i,data[0]); |
m0t0 | 0:4350259cf0d0 | 227 | break; |
m0t0 | 0:4350259cf0d0 | 228 | case(0x2F): |
m0t0 | 0:4350259cf0d0 | 229 | printf("0x%x: MPL_T_MIN_MSB=0x%x\r\n",i,data[0]); |
m0t0 | 0:4350259cf0d0 | 230 | break; |
m0t0 | 0:4350259cf0d0 | 231 | } |
m0t0 | 0:4350259cf0d0 | 232 | } |
m0t0 | 0:4350259cf0d0 | 233 | } |
m0t0 | 0:4350259cf0d0 | 234 | else if(length>0){ |
m0t0 | 0:4350259cf0d0 | 235 | uint8_t data[1]; |
m0t0 | 0:4350259cf0d0 | 236 | for(int i=start; i<length; i++){ |
m0t0 | 0:4350259cf0d0 | 237 | pressure_sensor.readRegs(i, data, 1); |
m0t0 | 0:4350259cf0d0 | 238 | switch(i){ |
m0t0 | 0:4350259cf0d0 | 239 | case(0x00): |
m0t0 | 0:4350259cf0d0 | 240 | printf("0x%x: MPL_STATUS=0x%x\r\n",i,data[0]); |
m0t0 | 0:4350259cf0d0 | 241 | break; |
m0t0 | 0:4350259cf0d0 | 242 | case(0x01): |
m0t0 | 0:4350259cf0d0 | 243 | printf("0x%x: MPL_OUT_P_MSB=0x%x\r\n",i,data[0]); |
m0t0 | 0:4350259cf0d0 | 244 | break; |
m0t0 | 0:4350259cf0d0 | 245 | case(0x02): |
m0t0 | 0:4350259cf0d0 | 246 | printf("0x%x: MPL_OUT_P_CSB=0x%x\r\n",i,data[0]); |
m0t0 | 0:4350259cf0d0 | 247 | break; |
m0t0 | 0:4350259cf0d0 | 248 | case(0x03): |
m0t0 | 0:4350259cf0d0 | 249 | printf("0x%x: MPL_OUT_P_LSB=0x%x\r\n",i,data[0]); |
m0t0 | 0:4350259cf0d0 | 250 | break; |
m0t0 | 0:4350259cf0d0 | 251 | case(0x04): |
m0t0 | 0:4350259cf0d0 | 252 | printf("0x%x: MPL_OUT_T_MSB=0x%x\r\n",i,data[0]); |
m0t0 | 0:4350259cf0d0 | 253 | break; |
m0t0 | 0:4350259cf0d0 | 254 | case(0x05): |
m0t0 | 0:4350259cf0d0 | 255 | printf("0x%x: MPL_OUT_T_LSB=0x%x\r\n",i,data[0]); |
m0t0 | 0:4350259cf0d0 | 256 | break; |
m0t0 | 0:4350259cf0d0 | 257 | case(0x06): |
m0t0 | 0:4350259cf0d0 | 258 | printf("0x%x: MPL_DR_STATUS=0x%x\r\n",i,data[0]); |
m0t0 | 0:4350259cf0d0 | 259 | break; |
m0t0 | 0:4350259cf0d0 | 260 | case(0x07): |
m0t0 | 0:4350259cf0d0 | 261 | printf("0x%x: MPL_OUT_P_DELTA_MSB=0x%x\r\n",i,data[0]); |
m0t0 | 0:4350259cf0d0 | 262 | break; |
m0t0 | 0:4350259cf0d0 | 263 | case(0x08): |
m0t0 | 0:4350259cf0d0 | 264 | printf("0x%x: MPL_OUT_P_DELTA_CSB=0x%x\r\n",i,data[0]); |
m0t0 | 0:4350259cf0d0 | 265 | break; |
m0t0 | 0:4350259cf0d0 | 266 | case(0x09): |
m0t0 | 0:4350259cf0d0 | 267 | printf("0x%x: MPL_OUT_P_DELTA_LSB=0x%x\r\n",i,data[0]); |
m0t0 | 0:4350259cf0d0 | 268 | break; |
m0t0 | 0:4350259cf0d0 | 269 | case(0x0A): |
m0t0 | 0:4350259cf0d0 | 270 | printf("0x%x: MPL_OUT_T_DELTA_MSB=0x%x\r\n",i,data[0]); |
m0t0 | 0:4350259cf0d0 | 271 | break; |
m0t0 | 0:4350259cf0d0 | 272 | case(0x0B): |
m0t0 | 0:4350259cf0d0 | 273 | printf("0x%x: MPL_OUT_T_DELTA_LSB=0x%x\r\n",i,data[0]); |
m0t0 | 0:4350259cf0d0 | 274 | break; |
m0t0 | 0:4350259cf0d0 | 275 | case(0x0C): |
m0t0 | 0:4350259cf0d0 | 276 | printf("0x%x: MPL_WHO_AM_I=0x%x\r\n",i,data[0]); |
m0t0 | 0:4350259cf0d0 | 277 | break; |
m0t0 | 0:4350259cf0d0 | 278 | case(0x0D): |
m0t0 | 0:4350259cf0d0 | 279 | printf("0x%x: MPL_F_STATUS=0x%x\r\n",i,data[0]); |
m0t0 | 0:4350259cf0d0 | 280 | break; |
m0t0 | 0:4350259cf0d0 | 281 | case(0x0E): |
m0t0 | 0:4350259cf0d0 | 282 | printf("0x%x: MPL_F_DATA=0x%x\r\n",i,data[0]); |
m0t0 | 0:4350259cf0d0 | 283 | break; |
m0t0 | 0:4350259cf0d0 | 284 | case(0x0F): |
m0t0 | 0:4350259cf0d0 | 285 | printf("0x%x: MPL_F_SETUP=0x%x\r\n",i,data[0]); |
m0t0 | 0:4350259cf0d0 | 286 | break; |
m0t0 | 0:4350259cf0d0 | 287 | case(0x10): |
m0t0 | 0:4350259cf0d0 | 288 | printf("0x%x: MPL_TIME_DLY=0x%x\r\n",i,data[0]); |
m0t0 | 0:4350259cf0d0 | 289 | break; |
m0t0 | 0:4350259cf0d0 | 290 | case(0x11): |
m0t0 | 0:4350259cf0d0 | 291 | printf("0x%x: MPL_SYSMOD=0x%x\r\n",i,data[0]); |
m0t0 | 0:4350259cf0d0 | 292 | break; |
m0t0 | 0:4350259cf0d0 | 293 | case(0x12): |
m0t0 | 0:4350259cf0d0 | 294 | printf("0x%x: MPL_INT_SOURCE=0x%x\r\n",i,data[0]); |
m0t0 | 0:4350259cf0d0 | 295 | break; |
m0t0 | 0:4350259cf0d0 | 296 | case(0x13): |
m0t0 | 0:4350259cf0d0 | 297 | printf("0x%x: MPL_PT_DATA_CFG=0x%x\r\n",i,data[0]); |
m0t0 | 0:4350259cf0d0 | 298 | break; |
m0t0 | 0:4350259cf0d0 | 299 | case(0x14): |
m0t0 | 0:4350259cf0d0 | 300 | printf("0x%x: MPL_BAR_IN_MSB=0x%x\r\n",i,data[0]); |
m0t0 | 0:4350259cf0d0 | 301 | break; |
m0t0 | 0:4350259cf0d0 | 302 | case(0x15): |
m0t0 | 0:4350259cf0d0 | 303 | printf("0x%x: MPL_BAR_IN_LSB=0x%x\r\n",i,data[0]); |
m0t0 | 0:4350259cf0d0 | 304 | break; |
m0t0 | 0:4350259cf0d0 | 305 | case(0x16): |
m0t0 | 0:4350259cf0d0 | 306 | printf("0x%x: MPL_P_TGT_MSB=0x%x\r\n",i,data[0]); |
m0t0 | 0:4350259cf0d0 | 307 | break; |
m0t0 | 0:4350259cf0d0 | 308 | case(0x17): |
m0t0 | 0:4350259cf0d0 | 309 | printf("0x%x: MPL_P_TGT_LSB=0x%x\r\n",i,data[0]); |
m0t0 | 0:4350259cf0d0 | 310 | break; |
m0t0 | 0:4350259cf0d0 | 311 | case(0x18): |
m0t0 | 0:4350259cf0d0 | 312 | printf("0x%x: MPL_T_TGT=0x%x\r\n",i,data[0]); |
m0t0 | 0:4350259cf0d0 | 313 | break; |
m0t0 | 0:4350259cf0d0 | 314 | case(0x19): |
m0t0 | 0:4350259cf0d0 | 315 | printf("0x%x: MPL_P_WND_MSB=0x%x\r\n",i,data[0]); |
m0t0 | 0:4350259cf0d0 | 316 | break; |
m0t0 | 0:4350259cf0d0 | 317 | case(0x1A): |
m0t0 | 0:4350259cf0d0 | 318 | printf("0x%x: MPL_P_WND_LSB=0x%x\r\n",i,data[0]); |
m0t0 | 0:4350259cf0d0 | 319 | break; |
m0t0 | 0:4350259cf0d0 | 320 | case(0x1B): |
m0t0 | 0:4350259cf0d0 | 321 | printf("0x%x: MPL_T_WND=0x%x\r\n",i,data[0]); |
m0t0 | 0:4350259cf0d0 | 322 | break; |
m0t0 | 0:4350259cf0d0 | 323 | case(0x1C): |
m0t0 | 0:4350259cf0d0 | 324 | printf("0x%x: MPL_P_MIN_MSB=0x%x\r\n",i,data[0]); |
m0t0 | 0:4350259cf0d0 | 325 | break; |
m0t0 | 0:4350259cf0d0 | 326 | case(0x1D): |
m0t0 | 0:4350259cf0d0 | 327 | printf("0x%x: MPL_P_MIN_CSB=0x%x\r\n",i,data[0]); |
m0t0 | 0:4350259cf0d0 | 328 | break; |
m0t0 | 0:4350259cf0d0 | 329 | case(0x1E): |
m0t0 | 0:4350259cf0d0 | 330 | printf("0x%x: MPL_P_MIN_LSB=0x%x\r\n",i,data[0]); |
m0t0 | 0:4350259cf0d0 | 331 | break; |
m0t0 | 0:4350259cf0d0 | 332 | case(0x1F): |
m0t0 | 0:4350259cf0d0 | 333 | printf("0x%x: MPL_T_MIN_MSB=0x%x\r\n",i,data[0]); |
m0t0 | 0:4350259cf0d0 | 334 | break; |
m0t0 | 0:4350259cf0d0 | 335 | case(0x20): |
m0t0 | 0:4350259cf0d0 | 336 | printf("0x%x: MPL_T_MIN_LSB=0x%x\r\n",i,data[0]); |
m0t0 | 0:4350259cf0d0 | 337 | break; |
m0t0 | 0:4350259cf0d0 | 338 | case(0x21): |
m0t0 | 0:4350259cf0d0 | 339 | printf("0x%x: MPL_P_MAX_MSB=0x%x\r\n",i,data[0]); |
m0t0 | 0:4350259cf0d0 | 340 | break; |
m0t0 | 0:4350259cf0d0 | 341 | case(0x22): |
m0t0 | 0:4350259cf0d0 | 342 | printf("0x%x: MPL_P_MAX_CSB=0x%x\r\n",i,data[0]); |
m0t0 | 0:4350259cf0d0 | 343 | break; |
m0t0 | 0:4350259cf0d0 | 344 | case(0x23): |
m0t0 | 0:4350259cf0d0 | 345 | printf("0x%x: MPL_P_MAX_LSB=0x%x\r\n",i,data[0]); |
m0t0 | 0:4350259cf0d0 | 346 | break; |
m0t0 | 0:4350259cf0d0 | 347 | case(0x24): |
m0t0 | 0:4350259cf0d0 | 348 | printf("0x%x: MPL_T_MAX_MSB=0x%x\r\n",i,data[0]); |
m0t0 | 0:4350259cf0d0 | 349 | break; |
m0t0 | 0:4350259cf0d0 | 350 | case(0x25): |
m0t0 | 0:4350259cf0d0 | 351 | printf("0x%x: MPL_T_MAX_LSB=0x%x\r\n",i,data[0]); |
m0t0 | 0:4350259cf0d0 | 352 | break; |
m0t0 | 0:4350259cf0d0 | 353 | case(0x26): |
m0t0 | 0:4350259cf0d0 | 354 | printf("0x%x: MPL_CTRL_REG1=0x%x\r\n",i,data[0]); |
m0t0 | 0:4350259cf0d0 | 355 | break; |
m0t0 | 0:4350259cf0d0 | 356 | case(0x27): |
m0t0 | 0:4350259cf0d0 | 357 | printf("0x%x: MPL_CTRL_REG2=0x%x\r\n",i,data[0]); |
m0t0 | 0:4350259cf0d0 | 358 | break; |
m0t0 | 0:4350259cf0d0 | 359 | case(0x28): |
m0t0 | 0:4350259cf0d0 | 360 | printf("0x%x: MPL_CTRL_REG3=0x%x\r\n",i,data[0]); |
m0t0 | 0:4350259cf0d0 | 361 | break; |
m0t0 | 0:4350259cf0d0 | 362 | case(0x29): |
m0t0 | 0:4350259cf0d0 | 363 | printf("0x%x: MPL_CTRL_REG4=0x%x\r\n",i,data[0]); |
m0t0 | 0:4350259cf0d0 | 364 | break; |
m0t0 | 0:4350259cf0d0 | 365 | case(0x2A): |
m0t0 | 0:4350259cf0d0 | 366 | printf("0x%x: MPL_CTRL_REG5=0x%x\r\n",i,data[0]); |
m0t0 | 0:4350259cf0d0 | 367 | break; |
m0t0 | 0:4350259cf0d0 | 368 | case(0x2B): |
m0t0 | 0:4350259cf0d0 | 369 | printf("0x%x: MPL_OFF_P=0x%x\r\n",i,data[0]); |
m0t0 | 0:4350259cf0d0 | 370 | break; |
m0t0 | 0:4350259cf0d0 | 371 | case(0x2C): |
m0t0 | 0:4350259cf0d0 | 372 | printf("0x%x: MPL_OFF_T=0x%x\r\n",i,data[0]); |
m0t0 | 0:4350259cf0d0 | 373 | break; |
m0t0 | 0:4350259cf0d0 | 374 | case(0x2D): |
m0t0 | 0:4350259cf0d0 | 375 | printf("0x%x: MPL_OFF_H=0x%x\r\n",i,data[0]); |
m0t0 | 0:4350259cf0d0 | 376 | break; |
m0t0 | 0:4350259cf0d0 | 377 | case(0x2E): |
m0t0 | 0:4350259cf0d0 | 378 | printf("0x%x: MPL_T_MIN_MSB=0x%x\r\n",i,data[0]); |
m0t0 | 0:4350259cf0d0 | 379 | break; |
m0t0 | 0:4350259cf0d0 | 380 | case(0x2F): |
m0t0 | 0:4350259cf0d0 | 381 | printf("0x%x: MPL_T_MIN_MSB=0x%x\r\n",i,data[0]); |
m0t0 | 0:4350259cf0d0 | 382 | break; |
m0t0 | 0:4350259cf0d0 | 383 | } |
m0t0 | 0:4350259cf0d0 | 384 | } |
m0t0 | 0:4350259cf0d0 | 385 | return 0; |
m0t0 | 0:4350259cf0d0 | 386 | } |
m0t0 | 0:4350259cf0d0 | 387 | else{ |
m0t0 | 0:4350259cf0d0 | 388 | return -1; |
m0t0 | 0:4350259cf0d0 | 389 | } |
m0t0 | 0:4350259cf0d0 | 390 | } |
m0t0 | 0:4350259cf0d0 | 391 | } |