pub struct HalComponent<R> { /* private fields */ }
Expand description
HAL component
The main HAL component interface. See the crate documentation for examples.
During registraton, all resource names are prefixed with the component name and a .
full stop
character. For example, a component named rust-comp
with a pin named input-1
will show up in
LinuxCNC as a pin called rust-comp.input-1
.
HalComponent
has a custom Drop
implementation which calls hal_exit
(among other things)
when the variable holding the component goes out of scope. Due to this, the component should be
initialised in main()
so it lives for the entire life of the program.
Implementations§
Source§impl<R> HalComponent<R>where
R: Resources,
impl<R> HalComponent<R>where
R: Resources,
Sourcepub fn new(name: &'static str) -> Result<Self, ComponentInitError>
pub fn new(name: &'static str) -> Result<Self, ComponentInitError>
Create a new HAL component
new
registers a new HAL component with LinuxCNC, registers the required UNIX signal
handlers and allocates resources (pins, signals, etc) required by the component.
Sourcepub fn should_exit(&self) -> bool
pub fn should_exit(&self) -> bool
Check whether the component was signalled to shut down