Discussion:
[nuttx] combo accelerometer + compas + gyro
Ramtin Amin keytwo@gmail.com [nuttx]
2018-03-17 12:06:58 UTC
Permalink
Hello,

I was looking at the LSM9DS1 code. this device can do combo
gyro+accel+compas.

So the code so far creates 3 FD for each of the sensor. That is
understandable at some point, but most of the people that want the 3 sensor
want to calculate either the Euler angle or Quaternion, and at that point,
we need to get the 3 values at the same time.

So I wanted to implement a driver for MPU9250 (spi) but it is important to
be able to read all 3 values at the same time, and doing it from 3 read()
syscall ends up making it slow and have a lot of addr/value exchange, while
in a single read I could read all registers that are consecutive.
Is it acceptable to make a driver that gives you all 3 values in a single
read() ?

Other option would be to offer 4 FD, 1 for each gyro/accel/compas that
would allow just reading 1 of those value. and another that does combo. ?
Gregory Nutt spudarnia@yahoo.com [nuttx]
2018-03-17 13:20:21 UTC
Permalink
Hi,
Post by Ramtin Amin ***@gmail.com [nuttx]
So the code so far creates 3 FD for each of the sensor. That is
understandable at some point, but most of the people that want the 3
sensor want to calculate either the Euler angle or Quaternion, and at
that point, we need to get the 3 values at the same time.
I see no problem with with read returning multiple values.  Some drivers
(like CAN), return a rather complex structure on read(). Look at
include/nuttx/drivers/can/can.h.  So does drivers/analog/adc.c (although
I don't like the logic in that one for determines how many ADC samples
of what size to return)

So I certainly see no problem with returning multiple values in a single
read, whether the values are returned as an array or as a structure.

BTW, this group has moved to
https://groups.google.com/forum/#!forum/nuttx . That is where most
discussions are happening now.

Greg

Loading...