在Android平台上获取传感器数据
为了在Android平台上读取传感器的数据(即加速度计、陀螺仪、磁力计、气压计、GPS),人们在互联网上谈论两种获取此类数据的方法
- 主要方式:通过JAVA使用Android SDK读取数据。
- 第二种方式与使用 Android NDK 读取数据有关。
不使用 SDK 或 NDK 直接通过 SPI、I2C 或 UART 与传感器通信怎么样?我知道我会因为了解传感器的通信协议并读取特定的寄存器而感到负担,我可以通过这些寄存器以更有效的方式获取数据。这可能吗?
To read the sensor's data on an Android platform (i.e. Accelerometer, Gyroscope, Magnetometer, Barometer, GPS ), people over the internet are talking about two ways to acquire such data
- Primary way: reading the data using the Android SDK via JAVA.
- The 2nd way is related to reading the data using the Android NDK.
What about communicating with the sensors directly via SPI,I2C, or UART without the use of the SDK or the NDK ? I understand that I'll be burdened by understanding the communication protocol with the sensors and reading specific registers from which I can acquire the data in a more efficient way. Is this possible ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
理论上这是可能的,瓦利德。如果你投入足够的时间和金钱来解决大多数技术问题,解决方案就成为可能。但我不得不问为什么有人想这样做?
这就像说“我很确定我可以倒车驾驶我的车。我会用手操作油门和刹车,并且我会添加几个额外的镜子来将挡风玻璃的视野反射到我身上。我会用腿来驾驶,别问我如何操作喇叭!”它只是在一个愚蠢的水平上做这件事。
您肯定需要各个芯片的详细信息,这意味着您需要将 XOOM 拆开 - 此类实现信息不会公开。并不是因为这是一个大秘密,而是因为如果制造商不发布 100% 的消费者不需要的信息,就可以降低成本。
底线:你的精力和脑力可以得到更有效的利用。
彼得
In theory it is possible, Walid. If you throw enough time and money at most technical problems, solutions become possible. But I would have to ask why anyone would want to do it that way?
It would be like saying "I'm pretty sure I can drive my car, inverted. I'll operate the accelerator and brake with my hands, and I'll add a couple of extra mirrors to reflect the windshield view down to me. And I'll steer with my legs. Don't ask me how I'll operate the horn!" It's just doing it at a goofy level.
You'd surely need details of the individual chips, which means you'd need to tear your XOOM apart - that kind of implementation info is not published. Not because it's a big secret, but because it keeps costs down if manufacturers don't publish info that 100% of consumers don't need.
Bottom line: there are more productive uses of your energy and brainpower.
Peter