pub trait HalPin: Sized {
    type Storage: Debug;

    fn name(&self) -> &str;
    fn storage_mut(&self) -> Result<&mut Self::Storage, StorageError>;
    fn storage(&self) -> Result<&Self::Storage, StorageError>;
    fn register(
        full_pin_name: &str,
        component_id: i32
    ) -> Result<Self, PinRegisterError>; fn allocate_storage() -> Result<*mut *mut Self::Storage, StorageError> { ... } }
Expand description

HAL pin trait

Implemented for any HAL pin. Handles allocation of backing storage in LinuxCNC’s memory space.

Required Associated Types

The underlying storage type for the given pin

This will usually be a scalar value such as u32 or bool

Required Methods

Get the pin’s name

Get a mutable pointer to underlying shared memory storing this pin’s value

Get a reference to the underlying shared memory storing the pin’s value

Register the pin with the LinuxCNC HAL

Returns a raw pointer to the underling HAL shared memory for the pin

Provided Methods

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