Self test boot program for testing icarus sensors

Dependencies:   BLE_API mbed nRF51822

Fork of BLE_UARTConsole by Bluetooth Low Energy

Revision:
10:3a24c970db40
Child:
11:70359785c2a7
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MPU9250Sensor.cpp	Tue Jan 27 13:25:37 2015 +0000
@@ -0,0 +1,59 @@
+#include "MPU9250Sensor.h"
+#include "mbed.h"
+
+#ifndef LOG
+#define LOG(...) do printf(__VA_ARGS__); while (0)
+#endif
+
+MPU9250Sensor::MPU9250Sensor(SPI* spi_,DigitalOut* cs_) : BaseSensor() {
+    this->spi=spi_;
+    this->cs=cs_;
+    *cs = UP;
+    //To prevent switching into I2C mode when using SPI, the I2C interface should be disabled by setting the I2C_IF_DIS 
+    //configuration bit. Setting this bit should be performed immediately after waiting for the time specified by the 
+    //“Start-Up Time for Register Read/Write” in Section 6.3.
+    
+    
+}
+
+char* MPU9250Sensor::getSimpleName() {
+    return "MPU9250";
+}
+
+
+uint32_t MPU9250Sensor::verifyIntegrity(uint32_t* errorResult) {
+    LOG("Start verfication of MPU9250 Sensor");
+    uint32_t errors = 0;
+    //Device id is 0xAD
+    //Device mems id is 0x1D
+    //Part id is 0xF2
+//    uint32_t sensorId = readRegister32(DEVID_AD);
+    
+  //  if (sensorId >> 8 !=0xAD1DF2){
+//        errorResult[errors++] = ERROR_WRONG_DEVICE_ID;
+//        LOG("Wrong sensorId: %X",sensorId);
+//    }
+    
+    //check status registry
+//    uint8_t status  = readRegister(STATUS);
+    
+    //indicate that SEU error was detetcted 
+   // if (status & (1 << 7)){
+//        errorResult[errors++] = ERROR_SEU_ERROR_DETECT;
+//        LOG("SEU error detected: %X",status);        
+//    }
+    //check that chip is in awaken state  
+    //if (!(status & (1 << 6))){
+//        errorResult[errors++] = ERROR_DEVICE_SLEEPING;
+//        LOG("Chip not awaken: %X",status);
+//    }    
+    
+    //perform self test
+//    errors+=selfTest(&errorResult[errors]); 
+    
+    return errors;
+}
+
+void MPU9250Sensor::getSensorDetails(sensor_t* sensorDetails) {
+
+}