-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
protocol: parse MsgType using scroll #63
base: master
Are you sure you want to change the base?
Conversation
proc-macro2 will be compatible with the new nightlies soon dtolnay/quote#73 |
FwUp = 11, | ||
CustomLed = 12, | ||
CustomKey = 13, | ||
Reserved, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think these needs to stay, so that send_buffer[pos] = message_type as u8;
in Serial::send
works correctly consistently? Especially for operation codes, those are dis-contiguous
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we could use the write functionality in scroll
for that as well? Agree that we need to be careful about preserving what actually goes on the wire, so codes don't change.
Oh that's really nice, I had been looking for a lib that does exactly this but hadn't tried out |
unknown => { | ||
return Err(SError::BadInput { | ||
size: unknown as usize, | ||
msg: "MsgType", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I try to sneak the unknown byte into the error message here, it should be formatted as (fmt, "bad input {} ({})", msg, size)
with semihosting
FwInfo => 10, | ||
FwUp => 11, | ||
CustomLed => 12, | ||
CustomKey => 13, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks ripe for a macro. scroll_derive
doesn't support deriving on enums, so we'll need to write one here.
I'd like to make some round-trip tests to run on x86-64 too. |
The test target hard-codes linux-gnu though, I will try to extract |
This currently requires openocd from git for the best experience.
As a PoC it only parses one byte. Next up would be
buffer.pread::<Message>(0)
, but I haven't cooked up a multiplexingtry_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