ah- / anne-key

Firmware for Anne Pro Keyboard written in Rust
Apache License 2.0
567 stars 32 forks source link

protocol: parse MsgType using scroll #63

Open hdhoang opened 6 years ago

hdhoang commented 6 years ago

As a PoC it only parses one byte. Next up would be buffer.pread::<Message>(0), but I haven't cooked up a multiplexing try_from_ctx for the different MsgType + XOp yet.

Further, we could have buffer.pwrite::<LedTheme> for sending the 0xca set-LED messages too.

cc #20

hdhoang commented 6 years ago

proc-macro2 will be compatible with the new nightlies soon dtolnay/quote#73

ah- commented 6 years ago

Oh that's really nice, I had been looking for a lib that does exactly this but hadn't tried out scroll yet. This is looking really promising, especially that it does proper parsing rather than just casting and hoping it all works.

hdhoang commented 6 years ago

I'd like to make some round-trip tests to run on x86-64 too.

hdhoang commented 6 years ago

The test target hard-codes linux-gnu though, I will try to extract rustup target list|grep default | cut -d ' ' -f 1 into make somehow.