grblHAL core
20260318
expanders_init.h
Go to the documentation of this file.
1
/*
2
expanders_init.h - An embedded CNC Controller with rs274/ngc (g-code) support
3
4
Calls the init function of enabled expanders, this file is typically included early in driver.h
5
io_expanders_init() should be called at the end of the drivers driver_init() implementation,
6
just before the driver claims ports.
7
8
These are NOT referenced in the core grblHAL code
9
10
Part of grblHAL
11
12
Copyright (c) 2025 Terje Io
13
14
grblHAL is free software: you can redistribute it and/or modify
15
it under the terms of the GNU General Public License as published by
16
the Free Software Foundation, either version 3 of the License, or
17
(at your option) any later version.
18
19
grblHAL is distributed in the hope that it will be useful,
20
but WITHOUT ANY WARRANTY; without even the implied warranty of
21
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22
GNU General Public License for more details.
23
24
You should have received a copy of the GNU General Public License
25
along with grblHAL. If not, see <http://www.gnu.org/licenses/>.
26
*/
27
28
#pragma once
29
30
extern
void
board_ports_init
(
void
);
// default is a weak function
31
32
// I2C expanders
33
34
#if PCA9654E_ENABLE || MCP3221_ENABLE || MCP4725_ENABLE || FLEXGPIO_ENABLE
35
36
#if defined(I2C_ENABLE) && !I2C_ENABLE
37
#undef I2C_ENABLE
38
#endif
39
40
#ifndef I2C_ENABLE
41
#define I2C_ENABLE 1
42
#endif
43
44
#if MCP3221_ENABLE
45
extern
void
mcp3221_init (
void
);
46
#endif
47
48
#if MCP4725_ENABLE
49
extern
void
mcp4725_init (
void
);
50
#endif
51
52
#if PCA9654E_ENABLE
53
extern
void
pca9654e_init(
void
);
54
#endif
55
56
// Third party I2C expander plugins goes after this line
57
58
#if FLEXGPIO_ENABLE
59
extern
void
flexgpio_init(
void
);
60
#endif
61
62
#endif
// I2C expanders
63
64
// SPI expanders
65
66
//
67
68
// ModBus expanders
69
70
#if PICOHAL_IO_ENABLE || R4SLS08_ENABLE
71
72
#if !defined(MODBUS_ENABLE) || !(MODBUS_ENABLE & MODBUS_RTU_ENABLED)
73
#error "Enabled IO expander(s) require Modbus RTU!"
74
#endif
75
76
#if R4SLS08_ENABLE
77
extern
void
r4sls08_init (
void
);
78
#endif
79
80
// Third party Modbus expander plugins goes after this line
81
82
#if PICOHAL_IO_ENABLE
83
extern
void
picohal_io_init (
void
);
84
#endif
85
86
#endif
// ModBus expanders
87
88
// CANBus expanders
89
90
//
91
92
// Other expanders
93
94
#if THCAD2_ENABLE
95
extern
void
thcad2_init (
void
);
96
#endif
97
98
#if FNC_EXPANDER_ENABLE
99
void
fnc_expander_init (
void
);
100
#endif
101
102
//
103
104
static
inline
void
io_expanders_init (
void
)
105
{
106
board_ports_init
();
// can be implemented by board specific code
107
108
#if MCP3221_ENABLE
109
mcp3221_init();
110
#endif
111
112
#if MCP4725_ENABLE
113
mcp4725_init();
114
#endif
115
116
#if R4SLS08_ENABLE
117
r4sls08_init();
118
#endif
119
120
#if PCA9654E_ENABLE
121
pca9654e_init();
122
#endif
123
124
#if FLEXGPIO_ENABLE
125
flexgpio_init();
126
#endif
127
128
#if PICOHAL_IO_ENABLE
129
picohal_io_init();
130
#endif
131
132
#if FNC_EXPANDER_ENABLE
133
fnc_expander_init();
134
#endif
135
136
#if THCAD2_ENABLE
137
thcad2_init();
138
#endif
139
}
board_ports_init
void board_ports_init(void)
Definition:
grbllib.c:110
STM
grblHAL Driver STM32F756
grbl
expanders_init.h
Generated by
1.9.1