Speeduino
Loading...
Searching...
No Matches
board_definition.h
Go to the documentation of this file.
1#pragma once
2
10#include <stdint.h>
11#include <Arduino.h>
12#include "src/stdlib/type_traits.h"
13#include "src/stdlib/limits.h"
14#include "storage_api.h"
15
23void initBoard(uint32_t baudRate);
24
30void boardInitPins(uint8_t boardID);
31
33uint16_t freeRam(void);
34
36void doSystemReset(void);
37
40
42uint8_t getSystemTemp(void);
43
46
48// Shared building blocks for the board headers
49#define _ANALOG_PINS_A0_A8 A0, A1, A2, A3, A4, A5, A6, A7, A8
50#define _ANALOG_PINS_A0_A14 _ANALOG_PINS_A0_A8, A9, A10, A11, A12, A13, A14
52
53// Include a specific header for a board.
54#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) || defined(__AVR_ATmega2561__)
55 #include "board_avr2560.h"
56#elif defined(CORE_TEENSY)
57 #if defined(__MK64FX512__) || defined(__MK66FX1M0__)
58 #include "board_teensy35.h"
59 #elif defined(__IMXRT1062__)
60 #include "board_teensy41.h"
61 #endif
62#elif defined(STM32_MCU_SERIES) || defined(ARDUINO_ARCH_STM32) || defined(STM32)
63 #include "board_stm32_official.h"
64#elif defined(__SAME51J19A__)
65 #include "board_same51.h"
66// Allow external injection of the board definition via compiler flags
67#elif defined(EXTERNAL_BOARD_H)
68 #include EXTERNAL_BOARD_H
69#else
70 #error Incorrect board selected. Please select the correct board (Usually Mega 2560) and upload again
71#endif
72
73#if defined(RTC_ENABLED)
75void boardInitRTC(void);
76#endif
77
78// It is important that we cast this to the actual overflow limit of the timer.
79// The compare variables type can be wider than the timer overflow.
80#define SET_COMPARE(compare, value) (compare) = (COMPARE_TYPE)(value)
81
83constexpr uint32_t MAX_TIMER_PERIOD = ticksToMicros((numeric_limits<COMPARE_TYPE>::max)());
static constexpr uint32_t ticksToMicros(COMPARE_TYPE ticks)
Convert timer ticks to µS.
Definition board_avr2560.h:50
uint8_t getSystemTemp(void)
Get the board temp for display in TunerStudio (optional)
constexpr uint32_t MAX_TIMER_PERIOD
The longest period of time (in uS) that the timer can permit.
Definition board_definition.h:83
storage_api_t getBoardStorageApi(void)
Get the storage API for the board.
void boardInitPins(uint8_t boardID)
Pin specific initialisation (optional - can be empty)
void jumpToBootloader(void)
Trigger the boot loader (optional)
void initBoard(uint32_t baudRate)
Initialise the board, including USB comms.
void doSystemReset(void)
Reset the board (optional)
uint16_t freeRam(void)
Calculate free RAM for display in TunerStudio.
Defines the required external storage API plus some convenience functions built around that API.
The external storage API. This must be supported by any storage system. E.g. EEPROM,...
Definition storage_api.h:18