grblHAL core  20240318
grbl_hal_t Struct Reference

HAL structure used for the driver interface. More...

#include <hal.h>

Data Fields

uint32_t version
 HAL version, set by the core. Driver should check against this in the driver_init() function. More...
 
char * info
 Pointer to driver info string, typically name of processor/platform. More...
 
char * driver_version
 Pointer to driver version date string in YYMMDD format. More...
 
char * driver_options
 Pointer to optional comma separated string with driver options. More...
 
char * driver_url
 Pointer to optional URL for the driver. More...
 
char * board
 Pointer to optional board name string. More...
 
char * board_url
 Pointer to optional URL for the board. More...
 
uint32_t f_step_timer
 Frequency of main stepper timer in Hz. More...
 
uint32_t f_mcu
 Frequency of MCU in MHz. More...
 
uint32_t rx_buffer_size
 Input stream buffer size in bytes. More...
 
uint32_t max_step_rate
 Currently unused. More...
 
uint8_t driver_axis_settings
 Currently unused. More...
 
get_free_mem_ptr get_free_mem
 Optional pointer to function for getting free memory (as sum of all free blocks in the heap). More...
 
driver_setup_ptr driver_setup
 Driver setup handler. Called once by the core after settings has been loaded. The driver should enable MCU peripherals in the provided function. More...
 
void(* delay_ms )(uint32_t ms, delay_callback_ptr callback)
 Millisecond delay. More...
 
void(* set_bits_atomic )(volatile uint_fast16_t *value, uint_fast16_t bits)
 Atomically set bits. More...
 
uint_fast16_t(* clear_bits_atomic )(volatile uint_fast16_t *value, uint_fast16_t v)
 Atomically clear bits. More...
 
uint_fast16_t(* set_value_atomic )(volatile uint_fast16_t *value, uint_fast16_t bits)
 Atomically set value. More...
 
void(* irq_enable )(void)
 Optional handler to disable global interrupts. More...
 
void(* irq_disable )(void)
 Optional handler to enable global interrupts. More...
 
irq_claim_ptr irq_claim
 Optional handler for claiming higher level interrupts. Set to a dummy handler on startup. More...
 
limits_ptrs_t limits
 Handlers for limit switches. More...
 
homing_ptrs_t homing
 Handlers for homing switches, used by homing cycle. More...
 
control_signals_ptrs_t control
 Handlers for control switches. More...
 
coolant_ptrs_t coolant
 Handlers for coolant. More...
 
spindle_data_ptrs_t spindle_data
 Handlers for getting/resetting spindle data (RPM, angular position, ...). More...
 
stepper_ptrs_t stepper
 Handlers for stepper motors. More...
 
io_stream_t stream
 Handlers for stream I/O. More...
 
settings_changed_ptr settings_changed
 Callback handler to be called on settings loaded or settings changed events. More...
 
probe_ptrs_t probe
 Optional handlers for probe input(s). More...
 
tool_ptrs_t tool
 Optional handlers for tool changes. More...
 
rtc_ptrs_t rtc
 Optional handlers for real time clock (RTC). More...
 
io_port_t port
 Optional handlers for axuillary I/O (adds support for M62-M66). More...
 
rgb_ptr_t rgb0
 Optional handler for RGB output to LEDs (neopixels) or lamps. More...
 
rgb_ptr_t rgb1
 Optional handler for RGB output to LEDs (neopixels) or lamps. More...
 
periph_port_t periph_port
 Optional handlers for peripheral pin registration. More...
 
driver_reset_ptr driver_reset
 Optional handler, called on soft resets. Set to a dummy handler by the core at startup. More...
 
nvs_io_t nvs
 Optional handlers for storing/retrieving settings and data to/from non-volatile storage (NVS). More...
 
enumerate_pins_ptr enumerate_pins
 Optional handler for enumerating pins used by the driver. More...
 
bool(* driver_release )(void)
 Optional handler for releasing hardware resources before exiting. More...
 
uint32_t(* get_elapsed_ticks )(void)
 Optional handler for getting number of elapsed 1 ms tics since startup. Rolls over every 49.71 days. Required by a number of plugins. More...
 
