You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Users of this library will probably be transmitting words that, while they may use the same sync/parity bits, interpret the u16 word bodies in a specific way (not as bytes, &str etc). To support this, we need to:
Provide a way of quickly creating a custom word
Initially thought this would be a trait but investigating proc-macro1
Derive(Word) on a custom struct that has two attributes (data and parity) decorated
Proc macro crate could be a sub-crate of mil_std_1553b
Provide access to the Field struct
Make the Field struct part of the public API
Update the Field struct to support fields greater than 8 bits
Add documentation and examples to the Field struct
Update the Message::get method to be generic or add another, generic getter method.2
After everything is implemented a user should be able to do the following:
#[derive(Word)]pubstructCustomWord{/// the body of the word#[data]mydata:[u8;2],/// the parity bit of the word#[parity]myparity:u8,/// some other dataothervar:u8,}implCustomWord{/// Mask for parsing a custom flag from the leading bitpubconstCUSTOM_FLAG:u16 = 0b1000000000000000;/// Field definition for the custom flagpubconstCUSTOM_FLAG_FIELD:Field = Field::from(Self::CUSTOM_FLAG);/// Check the custom flag on the wordpubfnis_custom_flag(&self) -> bool{Self::CUSTOM_FLAG_FIELD.get(self) == 1}}
Users of this library will probably be transmitting words that, while they may use the same sync/parity bits, interpret the u16 word bodies in a specific way (not as bytes, &str etc). To support this, we need to:
Field
structField
struct part of the public APIField
struct to support fields greater than 8 bitsField
structMessage::get
method to be generic or add another, generic getter method.2After everything is implemented a user should be able to do the following:
Footnotes
https://doc.rust-lang.org/reference/procedural-macros.html ↩
message.get(0).map(CustomWord::from).unwrap()
↩The text was updated successfully, but these errors were encountered: