6 releases
0.1.5 | Mar 31, 2022 |
---|---|
0.1.4 | Mar 30, 2022 |
#224 in No standard library
39 downloads per month
Used in electricui-cli
140KB
1K
SLoC
electricui-embedded
An unofficial and incomplete no_std
Rust library for
implementing the ElectricUI Binary Protocol.
See the ElectricUI docs or the ElectricUI C library for more information.
Example
See electricui-embedded-stm32f4-example for the target portion.
Note: this example is pretty low level and shouldn't be replicated, see the electricui-cli crate for other patterns and examples.
cargo run --example host -- /dev/ttyUSB0
Requesting board ID
>> { DataLen(0), Type(8), Int(1), Offset(0), IdLen(1), Resp(1), Acknum(0) }
<< { DataLen(2), Type(8), Int(1), Offset(0), IdLen(1), Resp(0), Acknum(0) }
Board ID: [EF, BE]
Requesting name
>> { DataLen(0), Type(0), Int(0), Offset(0), IdLen(4), Resp(1), Acknum(0) }
<< { DataLen(8), Type(4), Int(0), Offset(0), IdLen(4), Resp(0), Acknum(0) }
Name: 'my-board'
Requesting writable IDs announcement
>> { DataLen(0), Type(0), Int(1), Offset(0), IdLen(1), Resp(1), Acknum(0) }
<< { DataLen(34), Type(1), Int(1), Offset(0), IdLen(1), Resp(0), Acknum(0) }
<< { DataLen(1), Type(6), Int(1), Offset(0), IdLen(1), Resp(0), Acknum(0) }
Message IDs (4):
led_blink
led_state
lit_time
name
Got AM_END, count = 4
Requesting tracked variables
>> { DataLen(0), Type(0), Int(1), Offset(0), IdLen(1), Resp(1), Acknum(0) }
<< { DataLen(1), Type(6), Int(0), Offset(0), IdLen(9), Resp(0), Acknum(0) }
Got tracked var Id(led_blink), Type(U8), Data([01])
<< { DataLen(1), Type(6), Int(0), Offset(0), IdLen(9), Resp(0), Acknum(0) }
<< { DataLen(2), Type(8), Int(0), Offset(0), IdLen(8), Resp(0), Acknum(0) }
Got tracked var Id(led_state), Type(U8), Data([01])
Got tracked var Id(lit_time), Type(U16), Data([46, 00])
<< { DataLen(8), Type(4), Int(0), Offset(0), IdLen(4), Resp(0), Acknum(0) }
Got tracked var Id(name), Type(Char), Data([6D, 79, 2D, 62, 6F, 61, 72, 64])
Requesting heartbeat val=3
>> { DataLen(1), Type(6), Int(1), Offset(0), IdLen(1), Resp(1), Acknum(0) }
<< { DataLen(1), Type(6), Int(1), Offset(0), IdLen(1), Resp(0), Acknum(0) }
Got heartbeat val=3
Protocol Diagram
License
Licensed under either of
- Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Dependencies
~2MB
~44K SLoC