grblHAL core
20250514
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 grbl 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
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
#endif
// I2C expanders
59
60
// SPI expanders
61
62
//
63
64
// ModBus expanders
65
66
#if PICOHAL_IO_ENABLE || R4SLS08_ENABLE
67
68
#if !defined(MODBUS_ENABLE) || !(MODBUS_ENABLE & MODBUS_RTU_ENABLED)
69
#error "Enabled IO expander(s) require Modbus RTU!"
70
#endif
71
72
#if R4SLS08_ENABLE
73
extern
void
r4sls08_init (
void
);
74
#endif
75
76
// Third party Modbus expander plugins goes after this line
77
78
#if PICOHAL_IO_ENABLE
79
extern
void
picohal_io_init (
void
);
80
#endif
81
82
#endif
// ModBus expanders
83
84
// CANBus expanders
85
86
//
87
88
// Other expanders
89
90
//
91
92
static
inline
void
io_expanders_init (
void
)
93
{
94
board_ports_init
();
// can be implemented by board specific code
95
96
#if MCP3221_ENABLE
97
mcp3221_init();
98
#endif
99
100
#if MCP4725_ENABLE
101
mcp4725_init();
102
#endif
103
104
#if R4SLS08_ENABLE
105
r4sls08_init();
106
#endif
107
108
#if PCA9654E_ENABLE
109
pca9654e_init();
110
#endif
111
112
#if PICOHAL_IO_ENABLE
113
picohal_io_init();
114
#endif
115
}
board_ports_init
void board_ports_init(void)
Definition:
grbllib.c:103
STM
grblHAL Driver STM32F756
grbl
expanders_init.h
Generated by
1.9.1