Scroll to navigation

hal_pin_new(3hal) HAL hal_pin_new(3hal)

NAME

hal_pin_new - creates a HAL pin

SYNTAX


int hal_pin_bit_new(const char *name, hal_pin_dir_t dir, hal_bit_t ** data_ptr_addr, int comp_id)


int hal_pin_float_new(const char *name, hal_pin_dir_t dir, hal_float_t ** data_ptr_addr, int comp_id)


int hal_pin_u32_new(const char *name, hal_pin_dir_t dir, hal_u32_t ** data_ptr_addr, int comp_id)


int hal_pin_s32_new(const char *name, hal_pin_dir_t dir, hal_s32_t ** data_ptr_addr, int comp_id)


int hal_pin_port_new(const char *name, hal_pin_dir_t dir, hal_port_t ** data_ptr_addr, int comp_id)


int hal_pin_bit_newf(hal_pin_dir_t dir, hal_bit_t ** data_ptr_addr, int comp_id, const char *fmt, ...)


int hal_pin_float_newf(hal_pin_dir_t dir, hal_float_t ** data_ptr_addr, int comp_id, const char *fmt, ...)


int hal_pin_u32_newf(hal_pin_dir_t dir, hal_u32_t ** data_ptr_addr, int comp_id, const char *fmt, ...)


int hal_pin_s32_newf(hal_pin_dir_t dir, hal_s32_t ** data_ptr_addr, int comp_id, const char *fmt, ...)


int hal_pin_port_newf(hal_pin_dir_t dir, hal_port_t ** data_ptr_addr, int comp_id, const char *fmt, ...)


int hal_pin_new(const char *name, hal_type_t type, hal_pin_dir_t dir, void **data_ptr_addr, int comp_id)

ARGUMENTS

name of the pin

The direction of the pin, from the viewpoint of the component. It may be one of HAL_IN, HAL_OUT, or HAL_IO. Any number of HAL_IN or HAL_IO pins may be connected to the same signal, but at most one HAL_OUT pin is permitted. A component may assign a value to a pin that is HAL_OUT or HAL_IO, but may not assign a value to a pin that is HAL_IN.

The address of the pointer-to-data, which must lie within memory allocated by hal_malloc.

HAL component identifier returned by an earlier call to hal_init.

printf-style format string and arguments

The type of the param, as specified in hal_type_t(3hal).

DESCRIPTION

The hal_pin_new family of functions create a new pin object. Once a pin has been created, it can be linked to a signal object using hal_link. A pin contains a pointer, and the component that owns the pin can dereference the pointer to access whatever signal is linked to the pin. (If no signal is linked, it points to a dummy signal.)

There are functions for each of the data types that the HAL supports. Pins may only be linked to signals of the same type.

RETURN VALUE

Returns 0 on success, or a negative errno value on failure.

SEE ALSO

hal_type_t(3hal), hal_link(3hal)

2006-10-12 LinuxCNC Documentation