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... | |
timer_ptrs_t | timer |
Optional handlers for claiming and controlling timers. 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... | |
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... | |
void(* | debug_out )(bool on) |
io_stream_t | debug |
Handlers for debug stream I/O. 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... | |
coolant_state_t | coolant_cap |
Coolant outputs supported by the driver. More... | |
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.
char* board |
Pointer to optional board name string.
char* board_url |
Pointer to optional URL for the board.
uint_fast16_t(* clear_bits_atomic) (volatile uint_fast16_t *value, uint_fast16_t v) |
Atomically clear bits.
value | pointer to 16 bit unsigned integer. |
bits | bits to clear. |
control_signals_ptrs_t control |
Handlers for control switches.
coolant_ptrs_t coolant |
Handlers for coolant.
coolant_state_t coolant_cap |
Coolant outputs supported by the driver.
io_stream_t debug |
Handlers for debug stream I/O.
void(* debug_out) (bool on) |
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.
ms | number of milliseconds to delay. |
callback | function as a delay_callback_ptr function pointer. |
uint8_t driver_axis_settings |
Currently unused.
driver_cap_t driver_cap |
Basic driver capabilities flags.
char* driver_options |
Pointer to optional comma separated string with driver options.
bool(* driver_release) (void) |
Optional handler for releasing hardware resources before exiting.
driver_reset_ptr driver_reset |
Optional handler, called on soft resets. Set to a dummy handler by the core at startup.
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.
settings | pointer to settings_t structure. |
char* driver_url |
Pointer to optional URL for the driver.
char* driver_version |
Pointer to driver version date string in YYMMDD format.
encoder_ptrs_t encoder |
Optional handlers for encoder support.
enumerate_pins_ptr enumerate_pins |
Optional handler for enumerating pins used by the driver.
uint32_t f_mcu |
Frequency of MCU in MHz.
uint32_t f_step_timer |
Frequency of main stepper timer in Hz.
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_ptr get_free_mem |
Optional pointer to function for getting free memory (as sum of all free blocks in the heap).
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.
bool(* get_position) (int32_t(*position)[N_AXIS]) |
Optional handler for getting the current axis positions.
home_signals_t home_cap |
Home input signals supported by the driver.
homing_ptrs_t homing |
Handlers for homing switches, used by homing cycle.
char* info |
Pointer to driver info string, typically name of processor/platform.
irq_claim_ptr irq_claim |
Optional handler for claiming higher level interrupts. Set to a dummy handler on startup.
void(* irq_disable) (void) |
Optional handler to enable global interrupts.
void(* irq_enable) (void) |
Optional handler to disable global interrupts.
limits_ptrs_t limits |
Handlers for limit switches.
limit_signals_t limits_cap |
Limit input signals supported by the driver.
uint32_t max_step_rate |
Currently unused.
nvs_io_t nvs |
Optional handlers for storing/retrieving settings and data to/from non-volatile storage (NVS).
pallet_shuttle_ptr pallet_shuttle |
Optional handler for performing a pallet shuttle on program end (M60).
periph_port_t periph_port |
Optional handlers for peripheral pin registration.
io_port_t port |
Optional handlers for axuillary I/O (adds support for M62-M66).
probe_ptrs_t probe |
Optional handlers for probe input(s).
void(* reboot) (void) |
Optoional handler for rebooting the controller. This will be called when ASCII_ESC followed by CMD_REBOOT is received.
rgb_ptr_t rgb0 |
Optional handler for RGB output to LEDs (neopixels) or lamps.
rgb_ptr_t rgb1 |
Optional handler for RGB output to LEDs (neopixels) or lamps.
rtc_ptrs_t rtc |
Optional handlers for real time clock (RTC).
uint32_t rx_buffer_size |
Input stream buffer size in bytes.
void(* set_bits_atomic) (volatile uint_fast16_t *value, uint_fast16_t bits) |
Atomically set bits.
value | pointer to 16 bit unsigned integer. |
bits | bits to set. |
uint_fast16_t(* set_value_atomic) (volatile uint_fast16_t *value, uint_fast16_t bits) |
Atomically set value.
value | pointer to 16 bit unsigned integer. |
v | value to set. |
settings_changed_ptr settings_changed |
Callback handler to be called on settings loaded or settings changed events.
control_signals_t signals_cap |
Control input signals supported by the driver.
spindle_data_ptrs_t spindle_data |
Handlers for getting/resetting spindle data (RPM, angular position, ...).
Handlers for stepper motors.
io_stream_t stream |
Handlers for stream I/O.
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.
timer_ptrs_t timer |
Optional handlers for claiming and controlling timers.
tool_ptrs_t tool |
Optional handlers for tool changes.
uint32_t version |
HAL version, set by the core. Driver should check against this in the driver_init() function.