flash/flash.hpp

16 lines
432 B
C++

#pragma once
#include <avr/pgmspace.h>
#define F(str) (reinterpret_cast<const ::detail::FlashString *>(PSTR(str)))
#define GF(name, str) \
const char __##name[] PROGMEM = str; \
const auto *name = reinterpret_cast<const ::detail::FlashString *>(__##name)
namespace detail {
// Only used for C++ type safety, because otherwise a PSTR would be indistinguishable from a normal c-string
struct FlashString;
} // namespace detail