FastArduino
v1.10
C++ library to build fast but small Arduino/AVR projects
Loading...
Searching...
No Matches
io.h
1
// Copyright 2016-2023 Jean-Francois Poilpret
2
//
3
// Licensed under the Apache License, Version 2.0 (the "License");
4
// you may not use this file except in compliance with the License.
5
// You may obtain a copy of the License at
6
//
7
// http://www.apache.org/licenses/LICENSE-2.0
8
//
9
// Unless required by applicable law or agreed to in writing, software
10
// distributed under the License is distributed on an "AS IS" BASIS,
11
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
// See the License for the specific language governing permissions and
13
// limitations under the License.
14
15
// This file wraps "avr/io.h" header, in order to override all _SFR_XXX() macros
16
// to allow usage of all defines (such as PINB) to work in constexpr evalutations.
17
18
#ifndef BOARDS_IO_HH
19
#define BOARDS_IO_HH
20
21
#include <avr/io.h>
22
23
// Override all _SFR_XXX() macros to simply return a const integer value
24
#ifdef _SFR_IO8
25
#undef _SFR_IO8
26
#endif
27
#define _SFR_IO8(x) ((x) + __SFR_OFFSET)
28
29
#ifdef _SFR_IO16
30
#undef _SFR_IO16
31
#endif
32
#define _SFR_IO16(x) ((x) + __SFR_OFFSET)
33
34
#ifdef _SFR_MEM8
35
#undef _SFR_MEM8
36
#endif
37
#define _SFR_MEM8(x) (x)
38
39
#ifdef _SFR_MEM16
40
#undef _SFR_MEM16
41
#endif
42
#define _SFR_MEM16(x) (x)
43
44
// Force SREG which is used by <util/atomic.h>
45
#ifdef SREG
46
#undef SREG
47
#define SREG (*((volatile uint8_t*) (0x3F + __SFR_OFFSET)))
48
#endif
49
50
#endif
/* BOARDS_IO_HH */
fastarduino
boards
io.h
Generated by
1.9.5