uint64_t(* get_micros )(void)
 Optional handler for getting number of elapsed 1 us tics since startup. Rolls over every 1.19 hours. Required by a number of plugins. More...
 
pallet_shuttle_ptr pallet_shuttle
 Optional handler for performing a pallet shuttle on program end (M60). More...
 
void(* reboot )(void)
 Optoional handler for rebooting the controller. This will be called when ASCII_ESC followed by CMD_REBOOT is received. More...
 
user_mcode_ptrs_t user_mcode
 Optional handlers for user defined M-codes. More...
 
encoder_ptrs_t encoder
 Optional handlers for encoder support. More...
 
bool(* get_position )(int32_t(*position)[N_AXIS])
 Optional handler for getting the current axis positions. More...
 
bool(* stream_blocking_callback )(void)
 Check for a soft reset or abort in blocking calls. Set up by core at startup. More...
 
driver_cap_t driver_cap
 Basic driver capabilities flags. More...
 
control_signals_t signals_cap
 Control input signals supported by the driver. More...
 
limit_signals_t limits_cap
 Limit input signals supported by the driver. More...
 
home_signals_t home_cap
 Home input signals supported by the driver. More...
 

Detailed Description

HAL structure used for the driver interface.

This structure contains properties and function pointers (to handlers) that the core uses to communicate with the driver.

Required function pointers has to be set up by the driver in the driver_init() function.

NOTE: Those not marked as optional are required. If not assigned by the driver behaviour is undefined and is likely to cause a controller crash at some point.

Field Documentation

◆ board

char* board

Pointer to optional board name string.

◆ board_url

char* board_url

Pointer to optional URL for the board.

◆ clear_bits_atomic

uint_fast16_t(* clear_bits_atomic) (volatile uint_fast16_t *value, uint_fast16_t v)

Atomically clear bits.

Parameters
valuepointer to 16 bit unsigned integer.
bitsbits to clear.
Returns
value before bits were cleared.

◆ control

Handlers for control switches.

◆ coolant

coolant_ptrs_t coolant

Handlers for coolant.

◆ delay_ms

void(* delay_ms) (uint32_t ms, delay_callback_ptr callback)

Millisecond delay.

If the callback parameter is NULL the call blocks until the delay has expired otherwise it returns immediately and the callback function is called when the timeout expires.

A pending callback can be terminated by calling the function with the delay set to 0 and the callback to NULL.

Parameters
msnumber of milliseconds to delay.
callbackfunction as a delay_callback_ptr function pointer.

◆ driver_axis_settings

uint8_t driver_axis_settings

Currently unused.

◆ driver_cap

driver_cap_t driver_cap

Basic driver capabilities flags.

◆ driver_options

char* driver_options

Pointer to optional comma separated string with driver options.

◆ driver_release

bool(* driver_release) (void)

Optional handler for releasing hardware resources before exiting.

◆ driver_reset

driver_reset_ptr driver_reset

Optional handler, called on soft resets. Set to a dummy handler by the core at startup.

◆ driver_setup

driver_setup_ptr driver_setup

Driver setup handler. Called once by the core after settings has been loaded. The driver should enable MCU peripherals in the provided function.

Parameters
settingspointer to settings_t structure.
Returns
true if completed successfully and the driver supports the settings->version number, false otherwise.

◆ driver_url

char* driver_url

Pointer to optional URL for the driver.

◆ driver_version

char* driver_version

Pointer to driver version date string in YYMMDD format.

◆ encoder

encoder_ptrs_t encoder

Optional handlers for encoder support.

◆ enumerate_pins

enumerate_pins_ptr enumerate_pins

Optional handler for enumerating pins used by the driver.

◆ f_mcu

uint32_t f_mcu

Frequency of MCU in MHz.

◆ f_step_timer

uint32_t f_step_timer

Frequency of main stepper timer in Hz.

◆ get_elapsed_ticks

uint32_t(* get_elapsed_ticks) (void)

