| 108 | 
  108 | 
  
    void Adafruit_BNO055::setMode(adafruit_bno055_opmode_t mode)
 
   | 
  | 109 | 
  109 | 
  
    {
   | 
  | 110 | 
  110 | 
  
      _mode = mode;
 
   | 
  | 111 | 
   | 
  
      //Serial.print("Mode: 0x"); Serial.println(mode, HEX);
   | 
  | 112 | 
  111 | 
  
      write8(BNO055_OPR_MODE_ADDR, _mode);
 
   | 
  | 113 | 
  112 | 
  
      delay(30);
 
   | 
  | 114 | 
  113 | 
  
    }
 
   | 
  | ... | ... |  | 
  | 153 | 
  152 | 
  
    
 
   | 
  | 154 | 
  153 | 
  
      write8(BNO055_SYS_TRIGGER_ADDR, read8(BNO055_SYS_TRIGGER_ADDR) | 0x1);
 
   | 
  | 155 | 
  154 | 
  
      delay(1000);
 
   | 
  | 156 | 
   | 
  
      /* Read the system status register */
 
   | 
  | 157 | 
   | 
  
      if (system_status != 0)
 
   | 
  | 158 | 
   | 
  
        *system_status    = read8(BNO055_SYS_STAT_ADDR);
 
   | 
  | 159 | 
   | 
  
      if (self_test_result != 0)
 
   | 
  | 160 | 
   | 
  
        *self_test_result = read8(BNO055_SELFTEST_RESULT_ADDR);
 
   | 
  | 161 | 
   | 
  
      if (system_error != 0)
 
   | 
  | 162 | 
   | 
  
        *system_error     = read8(BNO055_SYS_ERR_ADDR);
 
   | 
  | 163 | 
   | 
  
    
 
   | 
  | 164 | 
   | 
  
      setMode(backupmode);
 
   | 
  | 165 | 
   | 
  
      delay(20);
 
   | 
  | 166 | 
   | 
  
    }
 
   | 
  | 167 | 
   | 
  
    
 
   | 
  | 168 | 
   | 
  
    /**************************************************************************/
 
   | 
  | 169 | 
   | 
  
    /*!
 
   | 
  | 170 | 
   | 
  
        @brief  Displays system status info via Serial.print
 
   | 
  | 171 | 
   | 
  
    */
 
   | 
  | 172 | 
   | 
  
    /**************************************************************************/
 
   | 
  | 173 | 
   | 
  
    void Adafruit_BNO055::displaySystemStatus(void)
 
   | 
  | 174 | 
   | 
  
    {
   | 
  | 175 | 
   | 
  
      uint8_t system_status, self_test_result, system_error;
 
   | 
  | 176 | 
   | 
  
      getSystemStatus(&system_status, &self_test_result, &system_error);
 
   | 
  | 177 | 
  155 | 
  
      
 
   | 
  | 178 | 
  156 | 
  
      /* System Status (see section 4.3.58)
 
   | 
  | 179 | 
  157 | 
  
         ---------------------------------
 
   | 
  | ... | ... |  | 
  | 185 | 
  163 | 
  
         5 = Sensor fusio algorithm running
 
   | 
  | 186 | 
  164 | 
  
         6 = System running without fusion algorithms */
 
   | 
  | 187 | 
  165 | 
  
      
 
   | 
  | 188 | 
   | 
  
      Serial.print("System Status:          0x");
   | 
  | 189 | 
   | 
  
      Serial.println(system_status, HEX);
 
   | 
  | 190 | 
   | 
  
    
 
   | 
   | 
  166 | 
  
      if (system_status != 0)
 
   | 
   | 
  167 | 
  
        *system_status    = read8(BNO055_SYS_STAT_ADDR);
 
   | 
   | 
  168 | 
  
      
 
   | 
  | 191 | 
  169 | 
  
      /* Self Test Results (see section )
 
   | 
  | 192 | 
  170 | 
  
         --------------------------------
 
   | 
  | 193 | 
  171 | 
  
         1 = test passed, 0 = test failed
 
   | 
  | 194 | 
   | 
  
        
 
   | 
   | 
  172 | 
  
      
 
   | 
  | 195 | 
  173 | 
  
         Bit 0 = Accelerometer self test
 
   | 
  | 196 | 
  174 | 
  
         Bit 1 = Magnetometer self test
 
   | 
  | 197 | 
  175 | 
  
         Bit 2 = Gyroscope self test
 
   | 
  | 198 | 
  176 | 
  
         Bit 3 = MCU self test
 
   | 
  | 199 | 
   | 
  
      
 
   | 
   | 
  177 | 
  
    
 
   | 
  | 200 | 
  178 | 
  
         0x0F = all good! */
 
   | 
  | 201 | 
  179 | 
  
      
 
   | 
  | 202 | 
   | 
  
      Serial.print("Self Test Results:      0x");
   | 
  | 203 | 
   | 
  
      Serial.println(self_test_result, HEX);
 
   | 
   | 
  180 | 
  
      if (self_test_result != 0)
 
   | 
   | 
  181 | 
  
        *self_test_result = read8(BNO055_SELFTEST_RESULT_ADDR);
 
   | 
  | 204 | 
  182 | 
  
    
 
   | 
  | 205 | 
  183 | 
  
      /* System Error (see section 4.3.59)
 
   | 
  | 206 | 
  184 | 
  
         ---------------------------------
 
   | 
  | ... | ... |  | 
  | 216 | 
  194 | 
  
         9 = Fusion algorithm configuration error
 
   | 
  | 217 | 
  195 | 
  
         A = Sensor configuration error */
 
   | 
  | 218 | 
  196 | 
  
      
 
   | 
  | 219 | 
   | 
  
      Serial.print("System Error:           0x");
   | 
  | 220 | 
   | 
  
      Serial.println(system_error, HEX);
 
   | 
   | 
  197 | 
  
      if (system_error != 0)
 
   | 
   | 
  198 | 
  
        *system_error     = read8(BNO055_SYS_ERR_ADDR);
 
   | 
   | 
  199 | 
  
    
 
   | 
   | 
  200 | 
  
      setMode(backupmode);
 
   | 
   | 
  201 | 
  
      delay(20);
 
   | 
  | 221 | 
  202 | 
  
    }
 
   | 
  | 222 | 
  203 | 
  
    
 
   | 
  | 223 | 
  204 | 
  
    /**************************************************************************/
 
   | 
  | ... | ... |  | 
  | 231 | 
  212 | 
  
    
 
   | 
  | 232 | 
  213 | 
  
      memset(info, 0, sizeof(adafruit_bno055_rev_info_t));
 
   | 
  | 233 | 
  214 | 
  
    
 
   | 
   | 
  215 | 
  
      /* Check the accelerometer revision */
 
   | 
  | 234 | 
  216 | 
  
      info->accel_rev = read8(BNO055_ACCEL_REV_ID_ADDR);
 
   | 
   | 
  217 | 
  
    
 
   | 
   | 
  218 | 
  
      /* Check the magnetometer revision */
 
   | 
  | 235 | 
  219 | 
  
      info->mag_rev   = read8(BNO055_MAG_REV_ID_ADDR);
 
   | 
   | 
  220 | 
  
    
 
   | 
   | 
  221 | 
  
      /* Check the gyroscope revision */
 
   | 
  | 236 | 
  222 | 
  
      info->gyro_rev  = read8(BNO055_GYRO_REV_ID_ADDR);
 
   | 
   | 
  223 | 
  
    
 
   | 
   | 
  224 | 
  
      /* Check the SW revision */
 
   | 
  | 237 | 
  225 | 
  
      info->bl_rev    = read8(BNO055_BL_REV_ID_ADDR);
 
   | 
  | 238 | 
  226 | 
  
      
 
   | 
  | 239 | 
  227 | 
  
      a = read8(BNO055_SW_REV_ID_LSB_ADDR);
 
   | 
  | ... | ... |  | 
  | 243 | 
  231 | 
  
    
 
   | 
  | 244 | 
  232 | 
  
    /**************************************************************************/
 
   | 
  | 245 | 
  233 | 
  
    /*!
 
   | 
  | 246 | 
   | 
  
        @brief  Displays the chip revision numbers via Serial.print
 
   | 
  | 247 | 
   | 
  
    */
 
   | 
  | 248 | 
   | 
  
    /**************************************************************************/
 
   | 
  | 249 | 
   | 
  
    void Adafruit_BNO055::displayRevInfo(void)
 
   | 
  | 250 | 
   | 
  
    {
   | 
  | 251 | 
   | 
  
      adafruit_bno055_rev_info_t info;
 
   | 
  | 252 | 
   | 
  
      getRevInfo(&info);
 
   | 
  | 253 | 
   | 
  
    
 
   | 
  | 254 | 
   | 
  
      /* Check the accelerometer revision */
 
   | 
  | 255 | 
   | 
  
      Serial.print("Accelerometer Revision: 0x");
   | 
  | 256 | 
   | 
  
      Serial.println(info.accel_rev, HEX);
 
   | 
  | 257 | 
   | 
  
      
 
   | 
  | 258 | 
   | 
  
      /* Check the magnetometer revision */
 
   | 
  | 259 | 
   | 
  
      Serial.print("Magnetometer Revision:  0x");
   | 
  | 260 | 
   | 
  
      Serial.println(info.mag_rev, HEX);
 
   | 
  | 261 | 
   | 
  
      
 
   | 
  | 262 | 
   | 
  
      /* Check the gyroscope revision */
 
   | 
  | 263 | 
   | 
  
      Serial.print("Gyroscope Revision:     0x");
   | 
  | 264 | 
   | 
  
      Serial.println(info.gyro_rev, HEX);
 
   | 
  | 265 | 
   | 
  
      
 
   | 
  | 266 | 
   | 
  
      /* Check the SW revision */
 
   | 
  | 267 | 
   | 
  
      Serial.print("SW Revision:            0x");
   | 
  | 268 | 
   | 
  
      Serial.println(info.sw_rev, HEX);
 
   | 
  | 269 | 
   | 
  
      
 
   | 
  | 270 | 
   | 
  
      /* Check the bootloader revision */
 
   | 
  | 271 | 
   | 
  
      Serial.print("Bootloader Revision:    0x");
   | 
  | 272 | 
   | 
  
      Serial.println(info.bl_rev, HEX);
 
   | 
  | 273 | 
   | 
  
    }
 
   | 
  | 274 | 
   | 
  
    
 
   | 
  | 275 | 
   | 
  
    /**************************************************************************/
 
   | 
  | 276 | 
   | 
  
    /*!
 
   | 
  | 277 | 
  234 | 
  
        @brief  Gets teh temperature in degrees celsius
 
   | 
  | 278 | 
  235 | 
  
    */
 
   | 
  | 279 | 
  236 | 
  
    /**************************************************************************/
 
   |