FastArduino v1.10
C++ library to build fast but small Arduino/AVR projects
Loading...
Searching...
No Matches
board.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#ifndef BOARDS_BOARD_HH
16#define BOARDS_BOARD_HH
17
18#include <stdint.h>
19
20// Arduino Boards
21#if defined(ARDUINO_MEGA)
22#include "mega.h"
23#elif defined(ARDUINO_UNO) || defined(BREADBOARD_ATMEGA328P)
24#include "uno.h"
25#elif defined(ARDUINO_LEONARDO)
26#include "leonardo.h"
27#elif defined(ARDUINO_NANO)
28#define HAS_8_ANALOG_INPUTS
29#include "uno.h"
30
31// Breadboards
32#elif defined(BREADBOARD_ATTINYX4)
33#include "attiny_x4.h"
34#elif defined(BREADBOARD_ATTINYX5)
35#include "attiny_x5.h"
36#elif defined(BREADBOARD_ATMEGAXX4P)
37#include "atmega_xx4.h"
38
39#else
40#error "board.h: board not supported"
41#endif
42
43// General constants used everywhere
44static constexpr const uint32_t ONE_MHZ = 1'000'000UL;
45static constexpr const uint32_t ONE_SECOND = 1'000'000UL;
46static constexpr const uint32_t INST_PER_US = F_CPU / ONE_MHZ;
47static constexpr const uint16_t ONE_MILLI_16 = 1000U;
48static constexpr const uint32_t ONE_MILLI_32 = 1000UL;
49
50#endif /* BOARDS_BOARD_HH */