W3C home > Mailing lists > Public > public-device-apis@w3.org > June 2015

Re: [sensors] Identify the lower level primitives that do the actual sensor polling.

From: Rick Waldron via GitHub <sysbot+gh@w3.org>
Date: Sat, 06 Jun 2015 00:35:53 +0000
To: public-device-apis@w3.org
Message-ID: <issue_comment.created-109490528-1433550953-sysbot+gh@w3.org>
> , it becomes apparent that identifying lower-level primitives that 
do the actual sensor polling 

We're not specifying the chip register reads.

- https://en.wikipedia.org/wiki/Serial_Peripheral_Interface_Bus
- https://en.wikipedia.org/wiki/I%C2%B2C

> would be helpful to better explain the magic behind concrete sensor 
implementations (in the spirit of the Extensible Web Manifesto) 

The step down from what we're trying to do, or at least what I 
originally proposed, is raw values from either SPI or I2C bus. These 
will be bytes that need to be operated on to be useful. Now we're 
talking about knowing which order the bytes are stored in the register
 (because that's the order they arrive when the bus is read). 
Sometimes the msb comes before the lsb and sometimes it's the reverse;
 sometimes they come in a logical order, sometimes they don't: 
(HMC5883L delivers bytes as [x-msb, x-lsb, z-msb, z-lsb, y-msb, y-lsb]
 vs. the ADXL345 Accelerometer which delivers [x-lsb, x-msb, y-lsb, 
y-msb, z-lsb, z-msb]. Those two examples alone mean that I have to 
know all of these things to make any sense of it: 

1. What order are the bytes with regard to values that this sensor 
produces (eg. x, y, z for accel)?
2. What order the bytes relative to each other?
3. Which is the msb and lsb?
4.  What is the value that OR'ing the msb and lsb produces, 
semantically? Is is acceleration, gravity, rate (dps), magnetic 
heading, true heading?
5. Do I even need to look for a pair of bytes to make a word, or is a 
single byte to be expected?
6. Signed, or Unsigned? 

I'm sure there are more things to consider, but that's enough to make 
my point, which is: that's a lot of things to have to know before one 
can do anything interesting with a sensor. 



@domenic 

> This is going to be really interesting since I imagine that it 
varies a lot per-platform. 

Depending on how low we're talking, maybe. At the chip level, they are
 all MEMs chips communicating via SPI and I2C bus, likely with an 
interrupt from the sensors to main SoC for wake-ups. 

-- 
GitHub Notif of comment by rwaldron
See https://github.com/w3c/sensors/issues/24#issuecomment-109490528
Received on Saturday, 6 June 2015 00:35:56 UTC

This archive was generated by hypermail 2.3.1 : Monday, 23 October 2017 14:54:05 UTC