[][src]Trait linuxcnc_hal::hal_pin::HalPin

pub trait HalPin: Sized {
    type Storage: Debug;
    fn name(&self) -> &str;
fn storage(&self) -> Result<&mut Self::Storage, StorageError>;
fn register_pin(
        full_pin_name: &str,
        direction: PinDirection,
        component_id: i32
    ) -> Result<Self, PinRegisterError>; fn allocate_storage() -> Result<*mut *mut Self::Storage, StorageError> { ... } }

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

Loading content...

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>

Register the pin with the LinuxCNC HAL

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

Loading content...

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().

Loading content...

Implementors

impl HalPin for HalPinBool[src]

type Storage = bool

impl HalPin for HalPinF64[src]

type Storage = f64

impl HalPin for HalPinI32[src]

type Storage = i32

impl HalPin for HalPinU32[src]

type Storage = u32

Loading content...