process-image
process-image is a Rust crate for conveniently accessing data inside a
process image using zero-cost abstractions. A process image (short PI) is
nothing else than a block of memory describing state. This concept stems from
the industrial automation world where such process images are used to represent
the state of all inputs and outputs used to control a machine or process.
process-image provides abstractions for absolute addressing of tags (=values)
and for building tag tables that then allow symbolic access.
Example
Absolute Addressing
use process_image as pi;
let mut buf = ;
// Absolute tag addressing
let sensor_limit_1 = tag!; // Read %MX3.6
let sensor_limit_2 = tag!; // Read %MX3.7
let temperature: u16 = tag!; // Read %MW2
*tag_mut! = true; // Set %MX0.2 := TRUE;
*tag_mut! = 2300; // Set %MW6 := 2300;
Symbolic Addressing
use process_image as pi;
let mut buf = ;
// Build tag table definition
process_image!
// Read-access only
let pi = try_from.unwrap;
dbg!;
dbg!;
dbg!;
// Read-write access
let mut pi = try_from.unwrap;
if *pi.sensor_limit_1
License
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.