Just as an example, I am doing that sort of things with a ublox sam-m8q gps using their binary protocol.
The example below is for the paragraph 31.18.20 UBX-NAV-STATUS (0x01 0x03).
Their messages are pure packed c struct with properly aligned words, dwords and so on and most of those have a fixed length. That was designed for C, C++ definitely.
However, I am not using an array, just a buffer containing a single data packet.
I would store more than one in an Array (javascript standard) of ArrayBuffer(s) and then getters or setters with this kind of Dataview code, not pre splitted buffers with their contents separated. Thats may be slower but it's memory savy.
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Hi all,
Just as an example, I am doing that sort of things with a ublox sam-m8q gps using their binary protocol.
The example below is for the paragraph 31.18.20 UBX-NAV-STATUS (0x01 0x03).
Their messages are pure packed c struct with properly aligned words, dwords and so on and most of those have a fixed length. That was designed for C, C++ definitely.
However, I am not using an array, just a buffer containing a single data packet.
I would store more than one in an Array (javascript standard) of ArrayBuffer(s) and then getters or setters with this kind of Dataview code, not pre splitted buffers with their contents separated. Thats may be slower but it's memory savy.