AUnit
1.7.1
Unit testing framework for Arduino platforms inspired by ArduinoUnit and Google Test.
src
aunit
Flash.h
Go to the documentation of this file.
1
/*
2
MIT License
3
4
Copyright (c) 2018 Brian T. Park
5
6
Permission is hereby granted, free of charge, to any person obtaining a copy
7
of this software and associated documentation files (the "Software"), to deal
8
in the Software without restriction, including without limitation the rights
9
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
copies of the Software, and to permit persons to whom the Software is
11
furnished to do so, subject to the following conditions:
12
13
The above copyright notice and this permission notice shall be included in all
14
copies or substantial portions of the Software.
15
16
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
SOFTWARE.
23
*/
24
67
#ifndef AUNIT_FLASH_H
68
#define AUNIT_FLASH_H
69
70
class
__FlashStringHelper;
71
77
#define AUNIT_FPSTR(pstr) reinterpret_cast<const __FlashStringHelper *>(pstr)
78
79
#if defined(ARDUINO_ARCH_AVR)
80
81
#include <avr/pgmspace.h>
82
#define AUNIT_F(x) F(x)
83
84
// Seeeduino SAMD21 Core is buggy, so we have to hack around it. Unfortunately,
85
// the Seeeduino core does not define an identifier for the following boards, so
86
// they are not supported:
87
// * Wio lite MG126
88
// * Wio GPS Board
89
// * Wio LTE CAT.1
90
#elif defined(SEEED_XIAO_M0) \
91
|| defined(SEEEDUINO_ZERO) \
92
|| defined(SEEED_FEMTO_M0) \
93
|| defined(SEEEDUINO_LORAWAN) \
94
|| defined(SEEED_WIO_TERMINAL) \
95
|| defined(SEEED_GROVE_UI_WIRELESS)
96
97
#include <avr/pgmspace.h>
98
99
// Seeeduino (as of 1.8.4) provides an incorrect definition of FPSTR()
100
// so we have to clobber it.
101
#undef FPSTR
102
#define FPSTR(p) (reinterpret_cast<const __FlashStringHelper *>(p))
103
#define AUNIT_F(x) F(x)
104
105
// The following should work for Adafruit SAMD core, and other third party SAMD
106
// (SparkFun?) cores which are less buggy. The Arduino SAMD Core breaks
107
// backwards compatibility for versions >= 1.8.10. It is blacklisted by the time
108
// we get here.
109
#elif defined(ARDUINO_ARCH_SAMD)
110
111
#include <avr/pgmspace.h>
112
#define AUNIT_F(x) F(x)
113
114
#elif defined(ESP8266)
115
116
#include <pgmspace.h>
117
#define AUNIT_F(x) F(x)
118
119
#elif defined(ESP32)
120
121
#include <pgmspace.h>
122
#define AUNIT_F(x) F(x)
123
124
// ESP32 cores don't seem to define SERIAL_PORT_MONITOR
125
#if ! defined(SERIAL_PORT_MONITOR)
126
#define SERIAL_PORT_MONITOR Serial
127
#endif
128
129
#elif defined(ARDUINO_ARCH_STM32)
130
131
#include <avr/pgmspace.h>
132
#define AUNIT_F(x) F(x)
133
134
#elif defined(EPOXY_DUINO)
135
136
#include <pgmspace.h>
137
#define AUNIT_F(x) F(x)
138
139
#elif defined(TEENSYDUINO)
140
141
#include <pgmspace.h>
142
#define AUNIT_F(x) F(x)
143
144
#else
145
146
#warning Untested platform, AUnit may still work...
147
148
#include <avr/pgmspace.h>
149
#define AUNIT_F(x) F(x)
150
151
#if ! defined(SERIAL_PORT_MONITOR)
152
#define SERIAL_PORT_MONITOR Serial
153
#endif
154
155
#endif
156
157
#endif
// AUNIT_FLASH_H
Generated by
1.9.1