Optional handler for getting number of elapsed 1 ms tics since startup. Rolls over every 49.71 days. Required by a number of plugins.

◆ get_free_mem

get_free_mem_ptr get_free_mem

Optional pointer to function for getting free memory (as sum of all free blocks in the heap).

◆ get_micros

uint64_t(* get_micros) (void)

Optional handler for getting number of elapsed 1 us tics since startup. Rolls over every 1.19 hours. Required by a number of plugins.

◆ get_position

bool(* get_position) (int32_t(*position)[N_AXIS])

Optional handler for getting the current axis positions.

Returns
the axis positions in an int32_array.

◆ home_cap

home_signals_t home_cap

Home input signals supported by the driver.

◆ homing

homing_ptrs_t homing

Handlers for homing switches, used by homing cycle.

◆ info

char* info

Pointer to driver info string, typically name of processor/platform.

◆ irq_claim

irq_claim_ptr irq_claim

Optional handler for claiming higher level interrupts. Set to a dummy handler on startup.

◆ irq_disable

void(* irq_disable) (void)

Optional handler to enable global interrupts.

◆ irq_enable

void(* irq_enable) (void)

Optional handler to disable global interrupts.

◆ limits

limits_ptrs_t limits

Handlers for limit switches.

◆ limits_cap

limit_signals_t limits_cap

Limit input signals supported by the driver.

◆ max_step_rate

uint32_t max_step_rate

Currently unused.

◆ nvs

nvs_io_t nvs

Optional handlers for storing/retrieving settings and data to/from non-volatile storage (NVS).

◆ pallet_shuttle

pallet_shuttle_ptr pallet_shuttle

Optional handler for performing a pallet shuttle on program end (M60).

◆ periph_port

periph_port_t periph_port

Optional handlers for peripheral pin registration.

◆ port

io_port_t port

Optional handlers for axuillary I/O (adds support for M62-M66).

◆ probe

probe_ptrs_t probe

Optional handlers for probe input(s).

◆ reboot

void(* reboot) (void)

Optoional handler for rebooting the controller. This will be called when ASCII_ESC followed by CMD_REBOOT is received.

◆ rgb0

rgb_ptr_t rgb0

Optional handler for RGB output to LEDs (neopixels) or lamps.

◆ rgb1

rgb_ptr_t rgb1

Optional handler for RGB output to LEDs (neopixels) or lamps.

◆ rtc

Optional handlers for real time clock (RTC).

◆ rx_buffer_size

uint32_t rx_buffer_size

Input stream buffer size in bytes.

◆ set_bits_atomic

void(* set_bits_atomic) (volatile uint_fast16_t *value, uint_fast16_t bits)

Atomically set bits.

Parameters
valuepointer to 16 bit unsigned integer.
bitsbits to set.

◆ set_value_atomic

uint_fast16_t(* set_value_atomic) (volatile uint_fast16_t *value, uint_fast16_t bits)

Atomically set value.

Parameters
valuepointer to 16 bit unsigned integer.
vvalue to set.
Returns
value before value were set.

◆ settings_changed

settings_changed_ptr settings_changed

Callback handler to be called on settings loaded or settings changed events.

◆ signals_cap

control_signals_t signals_cap

Control input signals supported by the driver.

◆ spindle_data

spindle_data_ptrs_t spindle_data

Handlers for getting/resetting spindle data (RPM, angular position, ...).

◆ stepper

Handlers for stepper motors.

◆ stream

io_stream_t stream

Handlers for stream I/O.

◆ stream_blocking_callback

bool(* stream_blocking_callback) (void)

Check for a soft reset or abort in blocking calls. Set up by core at startup.

Typically called from stream output functions when the output buffer is full and they are blocking waiting for space in the buffer to become available.

Returns
false when the blocking loop should exit, true otherwise.

◆ tool

Optional handlers for tool changes.

◆ user_mcode

user_mcode_ptrs_t user_mcode

Optional handlers for user defined M-codes.

◆ version

uint32_t version

HAL version, set by the core. Driver should check against this in the driver_init() function.


The documentation for this struct was generated from the following file: