milstd1553b_parser/
lib.rs

1//! # MIL-STD-1553B Protocol Parser
2//!
3//! A comprehensive Rust library for parsing and handling MIL-STD-1553B military data bus protocol.
4//!
5//! MIL-STD-1553B is a serial synchronous data bus specification used in military avionics
6//! and aerospace systems. This library provides:
7//!
8//! - Encoding/decoding of Manchester-encoded data
9//! - Message parsing and construction
10//! - Protocol validation
11//! - Error handling
12//!
13//! ## Features
14//!
15//! - `serde`: Enable serialization/deserialization support
16//!
17//! ## Example
18//!
19//! ```
20//! use milstd1553b_parser::{Word, WordType};
21//!
22//! // Create a data word
23//! let word = Word::new(0x1234, WordType::Data)?;
24//! println!("Word: {:?}", word);
25//! # Ok::<(), Box<dyn std::error::Error>>(())
26//! ```
27
28pub mod core;
29pub mod encoding;
30pub mod error;
31pub mod message;
32pub mod parser;
33pub mod protocol;
34
35pub use core::{Address, Word, WordType};
36pub use error::{ParseError, Result};
37pub use message::{Command, Message};
38pub use parser::Parser;
39
40/// The MIL-STD-1553B specification constants
41pub mod spec {
42    /// Clock frequency in Hz
43    pub const CLOCK_FREQUENCY: u32 = 1_000_000; // 1 MHz
44
45    /// Word length in bits
46    pub const WORD_LENGTH: usize = 20;
47
48    /// Maximum number of Remote Terminals
49    pub const MAX_REMOTE_TERMINALS: u8 = 30;
50
51    /// Manchester encoding uses 2 bits per data bit
52    pub const MANCHESTER_BITS_PER_WORD: usize = WORD_LENGTH * 2;
53
54    /// Maximum data word rate in bits per second
55    pub const MAX_DATA_WORD_RATE: u32 = 1_000_000; // 1 Mbps
56}