extern crate mil_std_1553b;
use mil_std_1553b::{
derive::{field, Word},
Field, Message,
};
#[allow(dead_code)]
#[derive(Default, Word)]
struct CustomWord {
#[data]
mydata: [u8; 2],
#[parity]
myparity: u8,
another: u8,
}
impl CustomWord {
#[field(STATUS_LIGHT, 0b1000000000000000)]
pub fn status_light_on(&self) -> bool {
Self::STATUS_LIGHT.get::<_, u16>(self) == 1
}
}
fn main() {
let input = [
0b10000011, 0b00001100, 0b01110011, 0b11010000, 0b11010011, 0b00101111, 0b00101101,
0b11100010, 0b11001110, 0b11011110,
];
let message = Message::<4>::read_command(&input).unwrap();
let word1 = message.get::<CustomWord>(0);
let word2 = message.get::<CustomWord>(1);
let status_light_on_1 = word1.unwrap().status_light_on();
let status_light_on_2 = word2.unwrap().status_light_on();
println!("status_light_on_1: {}", status_light_on_1);
println!("status_light_on_2: {}", status_light_on_2);
}