[−][src]Trait linuxcnc_hal::hal_pin::HalPin
HAL pin trait
Implemented for any HAL pin. Handles allocation of backing storage in LinuxCNC's memory space.
Associated Types
type Storage: Debug
The underlying storage type for the given pin
This will usually be a scalar value such as u32
or bool
Required methods
fn name(&self) -> &str
Get the pin's name
fn storage(&self) -> Result<&mut Self::Storage, StorageError>
Get pointer to underlying shared memory storing this pin's value
fn register_pin(
full_pin_name: &str,
direction: PinDirection,
component_id: i32
) -> Result<Self, PinRegisterError>
full_pin_name: &str,
direction: PinDirection,
component_id: i32
) -> Result<Self, PinRegisterError>
Register the pin with the LinuxCNC HAL
Returns a raw pointer to the underling HAL shared memory for the pin
Provided methods
fn allocate_storage() -> Result<*mut *mut Self::Storage, StorageError>
Allocate memory using hal_malloc()
for storing pin value in
Errors
This method will return an Err
if hal_malloc()
returns a null pointer.
Safety
This method attempts to allocate memory in LinuxCNC's shared memory space with the unsafe
method hal_malloc()
.
Implementors
impl HalPin for HalPinBool
[src]
type Storage = bool
fn name(&self) -> &str
[src]
fn storage(&self) -> Result<&mut Self::Storage, StorageError>
[src]
fn register_pin(
full_pin_name: &str,
direction: PinDirection,
component_id: i32
) -> Result<Self, PinRegisterError>
[src]
full_pin_name: &str,
direction: PinDirection,
component_id: i32
) -> Result<Self, PinRegisterError>
impl HalPin for HalPinF64
[src]
type Storage = f64
fn name(&self) -> &str
[src]
fn storage(&self) -> Result<&mut Self::Storage, StorageError>
[src]
fn register_pin(
full_pin_name: &str,
direction: PinDirection,
component_id: i32
) -> Result<Self, PinRegisterError>
[src]
full_pin_name: &str,
direction: PinDirection,
component_id: i32
) -> Result<Self, PinRegisterError>
impl HalPin for HalPinI32
[src]
type Storage = i32
fn name(&self) -> &str
[src]
fn storage(&self) -> Result<&mut Self::Storage, StorageError>
[src]
fn register_pin(
full_pin_name: &str,
direction: PinDirection,
component_id: i32
) -> Result<Self, PinRegisterError>
[src]
full_pin_name: &str,
direction: PinDirection,
component_id: i32
) -> Result<Self, PinRegisterError>