forked from Archive/PX4-Autopilot
trone: added support for WHOAMI register
This commit is contained in:
parent
215e8e2466
commit
7ca2553da2
|
@ -79,6 +79,9 @@
|
||||||
/* TRONE Registers addresses */
|
/* TRONE Registers addresses */
|
||||||
|
|
||||||
#define TRONE_MEASURE_REG 0x00 /* Measure range register */
|
#define TRONE_MEASURE_REG 0x00 /* Measure range register */
|
||||||
|
#define TRONE_WHO_AM_I_REG 0x01 /* Who am I test register */
|
||||||
|
#define TRONE_WHO_AM_I_REG_VAL 0xA1
|
||||||
|
|
||||||
|
|
||||||
/* Device limits */
|
/* Device limits */
|
||||||
#define TRONE_MIN_DISTANCE (0.20f)
|
#define TRONE_MIN_DISTANCE (0.20f)
|
||||||
|
@ -308,7 +311,20 @@ out:
|
||||||
int
|
int
|
||||||
TRONE::probe()
|
TRONE::probe()
|
||||||
{
|
{
|
||||||
|
uint8_t who_am_i=0;
|
||||||
|
|
||||||
|
const uint8_t cmd = TRONE_WHO_AM_I_REG;
|
||||||
|
if (transfer(&cmd, 1, &who_am_i, 1) == OK && who_am_i == TRONE_WHO_AM_I_REG_VAL) {
|
||||||
|
// it is responding correctly to a WHO_AM_I
|
||||||
return measure();
|
return measure();
|
||||||
|
}
|
||||||
|
|
||||||
|
debug("WHO_AM_I byte mismatch 0x%02x should be 0x%02x\n",
|
||||||
|
(unsigned)who_am_i,
|
||||||
|
TRONE_WHO_AM_I_REG_VAL);
|
||||||
|
|
||||||
|
// not found on any address
|
||||||
|
return -EIO;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -643,7 +659,6 @@ TRONE::cycle()
|
||||||
* Is there a collect->measure gap?
|
* Is there a collect->measure gap?
|
||||||
*/
|
*/
|
||||||
if (_measure_ticks > USEC2TICK(TRONE_CONVERSION_INTERVAL)) {
|
if (_measure_ticks > USEC2TICK(TRONE_CONVERSION_INTERVAL)) {
|
||||||
|
|
||||||
/* schedule a fresh cycle call when we are ready to measure again */
|
/* schedule a fresh cycle call when we are ready to measure again */
|
||||||
work_queue(HPWORK,
|
work_queue(HPWORK,
|
||||||
&_work,
|
&_work,
|
||||||
|
|
Loading…
Reference in New Issue