grblHAL core  20261008
hal.h
Go to the documentation of this file.
1 /*
2  hal.h - HAL (Hardware Abstraction Layer) entry points structures and capabilities type
3 
4  Part of grblHAL
5 
6  Copyright (c) 2016-2026 Terje Io
7 
8  grblHAL is free software: you can redistribute it and/or modify
9  it under the terms of the GNU General Public License as published by
10  the Free Software Foundation, either version 3 of the License, or
11  (at your option) any later version.
12 
13  grblHAL is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  GNU General Public License for more details.
17 
18  You should have received a copy of the GNU General Public License
19  along with grblHAL. If not, see <http://www.gnu.org/licenses/>.
20 */
21 
26 #ifndef _HAL_H_
27 #define _HAL_H_
28 
29 #include <time.h>
30 
31 #include "grbl.h"
32 #include "core_handlers.h"
33 #include "gcode.h"
34 #include "coolant_control.h"
35 #include "spindle_control.h"
36 #include "crossbar.h"
37 #include "stepper.h"
38 #include "nvs.h"
39 #include "probe.h"
40 #include "ioports.h"
41 #include "rgb.h"
42 #include "plugins.h"
43 
44 #define HAL_VERSION 10
45 
46 // Bitmap flags for driver capabilities, to be set by driver in driver_init() or plugins,
47 // flags may be cleared by plugins or the core to switch off capabilities.
48 typedef union {
49  uint32_t value;
50  struct {
51  uint32_t software_debounce :1,
59  sd_card :1,
63  wifi :1,
67  atc :1,
72  probe :1,
73  probe2 :1,
75  rtc :1,
76  rtc_set :1,
78  modbus_rtu :1, // Modbus RTU stream is enabled.
80  };
81 } driver_cap_t;
82 
83 
86 
88 typedef void (*driver_reset_ptr)(void);
89 
91 typedef uint32_t (*get_free_mem_ptr)(void);
92 
96 typedef void (*register_periph_pin_ptr)(const periph_pin_t *pin);
97 
103 typedef void (*set_periph_pin_description_ptr)(const pin_function_t function, const pin_group_t group, const char *description);
104 
105 typedef struct {
108 } periph_port_t;
109 
114 typedef void (*pin_info_ptr)(xbar_t *pin, void *data);
115 
122 typedef void (*enumerate_pins_ptr)(bool low_level, pin_info_ptr callback, void *data);
123 
124 
125 /*************
126  * Coolant *
127  *************/
128 
132 typedef void (*coolant_set_state_ptr)(coolant_state_t state);
133 
138 
140 typedef struct {
144 
145 
146 /********************
147  * Limit switches *
148  ********************/
149 
154 typedef void (*limits_enable_ptr)(bool on, axes_signals_t homing_cycle);
155 
160 
165 
167 typedef struct {
171 } limits_ptrs_t;
172 
173 
174 /************
175  * Homing *
176  ************/
177 
183 
185 typedef struct {
188 } homing_ptrs_t;
189 
190 /*****************************
191  * Control signal switches *
192  *****************************/
193 
198 
203 
205 typedef struct {
209 
210 
211 /**************
212  * Steppers *
213  **************/
214 
218 typedef union {
219  uint32_t value;
220  struct {
221  uint32_t id : 8,
222  axis : 8;
223  };
224 } motor_map_t;
225 
230 
231 
237 
238 
243 typedef void (*stepper_wake_up_ptr)(void);
244 
245 
252 typedef void (*stepper_go_idle_ptr)(bool clear_signals);
253 
261 typedef void (*stepper_enable_ptr)(axes_signals_t enable, bool hold);
262 
271 
280 typedef void (*stepper_cycles_per_tick_ptr)(uint32_t cycles_per_tick);
281 
296 
306 typedef void (*stepper_output_step_ptr)(axes_signals_t step_outbits, axes_signals_t dir_outbits);
307 
312 typedef axes_signals_t (*stepper_get_ganged_ptr)(bool auto_squared);
313 
319 typedef void (*stepper_claim_motor_ptr)(uint_fast8_t axis_id, bool claim);
320 
326 typedef stepper_status_t (*stepper_status_ptr)(bool reset);
327 
332 typedef void (*stepper_interrupt_callback_ptr)(void);
333 
335 typedef struct {
349 
350 
351 /**************
352  * ms delay *
353  **************/
354 
356 typedef void (*delay_callback_ptr)(void);
357 
359 typedef struct {
360  volatile uint32_t ms;
362 } delay_t;
363 
364 
365 /************
366  * Probes *
367  ************/
368 
375 
380 typedef bool (*probe_is_triggered_ptr)(probe_id_t probe_id);
381 
386 typedef void (*probe_configure_ptr)(bool is_probe_away, bool probing);
387 
392 typedef bool (*probe_select_ptr)(probe_id_t probe_id);
393 
399 
404 typedef void (*probe_connected_toggle_ptr)(void);
405 
407 typedef struct {
414 } probe_ptrs_t;
415 
416 
417 /*******************************
418  * Tool selection and change *
419  *******************************/
420 
421 typedef enum {
422  ATC_None = 0,
424  ATC_Online
426 
431 typedef void (*tool_select_ptr)(tool_data_t *tool, bool next);
432 
437 
442 
449 typedef struct {
453 } tool_ptrs_t;
454 
458 typedef void (*spindle_encoder_on_index_ptr)(int32_t count);
459 
460 //****
461 
467 typedef bool (*irq_claim_ptr)(irq_type_t irq, uint_fast8_t id, irq_callback_ptr callback);
468 
469 /************
470  * Timers *
471  ************/
472 
473 typedef void *hal_timer_t;
474 
475 typedef enum {
480 
481 typedef union {
482  uint16_t value;
483  struct {
484  uint16_t periodic :1,
486  up :1,
487  comp1 :1,
488  comp2 :1,
489  comp3 :1,
490  ext_clk :1,
491  encoder :1,
492  unused :7;
493  };
494 } timer_cap_t;
495 
496 typedef void (*timer_irq_handler_ptr)(void *context);
497 
498 typedef struct {
499  void *context;
500  bool single_shot;
502  uint32_t period;
504  uint32_t irq0;
506  uint32_t irq1;
508  uint32_t irq2;
510 } timer_cfg_t;
511 
517 typedef hal_timer_t (*timer_claim_ptr)(timer_cap_t cap, uint32_t timebase);
518 
524 typedef bool (*timer_cfg_ptr)(hal_timer_t timer, timer_cfg_t *cfg);
525 
531 typedef bool (*timer_start_ptr)(hal_timer_t timer, uint32_t period);
532 
537 typedef bool (*timer_stop_ptr)(hal_timer_t timer);
538 
539 typedef struct {
544 } timer_ptrs_t;
545 
546 /**************************
547  * RTC (Real Time Clock *
548  **************************/
549 typedef bool (*rtc_get_time_ptr)(struct timeval *time);
554 
559 typedef bool (*rtc_get_datetime_ptr)(struct tm *datetime);
560 
565 typedef bool (*rtc_set_datetime_ptr)(struct tm *datetime);
566 
567 typedef struct {
571 } rtc_ptrs_t;
572 
573 
574 
577 typedef void (*pallet_shuttle_ptr)(void);
578 
588 typedef struct {
589  uint32_t version;
590  char *info;
593  char *driver_url;
594  char *board;
595  char *board_url;
596  float step_us_min;
597  uint32_t f_step_timer;
598  uint32_t f_mcu;
599  uint32_t rx_buffer_size;
600  uint32_t max_step_rate;
602 
605 
612 
622  void (*delay_ms)(uint32_t ms, delay_callback_ptr callback);
623 
628  void (*set_bits_atomic)(volatile uint_fast16_t *value, uint_fast16_t bits);
629 
635  uint_fast16_t (*clear_bits_atomic)(volatile uint_fast16_t *value, uint_fast16_t v);
636 
642  uint_fast16_t (*set_value_atomic)(volatile uint_fast16_t *value, uint_fast16_t bits);
643 
645  void (*irq_enable)(void);
646 
648  void (*irq_disable)(void);
649 
652 
671  bool (*driver_release)(void);
672  uint32_t (*get_elapsed_ticks)(void);
673  uint64_t (*get_micros)(void);
675  void (*reboot)(void);
676 
678 
682  bool (*get_position)(int32_t (*position)[N_AXIS]);
683 
684 #ifdef DEBUGOUT
685  void (*debug_out)(bool on);
686  io_stream_t debug;
687 #endif
688 
696  bool (*stream_blocking_callback)(void);
697 
706 } grbl_hal_t;
707 
708 extern grbl_hal_t hal;
709 
720 extern bool driver_init (void);
721 
722 #endif
#define N_AXIS
Defines number of axes supported - minimum 3, maximum 8. If more than 3 axes are configured a complia...
Definition: config.h:42
core function pointers and data structures definitions.
bool(* irq_callback_ptr)(uint_fast8_t id, bool level)
Definition: crossbar.h:714
pin_function_t
Definition: crossbar.h:43
pin_group_t
Definition: crossbar.h:652
irq_type_t
Definition: crossbar.h:709
status_code_t
Definition: errors.h:31
DCRAM parser_state_t gc_state
Definition: gcode.c:93
void(* stepper_enable_ptr)(axes_signals_t enable, bool hold)
Pointer to function for enabling/disabling stepper motors.
Definition: hal.h:261
status_code_t(* tool_change_ptr)(parser_state_t *gc_state)
Pointer to function for executing a tool change.
Definition: hal.h:436
void * hal_timer_t
Timer handle, actual type defined by driver implementation.
Definition: hal.h:473
void(* delay_callback_ptr)(void)
Signature of delay callback functions.
Definition: hal.h:356
home_signals_t(* home_get_state_ptr)(void)
Pointer to function for getting home switches state.
Definition: hal.h:181
void(* stepper_disable_motors_ptr)(axes_signals_t axes, squaring_mode_t mode)
Pointer to function for enabling/disabling step signals for individual motors.
Definition: hal.h:270
coolant_state_t(* coolant_get_state_ptr)(void)
Pointer to function for getting the coolant state.
Definition: hal.h:137
void(* probe_connected_toggle_ptr)(void)
Pointer to function for toggling probe connected status. If the driver does not support a probe conne...
Definition: hal.h:404
hal_timer_t(* timer_claim_ptr)(timer_cap_t cap, uint32_t timebase)
Pointer to function for claiming a timer.
Definition: hal.h:517
atc_status_t(* atc_get_state_ptr)(void)
Pointer to function for checking ATC status.
Definition: hal.h:441
bool(* rtc_get_time_ptr)(struct timeval *time)
Pointer to function for getting the current time.
Definition: hal.h:553
void(* motor_iterator_ptr)(motor_iterator_callback_ptr callback)
Pointer to function for iterating over stepper motor vs. axis mappings.
Definition: hal.h:236
bool(* probe_is_triggered_ptr)(probe_id_t probe_id)
Pointer to function for getting triggered status for a specific probe.
Definition: hal.h:380
void(* motor_iterator_callback_ptr)(motor_map_t motor)
Signature of the callback function to receive motor vs. axis mappings.
Definition: hal.h:229
void(* pin_info_ptr)(xbar_t *pin, void *data)
Pointer to callback function for pin enumerations.
Definition: hal.h:114
void(* driver_reset_ptr)(void)
Pointer to function to be called when a soft reset occurs.
Definition: hal.h:88
void(* coolant_set_state_ptr)(coolant_state_t state)
Pointer to function for setting the coolant state.
Definition: hal.h:132
void(* limits_enable_ptr)(bool on, axes_signals_t homing_cycle)
Pointer to function for enabling/disabling limit switches functionality.
Definition: hal.h:154
bool(* timer_cfg_ptr)(hal_timer_t timer, timer_cfg_t *cfg)
Pointer to function for configuring a timer.
Definition: hal.h:524
limit_signals_t(* limits_get_state_ptr)(void)
Pointer to function for getting limit switches state.
Definition: hal.h:159
uint32_t(* get_free_mem_ptr)(void)
Pointer to function for getting free memory (as sum of all free blocks in the heap).
Definition: hal.h:91
bool(* driver_setup_ptr)(settings_t *settings)
Pointer to function called to set up driver peripherals after settings are loaded.
Definition: hal.h:85
void(* spindle_encoder_on_index_ptr)(int32_t count)
Pointer to callback function to receive spindle encoder index events.
Definition: hal.h:458
void(* timer_irq_handler_ptr)(void *context)
Definition: hal.h:496
void(* stepper_cycles_per_tick_ptr)(uint32_t cycles_per_tick)
Pointer to function for setting the step pulse interrupt rate for the next motion segment.
Definition: hal.h:280
float(* homing_get_feedrate_ptr)(axes_signals_t axes, homing_mode_t mode)
Definition: hal.h:182
void(* stepper_claim_motor_ptr)(uint_fast8_t axis_id, bool claim)
Pointer to function for claiming/releasing motor(s) from/to normal step/dir signalling.
Definition: hal.h:319
void(* stepper_output_step_ptr)(axes_signals_t step_outbits, axes_signals_t dir_outbits)
Pointer to function for outputting a single step pulse and direction signal.
Definition: hal.h:306
void(* pallet_shuttle_ptr)(void)
Pointer to function for performing a pallet shuttle.
Definition: hal.h:577
void(* stepper_interrupt_callback_ptr)(void)
Pointer to callback function for outputting the next direction and step pulse signals....
Definition: hal.h:332
bool(* rtc_get_datetime_ptr)(struct tm *datetime)
Pointer to function for setting the current datetime.
Definition: hal.h:559
void(* tool_select_ptr)(tool_data_t *tool, bool next)
Pointer to function for selecting a tool.
Definition: hal.h:431
control_signals_t(* control_signals_get_state_ptr)(void)
Pointer to function for getting control switches state.
Definition: hal.h:197
void(* stepper_go_idle_ptr)(bool clear_signals)
Pointer to function for disabling the main stepper interrupt.
Definition: hal.h:252
bool(* irq_claim_ptr)(irq_type_t irq, uint_fast8_t id, irq_callback_ptr callback)
Pointer to function for claiming higher level interrupt requests (irq).
Definition: hal.h:467
void(* control_signals_callback_ptr)(control_signals_t signals)
Pointer to callback function for reporting control switches events (interrupts). Set by the core on s...
Definition: hal.h:202
void(* enumerate_pins_ptr)(bool low_level, pin_info_ptr callback, void *data)
Pointer to function for enumerate pin information.
Definition: hal.h:122
void(* limit_interrupt_callback_ptr)(limit_signals_t state)
Pointer to callback function for reporting limit switches events (interrupts). Set by the core on sta...
Definition: hal.h:164
void(* stepper_pulse_start_ptr)(stepper_t *stepper)
Pointer to function for setting up steppers for the next step pulse.
Definition: hal.h:295
probe_flags_t(* probe_get_caps_ptr)(probe_id_t probe_id)
Pointer to function for getting probe capabilities.
Definition: hal.h:398
bool(* probe_select_ptr)(probe_id_t probe_id)
Pointer to function for selecting probe input.
Definition: hal.h:392
void(* set_periph_pin_description_ptr)(const pin_function_t function, const pin_group_t group, const char *description)
Pointer to function for setting pin description for a peripheral pin.
Definition: hal.h:103
void(* probe_configure_ptr)(bool is_probe_away, bool probing)
Pointer to function for setting probe operation mode.
Definition: hal.h:386
stepper_status_t(* stepper_status_ptr)(bool reset)
Pointer to function for querying or resetting stepper driver status.
Definition: hal.h:326
grbl_hal_t hal
Global HAL struct.
Definition: grbllib.c:75
timer_resolution_t
Definition: hal.h:475
@ Timer_16bit
Definition: hal.h:476
@ Timer_64bit
Definition: hal.h:478
@ Timer_32bit
Definition: hal.h:477
atc_status_t
Definition: hal.h:421
@ ATC_Offline
Definition: hal.h:423
@ ATC_None
Definition: hal.h:422
@ ATC_Online
Definition: hal.h:424
probe_state_t(* probe_get_state_ptr)(void)
Pointer to function for getting probe status.
Definition: hal.h:374
void(* register_periph_pin_ptr)(const periph_pin_t *pin)
Pointer to function for registering information about a peripheral pin.
Definition: hal.h:96
bool(* rtc_set_datetime_ptr)(struct tm *datetime)
Pointer to function for setting the current datetime.
Definition: hal.h:565
void(* stepper_wake_up_ptr)(void)
Pointer to function for enabling all stepper motors and the main stepper interrupt.
Definition: hal.h:243
bool(* timer_stop_ptr)(hal_timer_t timer)
Pointer to function for stopping a running timer.
Definition: hal.h:537
bool driver_init(void)
Driver main entry point. This will be called once by the core after the HAL structure has been nulled...
bool(* timer_start_ptr)(hal_timer_t timer, uint32_t period)
Pointer to function for starting a timer.
Definition: hal.h:531
axes_signals_t(* stepper_get_ganged_ptr)(bool auto_squared)
Pointer to function for getting which axes are configured for auto squaring.
Definition: hal.h:312
homing_mode_t
Definition: machine_limits.h:30
probe_id_t
Definition: probe.h:38
settings_t settings
Definition: settings.c:48
squaring_mode_t
Definition: stepper.h:29
Control switches handlers.
Definition: hal.h:205
control_signals_get_state_ptr get_state
Handler for getting limit switches status.
Definition: hal.h:206
control_signals_callback_ptr interrupt_callback
Callback for informing about control switches events. _Set by the core at startup.
Definition: hal.h:207
Handlers for coolant support.
Definition: hal.h:140
coolant_get_state_ptr get_state
Handler for getting coolant state.
Definition: hal.h:142
coolant_set_state_ptr set_state
Handler for setting coolant state.
Definition: hal.h:141
Delay struct, currently not used by core - may be used by drivers.
Definition: hal.h:359
volatile uint32_t ms
Definition: hal.h:360
delay_callback_ptr callback
Definition: hal.h:361
HAL structure used for the driver interface.
Definition: hal.h:588
home_signals_t home_cap
Home input signals supported by the driver.
Definition: hal.h:702
uint32_t rx_buffer_size
Input stream buffer size in bytes.
Definition: hal.h:599
char * driver_version
Pointer to driver version date string in YYMMDD format.
Definition: hal.h:591
control_signals_ptrs_t control
Handlers for control switches.
Definition: hal.h:655
homing_ptrs_t homing
Handlers for homing switches, used by homing cycle.
Definition: hal.h:654
nvs_io_t nvs
Optional handlers for storing/retrieving settings and data to/from non-volatile storage (NVS).
Definition: hal.h:669
io_stream_t stream
Handlers for stream I/O.
Definition: hal.h:659
uint32_t max_step_rate
Currently unused.
Definition: hal.h:600
spindle_data_ptrs_t spindle_data
Handlers for getting/resetting spindle data (RPM, angular position, ...).
Definition: hal.h:657
char * board
Pointer to optional board name string.
Definition: hal.h:594
uint8_t driver_axis_settings
Currently unused.
Definition: hal.h:601
char * info
Pointer to driver info string, typically name of processor/platform.
Definition: hal.h:590
coolant_ptrs_t coolant
Handlers for coolant.
Definition: hal.h:656
enumerate_pins_ptr enumerate_pins
Optional handler for enumerating pins used by the driver.
Definition: hal.h:670
get_free_mem_ptr get_free_mem
Optional pointer to function for getting free memory (as sum of all free blocks in the heap).
Definition: hal.h:604
periph_port_t periph_port
Optional handlers for peripheral pin registration.
Definition: hal.h:667
limit_signals_t limits_cap
Limit input signals supported by the driver.
Definition: hal.h:701
rtc_ptrs_t rtc
Optional handlers for real time clock (RTC).
Definition: hal.h:663
timer_ptrs_t timer
Optional handlers for claiming and controlling timers.
Definition: hal.h:662
char * board_url
Pointer to optional URL for the board.
Definition: hal.h:595
limits_ptrs_t limits
Handlers for limit switches.
Definition: hal.h:653
rgb_ptr_t rgb0
Optional handler for RGB output to LEDs (neopixels) or lamps.
Definition: hal.h:665
uint32_t f_step_timer
Frequency of main stepper timer in Hz.
Definition: hal.h:597
coolant_state_t coolant_cap
Coolant outputs supported by the driver.
Definition: hal.h:703
stepper_ptrs_t stepper
Handlers for stepper motors.
Definition: hal.h:658
uint32_t f_mcu
Frequency of MCU in MHz.
Definition: hal.h:598
driver_setup_ptr driver_setup
Driver setup handler. Called once by the core after settings has been loaded. The driver should enabl...
Definition: hal.h:611
irq_claim_ptr irq_claim
Optional handler for claiming higher level interrupts. Set to a dummy handler on startup.
Definition: hal.h:651
control_signals_t signals_pullup_disable_cap
Control input signals pullup disable supported by the driver.
Definition: hal.h:700
tool_ptrs_t tool
Optional handlers for tool changes.
Definition: hal.h:661
char * driver_url
Pointer to optional URL for the driver.
Definition: hal.h:593
driver_cap_t driver_cap
Basic driver capabilities flags.
Definition: hal.h:698
driver_reset_ptr driver_reset
Optional handler, called on soft resets. Set to a dummy handler by the core at startup.
Definition: hal.h:668
float step_us_min
Minimum step pulse width (microseconds).
Definition: hal.h:596
io_port_t port
Optional handlers for axuillary I/O (adds support for M62-M66).
Definition: hal.h:664
uint32_t version
HAL version, set by the core. Driver should check against this in the driver_init() function.
Definition: hal.h:589
home_signals_t motor_warning_cap
Motor warning input signals (per motor) supported by the driver.
Definition: hal.h:704
char * driver_options
Pointer to optional comma separated string with driver options.
Definition: hal.h:592
rgb_ptr_t rgb1
Optional handler for RGB output to LEDs (neopixels) or lamps.
Definition: hal.h:666
control_signals_t signals_cap
Control input signals supported by the driver.
Definition: hal.h:699
pallet_shuttle_ptr pallet_shuttle
Optional handler for performing a pallet shuttle on program end (M60).
Definition: hal.h:674
home_signals_t motor_fault_cap
Motor fault input signals (per motor) supported by the driver.
Definition: hal.h:705
probe_ptrs_t probe
Optional handlers for probe input(s).
Definition: hal.h:660
spindle_encoder_on_index_ptr spindle_encoder_on_index
Optional handler (callback) to receive spindle encoder index event.
Definition: hal.h:677
Home switches struct, consists of two packed axes_signals_t structs.
Definition: nuts_bolts.h:417
Limit switches handler for homing cycle.
Definition: hal.h:185
home_get_state_ptr get_state
Handler for getting homing switches status. Usually read from hal.limits.get_state.
Definition: hal.h:186
homing_get_feedrate_ptr get_feedrate
Definition: hal.h:187
Properties and handlers for auxiliary digital and analog I/O.
Definition: ioports.h:164
Properties and handlers for stream I/O.
Definition: stream.h:360
Limit switches handlers.
Definition: hal.h:167
limits_enable_ptr enable
Handler for enabling limits handling mode.
Definition: hal.h:168
limits_get_state_ptr get_state
Handler for getting limit switches status.
Definition: hal.h:169
limit_interrupt_callback_ptr interrupt_callback
Callback for informing about limit switches events. Set by the core at startup.
Definition: hal.h:170
Handler functions and variables for NVS storage of settings and data.
Definition: nvs.h:145
Parser state.
Definition: gcode.h:698
Definition: crossbar.h:904
Definition: hal.h:105
set_periph_pin_description_ptr set_pin_description
Optional handler for setting a description of a peripheral pin.
Definition: hal.h:107
register_periph_pin_ptr register_pin
Opional handler for registering information about a peripheral pin (with the driver).
Definition: hal.h:106
Handlers for probe input(s).
Definition: hal.h:407
probe_is_triggered_ptr is_triggered
Optional handler for getting probe triggered status.
Definition: hal.h:410
probe_configure_ptr configure
Optional handler for setting probe operation mode.
Definition: hal.h:408
probe_connected_toggle_ptr connected_toggle
Optional handler for toggling probe connected status.
Definition: hal.h:413
probe_select_ptr select
Optional handler for selecting probe to use.
Definition: hal.h:411
probe_get_caps_ptr get_caps
Optional handler for getting probe capabilities.
Definition: hal.h:412
probe_get_state_ptr get_state
Optional handler for getting probe status. Called from interrupt context.
Definition: hal.h:409
Definition: rgb.h:74
Definition: hal.h:567
rtc_set_datetime_ptr set_datetime
Optional handler setting the current datetime.
Definition: hal.h:570
rtc_get_time_ptr get_time
Optional handler getting the current time.
Definition: hal.h:568
rtc_get_datetime_ptr get_datetime
Optional handler getting the current datetime.
Definition: hal.h:569
Definition: settings.h:903
Definition: spindle_control.h:373
Stepper motor handlers.
Definition: hal.h:335
stepper_get_ganged_ptr get_ganged
Optional handler getting which axes are configured for ganging or auto squaring.
Definition: hal.h:343
stepper_enable_ptr enable
Handler for enabling/disabling stepper motor power for individual motors. Called from interrupt conte...
Definition: hal.h:338
stepper_cycles_per_tick_ptr cycles_per_tick
Handler for setting the step pulse rate for the next motion segment. Called from interrupt context.
Definition: hal.h:340
stepper_output_step_ptr output_step
Optional handler for outputting a single step pulse. Experimental. Called from interrupt context.
Definition: hal.h:345
stepper_interrupt_callback_ptr interrupt_callback
Callback for informing about the next step pulse to output. Set by the core at startup.
Definition: hal.h:342
stepper_pulse_start_ptr pulse_start
Handler for starting outputting direction signals and a step pulse. Called from interrupt context.
Definition: hal.h:341
stepper_wake_up_ptr wake_up
Handler for enabling stepper motor power and main stepper interrupt.
Definition: hal.h:336
motor_iterator_ptr motor_iterator
Optional handler iteration over motor vs. axis mappings. Required for the motors plugin (Trinamic dri...
Definition: hal.h:346
stepper_claim_motor_ptr claim_motor
Optional handler for claiming/releasing motor(s) from normal step/dir control.
Definition: hal.h:344
stepper_status_ptr status
Optional handler handler for querying steppper driver status or attempting to reset it.
Definition: hal.h:347
stepper_go_idle_ptr go_idle
Handler for disabling main stepper interrupt and optionally reset stepper signals....
Definition: hal.h:337
stepper_disable_motors_ptr disable_motors
Optional handler for enabling/disabling stepper motor step signals for individual motors.
Definition: hal.h:339
// Stepper driver warning and fault signal states, consists of two packed stepper_state_t structs in ...
Definition: nuts_bolts.h:429
Stepper ISR data struct. Contains the running data for the main stepper ISR.
Definition: stepper.h:84
Definition: hal.h:498
uint32_t irq1
Compare value for compare interrupt 1.
Definition: hal.h:506
bool encoder_mode
Set to true if timer is in encoder mode.
Definition: hal.h:501
timer_irq_handler_ptr irq1_callback
Pointer to compare interrupt 1 callback.
Definition: hal.h:507
uint32_t period
Current value for period register.
Definition: hal.h:502
timer_irq_handler_ptr irq0_callback
Pointer to compare interrupt 0 callback.
Definition: hal.h:505
timer_irq_handler_ptr timeout_callback
Pointer to main timeout callback.
Definition: hal.h:503
uint32_t irq2
Compare value for compare interrupt 2.
Definition: hal.h:508
bool single_shot
Set to true if timer is single shot.
Definition: hal.h:500
void * context
Pointer to data to be passed on to the interrupt handlers.
Definition: hal.h:499
timer_irq_handler_ptr irq2_callback
Pointer to compare interrupt 1 callback.
Definition: hal.h:509
uint32_t irq0
Compare value for compare interrupt 0.
Definition: hal.h:504
Definition: hal.h:539
timer_stop_ptr stop
Definition: hal.h:543
timer_start_ptr start
Definition: hal.h:542
timer_claim_ptr claim
Definition: hal.h:540
timer_cfg_ptr configure
Definition: hal.h:541
Definition: vfs.h:50
Tool data.
Definition: gcode.h:632
Handlers for tool changes.
Definition: hal.h:449
tool_change_ptr change
Optional handler for executing a tool change (M6).
Definition: hal.h:451
atc_get_state_ptr atc_get_state
Optional handler for checking ATC status.
Definition: hal.h:452
tool_select_ptr select
Optional handler for selecting a tool.
Definition: hal.h:450
Definition: crossbar.h:887
Definition: nuts_bolts.h:249
Definition: nuts_bolts.h:437
Definition: coolant_control.h:27
Definition: hal.h:48
uint32_t bltouch_probe
Definition: hal.h:77
uint32_t odometers
Definition: hal.h:69
uint32_t limits_pull_up
Pullup resistors for limit inputs are are supported.
Definition: hal.h:53
uint32_t laser_ppi_mode
Laser PPI (Pulses Per Inch) mode is supported.
Definition: hal.h:66
uint32_t probe2
2nd or 3rd probe input is supported.
Definition: hal.h:73
uint32_t spindle_encoder_index_event
Spindle encoder is supported.
Definition: hal.h:57
uint32_t unassigned
Definition: hal.h:79
uint32_t probe_latch
Deprecated.
Definition: hal.h:71
uint32_t atc
Automatic tool changer (ATC) is supported.
Definition: hal.h:67
uint32_t bluetooth
Definition: hal.h:61
uint32_t pwm_spindle
Definition: hal.h:70
uint32_t spindle_encoder
Spindle encoder is supported.
Definition: hal.h:56
uint32_t ethernet
Definition: hal.h:62
uint32_t spindle_sync
Spindle synced motion is supported.
Definition: hal.h:58
uint32_t mpg_mode
Definition: hal.h:65
uint32_t software_debounce
Software debounce of input switches signals is supported.
Definition: hal.h:51
uint32_t sd_card
Definition: hal.h:59
uint32_t step_pulse_delay
Stepper step pulse delay is supported.
Definition: hal.h:52
uint32_t wifi
Definition: hal.h:63
uint32_t rtc_set
Definition: hal.h:76
uint32_t modbus_rtu
Definition: hal.h:78
uint32_t no_gcode_message_handling
Definition: hal.h:68
uint32_t spindle_pid
Definition: hal.h:64
uint32_t control_pull_up
Pullup resistors for control inputs are supported.
Definition: hal.h:54
uint32_t rtc
Definition: hal.h:75
uint32_t probe
Primary (default) probe input is supported.
Definition: hal.h:72
uint32_t value
All bitmap flags.
Definition: hal.h:49
uint32_t littlefs
Definition: hal.h:60
uint32_t probe_pull_up
Pullup resistors for probe inputs are supported.
Definition: hal.h:55
uint32_t toolsetter
Toolsetter (2nd probe) input is supported.
Definition: hal.h:74
Limit switches struct, consists of four packed axes_signals_t structs in 32 bits.
Definition: nuts_bolts.h:406
Motor vs. axis mapping NOTE: id and axis values are equal for primary motors, unequal for secondary (...
Definition: hal.h:218
uint32_t axis
Definition: hal.h:222
uint32_t id
Definition: hal.h:221
uint32_t value
Definition: hal.h:219
Definition: probe.h:59
Definition: probe.h:44
Definition: hal.h:481
uint16_t resolution
timer_resolution_t
Definition: hal.h:485
uint16_t up
Timer supports upcounting.
Definition: hal.h:486
uint16_t unused
Definition: hal.h:492
uint16_t comp1
Timer supports compare interrupt 0.
Definition: hal.h:487
uint16_t encoder
Encoder mode supported.
Definition: hal.h:491
uint16_t comp3
Timer supports compare interrupt 2.
Definition: hal.h:489
uint16_t value
All bitmap flags.
Definition: hal.h:482
uint16_t ext_clk
External clock supported.
Definition: hal.h:490
uint16_t comp2
Timer supports compare interrupt 1.
Definition: hal.h:488
uint16_t periodic
Definition: hal.h:484