enable reading sensor data from simulator module for SITL

This commit is contained in:
tumbili
2015-06-08 22:21:58 -07:00
committed by Mark Charlebois
parent f0a3210e94
commit aef3f37ae0
4 changed files with 169 additions and 245 deletions
@@ -118,22 +118,26 @@ BARO_SIM::init()
int
BARO_SIM::dev_read(unsigned offset, void *data, unsigned count)
{
/*
union _cvt {
uint8_t b[4];
uint32_t w;
} *cvt = (_cvt *)data;
uint8_t buf[3];
*/
/* read the most recent measurement */
uint8_t cmd = 0;
int ret = transfer(&cmd, 1, &buf[0], 3);
int ret = transfer(&cmd, 1, static_cast<uint8_t *>(data), 3);
/*
if (ret == PX4_OK) {
/* fetch the raw value */
// fetch the raw value
cvt->b[0] = buf[2];
cvt->b[1] = buf[1];
cvt->b[2] = buf[0];
cvt->b[3] = 0;
}
*/
return ret;
}