Re: [PATCH v2] hw/sensor: Add lsm303dlhc magnetometer device

2021-09-20 Thread Kevin Townsend
HI Peter, On Mon, 20 Sept 2021 at 19:20, Peter Maydell wrote: > > Is 0.001 uT OK to use as a starting point? I think that's enough for most > > sensors I'm aware of. > > The thing is that the starting point is also the finishing point: > once we have released something that uses a particular set

Re: [PATCH v2] hw/sensor: Add lsm303dlhc magnetometer device

2021-09-20 Thread Peter Maydell
On Mon, 20 Sept 2021 at 17:49, Kevin Townsend wrote: > > On Mon, 20 Sept 2021 at 17:14, Peter Maydell wrote: >> >> That's OK -- our "int" properties are int64_t. So we could easily >> fit something like 1 == 1. uT, in case we might want >> the extra precision in future. That would be 1,00

Re: [PATCH v2] hw/sensor: Add lsm303dlhc magnetometer device

2021-09-20 Thread Kevin Townsend
On Mon, 20 Sept 2021 at 17:14, Peter Maydell wrote: > That's OK -- our "int" properties are int64_t. So we could easily > fit something like 1 == 1. uT, in case we might want > the extra precision in future. That would be 1,000,000 == 1 G > (assuming I haven't messed up my arithmetic ;-))

Re: [PATCH v2] hw/sensor: Add lsm303dlhc magnetometer device

2021-09-20 Thread Peter Maydell
On Mon, 20 Sept 2021 at 15:22, Kevin Townsend wrote: > On Mon, 20 Sept 2021 at 15:52, Peter Maydell wrote: >> >> >> Why "lsb" ? >> >> >> > >> > In my head, using LSB seemed more precise since I know exactly what value >> > will >> > be set to the registers, and exactly what I will get back when

Re: [PATCH v2] hw/sensor: Add lsm303dlhc magnetometer device

2021-09-20 Thread Kevin Townsend
On Mon, 20 Sept 2021 at 15:52, Peter Maydell wrote: > >> Why "lsb" ? > >> > > > > In my head, using LSB seemed more precise since I know exactly what > value will > > be set to the registers, and exactly what I will get back when reading > versus passing > > in a float that's needs to be conveted

Re: [PATCH v2] hw/sensor: Add lsm303dlhc magnetometer device

2021-09-20 Thread Peter Maydell
On Mon, 20 Sept 2021 at 14:38, Kevin Townsend wrote: > > Hi Peter, > > Thanks for the review, and sorry for the slow reply, just getting back from > holidays myself. > > On Thu, 26 Aug 2021 at 17:39, Peter Maydell wrote: >> >> >> So if I'm reading the datasheet correctly, the LM303DLHC is >> rea

Re: [PATCH v2] hw/sensor: Add lsm303dlhc magnetometer device

2021-09-20 Thread Kevin Townsend
Hi Peter, Thanks for the review, and sorry for the slow reply, just getting back from holidays myself. On Thu, 26 Aug 2021 at 17:39, Peter Maydell wrote: > > So if I'm reading the datasheet correctly, the LM303DLHC is > really two completely distinct i2c devices in a single > package with diffe

Re: [PATCH v2] hw/sensor: Add lsm303dlhc magnetometer device

2021-08-27 Thread Peter Maydell
On Sun, 15 Aug 2021 at 17:31, Kevin Townsend wrote: > > This commit adds emulation of the magnetometer on the LSM303DLHC. > It allows the magnetometer's X, Y and Z outputs to be set via the > mag_x, mag_y and mag_z properties, as well as the 12-bit > temperature output via the temperature property

Re: [PATCH v2] hw/sensor: Add lsm303dlhc magnetometer device

2021-08-26 Thread Peter Maydell
On Sun, 15 Aug 2021 at 17:31, Kevin Townsend wrote: > > This commit adds emulation of the magnetometer on the LSM303DLHC. > It allows the magnetometer's X, Y and Z outputs to be set via the > mag_x, mag_y and mag_z properties, as well as the 12-bit > temperature output via the temperature property

[PATCH v2] hw/sensor: Add lsm303dlhc magnetometer device

2021-08-15 Thread Kevin Townsend
This commit adds emulation of the magnetometer on the LSM303DLHC. It allows the magnetometer's X, Y and Z outputs to be set via the mag_x, mag_y and mag_z properties, as well as the 12-bit temperature output via the temperature property. Signed-off-by: Kevin Townsend --- hw/sensor/Kconfig