grblHAL core  20241107
crossbar.h
Go to the documentation of this file.
1 /*
2  crossbar.h - signal crossbar definitions
3 
4  Part of grblHAL
5 
6  Copyright (c) 2021-2024 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 _CROSSBAR_H_
23 #define _CROSSBAR_H_
24 
25 #include "nuts_bolts.h"
26 
27 typedef enum {
28 // NOTE: the sequence of the following enums MUST match the control_signals_t layout
44 // end control_signals_t sequence
101 // Output pins
184 // Multipin peripherals
199  Input_KeypadStrobe, // To be deprecated? Use Input_I2CStrobe instead.
208 // Single pin bidirectional peripherals
219 
220 #define PIN_ISINPUT(pin) (pin < Outputs)
221 #define PIN_ISOUTPUT(pin) (pin >= Outputs && pin < Bidirectional)
222 #define PIN_ISBIDIRECTIONAL(pin) (pin >= Bidirectional)
223 
224 typedef struct {
225  pin_function_t function;
226  const char *name;
227 } pin_name_t;
228 
229 PROGMEM static const pin_name_t pin_names[] = {
230  { .function = Input_Reset, .name = "Reset" },
231  { .function = Input_FeedHold, .name = "Feed hold" },
232  { .function = Input_CycleStart, .name = "Cycle start" },
233  { .function = Input_SafetyDoor, .name = "Safety door" },
234  { .function = Input_BlockDelete, .name = "Block delete" },
235  { .function = Input_StopDisable, .name = "Stop disable" },
236  { .function = Input_EStop, .name = "Emergency stop" },
237  { .function = Input_ProbeDisconnect, .name = "Probe disconnect" },
238  { .function = Input_MotorFault, .name = "Motor fault" },
239  { .function = Input_MotorWarning, .name = "Motor warning" },
240  { .function = Input_LimitsOverride, .name = "Limits override" },
241  { .function = Input_SingleBlock, .name = "Single block" },
242  { .function = Input_ProbeOvertravel, .name = "Probe overtravel" },
243  { .function = Input_Probe, .name = "Probe" },
244  { .function = Input_MPGSelect, .name = "MPG mode select" },
245  { .function = Input_LimitX, .name = "X limit min" },
246  { .function = Input_LimitX_2, .name = "X limit min 2" },
247  { .function = Input_LimitX_Max, .name = "X limit max" },
248  { .function = Input_HomeX, .name = "X home" },
249  { .function = Input_HomeX_2, .name = "X home 2" },
250  { .function = Input_LimitY, .name = "Y limit min" },
251  { .function = Input_LimitY_2, .name = "Y limit min 2" },
252  { .function = Input_LimitY_Max, .name = "Y limit max" },
253  { .function = Input_HomeY, .name = "Y home" },
254  { .function = Input_HomeY_2, .name = "Y home 2" },
255  { .function = Input_LimitZ, .name = "Z limit min" },
256  { .function = Input_LimitZ_2, .name = "Z limit min 2" },
257  { .function = Input_LimitZ_Max, .name = "Z limit max" },
258  { .function = Input_HomeZ, .name = "Z home" },
259  { .function = Input_HomeZ_2, .name = "Z home 2" },
260  { .function = Input_SpindleIndex, .name = "Spindle index" },
261  { .function = Input_SpindlePulse, .name = "Spindle pulse" },
262  { .function = Input_Aux0, .name = "Aux in 0" },
263  { .function = Input_Aux1, .name = "Aux in 1" },
264  { .function = Input_Aux2, .name = "Aux in 2" },
265  { .function = Input_Aux3, .name = "Aux in 3" },
266  { .function = Input_Aux4, .name = "Aux in 4" },
267  { .function = Input_Aux5, .name = "Aux in 5" },
268  { .function = Input_Aux6, .name = "Aux in 6" },
269  { .function = Input_Aux7, .name = "Aux in 7" },
270  { .function = Input_Aux8, .name = "Aux in 8" },
271  { .function = Input_Aux9, .name = "Aux in 9" },
272  { .function = Input_Aux10, .name = "Aux in 10" },
273  { .function = Input_Aux11, .name = "Aux in 11" },
274  { .function = Input_Analog_Aux0, .name = "Aux analog in 0" },
275  { .function = Input_Analog_Aux1, .name = "Aux analog in 1" },
276  { .function = Input_Analog_Aux2, .name = "Aux analog in 2" },
277  { .function = Input_Analog_Aux3, .name = "Aux analog in 3" },
278  { .function = Input_Analog_Aux4, .name = "Aux analog in 4" },
279  { .function = Input_Analog_Aux5, .name = "Aux analog in 5" },
280  { .function = Input_Analog_Aux6, .name = "Aux analog in 6" },
281  { .function = Input_Analog_Aux7, .name = "Aux analog in 7" },
282  { .function = Output_StepX, .name = "X step" },
283  { .function = Output_StepX_2, .name = "X2 step" },
284  { .function = Output_StepY, .name = "Y step" },
285  { .function = Output_StepY_2, .name = "Y2 step" },
286  { .function = Output_StepZ, .name = "Z step" },
287  { .function = Output_StepZ_2, .name = "Z2 step" },
288  { .function = Output_DirX, .name = "X dir" },
289  { .function = Output_DirX_2, .name = "X2 dir" },
290  { .function = Output_DirY, .name = "Y dir" },
291  { .function = Output_DirY_2, .name = "Y2 dir" },
292  { .function = Output_DirZ, .name = "Z dir" },
293  { .function = Output_DirZ_2, .name = "Z2 dir" },
294  { .function = Output_StepperPower, .name = "Stepper power" },
295  { .function = Output_StepperEnable, .name = "Steppers enable" },
296  { .function = Output_StepperEnableX, .name = "X enable" },
297  { .function = Output_StepperEnableY, .name = "Y enable" },
298  { .function = Output_StepperEnableZ, .name = "Z enable" },
299  { .function = Output_StepperEnableXY, .name = "XY enable" },
300 #ifdef A_AXIS
301  { .function = Output_StepA, .name = "A step" },
302  { .function = Output_DirA, .name = "A dir" },
303  { .function = Output_StepperEnableA, .name = "A enable" },
304  { .function = Input_LimitA, .name = "A limit min" },
305  { .function = Input_LimitA_Max, .name = "A limit max" },
306  { .function = Input_HomeA, .name = "A home" },
307 #endif
308 #ifdef B_AXIS
309  { .function = Output_StepB, .name = "B step" },
310  { .function = Output_DirB, .name = "B dir" },
311  { .function = Output_StepperEnableB, .name = "B enable" },
312  { .function = Output_StepperEnableAB, .name = "AB enable" },
313  { .function = Input_LimitB, .name = "B limit min" },
314  { .function = Input_LimitB_Max, .name = "B limit max" },
315  { .function = Input_HomeB, .name = "B home" },
316 #endif
317 #ifdef C_AXIS
318  { .function = Output_StepC, .name = "C step" },
319  { .function = Output_DirC, .name = "C dir" },
320  { .function = Output_StepperEnableC, .name = "C enable" },
321  { .function = Input_LimitC, .name = "C limit min" },
322  { .function = Input_LimitC_Max, .name = "C limit max" },
323  { .function = Input_HomeC, .name = "C home" },
324 #endif
325 #ifdef U_AXIS
326  { .function = Output_StepU, .name = "U step" },
327  { .function = Output_DirU, .name = "U dir" },
328  { .function = Output_StepperEnableU, .name = "U enable" },
329  { .function = Input_LimitU, .name = "U limit min" },
330  { .function = Input_LimitU_Max, .name = "U limit max" },
331  { .function = Input_HomeU, .name = "U home" },
332 #endif
333 #ifdef V_AXIS
334  { .function = Output_StepV, .name = "V step" },
335  { .function = Output_DirV, .name = "V dir" },
336  { .function = Output_StepperEnableV, .name = "V enable" },
337  { .function = Input_LimitV, .name = "V limit min" },
338  { .function = Input_LimitV_Max, .name = "V limit max" },
339  { .function = Input_HomeV, .name = "V home" },
340 #endif
341  { .function = Output_MotorChipSelect, .name = "Motor CS" },
342  { .function = Output_MotorChipSelectX, .name = "Motor CSX" },
343  { .function = Output_MotorChipSelectY, .name = "Motor CSY" },
344  { .function = Output_MotorChipSelectZ, .name = "Motor CSZ" },
345  { .function = Output_MotorChipSelectM3, .name = "Motor CSM3" },
346  { .function = Output_MotorChipSelectM4, .name = "Motor CSM4" },
347  { .function = Output_MotorChipSelectM5, .name = "Motor CSM5" },
348  { .function = Output_MotorChipSelectM6, .name = "Motor CSM6" },
349  { .function = Output_MotorChipSelectM7, .name = "Motor CSM7" },
350  { .function = Output_SpindleOn, .name = "Spindle on" },
351  { .function = Output_SpindleDir, .name = "Spindle direction" },
352  { .function = Output_SpindlePWM, .name = "Spindle PWM" },
353  { .function = Output_Spindle1On, .name = "Spindle 2 on" },
354  { .function = Output_Spindle1Dir, .name = "Spindle 2 direction" },
355  { .function = Output_Spindle1PWM, .name = "Spindle 2 PWM" },
356  { .function = Output_CoolantMist, .name = "Mist" },
357  { .function = Output_CoolantFlood, .name = "Flood" },
358  { .function = Output_Aux0, .name = "Aux out 0" },
359  { .function = Output_Aux1, .name = "Aux out 1" },
360  { .function = Output_Aux2, .name = "Aux out 2" },
361  { .function = Output_Aux3, .name = "Aux out 3" },
362  { .function = Output_Aux4, .name = "Aux out 4" },
363  { .function = Output_Aux5, .name = "Aux out 5" },
364  { .function = Output_Aux6, .name = "Aux out 6" },
365  { .function = Output_Aux7, .name = "Aux out 7" },
366  { .function = Output_Aux8, .name = "Aux out 8" },
367  { .function = Output_Aux9, .name = "Aux out 9" },
368  { .function = Output_Aux10, .name = "Aux out 10" },
369  { .function = Output_Aux11, .name = "Aux out 11" },
370  { .function = Output_Analog_Aux0, .name = "Aux analog out 0" },
371  { .function = Output_Analog_Aux1, .name = "Aux analog out 1" },
372  { .function = Output_Analog_Aux2, .name = "Aux analog out 2" },
373  { .function = Output_Analog_Aux3, .name = "Aux analog out 3" },
374  { .function = Output_Analog_Aux4, .name = "Aux analog out 4" },
375  { .function = Output_Analog_Aux5, .name = "Aux analog out 5" },
376  { .function = Output_Analog_Aux6, .name = "Aux analog out 6" },
377  { .function = Output_Analog_Aux7, .name = "Aux analog out 7" },
378  { .function = Output_LED, .name = "LED" },
379  { .function = Output_LED_R, .name = "LED R" },
380  { .function = Output_LED_G, .name = "LED G" },
381  { .function = Output_LED_B, .name = "LED B" },
382  { .function = Output_LED_W, .name = "LED W" },
383  { .function = Output_LED_Adressable, .name = "LED adressable" },
384  { .function = Output_LED1_Adressable, .name = "LED adressable 1" },
385  { .function = Input_MISO, .name = "MISO" },
386  { .function = Output_MOSI, .name = "MOSI" },
387  { .function = Output_SPICLK, .name = "SPI CLK" },
388  { .function = Output_SPICS, .name = "SPI CS" },
389  { .function = Output_FlashCS, .name = "Flash CS" },
390  { .function = Output_SdCardCS, .name = "SD card CS" },
391  { .function = Input_SdCardDetect, .name = "SD card detect" },
392  { .function = Output_SPIRST, .name = "SPI reset" },
393  { .function = Input_SPIIRQ, .name = "SPI IRQ" },
394  { .function = Output_I2CSCK, .name = "I2C SCK" },
395  { .function = Bidirectional_SDA, .name = "I2C SDA" },
396  { .function = Input_KeypadStrobe, .name = "Keypad strobe" },
397  { .function = Input_I2CStrobe, .name = "I2C strobe" },
398  { .function = Input_RX, .name = "RX" },
399  { .function = Output_TX, .name = "TX" },
400  { .function = Output_RTS, .name = "RTS" },
401  { .function = Input_QEI_A, .name = "QEI A" },
402  { .function = Input_QEI_B, .name = "QEI B" },
403  { .function = Input_QEI_Select, .name = "QEI select" },
404  { .function = Input_QEI_Index, .name = "QEI index" },
405  { .function = Bidirectional_MotorUARTX, .name = "UART X" },
406  { .function = Bidirectional_MotorUARTY, .name = "UART Y" },
407  { .function = Bidirectional_MotorUARTZ, .name = "UART Z" },
408  { .function = Bidirectional_MotorUARTM3, .name = "UART M3" },
409  { .function = Bidirectional_MotorUARTM4, .name = "UART M4" },
410  { .function = Bidirectional_MotorUARTM5, .name = "UART M5" },
411  { .function = Bidirectional_MotorUARTM6, .name = "UART M6" },
412  { .function = Bidirectional_MotorUARTM7, .name = "UART M7" }
413 };
414 
415 typedef enum {
442 // Interrupt capable pins that may have debounce processing enabled
444  PinGroup_Limit = (1<<9),
445  PinGroup_LimitMax = (1<<10),
446  PinGroup_Probe = (1<<11),
447  PinGroup_Keypad = (1<<12),
448  PinGroup_MPG = (1<<13),
449  PinGroup_QEI = (1<<14),
454  PinGroup_AuxInput = (1<<19)
456 
458 typedef enum {
459  IRQ_Mode_None = 0b00000,
460  IRQ_Mode_Rising = 0b00001,
461  IRQ_Mode_Falling = 0b00010,
463  IRQ_Mode_Change = 0b00100,
464  IRQ_Mode_Edges = 0b00111,
465  IRQ_Mode_High = 0b01000,
466  IRQ_Mode_Low = 0b10000,
467  IRQ_Mode_All = 0b11111
469 
470 typedef enum {
472  IRQ_SPI
474 
475 typedef bool (*irq_callback_ptr)(uint_fast8_t id, bool level);
476 
477 typedef struct driver_irq_handler {
482 
484 typedef enum {
485  PullMode_None = 0b00,
486  PullMode_Up = 0b01,
487  PullMode_Down = 0b10,
488  PullMode_UpDown = 0b11
490 
491 #define PINMODE_NONE (0)
492 #define PINMODE_OUTPUT (1U<<1)
493 #ifndef __LPC17XX__
494 #define PINMODE_OD (1U<<2)
495 #endif
496 #define PINMODE_PULLUP (PullMode_Up<<3)
497 #define PINMODE_PULLDOWN (PullMode_Down<<3)
498 #define PINMODE_ANALOG (1U<<11)
499 #define PINMODE_PWM (1U<<12)
500 #define PINMODE_PWM_SERVO (1U<<13)
501 
502 typedef union {
503  uint16_t mask;
504  struct {
505  uint16_t input :1,
506  output :1,
510  invert :1,
511  analog :1,
512  pwm :1,
516  };
517 } pin_cap_t;
518 
519 typedef union {
520  uint16_t mask;
521  struct {
522  uint16_t input :1,
523  output :1,
528  analog :1,
529  pwm :1,
533  };
534 } pin_mode_t;
535 
536 #define XBAR_SET_CAP(cap, mode) { cap.mask = mode.mask; cap.claimable = !mode.claimed; }
537 #define XBAR_SET_DIN_INFO(pin, pin_id, src, cfg_fn, get_val_fn) { \
538  pin.id = pin_id; \
539  pin.mode = src.mode; \
540  pin.cap = src.cap; \
541  pin.cap.invert = On; \
542  pin.cap.claimable = !src.mode.claimed; \
543  pin.function = src.id; \
544  pin.group = src.group; \
545  pin.pin = src.pin; \
546  pin.port = (void *)src.port; \
547  pin.description = src.description; \
548  pin.config = cfg_fn; \
549  pin.get_value = get_val_fn; \
550 }
551 #define XBAR_SET_DOUT_INFO(pin, pin_id, src, cfg_fn, get_val_fn) { \
552  pin.id = pin_id; \
553  pin.mode = src.mode; \
554  pin.cap.mask = src.mode.mask; \
555  pin.cap.invert = On; \
556  pin.cap.claimable = !src.mode.claimed; \
557  pin.function = src.id; \
558  pin.group = src.group; \
559  pin.pin = src.pin; \
560  pin.port = (void *)src.port; \
561  pin.description = src.description; \
562  pin.config = cfg_fn; \
563  pin.get_value = get_val_fn; \
564 }
565 
567 typedef struct {
568  bool inverted;
569  bool debounce;
572 
574 typedef struct {
575  bool inverted;
577  bool pwm;
579 
581 typedef struct {
582  float freq_hz; //
583  float min;
584  float max;
585  float off_value; // percent of period
586  float min_value; // percent of period
587  float max_value; // percent of period
588  bool invert;
590 } pwm_config_t;
591 
592 typedef union
593 {
597 } xbar_cfg_ptr_t __attribute__ ((__transparent_union__));
598 
599 struct xbar;
600 
601 typedef float (*xbar_get_value_ptr)(struct xbar *pin);
602 typedef void (*xbar_set_value_ptr)(struct xbar *pin, float value);
603 typedef void (*xbar_event_ptr)(bool on);
604 typedef bool (*xbar_config_ptr)(struct xbar *pin, xbar_cfg_ptr_t cfg_data, bool persistent);
605 
606 typedef struct {
607  pin_function_t function;
608  uint8_t aux_port;
611  uint8_t pin;
612  void *port;
613  void *input;
614 } aux_ctrl_t;
615 
616 typedef struct {
617  pin_function_t function;
618  uint8_t aux_port;
619  uint8_t pin;
620  void *port;
621  void *output;
623 
624 typedef struct xbar {
625  uint8_t id;
626  pin_function_t function;
628  void *port;
629  const char *description;
630  uint_fast8_t pin;
638 
639 typedef struct {
640  pin_function_t function;
642  void *port;
643  uint_fast8_t pin;
645  const char *description;
646 } periph_pin_t;
647 
648 typedef struct periph_signal {
652 
653 typedef union {
654  uint8_t mask;
655  struct {
656  uint8_t limits :1,
661  };
663 
664 void xbar_set_homing_source (void);
668 const char *xbar_fn_to_pinname (pin_function_t id);
670 
671 #endif
limit_signals_t xbar_get_homing_source_from_cycle(axes_signals_t homing_cycle)
Definition: crossbar.c:115
bool(* irq_callback_ptr)(uint_fast8_t id, bool level)
Definition: crossbar.h:475
const char * xbar_fn_to_pinname(pin_function_t id)
Definition: crossbar.c:131
pull_mode_t
Pin pullup and pulldown modes, may be or'ed when reporting pin capability.
Definition: crossbar.h:484
@ PullMode_Down
0b10 (0x02)
Definition: crossbar.h:487
@ PullMode_None
0b00 (0x00)
Definition: crossbar.h:485
@ PullMode_Up
0b01 (0x01)
Definition: crossbar.h:486
@ PullMode_UpDown
0b11 (0x03) - only used to report port capability.
Definition: crossbar.h:488
pin_function_t
Definition: crossbar.h:27
@ Output_DirX_2
Definition: crossbar.h:115
@ Output_SPICS
Definition: crossbar.h:189
@ Input_LimitB
Definition: crossbar.h:65
@ Input_QEI_A
Definition: crossbar.h:204
@ Input_LimitY_2
Definition: crossbar.h:53
@ Input_FeedHold
Definition: crossbar.h:30
@ Input_Aux6
Definition: crossbar.h:85
@ Output_Aux2
Definition: crossbar.h:156
@ Output_Analog_Aux0
Definition: crossbar.h:167
@ Output_MOSI
Definition: crossbar.h:187
@ Output_LED_R
Definition: crossbar.h:177
@ Input_HomeX_2
Definition: crossbar.h:51
@ Output_RTS
Definition: crossbar.h:203
@ Input_Analog_Aux1
Definition: crossbar.h:93
@ Input_SpindleIndex
Definition: crossbar.h:77
@ Input_Analog_Aux5
Definition: crossbar.h:97
@ Output_StepperEnableV
Definition: crossbar.h:142
@ Output_StepZ_2
Definition: crossbar.h:108
@ Input_HomeA
Definition: crossbar.h:64
@ Input_HomeC
Definition: crossbar.h:70
@ Output_DirX
Definition: crossbar.h:114
@ Input_Unassigned
Definition: crossbar.h:41
@ Output_TX
Definition: crossbar.h:202
@ Output_MotorChipSelectX
Definition: crossbar.h:126
@ Input_Reset
Definition: crossbar.h:29
@ Bidirectional_MotorUARTM7
Definition: crossbar.h:217
@ Input_SPIIRQ
Definition: crossbar.h:194
@ Output_StepB
Definition: crossbar.h:110
@ Input_HomeZ
Definition: crossbar.h:60
@ Bidirectional_MotorUARTM5
Definition: crossbar.h:215
@ Output_Aux4
Definition: crossbar.h:158
@ Input_Analog_Aux7
Definition: crossbar.h:99
@ Output_Analog_AuxMax
Definition: crossbar.h:175
@ Input_Probe
Definition: crossbar.h:43
@ Output_DirV
Definition: crossbar.h:124
@ Output_StepperEnableX
Definition: crossbar.h:136
@ Output_FlashCS
Definition: crossbar.h:190
@ Output_DirA
Definition: crossbar.h:120
@ Output_StepY_2
Definition: crossbar.h:106
@ Output_MotorChipSelectM6
Definition: crossbar.h:132
@ Output_DirB
Definition: crossbar.h:121
@ Input_MotorFault
Definition: crossbar.h:37
@ Output_SdCardCS
Definition: crossbar.h:191
@ Input_Analog_AuxMax
Definition: crossbar.h:100
@ Bidirectional_MotorUARTM4
Definition: crossbar.h:214
@ Input_MotorWarning
Definition: crossbar.h:38
@ Output_DirY
Definition: crossbar.h:116
@ Output_StepperEnableAB
Definition: crossbar.h:145
@ Output_MotorChipSelectM5
Definition: crossbar.h:131
@ Output_Aux1
Definition: crossbar.h:155
@ Input_ProbeDisconnect
Definition: crossbar.h:36
@ Bidirectional_I2CSDA
Definition: crossbar.h:198
@ Output_Aux11
Definition: crossbar.h:165
@ Input_LimitX
Definition: crossbar.h:47
@ Output_Analog_Aux6
Definition: crossbar.h:173
@ Output_LED
Definition: crossbar.h:176
@ Input_EStop
Definition: crossbar.h:35
@ Input_StopDisable
Definition: crossbar.h:34
@ Input_HomeZ_2
Definition: crossbar.h:61
@ Input_LimitA_Max
Definition: crossbar.h:63
@ Output_DirY_2
Definition: crossbar.h:117
@ Input_HomeX
Definition: crossbar.h:50
@ Output_StepperEnableXY
Definition: crossbar.h:144
@ Input_SdCardDetect
Definition: crossbar.h:192
@ Output_LED1_Adressable
Definition: crossbar.h:183
@ Input_SpindlePulse
Definition: crossbar.h:78
@ Input_HomeY_2
Definition: crossbar.h:56
@ Output_LED_Adressable
Definition: crossbar.h:181
@ Output_DirZ
Definition: crossbar.h:118
@ Bidirectional_MotorUARTM6
Definition: crossbar.h:216
@ Input_LimitsOverride
Definition: crossbar.h:39
@ Input_HomeU
Definition: crossbar.h:73
@ Input_Aux3
Definition: crossbar.h:82
@ Input_ModeSelect
Definition: crossbar.h:46
@ Output_LED0_Adressable
Definition: crossbar.h:182
@ Outputs
Definition: crossbar.h:103
@ Input_Aux8
Definition: crossbar.h:87
@ Output_StepV
Definition: crossbar.h:113
@ Input_Aux11
Definition: crossbar.h:90
@ Output_StepperEnableZ
Definition: crossbar.h:138
@ Output_Analog_Aux3
Definition: crossbar.h:170
@ Output_StepU
Definition: crossbar.h:112
@ Input_LimitX_Max
Definition: crossbar.h:49
@ Output_AuxMax
Definition: crossbar.h:166
@ Input_QEI_Select
Definition: crossbar.h:206
@ Output_StepperEnableU
Definition: crossbar.h:141
@ Output_StepperEnableA
Definition: crossbar.h:139
@ Input_Aux9
Definition: crossbar.h:88
@ Output_Aux7
Definition: crossbar.h:161
@ Output_MotorChipSelectY
Definition: crossbar.h:127
@ Bidirectional_MotorUARTZ
Definition: crossbar.h:212
@ Input_LimitA
Definition: crossbar.h:62
@ Output_StepperPower
Definition: crossbar.h:134
@ Input_HomeY
Definition: crossbar.h:55
@ Input_LimitY
Definition: crossbar.h:52
@ Output_Aux9
Definition: crossbar.h:163
@ Input_BlockDelete
Definition: crossbar.h:33
@ Input_KeypadStrobe
Definition: crossbar.h:199
@ Output_LED_G
Definition: crossbar.h:178
@ Input_Aux2
Definition: crossbar.h:81
@ Input_Aux4
Definition: crossbar.h:83
@ Input_HomeV
Definition: crossbar.h:76
@ Output_StepperEnable
Definition: crossbar.h:135
@ Input_LimitV_Max
Definition: crossbar.h:75
@ Output_Analog_Aux1
Definition: crossbar.h:168
@ Input_LimitU_Max
Definition: crossbar.h:72
@ Input_LimitY_Max
Definition: crossbar.h:54
@ Output_SpindleDir
Definition: crossbar.h:147
@ Output_StepperEnableY
Definition: crossbar.h:137
@ Input_LimitZ_Max
Definition: crossbar.h:59
@ Multipin
Definition: crossbar.h:186
@ Output_StepperEnableC
Definition: crossbar.h:143
@ Input_LimitX_2
Definition: crossbar.h:48
@ Input_LimitC
Definition: crossbar.h:68
@ Input_SingleBlock
Definition: crossbar.h:40
@ Output_DirU
Definition: crossbar.h:123
@ Output_SPIRST
Definition: crossbar.h:193
@ Input_LimitU
Definition: crossbar.h:71
@ Input_LimitB_Max
Definition: crossbar.h:66
@ Input_AuxMax
Definition: crossbar.h:91
@ Output_DirZ_2
Definition: crossbar.h:119
@ Output_MotorChipSelectM7
Definition: crossbar.h:133
@ Input_ProbeOvertravel
Definition: crossbar.h:42
@ Output_MotorChipSelectM3
Definition: crossbar.h:129
@ Input_LimitZ_2
Definition: crossbar.h:58
@ Output_DirC
Definition: crossbar.h:122
@ Output_Analog_Aux7
Definition: crossbar.h:174
@ Output_StepY
Definition: crossbar.h:105
@ Output_SpindleOn
Definition: crossbar.h:146
@ Input_LimitV
Definition: crossbar.h:74
@ Output_Aux8
Definition: crossbar.h:162
@ Input_I2CStrobe
Definition: crossbar.h:200
@ Input_Analog_Aux3
Definition: crossbar.h:95
@ Output_Spindle1Dir
Definition: crossbar.h:150
@ Output_Aux10
Definition: crossbar.h:164
@ Output_SpindlePWM
Definition: crossbar.h:148
@ Output_CoolantMist
Definition: crossbar.h:152
@ Input_MPGSelect
Definition: crossbar.h:45
@ Output_Spindle1On
Definition: crossbar.h:149
@ Input_Aux1
Definition: crossbar.h:80
@ Input_RX
Definition: crossbar.h:201
@ Bidirectional_MotorUARTM3
Definition: crossbar.h:213
@ Input_LimitZ
Definition: crossbar.h:57
@ Output_StepX_2
Definition: crossbar.h:104
@ Input_Analog_Aux6
Definition: crossbar.h:98
@ Output_MotorChipSelectM4
Definition: crossbar.h:130
@ Bidirectional_MotorUARTX
Definition: crossbar.h:209
@ Input_Aux0
Definition: crossbar.h:79
@ Bidirectional_SDA
Definition: crossbar.h:197
@ Output_MotorChipSelectZ
Definition: crossbar.h:128
@ Output_Analog_Aux2
Definition: crossbar.h:169
@ Input_Aux10
Definition: crossbar.h:89
@ Output_Analog_Aux4
Definition: crossbar.h:171
@ Output_Aux0
Definition: crossbar.h:154
@ Input_Analog_Aux2
Definition: crossbar.h:94
@ Input_QEI_B
Definition: crossbar.h:205
@ Output_Aux6
Definition: crossbar.h:160
@ Input_MISO
Definition: crossbar.h:185
@ Bidirectional_MotorUARTY
Definition: crossbar.h:211
@ Output_Aux5
Definition: crossbar.h:159
@ Output_StepperEnableB
Definition: crossbar.h:140
@ Output_SCK
Definition: crossbar.h:195
@ Input_CycleStart
Definition: crossbar.h:31
@ Output_LED_B
Definition: crossbar.h:179
@ Output_StepX
Definition: crossbar.h:102
@ Output_Aux3
Definition: crossbar.h:157
@ Bidirectional
Definition: crossbar.h:210
@ Output_StepZ
Definition: crossbar.h:107
@ Output_StepC
Definition: crossbar.h:111
@ Output_SPICLK
Definition: crossbar.h:188
@ Input_QEI_Index
Definition: crossbar.h:207
@ Input_Analog_Aux0
Definition: crossbar.h:92
@ Output_MotorChipSelect
Definition: crossbar.h:125
@ Input_Aux7
Definition: crossbar.h:86
@ Input_SafetyDoor
Definition: crossbar.h:32
@ Output_CoolantFlood
Definition: crossbar.h:153
@ Input_HomeB
Definition: crossbar.h:67
@ Input_Aux5
Definition: crossbar.h:84
@ Output_Analog_Aux5
Definition: crossbar.h:172
@ Input_LimitC_Max
Definition: crossbar.h:69
@ Output_LED_W
Definition: crossbar.h:180
@ Output_StepA
Definition: crossbar.h:109
@ Input_Analog_Aux4
Definition: crossbar.h:96
@ Output_I2CSCK
Definition: crossbar.h:196
@ Output_Spindle1PWM
Definition: crossbar.h:151
float(* xbar_get_value_ptr)(struct xbar *pin)
Definition: crossbar.h:601
limit_signals_t xbar_get_homing_source(void)
Definition: crossbar.c:109
void(* xbar_event_ptr)(bool on)
Definition: crossbar.h:603
axes_signals_t xbar_fn_to_axismask(pin_function_t id)
Definition: crossbar.c:26
pin_group_t
Definition: crossbar.h:415
@ PinGroup_SpindlePWM
Definition: crossbar.h:417
@ PinGroup_AuxInputAnalog
Definition: crossbar.h:426
@ PinGroup_UART1
Definition: crossbar.h:433
@ PinGroup_Control
Definition: crossbar.h:443
@ PinGroup_QEI_Select
Definition: crossbar.h:450
@ PinGroup_AuxOutput
Definition: crossbar.h:425
@ PinGroup_QEI
Definition: crossbar.h:449
@ PinGroup_Keypad
Definition: crossbar.h:447
@ PinGroup_StepperDir
Definition: crossbar.h:424
@ PinGroup_USB
Definition: crossbar.h:438
@ PinGroup_SPI
Definition: crossbar.h:432
@ PinGroup_UART3
Definition: crossbar.h:436
@ PinGroup_StepperPower
Definition: crossbar.h:421
@ PinGroup_UART4
Definition: crossbar.h:437
@ PinGroup_CAN
Definition: crossbar.h:439
@ PinGroup_MotorChipSelect
Definition: crossbar.h:429
@ PinGroup_AuxOutputAnalog
Definition: crossbar.h:427
@ PinGroup_SdCard
Definition: crossbar.h:428
@ PinGroup_Motor_Warning
Definition: crossbar.h:452
@ PinGroup_I2C
Definition: crossbar.h:431
@ PinGroup_LED
Definition: crossbar.h:440
@ PinGroup_MotorUART
Definition: crossbar.h:430
@ PinGroup_UART2
Definition: crossbar.h:435
@ PinGroup_Limit
Definition: crossbar.h:444
@ PinGroup_QEI_Index
Definition: crossbar.h:451
@ PinGroup_SpindleIndex
Definition: crossbar.h:420
@ PinGroup_AuxInput
Definition: crossbar.h:454
@ PinGroup_Home
Definition: crossbar.h:441
@ PinGroup_Probe
Definition: crossbar.h:446
@ PinGroup_LimitMax
Definition: crossbar.h:445
@ PinGroup_MPG
Definition: crossbar.h:448
@ PinGroup_StepperStep
Definition: crossbar.h:423
@ PinGroup_StepperEnable
Definition: crossbar.h:422
@ PinGroup_SpindlePulse
Definition: crossbar.h:419
@ PinGroup_Coolant
Definition: crossbar.h:418
@ PinGroup_Motor_Fault
Definition: crossbar.h:453
@ PinGroup_SpindleControl
Definition: crossbar.h:416
@ PinGroup_UART
Definition: crossbar.h:434
irq_type_t
Definition: crossbar.h:470
@ IRQ_I2C_Strobe
Definition: crossbar.h:471
@ IRQ_SPI
Definition: crossbar.h:472
bool(* xbar_config_ptr)(struct xbar *pin, xbar_cfg_ptr_t cfg_data, bool persistent)
Definition: crossbar.h:604
struct driver_irq_handler driver_irq_handler_t
control_signals_t xbar_fn_to_signals_mask(pin_function_t id)
Definition: crossbar.c:144
struct xbar xbar_t
pin_irq_mode_t
Pin interrupt modes, may be or'ed when reporting pin capability.
Definition: crossbar.h:458
@ IRQ_Mode_Low
0b10000 (0x10)
Definition: crossbar.h:466
@ IRQ_Mode_Rising
0b00001 (0x01)
Definition: crossbar.h:460
@ IRQ_Mode_RisingFalling
0b00011 (0x03) - only used to report port capability.
Definition: crossbar.h:462
@ IRQ_Mode_None
0b00000 (0x00)
Definition: crossbar.h:459
@ IRQ_Mode_High
0b01000 (0x08)
Definition: crossbar.h:465
@ IRQ_Mode_All
0b11111 (0x1F) - only used to report port capability.
Definition: crossbar.h:467
@ IRQ_Mode_Change
0b00100 (0x04)
Definition: crossbar.h:463
@ IRQ_Mode_Falling
0b00010 (0x02)
Definition: crossbar.h:461
@ IRQ_Mode_Edges
0b00111 (0x07) - only used to report port capability.
Definition: crossbar.h:464
void xbar_set_homing_source(void)
Definition: crossbar.c:98
void(* xbar_set_value_ptr)(struct xbar *pin, float value)
Definition: crossbar.h:602
struct periph_signal periph_signal_t
__attribute__
Definition: errors.h:30
Definition: crossbar.h:616
uint8_t aux_port
Definition: crossbar.h:618
uint8_t pin
Definition: crossbar.h:619
void * output
Definition: crossbar.h:621
void * port
Definition: crossbar.h:620
Definition: crossbar.h:606
uint8_t aux_port
Definition: crossbar.h:608
control_signals_t cap
Definition: crossbar.h:610
pin_irq_mode_t irq_mode
Definition: crossbar.h:609
void * input
Definition: crossbar.h:613
uint8_t pin
Definition: crossbar.h:611
void * port
Definition: crossbar.h:612
Definition: crossbar.h:477
irq_callback_ptr callback
Definition: crossbar.h:479
struct driver_irq_handler * next
Definition: crossbar.h:480
irq_type_t type
Definition: crossbar.h:478
/a cfg_data argument to /a xbar_config_ptr for gpio input pins
Definition: crossbar.h:567
bool debounce
Definition: crossbar.h:569
bool inverted
Definition: crossbar.h:568
pull_mode_t pull_mode
Definition: crossbar.h:570
/a cfg_data argument to /a xbar_config_ptr for gpio output pins
Definition: crossbar.h:574
bool inverted
Definition: crossbar.h:575
bool open_drain
Definition: crossbar.h:576
bool pwm
Definition: crossbar.h:577
Limit switches struct, consists of four packed axes_signals_t structs in 32 bits.
Definition: nuts_bolts.h:157
Definition: crossbar.h:639
pin_mode_t mode
Definition: crossbar.h:644
const char * description
Definition: crossbar.h:645
uint_fast8_t pin
Definition: crossbar.h:643
void * port
Definition: crossbar.h:642
pin_group_t group
Definition: crossbar.h:641
Definition: crossbar.h:648
struct periph_signal * next
Definition: crossbar.h:650
periph_pin_t pin
Definition: crossbar.h:649
Definition: crossbar.h:224
const char * name
Definition: crossbar.h:226
pin_function_t function
Definition: crossbar.h:225
/a cfg_data argument to /a xbar_config_ptr for PWM pins
Definition: crossbar.h:581
float freq_hz
Definition: crossbar.h:582
bool invert
Definition: crossbar.h:588
float max
Definition: crossbar.h:584
bool servo_mode
Definition: crossbar.h:589
float off_value
Definition: crossbar.h:585
float min_value
Definition: crossbar.h:586
float max_value
Definition: crossbar.h:587
float min
Definition: crossbar.h:583
Definition: crossbar.h:624
xbar_event_ptr on_event
Not used - might be removed.
Definition: crossbar.h:636
uint8_t id
Pin id.
Definition: crossbar.h:625
pin_mode_t mode
Current pin configuration.
Definition: crossbar.h:632
const char * description
Optional pointer to description string.
Definition: crossbar.h:629
xbar_config_ptr config
Optional pointer to function for configuring the port.
Definition: crossbar.h:633
xbar_set_value_ptr set_value
Optional pointer to function to set port value.
Definition: crossbar.h:635
xbar_get_value_ptr get_value
Optional pointer to function to get current port value.
Definition: crossbar.h:634
uint_fast8_t pin
Pin number.
Definition: crossbar.h:630
pin_cap_t cap
Pin capabilities.
Definition: crossbar.h:631
void * port
Optional pointer to the underlying peripheral or pin specific data.
Definition: crossbar.h:628
pin_group_t group
Pin group.
Definition: crossbar.h:627
Definition: nuts_bolts.h:130
Definition: system.h:123
Definition: crossbar.h:502
uint16_t output
Definition: crossbar.h:506
uint16_t irq_mode
Definition: crossbar.h:509
uint16_t debounce
Definition: crossbar.h:515
uint16_t pwm
Definition: crossbar.h:512
uint16_t open_drain
Definition: crossbar.h:507
uint16_t mask
Definition: crossbar.h:503
uint16_t input
Definition: crossbar.h:505
uint16_t analog
Definition: crossbar.h:511
uint16_t claimable
Definition: crossbar.h:514
uint16_t invert
Definition: crossbar.h:510
uint16_t pull_mode
Definition: crossbar.h:508
uint16_t servo_pwm
Definition: crossbar.h:513
Definition: crossbar.h:653
uint8_t qei_select
Definition: crossbar.h:659
uint8_t aux_inputs
Definition: crossbar.h:657
uint8_t limits
Definition: crossbar.h:656
uint8_t unassigned
Definition: crossbar.h:660
uint8_t mask
Definition: crossbar.h:654
uint8_t safety_door
Definition: crossbar.h:658
Definition: crossbar.h:519
uint16_t output
Definition: crossbar.h:523
uint16_t irq_mode
Definition: crossbar.h:526
uint16_t claimed
Definition: crossbar.h:531
uint16_t debounce
Definition: crossbar.h:532
uint16_t pwm
Definition: crossbar.h:529
uint16_t open_drain
Definition: crossbar.h:524
uint16_t mask
Definition: crossbar.h:520
uint16_t input
Definition: crossbar.h:522
uint16_t analog
Definition: crossbar.h:528
uint16_t inverted
Definition: crossbar.h:527
uint16_t pull_mode
Definition: crossbar.h:525
uint16_t servo_pwm
Definition: crossbar.h:530
Definition: crossbar.h:593
pwm_config_t * pwm_config
Definition: crossbar.h:594
gpio_out_config_t * gpio_out_config
Definition: crossbar.h:596
gpio_in_config_t * gpio_in_config
Definition: crossbar.h:595