forked from grblHAL/RP2040
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ioexpand.h
64 lines (50 loc) · 1.52 KB
/
ioexpand.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/*
ioexpand.h - driver code for RP2040 ARM processor
I2C I/O expander
Part of grblHAL
Copyright (c) 2018-2022 Terje Io
Grbl is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Grbl is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Grbl. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _IOEXPAND_H_
#define _IOEXPAND_H_
#include "driver.h"
#define ioex_out(pin) ioex_outN(pin)
#define ioex_outN(pin) io_expander.out ## pin
#define ioex_in(pin) ioex_inN(pin)
#define ioex_inN(pin) io_expander.in ## pin
typedef union {
uint8_t mask;
struct {
uint8_t out0 :1,
out1 :1,
out2 :1,
out3 :1,
out4 :1,
out5 :1,
out6 :1,
out7 :1;
};
struct {
uint8_t in0 :1,
in1 :1,
in2 :1,
in3 :1,
in4 :1,
in5 :1,
in6 :1,
in7 :1;
};
} ioexpand_t;
void ioexpand_init (void);
void ioexpand_out (ioexpand_t pins);
ioexpand_t ioexpand_in (void);
#endif