grblHAL core  20251016
probe.h
Go to the documentation of this file.
1 /*
2  probe.h - An embedded CNC Controller with rs274/ngc (g-code) support
3 
4  Part of grblHAL
5 
6  Copyright (c) 2020-2025 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 
22 #ifndef _PROBE_H_
23 #define _PROBE_H_
24 
25 #include "crossbar.h"
26 
27 #define N_PROBE_MAX 3
28 
29 // Values that define the probing state machine.
30 
31 typedef bool (*get_probe_input_ptr)(void *input);
32 
33 typedef enum {
37 
38 typedef enum {
41  Probe_2
43 
44 typedef union {
45  uint16_t value;
46  struct {
47  uint16_t triggered :1,
48  connected :1,
49  inverted :1,
53  irq_mode :5,
54  unused :3,
55  probe_id :2;
56  };
58 
59 typedef union {
60  uint8_t value;
61  struct {
62  uint8_t available :1,
63  connected :1,
64  latchable :1,
65  watchable :1,
66  guarded :1,
68  };
70 
71 void probe_connected_event (void *data);
72 bool probe_add (probe_id_t probe_id, uint8_t port, pin_irq_mode_t irq_mode, void *input, get_probe_input_ptr get_input);
73 
74 #endif // _PROBE_H_
pin_irq_mode_t
Pin interrupt modes, may be or'ed when reporting pin capability.
Definition: crossbar.h:561
probe_id_t
Definition: probe.h:38
@ Probe_Toolsetter
1
Definition: probe.h:40
@ Probe_2
2
Definition: probe.h:41
@ Probe_Default
0
Definition: probe.h:39
bool probe_add(probe_id_t probe_id, uint8_t port, pin_irq_mode_t irq_mode, void *input, get_probe_input_ptr get_input)
Definition: probe.c:161
void probe_connected_event(void *data)
Definition: probe.c:215
bool(* get_probe_input_ptr)(void *input)
Definition: probe.h:31
probing_state_t
Definition: probe.h:33
@ Probing_Off
0
Definition: probe.h:34
@ Probing_Active
1
Definition: probe.h:35
Definition: probe.h:59
uint8_t watchable
Set to true when probe input supports change interrupt.
Definition: probe.h:65
uint8_t unassigned
Definition: probe.h:67
uint8_t latchable
Set to true when probe input supports change rising/falling.
Definition: probe.h:64
uint8_t value
Definition: probe.h:60
uint8_t connected
Set to true when probe is connected. Always set to true if the driver does not have a probe connected...
Definition: probe.h:63
uint8_t guarded
Set to true when probe protection is enabled.
Definition: probe.h:66
uint8_t available
Set to true when probe input is available.
Definition: probe.h:62
Definition: probe.h:44
uint16_t irq_mode
pin_irq_mode_t - for driver use
Definition: probe.h:53
uint16_t connected
Set to true when probe is connected. Always set to true if the driver does not have a probe connected...
Definition: probe.h:48
uint16_t is_probing
For driver use.
Definition: probe.h:50
uint16_t triggered
Set to true when probe or toolsetter is triggered.
Definition: probe.h:47
uint16_t unused
Definition: probe.h:54
uint16_t irq_enabled
For driver use.
Definition: probe.h:52
uint16_t value
Definition: probe.h:45
uint16_t was_probing
For driver use.
Definition: probe.h:51
uint16_t inverted
For driver use.
Definition: probe.h:49
uint16_t probe_id
Id of active probe (for now).
Definition: probe.h:55