summary refs log tree commit diff
path: root/platforms/progmem.h
diff options
context:
space:
mode:
authorJoel Challis <git@zvecr.com>2021-11-19 18:41:02 +0000
committerGitHub <noreply@github.com>2021-11-19 10:41:02 -0800
commit2728603fe6d73e805a539d337fd01051c46ca806 (patch)
tree5c83ffc7efa112da870bd5d8502a9d91d4792f35 /platforms/progmem.h
parent43b9e23bae12916d5161f03700c9bfe46737324b (diff)
Move tmk_core/common/<plat> (#13918)
Diffstat (limited to 'platforms/progmem.h')
-rw-r--r--platforms/progmem.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/platforms/progmem.h b/platforms/progmem.h
new file mode 100644
index 0000000000..a70d8e299f
--- /dev/null
+++ b/platforms/progmem.h
@@ -0,0 +1,19 @@
+#pragma once
+
+#if defined(__AVR__)
+#    include <avr/pgmspace.h>
+#else
+#    include <string.h>
+#    define PROGMEM
+#    define __flash
+#    define PSTR(x) x
+#    define PGM_P const char*
+#    define memcpy_P(dest, src, n) memcpy(dest, src, n)
+#    define pgm_read_byte(address_short) *((uint8_t*)(address_short))
+#    define pgm_read_word(address_short) *((uint16_t*)(address_short))
+#    define pgm_read_dword(address_short) *((uint32_t*)(address_short))
+#    define pgm_read_ptr(address_short) *((void**)(address_short))
+#    define strcmp_P(s1, s2) strcmp(s1, s2)
+#    define strcpy_P(dest, src) strcpy(dest, src)
+#    define strlen_P(src) strlen(src)
+#endif