Revision 3b2655dc

View differences:

Adafruit_BNO055.cpp
104 104
    @brief  Gets the latest system status info
105 105
*/
106 106
/**************************************************************************/
107
void Adafruit_BNO055::getSystemStatus(adafruit_bno055_system_status_t * status)
107
void Adafruit_BNO055::getSystemStatus(uint8_t *system_status, uint8_t *self_test_result, uint8_t *system_error)
108 108
{
109
  memset(status, 0, sizeof(adafruit_bno055_system_status_t));
110
  
109
  write8(BNO055_SYS_TRIGGER_ADDR, read8(BNO055_SYS_TRIGGER_ADDR) | 0x1);
110
  delay(10);
111 111
  /* Read the system status register */
112
  status->system_status    = read8(BNO055_SYS_STAT_ADDR);
113
  status->self_test_result = read8(BNO055_SELFTEST_RESULT_ADDR);
114
  status->system_error     = read8(BNO055_SYS_ERR_ADDR);
112
  if (system_status != 0)
113
    *system_status    = read8(BNO055_SYS_STAT_ADDR);
114
  if (self_test_result != 0)
115
    *self_test_result = read8(BNO055_SELFTEST_RESULT_ADDR);
116
  if (system_error != 0)
117
    *system_error     = read8(BNO055_SYS_ERR_ADDR);
115 118
}
116 119

  
117 120
/**************************************************************************/
......
121 124
/**************************************************************************/
122 125
void Adafruit_BNO055::displaySystemStatus(void)
123 126
{
124
  adafruit_bno055_system_status_t status;
125
  getSystemStatus(&status);
127
  uint8_t system_status, self_test_result, system_error;
128
  getSystemStatus(&system_status, &self_test_result, &system_error);
126 129
  
127 130
  /* System Status (see section 4.3.58)
128 131
     ---------------------------------
......
135 138
     6 = System running without fusion algorithms */
136 139
  
137 140
  Serial.print("System Status:          0x");
138
  Serial.println(status.system_status, HEX);
141
  Serial.println(system_status, HEX);
139 142

  
140 143
  /* Self Test Results (see section )
141 144
     --------------------------------
......
149 152
     0x0F = all good! */
150 153
  
151 154
  Serial.print("Self Test Results:      0x");
152
  Serial.println(status.self_test_result, HEX);
155
  Serial.println(self_test_result, HEX);
153 156

  
154 157
  /* System Error (see section 4.3.59)
155 158
     ---------------------------------
......
166 169
     A = Sensor configuration error */
167 170
  
168 171
  Serial.print("System Error:           0x");
169
  Serial.println(status.system_error, HEX);
172
  Serial.println(system_error, HEX);
170 173
}
171 174

  
172 175
/**************************************************************************/
Adafruit_BNO055.h
221 221
      uint8_t  bl_rev;
222 222
    } adafruit_bno055_rev_info_t;
223 223
    
224
    typedef struct
225
    {
226
      uint8_t system_status;      
227
      uint8_t self_test_result;
228
      uint8_t system_error;
229
    } adafruit_bno055_system_status_t;
230
    
231 224
    typedef enum
232 225
    {
233 226
      VECTOR_ACCELEROMETER = BNO055_ACCEL_DATA_X_LSB_ADDR,
......
244 237
    void  setMode             ( adafruit_bno055_opmode_t mode );
245 238
    void  getRevInfo          ( adafruit_bno055_rev_info_t* );
246 239
    void  displayRevInfo      ( void );
247
    void  getSystemStatus     ( adafruit_bno055_system_status_t* );
240
    //    void  getSystemStatus     ( adafruit_bno055_system_status_t* );
241
    void  getSystemStatus     ( uint8_t *system_status, 
242
				uint8_t *self_test_result, 
243
				uint8_t *system_error);
248 244
    void  displaySystemStatus ( void );
249 245
    void  printDouble         ( double val, unsigned int precision );
250 246
    

Also available in: Unified diff