cryptnox-sdk-cpp 1.0.0
Platform-independent C++ core SDK for Cryptnox Hardware Wallet
Loading...
Searching...
No Matches
platform_compat.h
Go to the documentation of this file.
1/*
2 * SPDX-License-Identifier: LGPL-3.0-or-later
3 * Copyright (c) 2026 Cryptnox SA
4 */
5
6#ifndef PLATFORM_COMPAT_H
7#define PLATFORM_COMPAT_H
8
19
20#ifdef ARDUINO
21/* On Arduino, pull in Arduino.h so SDK headers that reference __FlashStringHelper,
22 * DEC/HEX/OCT/BIN, F(), or delay() compile regardless of whether the including
23 * translation unit already included <Arduino.h>. Arduino.h transitively provides
24 * <stdint.h>, <stddef.h>, <string.h>, etc., so no need to include them here. */
25# include <Arduino.h>
26#else
27/* Off Arduino, include the C standard headers explicitly so the SDK compiles
28 * without depending on what the including TU may or may not have pulled in. */
29# include <stdint.h>
30# include <stddef.h>
31# include <string.h>
32# include <stdbool.h>
33
34# define DEC 10
35# define HEX 16
36# define OCT 8
37# define BIN 2
38
39/* F("...") on Arduino returns __FlashStringHelper* to keep string literals in
40 * flash. On non-Arduino it is the identity macro, resolving to const char*. */
42# define F(string_literal) (string_literal)
43
44#endif /* ARDUINO / !ARDUINO */
45
46#endif /* PLATFORM_COMPAT_H */