diff options
| author | Birte Kristina Friesel <derf@finalrewind.org> | 2026-01-10 13:12:33 +0100 |
|---|---|---|
| committer | Birte Kristina Friesel <derf@finalrewind.org> | 2026-01-10 13:12:33 +0100 |
| commit | d7525456752e182b2e20ae0f38ed022f881eec9e (patch) | |
| tree | efa295b2f0132142de94c12efa7aef52121d5ba1 /src | |
| parent | 11533e773394511215bfebdf413a1139cddb150d (diff) | |
framebuffer, pixelfont: use HAVE_PROGMEM rather than hardcoding arch checks
Diffstat (limited to 'src')
| -rw-r--r-- | src/arch/arduino-nano/Makefile.inc | 1 | ||||
| -rw-r--r-- | src/arch/atmega2560/Makefile.inc | 1 | ||||
| -rw-r--r-- | src/object/framebuffer.cc | 6 |
3 files changed, 5 insertions, 3 deletions
diff --git a/src/arch/arduino-nano/Makefile.inc b/src/arch/arduino-nano/Makefile.inc index 2313d18..f6fb416 100644 --- a/src/arch/arduino-nano/Makefile.inc +++ b/src/arch/arduino-nano/Makefile.inc @@ -22,6 +22,7 @@ cpu_freq ?= 16000000 COMMON_FLAGS += -Werror=overflow COMMON_FLAGS += -mmcu=${MCU} -DMULTIPASS_ARCH_arduino_nano COMMON_FLAGS += -DF_CPU=${cpu_freq}UL +COMMON_FLAGS += -DHAVE_PROGMEM ifeq (${stack_usage}, ) COMMON_FLAGS += -flto diff --git a/src/arch/atmega2560/Makefile.inc b/src/arch/atmega2560/Makefile.inc index 6d82a1c..a8cfb42 100644 --- a/src/arch/atmega2560/Makefile.inc +++ b/src/arch/atmega2560/Makefile.inc @@ -17,6 +17,7 @@ cpu_freq ?= 16000000 COMMON_FLAGS += -Werror=overflow COMMON_FLAGS += -mmcu=${MCU} -DMULTIPASS_ARCH_atmega2560 COMMON_FLAGS += -DF_CPU=${cpu_freq}UL +COMMON_FLAGS += -DHAVE_PROGMEM ifeq (${stack_usage}, ) COMMON_FLAGS += -flto diff --git a/src/object/framebuffer.cc b/src/object/framebuffer.cc index e7b914d..a3848ef 100644 --- a/src/object/framebuffer.cc +++ b/src/object/framebuffer.cc @@ -1,6 +1,6 @@ #include "object/framebuffer.h" -#ifdef MULTIPASS_ARCH_arduino_nano +#ifdef HAVE_PROGMEM #include <avr/pgmspace.h> #endif @@ -119,7 +119,7 @@ void Framebuffer::put(char c) if ((c < 32) || (c > 126)) { c = '?'; } -#ifdef MULTIPASS_ARCH_arduino_nano +#ifdef HAVE_PROGMEM uint8_t *glyph_addr = (uint8_t *)pgm_read_ptr(&font[c - 32]); const unsigned char glyph_w = pgm_read_byte(&glyph_addr[0]); #else @@ -136,7 +136,7 @@ void Framebuffer::put(char c) for (unsigned char i = 0; i < glyph_w; i++) { unsigned char x = i / fontSize; unsigned char y = i % fontSize; -#ifdef MULTIPASS_ARCH_arduino_nano +#ifdef HAVE_PROGMEM data[(height/8) * (fontX + x) + fontY/8 + y] = pgm_read_byte(&glyph_addr[i+1]); #else data[(height/8) * (fontX + x) + fontY/8 + y] = glyph[i+1]; |
