Merge pull request #11198 from SteveCEvans/sce_rc2
[betaflight.git] / src / main / drivers / io_types.h
blob0ea877a65cbfb7ec3473ce67cfd89ed8fadfd2ff
1 /*
2 * This file is part of Cleanflight and Betaflight.
4 * Cleanflight and Betaflight are free software. You can redistribute
5 * this software and/or modify this software under the terms of the
6 * GNU General Public License as published by the Free Software
7 * Foundation, either version 3 of the License, or (at your option)
8 * any later version.
10 * Cleanflight and Betaflight are distributed in the hope that they
11 * will be useful, but WITHOUT ANY WARRANTY; without even the implied
12 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 * See the GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this software.
18 * If not, see <http://www.gnu.org/licenses/>.
21 #pragma once
23 #include <stdint.h>
25 // IO pin identification
26 // make sure that ioTag_t can't be assigned into IO_t without warning
27 typedef uint8_t ioTag_t; // packet tag to specify IO pin
28 typedef void* IO_t; // type specifying IO pin. Currently ioRec_t pointer, but this may change
30 // NONE initializer for ioTag_t variables
31 #define IO_TAG_NONE 0
33 // NONE initializer for IO_t variable
34 #define IO_NONE ((IO_t)0)
36 // both ioTag_t and IO_t are guarantied to be zero if pinid is NONE (no pin)
37 // this simplifies initialization (globals are zeroed on start) and allows
38 // omitting unused fields in structure initializers.
39 // it is also possible to use IO_t and ioTag_t as boolean value
40 // TODO - this may conflict with requirement to generate warning/error on IO_t - ioTag_t assignment
41 // IO_t being pointer is only possibility I know of ..
43 // pin config handling
44 // pin config is packed into ioConfig_t to decrease memory requirements
45 // IOCFG_x macros are defined for common combinations for all CPUs; this
46 // helps masking CPU differences
48 typedef uint8_t ioConfig_t; // packed IO configuration