diff --git a/Makefile b/Makefile index 7098cfb..abb9347 100644 --- a/Makefile +++ b/Makefile @@ -17,13 +17,13 @@ LORA = 1 # Display dimensions DISPLAY_WIDTH = 320 DISPLAY_HEIGHT = 240 -# 1 = BGR, 0 = RGB -BGR = 0 +# true = BGR, false = RGB +BGR = true # Invert color -INVERT = 1 +INVERT = true # Flip image -HFLIP = 1 -VFLIP = 0 +HFLIP = true +VFLIP = false ifndef RFM override RFM = 0 @@ -34,8 +34,7 @@ override LORA = 1 endif MAIN = avrrfm.c -SRC = bitmaps.c colorspace.c dejavu.c display.c font.c i2c.c mcp9808.c \ - spi.c tft.c unifont.c usart.c rfm.c sdc.c +SRC = bitmaps.c dejavu.c i2c.c mcp9808.c spi.c usart.c rfm.c tft.c sdc.c CC = avr-gcc OBJCOPY = avr-objcopy @@ -58,14 +57,13 @@ CFLAGS += -std=gnu99 TARGET = $(strip $(basename $(MAIN))) SRC += $(TARGET).c -SRC += librfm$(RFM).a libsdc.a +SRC += librfm$(RFM).a libtft.a libsdc.a OBJ = $(SRC:.c=.o) OBJ = $(SRC:.S=.o) -$(TARGET).elf: bitmaps.h colorspace.h dejavu.h display.h font.h i2c.h \ - mcp9808.h pins.h spi.h tft.h types.h unifont.h usart.h utils.h \ - librfm$(RFM).h libsdc.h Makefile +$(TARGET).elf: dejavu.h i2c.h mcp9808.h pins.h spi.h types.h unifont.h usart.h \ + utils.h librfm$(RFM).h libtft.h libsdc.h Makefile all: $(TARGET).hex diff --git a/avrrfm.c b/avrrfm.c index 8e409aa..e4b5681 100644 --- a/avrrfm.c +++ b/avrrfm.c @@ -28,10 +28,9 @@ #include "spi.h" #include "utils.h" #include "librfm95.h" +#include "libtft.h" #include "libsdc.h" #include "mcp9808.h" -#include "tft.h" -#include "display.h" #include "dejavu.h" #include "unifont.h" @@ -73,6 +72,30 @@ #define RECEIVER 1 #endif +#ifndef DISPLAY_WIDTH + #define DISPLAY_WIDTH 320 +#endif + +#ifndef DISPLAY_HEIGHT + #define DISPLAY_HEIGHT 240 +#endif + +#ifndef BGR + #define BGR false +#endif + +#ifndef INVERT + #define INVERT false +#endif + +#ifndef HFLIP + #define HFLIP false +#endif + +#ifndef VFLIP + #define VFLIP false +#endif + static volatile uint16_t watchdogInts = 0; /* Temp. label coordinates */ @@ -227,17 +250,17 @@ static void displayTemp(uint8_t rssi, bool crc, Temperature *temp) { snprintf(buf, sizeof (buf), "RSSI: %4d dBm, CRC: %d, PA: %s dBm", -rssi, crc, crc ? paf : "---"); const __flash Font *unifont = &unifontFont; - writeString(0, 0, unifont, buf, BLACK, WHITE); + tftWriteString(0, 0, unifont, buf, BLACK, WHITE); // display temperature (floating, red if CRC failed) snprintf(buf, sizeof (buf), "%c%d.%d°", tempx10 < 0 ? '-' : ' ', abs(tdiv.quot), abs(tdiv.rem)); const __flash Font *dejaVu = &dejaVuFont; - if (width > 0) fillArea(xo, yo, width, dejaVu->height, WHITE); + if (width > 0) tftFillArea(xo, yo, width, dejaVu->height, WHITE); if (yl == 0) yl = unifont->height; // FIXME required space should be calculated before writing the text // i.e. 9.9° -> 10.0° can go wrong - width = writeString(xl, yl, dejaVu, buf, WHITE, crc ? BLACK : RED); + width = tftWriteString(xl, yl, dejaVu, buf, WHITE, crc ? BLACK : RED); xo = xl; yo = yl; xl += LABEL_OFFSET; @@ -360,9 +383,10 @@ int main(void) { } if (RECEIVER) { - initDisplay(); - setFrame(WHITE); - fillArea(0, 0, DISPLAY_WIDTH, 16, BLACK); + tftInit(DISPLAY_WIDTH, DISPLAY_HEIGHT, HFLIP, VFLIP, BGR, INVERT); + tftSetFrame(WHITE); + tftFillArea(0, 0, DISPLAY_WIDTH, 16, BLACK); + tftWriteBitmap(0, 176, 0, 0xffff, 0x0000); // initial rx mode if (radio) { if (LORA) { diff --git a/bitmaps.c b/bitmaps.c index 1d209f6..68bb7a7 100644 --- a/bitmaps.c +++ b/bitmaps.c @@ -2,18 +2,78 @@ * File: bitmaps.c * Author: torsten.roemer@luniks.net * - * Created on 6. November 2023, 18:45 + * Created on 06/07/2023, 23:28 */ -#include "bitmaps.h" +#include "font.h" -const __flash uint8_t SOME_DATA[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +const __flash uint8_t TUX_DATA[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x03, 0xff, 0x80, 0x00, 0x00, + 0x00, 0x00, 0x07, 0xff, 0xc0, 0x00, 0x00, + 0x00, 0x00, 0x07, 0xff, 0xe0, 0x00, 0x00, + 0x00, 0x00, 0x0f, 0xff, 0xf0, 0x00, 0x00, + 0x00, 0x00, 0x0f, 0xff, 0xf0, 0x00, 0x00, + 0x00, 0x00, 0x0f, 0xff, 0xf0, 0x00, 0x00, + 0x00, 0x00, 0x0f, 0xf9, 0xf0, 0x00, 0x00, + 0x00, 0x00, 0x0c, 0xf0, 0xf8, 0x00, 0x00, + 0x00, 0x00, 0x08, 0x60, 0x78, 0x00, 0x00, + 0x00, 0x00, 0x0a, 0x66, 0x70, 0x00, 0x00, + 0x00, 0x00, 0x0b, 0x6e, 0x70, 0x00, 0x00, + 0x00, 0x00, 0x0b, 0x06, 0x70, 0x00, 0x00, + 0x00, 0x00, 0x0c, 0x02, 0xf0, 0x00, 0x00, + 0x00, 0x00, 0x08, 0x00, 0xf8, 0x00, 0x00, + 0x00, 0x00, 0x08, 0x00, 0x78, 0x00, 0x00, + 0x00, 0x00, 0x0c, 0x00, 0x78, 0x00, 0x00, + 0x00, 0x00, 0x0e, 0x00, 0xf8, 0x00, 0x00, + 0x00, 0x00, 0x0e, 0x04, 0xfc, 0x00, 0x00, + 0x00, 0x00, 0x0b, 0x10, 0x7e, 0x00, 0x00, + 0x00, 0x00, 0x19, 0xe0, 0x3e, 0x00, 0x00, + 0x00, 0x00, 0x30, 0x00, 0x3f, 0x00, 0x00, + 0x00, 0x00, 0x30, 0x00, 0x1f, 0x80, 0x00, + 0x00, 0x00, 0x60, 0x00, 0x1f, 0xc0, 0x00, + 0x00, 0x00, 0xe0, 0x00, 0x1f, 0xc0, 0x00, + 0x00, 0x01, 0xe0, 0x00, 0x0f, 0xe0, 0x00, + 0x00, 0x03, 0xe0, 0x00, 0x0f, 0xf0, 0x00, + 0x00, 0x03, 0xc0, 0x00, 0x07, 0xf0, 0x00, + 0x00, 0x03, 0xc0, 0x00, 0x07, 0x78, 0x00, + 0x00, 0x07, 0x80, 0x00, 0x03, 0x78, 0x00, + 0x00, 0x07, 0x80, 0x00, 0x03, 0xbc, 0x00, + 0x00, 0x0f, 0x80, 0x00, 0x03, 0xbc, 0x00, + 0x00, 0x0f, 0x00, 0x00, 0x03, 0xbc, 0x00, + 0x00, 0x1f, 0x00, 0x00, 0x03, 0xbc, 0x00, + 0x00, 0x1f, 0x00, 0x00, 0x03, 0xbe, 0x00, + 0x00, 0x3f, 0x00, 0x00, 0x03, 0xbe, 0x00, + 0x00, 0x3b, 0x00, 0x00, 0x02, 0x3e, 0x00, + 0x00, 0x3d, 0x00, 0x00, 0x01, 0xfe, 0x00, + 0x00, 0x26, 0x00, 0x00, 0x03, 0xfe, 0x00, + 0x00, 0x03, 0x00, 0x00, 0x07, 0xfe, 0x00, + 0x00, 0x01, 0xc0, 0x00, 0x03, 0xf9, 0x00, + 0x00, 0x00, 0xe0, 0x00, 0x01, 0xf1, 0x00, + 0x00, 0x40, 0x70, 0x00, 0x00, 0xe1, 0x00, + 0x06, 0x00, 0x78, 0x00, 0x00, 0x01, 0x00, + 0x08, 0x00, 0x3c, 0x00, 0x08, 0x01, 0x00, + 0x00, 0x00, 0x3c, 0x00, 0x08, 0x00, 0x80, + 0x04, 0x00, 0x1c, 0x00, 0x08, 0x00, 0x20, + 0x04, 0x00, 0x08, 0x00, 0x08, 0x00, 0x10, + 0x04, 0x00, 0x08, 0x00, 0x68, 0x00, 0x10, + 0x00, 0x00, 0x04, 0x00, 0xe8, 0x00, 0x60, + 0x08, 0x00, 0x05, 0x03, 0xf8, 0x01, 0x80, + 0x08, 0x00, 0x05, 0xff, 0xf8, 0x06, 0x00, + 0x07, 0x00, 0x07, 0xff, 0xf8, 0x08, 0x00, + 0x00, 0x38, 0x06, 0x00, 0x18, 0x30, 0x00, + 0x00, 0x03, 0x0c, 0x00, 0x0c, 0x60, 0x00, + 0x00, 0x00, 0x70, 0x00, 0x07, 0x80, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; const __flash Bitmap bitmaps[] = { - {16, 16, SPACE_MONO1, SOME_DATA} -}; + {56, 64, SPACE_MONO1, TUX_DATA} +}; \ No newline at end of file diff --git a/bitmaps.h b/bitmaps.h deleted file mode 100644 index 326521e..0000000 --- a/bitmaps.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * File: bitmaps.h - * Author: torsten.roemer@luniks.net - * - * Created on 16. April 2023, 18:19 - */ - -#ifndef BITMAPS_H -#define BITMAPS_H - -#include "types.h" -#include "colorspace.h" - -/** - * A bitmap with its width and height, and data. - */ -typedef struct { - /** Width of the bitmap. */ - const width_t width; - /** Height of the bitmap. */ - const height_t height; - /** Color space of the bitmap. */ - const space_t space; - /** The actual bitmap. */ - const __flash uint8_t *bitmap; -} Bitmap; - -/** - * Available bitmaps. - */ -extern const __flash Bitmap bitmaps[]; - -#endif /* BITMAPS_H */ - diff --git a/colorspace.c b/colorspace.c deleted file mode 100644 index 2f53d53..0000000 --- a/colorspace.c +++ /dev/null @@ -1,89 +0,0 @@ -/* - * File: colorspace.c - * Author: torsten.roemer@luniks.net - * - * Created on 3. Juli 2024, 19:03 - */ - -#include "colorspace.h" - -/** - * Converts the given 8 pixel in 1-Bit monochrome to 16-Bit RGB (5/6/5) color - * stored in the given array of 16 bytes, with the given background and - * foreground color. - * - * @param mono 8 pixel in 1-Bit monochrome - * @param rgb 8 pixel in 16-Bit RGB (5/6/5) color - * @param bg background color - * @param fg foreground color - */ -static void mono1ToRGB16(uint8_t mono, uint8_t *rgb, - uint16_t bg, uint16_t fg) { - for (uint8_t i = 0; i < 16; i++) { - uint8_t _bg = i % 2 == 0 ? bg >> 8 : bg; - uint8_t _fg = i % 2 == 0 ? fg >> 8 : fg; - rgb[i] = (mono & (1 << ((15 - i) >> 1))) ? _fg : _bg; - } -} - -/* - * Converts the given two pixel in 4-Bit greyscale to 16-Bit RGB (5/6/5) color - * stored in the given array of four bytes. - * - * @param grey two pixel in 4-Bit greyscale - * @param rgb two pixel in 16-Bit RGB (5/6/5) color - */ -static void grey4ToRGB16(uint8_t grey, uint8_t *rgb) { - uint8_t grey4 = ((grey >> 4) & 1); - uint8_t grey0 = ((grey >> 0) & 1); - - rgb[0] = (grey & 0xf0); - rgb[0] |= (grey4 << 3); - rgb[0] |= (grey >> 5); - - rgb[1] = ((grey & 0xf0) << 3); - rgb[1] |= ((grey & 0xf0) >> 3); - rgb[1] |= (grey4 << 6) | (grey4 << 5) | (grey4 << 0); - - rgb[2] = (grey << 4); - rgb[2] |= (grey0 << 3); - rgb[2] |= ((grey & 0x0f) >> 1); - - rgb[3] = (grey << 7); - rgb[3] |= ((grey & 0x0f) << 1); - rgb[3] |= (grey0 << 6) | (grey0 << 5) | (grey0 << 0); -} - -void writeSpace(const __flash uint8_t *bitmap, - width_t width, height_t height, - space_t space, uint16_t bg, uint16_t fg) { - switch (space) { - case SPACE_MONO1: { - bytes_t bytes = width * height / 8; - for (uint16_t i = 0; i < bytes; i++) { - uint8_t rgb[16]; - mono1ToRGB16(bitmap[i], rgb, bg, fg); - for (uint8_t j = 0; j < 16; j++) { - transmit(rgb[j]); - } - } - }; break; - case SPACE_GREY4: { - bytes_t bytes = width * height / 2; - for (uint16_t i = 0; i < bytes; i++) { - uint8_t rgb[4]; - grey4ToRGB16(bitmap[i], rgb); - for (uint8_t j = 0; j < 4; j++) { - transmit(rgb[j]); - } - } - }; break; - default: { - // SPACE_RGB16 - bytes_t bytes = width * height * 2; - for (uint16_t i = 0; i < bytes; i++) { - transmit(bitmap[i]); - } - } - } -} \ No newline at end of file diff --git a/colorspace.h b/colorspace.h deleted file mode 100644 index a590bdf..0000000 --- a/colorspace.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * File: colorspace.h - * Author: torsten.roemer@luniks.net - * - * Created on 3. Juli 2024, 19:02 - */ - -#ifndef COLORSPACE_H -#define COLORSPACE_H - -// TODO use enum? typedef? -#define SPACE_MONO1 1 -#define SPACE_GREY4 4 -#define SPACE_RGB16 16 - -#include -#include "types.h" -#include "spi.h" - -/** - * Helper to write image data to the display, converting from the given - * color space to that of the display. - * - * @param bitmap pointer to bitmap data in program memory - * @param width width of the bitmap in pixels - * @param height height of the bitmap in pixels - * @param space color space of the bitmap - * @param bg background color (used only with SPACE_MONO1) - * @param fg foreground color (used only with SPACE_MONO1) - */ -void writeSpace(const __flash uint8_t *bitmap, - width_t width, height_t height, - space_t space, uint16_t bg, uint16_t fg); - -#endif /* COLORSPACE_H */ - diff --git a/dejavu.c b/dejavu.c index df07eac..fb86c2c 100644 --- a/dejavu.c +++ b/dejavu.c @@ -1,4 +1,4 @@ -/* +/* * File: dejavu.c * Author: torsten.roemer@luniks.net * https://dejavu-fonts.github.io/License.html @@ -6,33 +6,31 @@ * Created on 23. April 2023, 18:41 */ -#include -#include "font.h" #include "dejavu.h" #include "utils.h" #define HEIGHT 56 static const __flash uint8_t SPACE[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; @@ -86,33 +84,33 @@ static const __flash uint8_t NUMBER_SIGN[] = { }; static const __flash uint8_t PERCENT_SIGN[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x00, - 0x03, 0xfe, 0x00, 0x00, 0x07, 0xff, 0x00, 0x00, + 0x03, 0xfe, 0x00, 0x00, 0x07, 0xff, 0x00, 0x00, 0x0f, 0x07, 0x80, 0x00, 0x0e, 0x03, 0x80, 0x00, - 0x1c, 0x01, 0xc0, 0x00, 0x1c, 0x01, 0xc0, 0x00, 0x1c, 0x01, 0xc0, 0x00, 0x1c, 0x01, 0xc0, 0x00, - 0x1c, 0x01, 0xc0, 0x00, 0x0e, 0x03, 0x80, 0x00, + 0x1c, 0x01, 0xc0, 0x00, 0x1c, 0x01, 0xc0, 0x00, + 0x1c, 0x01, 0xc0, 0x00, 0x0e, 0x03, 0x80, 0x00, 0x0f, 0x07, 0x80, 0x18, 0x07, 0xff, 0x00, 0xf8, - 0x03, 0xfe, 0x03, 0xf0, 0x00, 0xf8, 0x1f, 0xc0, + 0x03, 0xfe, 0x03, 0xf0, 0x00, 0xf8, 0x1f, 0xc0, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x03, 0xf8, 0x00, - 0x00, 0x0f, 0xc0, 0x00, 0x00, 0x3f, 0x00, 0x00, + 0x00, 0x0f, 0xc0, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x01, 0xf8, 0x0f, 0x80, 0x07, 0xe0, 0x3f, 0xe0, - 0x0f, 0x80, 0x7f, 0xf0, 0x04, 0x00, 0xf0, 0x78, + 0x0f, 0x80, 0x7f, 0xf0, 0x04, 0x00, 0xf0, 0x78, 0x00, 0x00, 0xe0, 0x38, 0x00, 0x01, 0xc0, 0x1c, - 0x00, 0x01, 0xc0, 0x1c, 0x00, 0x01, 0xc0, 0x1c, 0x00, 0x01, 0xc0, 0x1c, 0x00, 0x01, 0xc0, 0x1c, - 0x00, 0x00, 0xe0, 0x38, 0x00, 0x00, 0xf0, 0x78, + 0x00, 0x01, 0xc0, 0x1c, 0x00, 0x01, 0xc0, 0x1c, + 0x00, 0x00, 0xe0, 0x38, 0x00, 0x00, 0xf0, 0x78, 0x00, 0x00, 0x7f, 0xf0, 0x00, 0x00, 0x3f, 0xe0, - 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; @@ -141,25 +139,25 @@ static const __flash uint8_t ASTERISK[] = { }; static const __flash uint8_t PLUS_SIGN[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, 0x00, - 0x3c, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, + 0x3c, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x3c, - 0x00, 0x00, 0x3c, 0x00, 0xff, 0xff, 0xff, 0xff, + 0x00, 0x00, 0x3c, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x3c, + 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, 0x00, - 0x3c, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, + 0x3c, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; @@ -182,25 +180,25 @@ static const __flash uint8_t COMMA[] = { }; static const __flash uint8_t HYPHEN_MINUS[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xff, 0xc0, 0x03, 0xff, 0xc0, - 0x03, 0xff, 0xc0, 0x03, 0xff, 0xc0, 0x00, 0x00, + 0x03, 0xff, 0xc0, 0x03, 0xff, 0xc0, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; diff --git a/dejavu.h b/dejavu.h index 68d9272..a4b45c4 100644 --- a/dejavu.h +++ b/dejavu.h @@ -10,7 +10,6 @@ #define DEJAVU_H #include "font.h" -#include "colorspace.h" /** * DejaVu font. diff --git a/display.c b/display.c deleted file mode 100644 index a33ed0f..0000000 --- a/display.c +++ /dev/null @@ -1,53 +0,0 @@ -/* - * File: display.c - * Author: torsten.roemer@luniks.net - * - * Created on 18. April 2023, 21:56 - */ - -#include "display.h" - -void setFrame(uint16_t color) { - fillArea(0, 0, DISPLAY_WIDTH, DISPLAY_HEIGHT, color); -} - -width_t writeBitmap(x_t x, y_t y, uint16_t index, - uint16_t bg, uint16_t fg) { - const __flash Bitmap *bitmap = &bitmaps[index]; - setArea(x, y, bitmap->width, bitmap->height, false, false); - writeData(bitmap->bitmap, bitmap->width, bitmap->height, - bitmap->space, bg, fg); - - return bitmap->width; -} - -width_t writeGlyph(x_t x, y_t y, const __flash Font *font, code_t code, - uint16_t bg, uint16_t fg) { - const __flash Glyph *glyph = getGlyphAddress(font, code); - setArea(x, y, glyph->width, font->height, false, false); - writeData(glyph->bitmap, glyph->width, font->height, - font->space, bg, fg); - - return glyph->width; -} - -width_t writeString(x_t x, y_t y, const __flash Font *font, const char *string, - uint16_t bg, uint16_t fg) { - width_t xorig = x; - uint8_t offset = 0; - for (; *string != '\0'; string++) { - uint8_t c = (uint8_t) *string; - if (c == 194) { - // multibyte - } else if (c == 195) { - // multibyte, add 64 to get code point - offset = 64; - } else { - code_t code = c + offset; - x += writeGlyph(x, y, font, code, bg, fg); - offset = 0; - } - } - - return x - xorig; -} diff --git a/display.h b/display.h deleted file mode 100644 index 2f1bb29..0000000 --- a/display.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * File: display.h - * Author: torsten.roemer@luniks.net - * - * Created on 18. April 2023, 21:56 - */ - -#ifndef DISPLAY_H -#define DISPLAY_H - -#include -#include -#include -#include -#include -#include "types.h" -#include "bitmaps.h" -#include "font.h" -#include "bitmaps.h" -#include "spi.h" -#include "tft.h" -#include "usart.h" -#include "utils.h" - -/** - * Sets the whole display to the given 16-Bit (5/6/5) RGB color. - * - * @param color - */ -void setFrame(uint16_t color); - -/** - * Writes the bitmap with the given index to the given row and column - * and returns the width of the bitmap. - * - * @param x - * @param y - * @param index - * @param bg background color (used only with SPACE_MONO1) - * @param fg foreground color (used only with SPACE_MONO1) - * @return bitmap width - */ -width_t writeBitmap(x_t x, y_t y, uint16_t index, - uint16_t bg, uint16_t fg); - -/** - * Writes the glyph with the given pseudo UTF-8 code point with the given - * font to the given row and column and returns the width of the glyph. - * - * @param x - * @param y - * @param font - * @param code - * @param bg background color (used only with SPACE_MONO1) - * @param fg foreground color (used only with SPACE_MONO1) - * @return glyph width - */ -width_t writeGlyph(x_t x, y_t y, const __flash Font *font, code_t code, - uint16_t bg, uint16_t fg); - -/** - * Writes the given string with the given font to the given row and column - * and returns the width of the string. - * - * @param x - * @param y - * @param font - * @param string - * @param bg background color (used only with SPACE_MONO1) - * @param fg foreground color (used only with SPACE_MONO1) - * @return glyph width - */ -width_t writeString(x_t x, y_t y, const __flash Font *font, const char *string, - uint16_t bg, uint16_t fg); - -#endif /* DISPLAY_H */ diff --git a/font.c b/font.c deleted file mode 100644 index 4739809..0000000 --- a/font.c +++ /dev/null @@ -1,32 +0,0 @@ -/* - * File: font.c - * Author: torsten.roemer@luniks.net - * - * Created on 25. April 2023, 21:00 - */ - -#include -#include "font.h" - -const __flash Glyph* getGlyphAddress(const __flash Font *font, code_t code) { - - // https://en.wikipedia.org/wiki/Binary_search_algorithm - code_t l = 0; - code_t r = font->length - 1; - - while (l <= r) { - code_t m = (l + r) / 2; - const __flash Glyph *pglyph = &font->glyphs[m]; - if (pglyph->code < code) { - l = m + 1; - } else if (pglyph->code > code) { - r = m - 1; - } else { - // found code point, return address of glyph - return pglyph; - } - } - - // return question mark if unknown code point - return getGlyphAddress(font, 0x003f); -} diff --git a/font.h b/font.h index c9e7f3e..6a10326 100644 --- a/font.h +++ b/font.h @@ -8,8 +8,33 @@ #ifndef FONT_H #define FONT_H +#include #include "types.h" +/* Colorspaces */ +#define SPACE_MONO1 1 +#define SPACE_GREY4 4 +#define SPACE_RGB16 16 + +/** + * A bitmap with its width and height, and data. + */ +typedef struct { + /** Width of the bitmap. */ + const width_t width; + /** Height of the bitmap. */ + const height_t height; + /** Color space of the bitmap. */ + const space_t space; + /** The actual bitmap. */ + const __flash uint8_t *bitmap; +} Bitmap; + +/** + * Available bitmaps. + */ +extern const __flash Bitmap bitmaps[]; + /** * A glyph with its pseudo UTF-8 code point, width and bitmap. */ diff --git a/hack.h b/hack.h new file mode 100644 index 0000000..80cb449 --- /dev/null +++ b/hack.h @@ -0,0 +1,28 @@ +/* + * File: hack.h + * Author: torsten.roemer@luniks.net + * + * The work in the Hack project is Copyright 2018 Source Foundry Authors and + * licensed under the MIT License. + * The work in the DejaVu project was committed to the public domain. + * Bitstream Vera Sans Mono Copyright 2003 Bitstream Inc. and licensed under + * the Bitstream Vera License with Reserved Font Names "Bitstream" and "Vera". + * + * A subset of glyphs in the Hack font as 8x16 bitmaps in 4-Bit greyscale + * with antialiasing. + * + * Created on 16. November 2023, 17:25 + */ + +#ifndef HACK_H +#define HACK_H + +#include "font.h" + +/** + * Hack font. + */ +extern const __flash Font hackFont; + +#endif /* HACK_H */ + diff --git a/libtft.a b/libtft.a new file mode 100644 index 0000000..b4ae5c9 Binary files /dev/null and b/libtft.a differ diff --git a/libtft.h b/libtft.h new file mode 100644 index 0000000..b0c68b1 --- /dev/null +++ b/libtft.h @@ -0,0 +1,204 @@ +/* + * File: tft.h + * Author: torsten.roemer@luniks.net + * + * Created on 6. November 2023, 18:45 + */ + +#ifndef LIBTFT_H +#define LIBTFT_H + +#include +#include +#include +#include +#include "font.h" + +#define SWRESET 0x01 +#define SLPIN 0x10 +#define SLPOUT 0x11 +#define NORON 0x13 +#define INVOFF 0x20 +#define INVON 0x21 +#define DISPON 0x29 +#define CASET 0x2a +#define RASET 0x2b +#define RAMWR 0x2c +#define MADCTL 0x36 +#define COLMOD 0x3a + +/** + * F_CPU dependent delay of 100 milliseconds. + * _delay_ms(100); + */ +void _tftDelay100(void); + +/** + * Selects the display to talk to via SPI. + * PORTB &= ~(1 << PB1); + */ +void _tftSel(void); + +/** + * Deselects the display to talk to via SPI. + * PORTB |= (1 << PB1); + */ +void _tftDes(void); + +/** + * Sets display to send a command. + * PORTB &= ~(1 << PB2); + */ +void _tftSetCmd(void); + +/** + * Sets display to send data. + * PORTB |= (1 << PB2); + */ +void _tftSetData(void); + +/** + * Does a hardware reset. + * PORTB &= ~(1 << PB3); + * _delay_ms(10); + * PORTB |= (1 << PB3); + */ +void _tftReset(void); + +/** + * SPI transmits/receives given data/returns it. + * + * @param data + * @return data + */ +uint8_t _tftTx(uint8_t data); + +/** + * Initializes the display. + * + * @param width display width + * @param height display height + * @param hflip horizontal flip + * @param vflip vertical flip + * @param bgr BGR or RGB + * @param invert invert display + */ +void tftInit(width_t width, height_t height, + bool hflip, bool vflip, + bool bgr, bool invert); + +/** + * Sets to write data to display RAM. + */ +void tftWriteStart(void); + +/** + * Restart writing to display after SPI deselecting it. + */ +void tftWriteRestart(void); + +/** + * Writes the given byte to display RAM. + * + * @param byte + */ +void tftWriteByte(uint8_t byte); + +/** + * Completes writing data to display RAM. + */ +void tftWriteEnd(void); + +/** + * Sets the given color in the given area of the display. + * + * @param x in pixels, origin top left + * @param y in pixels, origin top left + * @param width width in pixels + * @param height height in pixels + * @param color 16-Bit (5/6/5) RGB color + */ +void tftFillArea(x_t x, y_t y, + width_t width, height_t height, + uint16_t color); + +/** + * Sets the area to write image data to. + * + * @param x in pixels, origin top left + * @param y in pixels, origin top left + * @param width width in pixels + * @param height height in pixels + * @param hflip if image should be flipped horizontally + * @param vflip if image should be flipped vertically + */ +void tftSetArea(x_t x, y_t y, + width_t width, height_t height, + bool hflip, bool vflip); + +/** + * Sets the whole display to the given 16-Bit (5/6/5) RGB color. + * + * @param color + */ +void tftSetFrame(uint16_t color); + +/** + * Writes image data to the previously set area. + * + * @param bitmap pointer to bitmap data in program memory + * @param width width of the bitmap in pixels + * @param height height of the bitmap in pixels + * @param space color space of the bitmap + * @param bg background color (used only with SPACE_MONO1) + * @param fg foreground color (used only with SPACE_MONO1) + */ +void tftWriteData(const __flash uint8_t *bitmap, + width_t width, height_t height, + space_t space, uint16_t bg, uint16_t fg); + +/** + * Writes the bitmap with the given index to the given row and column + * and returns the width of the bitmap. + * + * @param x + * @param y + * @param index + * @param bg background color (used only with SPACE_MONO1) + * @param fg foreground color (used only with SPACE_MONO1) + * @return bitmap width + */ +width_t tftWriteBitmap(x_t x, y_t y, uint16_t index, + uint16_t bg, uint16_t fg); + +/** + * Writes the glyph with the given pseudo UTF-8 code point with the given + * font to the given row and column and returns the width of the glyph. + * + * @param x + * @param y + * @param font + * @param code + * @param bg background color (used only with SPACE_MONO1) + * @param fg foreground color (used only with SPACE_MONO1) + * @return glyph width + */ +width_t tftWriteGlyph(x_t x, y_t y, const __flash Font *font, code_t code, + uint16_t bg, uint16_t fg); + +/** + * Writes the given string with the given font to the given row and column + * and returns the width of the string. + * + * @param x + * @param y + * @param font + * @param string + * @param bg background color (used only with SPACE_MONO1) + * @param fg foreground color (used only with SPACE_MONO1) + * @return glyph width + */ +width_t tftWriteString(x_t x, y_t y, const __flash Font *font, const char *string, + uint16_t bg, uint16_t fg); + +#endif /* LIBTFT_H */ diff --git a/nbproject/Makefile-Custom.mk b/nbproject/Makefile-Custom.mk index f6f45f1..41e749a 100644 --- a/nbproject/Makefile-Custom.mk +++ b/nbproject/Makefile-Custom.mk @@ -36,20 +36,15 @@ OBJECTDIR=${CND_BUILDDIR}/${CND_CONF}/${CND_PLATFORM} # Object Files OBJECTFILES= \ ${OBJECTDIR}/_ext/48b9ad18/avrrfm.o \ - ${OBJECTDIR}/_ext/48b9ad18/bitmaps.o \ - ${OBJECTDIR}/_ext/48b9ad18/colorspace.o \ - ${OBJECTDIR}/_ext/48b9ad18/dejavu.o \ - ${OBJECTDIR}/_ext/48b9ad18/display.o \ - ${OBJECTDIR}/_ext/48b9ad18/font.o \ ${OBJECTDIR}/_ext/48b9ad18/i2c.o \ ${OBJECTDIR}/_ext/48b9ad18/librfm69.o \ ${OBJECTDIR}/_ext/48b9ad18/mcp9808.o \ ${OBJECTDIR}/_ext/48b9ad18/rfm.o \ ${OBJECTDIR}/_ext/48b9ad18/sdc.o \ ${OBJECTDIR}/_ext/48b9ad18/spi.o \ - ${OBJECTDIR}/_ext/48b9ad18/tft.o \ - ${OBJECTDIR}/_ext/48b9ad18/unifont.o \ - ${OBJECTDIR}/_ext/48b9ad18/usart.o + ${OBJECTDIR}/_ext/48b9ad18/usart.o \ + ${OBJECTDIR}/bitmaps.o \ + ${OBJECTDIR}/tft.o # C Compiler Flags @@ -80,26 +75,6 @@ ${OBJECTDIR}/_ext/48b9ad18/avrrfm.o: /home/dode/dev/avrrfm/avrrfm.c ${MKDIR} -p ${OBJECTDIR}/_ext/48b9ad18 $(COMPILE.c) -g -DBAUD=38400 -DDRIVER=1 -DF_CPU=8000000UL -DRFM=95 -D__AVR_ATmega328P__ -D__flash=volatile -I. -std=c99 -o ${OBJECTDIR}/_ext/48b9ad18/avrrfm.o /home/dode/dev/avrrfm/avrrfm.c -${OBJECTDIR}/_ext/48b9ad18/bitmaps.o: /home/dode/dev/avrrfm/bitmaps.c - ${MKDIR} -p ${OBJECTDIR}/_ext/48b9ad18 - $(COMPILE.c) -g -DBAUD=38400 -DDRIVER=1 -DF_CPU=8000000UL -DRFM=95 -D__AVR_ATmega328P__ -D__flash=volatile -I. -o ${OBJECTDIR}/_ext/48b9ad18/bitmaps.o /home/dode/dev/avrrfm/bitmaps.c - -${OBJECTDIR}/_ext/48b9ad18/colorspace.o: /home/dode/dev/avrrfm/colorspace.c - ${MKDIR} -p ${OBJECTDIR}/_ext/48b9ad18 - $(COMPILE.c) -g -DBAUD=38400 -DDRIVER=1 -DF_CPU=8000000UL -DRFM=95 -D__AVR_ATmega328P__ -D__flash=volatile -I. -o ${OBJECTDIR}/_ext/48b9ad18/colorspace.o /home/dode/dev/avrrfm/colorspace.c - -${OBJECTDIR}/_ext/48b9ad18/dejavu.o: /home/dode/dev/avrrfm/dejavu.c - ${MKDIR} -p ${OBJECTDIR}/_ext/48b9ad18 - $(COMPILE.c) -g -DBAUD=38400 -DDRIVER=1 -DF_CPU=8000000UL -DRFM=95 -D__AVR_ATmega328P__ -D__flash=volatile -I. -o ${OBJECTDIR}/_ext/48b9ad18/dejavu.o /home/dode/dev/avrrfm/dejavu.c - -${OBJECTDIR}/_ext/48b9ad18/display.o: /home/dode/dev/avrrfm/display.c - ${MKDIR} -p ${OBJECTDIR}/_ext/48b9ad18 - $(COMPILE.c) -g -DBAUD=38400 -DDRIVER=1 -DF_CPU=8000000UL -DRFM=95 -D__AVR_ATmega328P__ -D__flash=volatile -I. -o ${OBJECTDIR}/_ext/48b9ad18/display.o /home/dode/dev/avrrfm/display.c - -${OBJECTDIR}/_ext/48b9ad18/font.o: /home/dode/dev/avrrfm/font.c - ${MKDIR} -p ${OBJECTDIR}/_ext/48b9ad18 - $(COMPILE.c) -g -DBAUD=38400 -DDRIVER=1 -DF_CPU=8000000UL -DRFM=95 -D__AVR_ATmega328P__ -D__flash=volatile -I. -o ${OBJECTDIR}/_ext/48b9ad18/font.o /home/dode/dev/avrrfm/font.c - ${OBJECTDIR}/_ext/48b9ad18/i2c.o: /home/dode/dev/avrrfm/i2c.c ${MKDIR} -p ${OBJECTDIR}/_ext/48b9ad18 $(COMPILE.c) -g -DBAUD=38400 -DDRIVER=1 -DF_CPU=8000000UL -DRFM=95 -D__AVR_ATmega328P__ -D__flash=volatile -I. -o ${OBJECTDIR}/_ext/48b9ad18/i2c.o /home/dode/dev/avrrfm/i2c.c @@ -124,18 +99,18 @@ ${OBJECTDIR}/_ext/48b9ad18/spi.o: /home/dode/dev/avrrfm/spi.c ${MKDIR} -p ${OBJECTDIR}/_ext/48b9ad18 $(COMPILE.c) -g -DBAUD=38400 -DDRIVER=1 -DF_CPU=8000000UL -DRFM=95 -D__AVR_ATmega328P__ -D__flash=volatile -I. -std=c99 -o ${OBJECTDIR}/_ext/48b9ad18/spi.o /home/dode/dev/avrrfm/spi.c -${OBJECTDIR}/_ext/48b9ad18/tft.o: /home/dode/dev/avrrfm/tft.c - ${MKDIR} -p ${OBJECTDIR}/_ext/48b9ad18 - $(COMPILE.c) -g -DBAUD=38400 -DDRIVER=1 -DF_CPU=8000000UL -DRFM=95 -D__AVR_ATmega328P__ -D__flash=volatile -I. -o ${OBJECTDIR}/_ext/48b9ad18/tft.o /home/dode/dev/avrrfm/tft.c - -${OBJECTDIR}/_ext/48b9ad18/unifont.o: /home/dode/dev/avrrfm/unifont.c - ${MKDIR} -p ${OBJECTDIR}/_ext/48b9ad18 - $(COMPILE.c) -g -DBAUD=38400 -DDRIVER=1 -DF_CPU=8000000UL -DRFM=95 -D__AVR_ATmega328P__ -D__flash=volatile -I. -o ${OBJECTDIR}/_ext/48b9ad18/unifont.o /home/dode/dev/avrrfm/unifont.c - ${OBJECTDIR}/_ext/48b9ad18/usart.o: /home/dode/dev/avrrfm/usart.c ${MKDIR} -p ${OBJECTDIR}/_ext/48b9ad18 $(COMPILE.c) -g -DBAUD=38400 -DDRIVER=1 -DF_CPU=8000000UL -DRFM=95 -D__AVR_ATmega328P__ -D__flash=volatile -I. -o ${OBJECTDIR}/_ext/48b9ad18/usart.o /home/dode/dev/avrrfm/usart.c +${OBJECTDIR}/bitmaps.o: bitmaps.c + ${MKDIR} -p ${OBJECTDIR} + $(COMPILE.c) -g -DBAUD=38400 -DDRIVER=1 -DF_CPU=8000000UL -DRFM=95 -D__AVR_ATmega328P__ -D__flash=volatile -I. -o ${OBJECTDIR}/bitmaps.o bitmaps.c + +${OBJECTDIR}/tft.o: tft.c + ${MKDIR} -p ${OBJECTDIR} + $(COMPILE.c) -g -DBAUD=38400 -DDRIVER=1 -DF_CPU=8000000UL -DRFM=95 -D__AVR_ATmega328P__ -D__flash=volatile -I. -o ${OBJECTDIR}/tft.o tft.c + # Subprojects .build-subprojects: diff --git a/nbproject/configurations.xml b/nbproject/configurations.xml index 858d46d..73de51b 100644 --- a/nbproject/configurations.xml +++ b/nbproject/configurations.xml @@ -4,10 +4,6 @@ avrrfm.c bitmaps.c - colorspace.c - dejavu.c - display.c - font.c i2c.c librfm69.c mcp9808.c @@ -16,7 +12,6 @@ sdc.c spi.c tft.c - unifont.c usart.c - - - - - - - - - - @@ -80,11 +65,11 @@ - + - + - + diff --git a/tft.c b/tft.c index f66ac05..165d7f1 100644 --- a/tft.c +++ b/tft.c @@ -2,267 +2,41 @@ * File: tft.c * Author: torsten.roemer@luniks.net * - * Created on 6. November 2023, 18:45 + * Created on 06.07.2025, 20:26 */ -#include "tft.h" +#include -/** - * Does a hardware reset. - */ -static void hwReset(void) { - PORT_DISP &= ~(1 << PIN_DRST); - _delay_ms(10); - PORT_DISP |= (1 << PIN_DRST); +#include "libtft.h" +#include "pins.h" +#include "spi.h" + +void _tftDelay100() { + _delay_ms(100); } -static void displaySel(void) { +void _tftSel() { PORT_DISP &= ~(1 << PIN_DCS); } -static void displayDes(void) { +void _tftDes() { PORT_DISP |= (1 << PIN_DCS); } -/** - * Sets display to send a command. - */ -static void displaySetCmd(void) { +void _tftSetCmd(void) { PORT_DISP &= ~(1 << PIN_DDC); } -/** - * Sets display to send data. - */ -static void displaySetData(void) { +void _tftSetData(void){ PORT_DISP |= (1 << PIN_DDC); } -/** - * Sends the given command to the display. - * - * @param cmd - */ -static void displayCmd(uint8_t cmd) { - displaySetCmd(); - transmit(cmd); -} - -/** - * Sends the given data to the display. - * - * @param data - */ -static void displayData(uint8_t data) { - displaySetData(); - transmit(data); -} - -/** - * Sets horizontal and/or vertical flip. - * - * @param hflip - * @param vflip - */ -static void madctl(bool hflip, bool vflip) { - // Memory data access control - uint8_t madctl = 0b00110110; - madctl |= (HFLIP << 7); - madctl |= (VFLIP << 6); - madctl |= (BGR << 3); - - if (hflip) { - // Row Address Order (MY) - madctl ^= (1 << 7); - } - if (vflip) { - // Column Address Order (MX) - madctl ^= (1 << 6); - } - - displaySel(); - displayCmd(MADCTL); - displayData(madctl); - displayDes(); -} - -/** - * Sets the given column start and end address. - * - * @param xs start address - * @param xe end address - */ -static void caset(x_t xs, x_t xe) { - displaySel(); - displayCmd(CASET); - displayData(xs >> 8); - displayData(xs); - displayData(xe >> 8); - displayData(xe); - displayDes(); -} - -/** - * Sets the given row start and end address. - * - * @param ys start address - * @param ye end address - */ -static void raset(y_t ys, y_t ye) { - displaySel(); - displayCmd(RASET); - displayData(ys >> 8); - displayData(ys); - displayData(ye >> 8); - displayData(ye); - displayDes(); -} - -void initDisplay(void) { - _delay_ms(100); - - // Hardware reset - hwReset(); - - // TODO necessary? - _delay_ms(10); - - // Software reset - displaySel(); - displayCmd(SWRESET); - displayDes(); - - // TODO necessary? +void _tftReset(void) { + PORT_DISP &= ~(1 << PIN_DRST); _delay_ms(10); - - // Sleep out & booster on - displaySel(); - displayCmd(SLPOUT); - displayDes(); - - // Partial off (Normal) - displaySel(); - displayCmd(NORON); - displayDes(); - - // Display Inversion on/off - displaySel(); - displayCmd(INVOFF + INVERT); // INVOFF + 1 = INVON - displayDes(); - - // Interface pixel format - displaySel(); - displayCmd(COLMOD); - displayData(0b00111101); - displayDes(); - - // Display on - displaySel(); - displayCmd(DISPON); - displayDes(); - - // Sleep in & booster off - // displaySel(); - // displayCmd(SLPIN); - // displayDes(); - - printString("Display init done\r\n"); -} - -void demoDisplay(void) { - // TODO -} - -void drawPixel(x_t x, y_t y, uint16_t color) { - // TODO -} - -void drawCircle(x_t x, y_t y, uint16_t radius, uint16_t color) { - // TODO -} - -void drawRectangle(x_t x, y_t y, width_t width, height_t height, - uint16_t color) { - // TODO -} - -void writeStart(void) { - // Memory write - displaySel(); - displayCmd(RAMWR); - displaySetData(); -} - -void writeRestart(void) { - displaySel(); -} - -void writeByte(uint8_t byte) { - // Memory write - transmit(byte); -} - -void writeEnd(void) { - // Memory write - displayDes(); -} - -void fillArea(x_t x, x_t y, - width_t width, height_t height, - uint16_t color) { - - madctl(false, false); - - // X address start/end - uint16_t xs = x; - uint16_t xe = x + width - 1; - caset(xs, xe); - - // Y address start/end - uint16_t ys = y; - uint16_t ye = y + height - 1; - raset(ys, ye); - - writeStart(); - - bytes_t pixels = (bytes_t)width * (bytes_t)height; - for (bytes_t i = 0; i < pixels; i++) { - transmit(color >> 8); - transmit(color); - } - - writeEnd(); -} - -void setArea(x_t x, y_t y, - width_t width, height_t height, - bool hflip, bool vflip) { - - madctl(hflip, vflip); - - // X address start/end - uint16_t xs = x; - uint16_t xe = x + width - 1; - if (hflip) { - xs = DISPLAY_WIDTH - x - width; - xe = DISPLAY_WIDTH - x - 1; - } - caset(xs, xe); - - // Y address start/end - uint16_t ys = y; - uint16_t ye = y + height - 1; - if (vflip) { - ys = DISPLAY_HEIGHT - y - height; - ye = DISPLAY_HEIGHT - y - 1; - } - raset(ys, ye); + PORT_DISP |= (1 << PIN_DRST); } -void writeData(const __flash uint8_t *bitmap, - width_t width, height_t height, - space_t space, uint16_t bg, uint16_t fg) { - writeStart(); - writeSpace(bitmap, width, height, space, bg, fg); - writeEnd(); -} +uint8_t _tftTx(uint8_t data) { + return transmit(data); +} \ No newline at end of file diff --git a/tft.h b/tft.h deleted file mode 100644 index 390528d..0000000 --- a/tft.h +++ /dev/null @@ -1,163 +0,0 @@ -/* - * File: tft.h - * Author: torsten.roemer@luniks.net - * - * Created on 6. November 2023, 18:45 - */ - -#ifndef TFT_H -#define TFT_H - -#include -#include -#include -#include -#include -#include "types.h" -#include "pins.h" -#include "usart.h" -#include "spi.h" -#include "colorspace.h" - -#define SWRESET 0x01 -#define SLPIN 0x10 -#define SLPOUT 0x11 -#define NORON 0x13 -#define INVOFF 0x20 -#define INVON 0x21 -#define DISPON 0x29 -#define CASET 0x2a -#define RASET 0x2b -#define RAMWR 0x2c -#define MADCTL 0x36 -#define COLMOD 0x3a - -#ifndef DISPLAY_WIDTH - #define DISPLAY_WIDTH 160 -#endif - -#ifndef DISPLAY_HEIGHT - #define DISPLAY_HEIGHT 128 -#endif - -#ifndef BGR - #define BGR 0 -#endif - -#ifndef INVERT - #define INVERT 0 -#endif - -#ifndef HFLIP - #define HFLIP 0 -#endif - -#ifndef VFLIP - #define VFLIP 0 -#endif - -/** - * Initializes the display. - */ -void initDisplay(void); - -/** - * Displays a demo. - */ -void demoDisplay(void); - -/** - * Draws a pixel at given coordinates and color. - * - * @param x - * @param y - * @param color - */ -void drawPixel(x_t x, y_t y, uint16_t color); - -/** - * Draws a circle at given center coordinates, with given radius and color. - * - * @param x - * @param y - * @param radius - * @param color - */ -void drawCircle(x_t x, y_t y, uint16_t radius, uint16_t color); - -/** - * Draws a rectangle at given origin, with given width, height and color. - * - * @param x - * @param y - * @param width - * @param height - * @param color - */ -void drawRectangle(x_t x, y_t y, width_t width, height_t height, - uint16_t color); - -/** - * Sets to write data to display RAM. - */ -void writeStart(void); - -/** - * Restart writing to display after SPI deselecting it. - */ -void writeRestart(void); - -/** - * Writes the given byte to display RAM. - * - * @param byte - */ -void writeByte(uint8_t byte); - -/** - * Completes writing data to display RAM. - */ -void writeEnd(void); - -/** - * Sets the given color in the given area of the display. - * - * @param x in pixels, origin top left - * @param y in pixels, origin top left - * @param width width in pixels - * @param height height in pixels - * @param color 16-Bit (5/6/5) RGB color - */ -void fillArea(x_t x, y_t y, - width_t width, height_t height, - uint16_t color); - -/** - * Sets the area to write image data to. - * - * @param x in pixels, origin top left - * @param y in pixels, origin top left - * @param width width of the bitmap in pixels - * @param height height of the bitmap in pixels - * @param hflip if image should be flipped horizontally - * @param vflip if image should be flipped vertically - */ -void setArea(x_t x, y_t y, - width_t width, height_t height, - bool hflip, bool vflip); - -/** - * Writes image data to the previously set area. - * - * @param bitmap pointer to bitmap data in program memory - * @param width width of the bitmap in pixels - * @param height height of the bitmap in pixels - * @param space color space of the bitmap - * @param bg background color (used only with SPACE_MONO1) - * @param fg foreground color (used only with SPACE_MONO1) - */ -void writeData(const __flash uint8_t *bitmap, - width_t width, height_t height, - space_t space, uint16_t bg, uint16_t fg); - -#endif /* TFT_H */ diff --git a/unifont.c b/unifont.c deleted file mode 100644 index 489a1e2..0000000 --- a/unifont.c +++ /dev/null @@ -1,982 +0,0 @@ -/* - * File: unifont.c - * Author: torsten.roemer@luniks.net - * Unifont is part of the GNU Project: http://savannah.gnu.org/projects/unifont/ - * - * Created on 8. April 2023, 20:52 - */ - -#include -#include "font.h" -#include "unifont.h" -#include "utils.h" - -#define WIDTH 8 -#define HEIGHT 16 - -static const __flash uint8_t SPACE[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; - -static const __flash uint8_t EXCLAMATION_MARK[] = { - 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x08, 0x08, - 0x08, 0x08, 0x08, 0x00, 0x08, 0x08, 0x00, 0x00}; - -static const __flash uint8_t QUOTATION_MARK[] = { - 0x00, 0x00, 0x22, 0x22, 0x22, 0x22, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; - -static const __flash uint8_t NUMBER_SIGN[] = { - 0x00, 0x00, 0x00, 0x00, 0x12, 0x12, 0x12, 0x7E, - 0x24, 0x24, 0x7E, 0x48, 0x48, 0x48, 0x00, 0x00}; - -static const __flash uint8_t DOLLAR_SIGN[] = { - 0x00, 0x00, 0x00, 0x00, 0x08, 0x3E, 0x49, 0x48, - 0x38, 0x0E, 0x09, 0x49, 0x3E, 0x08, 0x00, 0x00}; - -static const __flash uint8_t PERCENT_SIGN[] = { - 0x00, 0x00, 0x00, 0x00, 0x31, 0x4A, 0x4A, 0x34, - 0x08, 0x08, 0x16, 0x29, 0x29, 0x46, 0x00, 0x00}; - -static const __flash uint8_t AMPERSAND[] = { - 0x00, 0x00, 0x00, 0x00, 0x1C, 0x22, 0x22, 0x14, - 0x18, 0x29, 0x45, 0x42, 0x46, 0x39, 0x00, 0x00}; - -static const __flash uint8_t APOSTROPHE[] = { - 0x00, 0x00, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; - -static const __flash uint8_t LEFT_PARENTHESIS[] = { - 0x00, 0x00, 0x00, 0x04, 0x08, 0x08, 0x10, 0x10, - 0x10, 0x10, 0x10, 0x10, 0x08, 0x08, 0x04, 0x00}; - -static const __flash uint8_t RIGHT_PARENTHESIS[] = { - 0x00, 0x00, 0x00, 0x20, 0x10, 0x10, 0x08, 0x08, - 0x08, 0x08, 0x08, 0x08, 0x10, 0x10, 0x20, 0x00}; - -static const __flash uint8_t ASTERISK[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x49, - 0x2A, 0x1C, 0x2A, 0x49, 0x08, 0x00, 0x00, 0x00}; - -static const __flash uint8_t PLUS_SIGN[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, - 0x08, 0x7F, 0x08, 0x08, 0x08, 0x00, 0x00, 0x00}; - -static const __flash uint8_t COMMA[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x18, 0x08, 0x08, 0x10}; - -static const __flash uint8_t HYPHEN_MINUS[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; - -static const __flash uint8_t FULL_STOP[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00}; - -static const __flash uint8_t SOLIDUS[] = { - 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, 0x04, 0x08, - 0x08, 0x10, 0x10, 0x20, 0x40, 0x40, 0x00, 0x00}; - -static const __flash uint8_t DIGIT_0[] = { - 0x00, 0x00, 0x00, 0x00, 0x18, 0x24, 0x42, 0x46, - 0x4A, 0x52, 0x62, 0x42, 0x24, 0x18, 0x00, 0x00}; - -static const __flash uint8_t DIGIT_1[] = { - 0x00, 0x00, 0x00, 0x00, 0x08, 0x18, 0x28, 0x08, - 0x08, 0x08, 0x08, 0x08, 0x08, 0x3E, 0x00, 0x00}; - -static const __flash uint8_t DIGIT_2[] = { - 0x00, 0x00, 0x00, 0x00, 0x3C, 0x42, 0x42, 0x02, - 0x0C, 0x10, 0x20, 0x40, 0x40, 0x7E, 0x00, 0x00}; - -static const __flash uint8_t DIGIT_3[] = { - 0x00, 0x00, 0x00, 0x00, 0x3C, 0x42, 0x42, 0x02, - 0x1C, 0x02, 0x02, 0x42, 0x42, 0x3C, 0x00, 0x00}; - -static const __flash uint8_t DIGIT_4[] = { - 0x00, 0x00, 0x00, 0x00, 0x04, 0x0C, 0x14, 0x24, - 0x44, 0x44, 0x7E, 0x04, 0x04, 0x04, 0x00, 0x00}; - -static const __flash uint8_t DIGIT_5[] = { - 0x00, 0x00, 0x00, 0x00, 0x7E, 0x40, 0x40, 0x40, - 0x7C, 0x02, 0x02, 0x02, 0x42, 0x3C, 0x00, 0x00}; - -static const __flash uint8_t DIGIT_6[] = { - 0x00, 0x00, 0x00, 0x00, 0x1C, 0x20, 0x40, 0x40, - 0x7C, 0x42, 0x42, 0x42, 0x42, 0x3C, 0x00, 0x00}; - -static const __flash uint8_t DIGIT_7[] = { - 0x00, 0x00, 0x00, 0x00, 0x7E, 0x02, 0x02, 0x04, - 0x04, 0x04, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00}; - -static const __flash uint8_t DIGIT_8[] = { - 0x00, 0x00, 0x00, 0x00, 0x3C, 0x42, 0x42, 0x42, - 0x3C, 0x42, 0x42, 0x42, 0x42, 0x3C, 0x00, 0x00}; - -static const __flash uint8_t DIGIT_9[] = { - 0x00, 0x00, 0x00, 0x00, 0x3C, 0x42, 0x42, 0x42, - 0x3E, 0x02, 0x02, 0x02, 0x04, 0x38, 0x00, 0x00}; - -static const __flash uint8_t COLON[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, - 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00}; - -static const __flash uint8_t SEMICOLON[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, - 0x00, 0x00, 0x00, 0x18, 0x08, 0x08, 0x10, 0x00}; - -static const __flash uint8_t LESS_THAN_SIGN[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x04, 0x08, - 0x10, 0x20, 0x10, 0x08, 0x04, 0x02, 0x00, 0x00}; - -static const __flash uint8_t EQUALS_SIGN[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7E, - 0x00, 0x00, 0x00, 0x7E, 0x00, 0x00, 0x00, 0x00}; - -static const __flash uint8_t GREATER_THAN_SIGN[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x20, 0x10, - 0x08, 0x04, 0x08, 0x10, 0x20, 0x40, 0x00, 0x00}; - -static const __flash uint8_t QUESTION_MARK[] = { - 0x00, 0x00, 0x00, 0x00, 0x3C, 0x42, 0x42, 0x02, - 0x04, 0x08, 0x08, 0x00, 0x08, 0x08, 0x00, 0x00}; - -static const __flash uint8_t COMMERCIAL_AT[] = { - 0x00, 0x00, 0x00, 0x00, 0x1C, 0x22, 0x4A, 0x56, - 0x52, 0x52, 0x52, 0x4E, 0x20, 0x1E, 0x00, 0x00}; - -static const __flash uint8_t A[] = { - 0x00, 0x00, 0x00, 0x00, 0x18, 0x24, 0x24, 0x42, - 0x42, 0x7E, 0x42, 0x42, 0x42, 0x42, 0x00, 0x00}; - -static const __flash uint8_t B[] = { - 0x00, 0x00, 0x00, 0x00, 0x7C, 0x42, 0x42, 0x42, - 0x7C, 0x42, 0x42, 0x42, 0x42, 0x7C, 0x00, 0x00}; - -static const __flash uint8_t C[] = { - 0x00, 0x00, 0x00, 0x00, 0x3C, 0x42, 0x42, 0x40, - 0x40, 0x40, 0x40, 0x42, 0x42, 0x3C, 0x00, 0x00}; - -static const __flash uint8_t D[] = { - 0x00, 0x00, 0x00, 0x00, 0x78, 0x44, 0x42, 0x42, - 0x42, 0x42, 0x42, 0x42, 0x44, 0x78, 0x00, 0x00}; - -static const __flash uint8_t E[] = { - 0x00, 0x00, 0x00, 0x00, 0x7E, 0x40, 0x40, 0x40, - 0x7C, 0x40, 0x40, 0x40, 0x40, 0x7E, 0x00, 0x00}; - -static const __flash uint8_t F[] = { - 0x00, 0x00, 0x00, 0x00, 0x7E, 0x40, 0x40, 0x40, - 0x7C, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00}; - -static const __flash uint8_t G[] = { - 0x00, 0x00, 0x00, 0x00, 0x3C, 0x42, 0x42, 0x40, - 0x40, 0x4E, 0x42, 0x42, 0x46, 0x3A, 0x00, 0x00}; - -static const __flash uint8_t H[] = { - 0x00, 0x00, 0x00, 0x00, 0x42, 0x42, 0x42, 0x42, - 0x7E, 0x42, 0x42, 0x42, 0x42, 0x42, 0x00, 0x00}; - -static const __flash uint8_t I[] = { - 0x00, 0x00, 0x00, 0x00, 0x3E, 0x08, 0x08, 0x08, - 0x08, 0x08, 0x08, 0x08, 0x08, 0x3E, 0x00, 0x00}; - -static const __flash uint8_t J[] = { - 0x00, 0x00, 0x00, 0x00, 0x1F, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x44, 0x44, 0x38, 0x00, 0x00}; - -static const __flash uint8_t K[] = { - 0x00, 0x00, 0x00, 0x00, 0x42, 0x44, 0x48, 0x50, - 0x60, 0x60, 0x50, 0x48, 0x44, 0x42, 0x00, 0x00}; - -static const __flash uint8_t L[] = { - 0x00, 0x00, 0x00, 0x00, 0x40, 0x40, 0x40, 0x40, - 0x40, 0x40, 0x40, 0x40, 0x40, 0x7E, 0x00, 0x00}; - -static const __flash uint8_t M[] = { - 0x00, 0x00, 0x00, 0x00, 0x42, 0x42, 0x66, 0x66, - 0x5A, 0x5A, 0x42, 0x42, 0x42, 0x42, 0x00, 0x00}; - -static const __flash uint8_t N[] = { - 0x00, 0x00, 0x00, 0x00, 0x42, 0x62, 0x62, 0x52, - 0x52, 0x4A, 0x4A, 0x46, 0x46, 0x42, 0x00, 0x00}; - -static const __flash uint8_t O[] = { - 0x00, 0x00, 0x00, 0x00, 0x3C, 0x42, 0x42, 0x42, - 0x42, 0x42, 0x42, 0x42, 0x42, 0x3C, 0x00, 0x00}; - -static const __flash uint8_t P[] = { - 0x00, 0x00, 0x00, 0x00, 0x7C, 0x42, 0x42, 0x42, - 0x7C, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00}; - -static const __flash uint8_t Q[] = { - 0x00, 0x00, 0x00, 0x00, 0x3C, 0x42, 0x42, 0x42, - 0x42, 0x42, 0x42, 0x5A, 0x66, 0x3C, 0x03, 0x00}; - -static const __flash uint8_t R[] = { - 0x00, 0x00, 0x00, 0x00, 0x7C, 0x42, 0x42, 0x42, - 0x7C, 0x48, 0x44, 0x44, 0x42, 0x42, 0x00, 0x00}; - -static const __flash uint8_t S[] = { - 0x00, 0x00, 0x00, 0x00, 0x3C, 0x42, 0x42, 0x40, - 0x30, 0x0C, 0x02, 0x42, 0x42, 0x3C, 0x00, 0x00}; - -static const __flash uint8_t T[] = { - 0x00, 0x00, 0x00, 0x00, 0x7F, 0x08, 0x08, 0x08, - 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00}; - -static const __flash uint8_t U[] = { - 0x00, 0x00, 0x00, 0x00, 0x42, 0x42, 0x42, 0x42, - 0x42, 0x42, 0x42, 0x42, 0x42, 0x3C, 0x00, 0x00}; - -static const __flash uint8_t V[] = { - 0x00, 0x00, 0x00, 0x00, 0x41, 0x41, 0x41, 0x22, - 0x22, 0x22, 0x14, 0x14, 0x08, 0x08, 0x00, 0x00}; - -static const __flash uint8_t W[] = { - 0x00, 0x00, 0x00, 0x00, 0x42, 0x42, 0x42, 0x42, - 0x5A, 0x5A, 0x66, 0x66, 0x42, 0x42, 0x00, 0x00}; - -static const __flash uint8_t X[] = { - 0x00, 0x00, 0x00, 0x00, 0x42, 0x42, 0x24, 0x24, - 0x18, 0x18, 0x24, 0x24, 0x42, 0x42, 0x00, 0x00}; - -static const __flash uint8_t Y[] = { - 0x00, 0x00, 0x00, 0x00, 0x41, 0x41, 0x22, 0x22, - 0x14, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00}; - -static const __flash uint8_t Z[] = { - 0x00, 0x00, 0x00, 0x00, 0x7E, 0x02, 0x02, 0x04, - 0x08, 0x10, 0x20, 0x40, 0x40, 0x7E, 0x00, 0x00}; - -static const __flash uint8_t LEFT_SQUARE_BRACKET[] = { - 0x00, 0x00, 0x00, 0x0E, 0x08, 0x08, 0x08, 0x08, - 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x0E, 0x00}; - -static const __flash uint8_t REVERSE_SOLIDUS[] = { - 0x00, 0x00, 0x00, 0x00, 0x40, 0x40, 0x20, 0x10, - 0x10, 0x08, 0x08, 0x04, 0x02, 0x02, 0x00, 0x00}; - -static const __flash uint8_t RIGHT_SQUARE_BRACKET[] = { - 0x00, 0x00, 0x00, 0x70, 0x10, 0x10, 0x10, 0x10, - 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x70, 0x00}; - -static const __flash uint8_t CIRCUMFLEX_ACCENT[] = { - 0x00, 0x00, 0x18, 0x24, 0x42, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; - -static const __flash uint8_t LOW_LINE[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7F, 0x00}; - -static const __flash uint8_t GRAVE_ACCENT[] = { - 0x00, 0x20, 0x10, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; - -static const __flash uint8_t a[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x42, - 0x02, 0x3E, 0x42, 0x42, 0x46, 0x3A, 0x00, 0x00}; - -static const __flash uint8_t b[] = { - 0x00, 0x00, 0x00, 0x40, 0x40, 0x40, 0x5C, 0x62, - 0x42, 0x42, 0x42, 0x42, 0x62, 0x5C, 0x00, 0x00}; - -static const __flash uint8_t c[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x42, - 0x40, 0x40, 0x40, 0x40, 0x42, 0x3C, 0x00, 0x00}; - -static const __flash uint8_t d[] = { - 0x00, 0x00, 0x00, 0x02, 0x02, 0x02, 0x3A, 0x46, - 0x42, 0x42, 0x42, 0x42, 0x46, 0x3A, 0x00, 0x00}; - -static const __flash uint8_t e[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x42, - 0x42, 0x7E, 0x40, 0x40, 0x42, 0x3C, 0x00, 0x00}; - -static const __flash uint8_t f[] = { - 0x00, 0x00, 0x00, 0x0C, 0x10, 0x10, 0x10, 0x7C, - 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00}; - -static const __flash uint8_t g[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x3A, 0x44, - 0x44, 0x44, 0x38, 0x20, 0x3C, 0x42, 0x42, 0x3C}; - -static const __flash uint8_t h[] = { - 0x00, 0x00, 0x00, 0x40, 0x40, 0x40, 0x5C, 0x62, - 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x00, 0x00}; - -static const __flash uint8_t i[] = { - 0x00, 0x00, 0x00, 0x08, 0x08, 0x00, 0x18, 0x08, - 0x08, 0x08, 0x08, 0x08, 0x08, 0x3E, 0x00, 0x00}; - -static const __flash uint8_t j[] = { - 0x00, 0x00, 0x00, 0x04, 0x04, 0x00, 0x0C, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x48, 0x30}; - -static const __flash uint8_t k[] = { - 0x00, 0x00, 0x00, 0x40, 0x40, 0x40, 0x44, 0x48, - 0x50, 0x60, 0x50, 0x48, 0x44, 0x42, 0x00, 0x00}; - -static const __flash uint8_t l[] = { - 0x00, 0x00, 0x00, 0x18, 0x08, 0x08, 0x08, 0x08, - 0x08, 0x08, 0x08, 0x08, 0x08, 0x3E, 0x00, 0x00}; - -static const __flash uint8_t m[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0x49, - 0x49, 0x49, 0x49, 0x49, 0x49, 0x49, 0x00, 0x00}; - -static const __flash uint8_t n[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5C, 0x62, - 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x00, 0x00}; - -static const __flash uint8_t o[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x42, - 0x42, 0x42, 0x42, 0x42, 0x42, 0x3C, 0x00, 0x00}; - -static const __flash uint8_t p[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5C, 0x62, - 0x42, 0x42, 0x42, 0x42, 0x62, 0x5C, 0x40, 0x40}; - -static const __flash uint8_t q[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3A, 0x46, - 0x42, 0x42, 0x42, 0x42, 0x46, 0x3A, 0x02, 0x02}; - -static const __flash uint8_t r[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5C, 0x62, - 0x42, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00}; - -static const __flash uint8_t s[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x42, - 0x40, 0x30, 0x0C, 0x02, 0x42, 0x3C, 0x00, 0x00}; - -static const __flash uint8_t t[] = { - 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x10, 0x7C, - 0x10, 0x10, 0x10, 0x10, 0x10, 0x0C, 0x00, 0x00}; - -static const __flash uint8_t u[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x42, - 0x42, 0x42, 0x42, 0x42, 0x46, 0x3A, 0x00, 0x00}; - -static const __flash uint8_t v[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x42, - 0x42, 0x24, 0x24, 0x24, 0x18, 0x18, 0x00, 0x00}; - -static const __flash uint8_t w[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x41, 0x49, - 0x49, 0x49, 0x49, 0x49, 0x49, 0x36, 0x00, 0x00}; - -static const __flash uint8_t x[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x42, - 0x24, 0x18, 0x18, 0x24, 0x42, 0x42, 0x00, 0x00}; - -static const __flash uint8_t y[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x42, - 0x42, 0x42, 0x42, 0x26, 0x1A, 0x02, 0x02, 0x3C}; - -static const __flash uint8_t z[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7E, 0x02, - 0x04, 0x08, 0x10, 0x20, 0x40, 0x7E, 0x00, 0x00}; - -static const __flash uint8_t LEFT_CURLY_BRACKET[] = { - 0x00, 0x00, 0x00, 0x0C, 0x10, 0x10, 0x08, 0x08, - 0x10, 0x20, 0x10, 0x08, 0x08, 0x10, 0x10, 0x0C}; - -static const __flash uint8_t VERTICAL_LINE[] = { - 0x00, 0x00, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, - 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08}; - -static const __flash uint8_t RIGHT_CURLY_BRACKET[] = { - 0x00, 0x00, 0x00, 0x30, 0x08, 0x08, 0x10, 0x10, - 0x08, 0x04, 0x08, 0x10, 0x10, 0x08, 0x08, 0x30}; - -static const __flash uint8_t TILDE[] = { - 0x00, 0x00, 0x00, 0x31, 0x49, 0x46, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; - -static const __flash uint8_t INVERTED_EXCLAMATION_MARK[] = { - 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x00, 0x08, - 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00}; - -static const __flash uint8_t CENT_SIGN[] = { - 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x3E, 0x49, - 0x48, 0x48, 0x49, 0x3E, 0x08, 0x08, 0x00, 0x00}; - -static const __flash uint8_t POUND_SIGN[] = { - 0x00, 0x00, 0x00, 0x00, 0x0E, 0x10, 0x10, 0x10, - 0x7C, 0x10, 0x10, 0x10, 0x3E, 0x61, 0x00, 0x00}; - -static const __flash uint8_t CURRENCY_SIGN[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x3C, 0x24, - 0x42, 0x42, 0x24, 0x3C, 0x42, 0x00, 0x00, 0x00}; - -static const __flash uint8_t YEN_SIGN[] = { - 0x00, 0x00, 0x00, 0x00, 0x41, 0x22, 0x14, 0x08, - 0x7F, 0x08, 0x7F, 0x08, 0x08, 0x08, 0x00, 0x00}; - -static const __flash uint8_t BROKEN_BAR[] = { - 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x08, 0x08, - 0x00, 0x00, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00}; - -static const __flash uint8_t SECTION_SIGN[] = { - 0x00, 0x00, 0x00, 0x00, 0x3C, 0x42, 0x40, 0x3C, - 0x42, 0x42, 0x3C, 0x02, 0x42, 0x3C, 0x00, 0x00}; - -static const __flash uint8_t DIAERESIS[] = { - 0x24, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; - -static const __flash uint8_t COPYRIGHT_SIGN[] = { - 0x00, 0x00, 0x00, 0x00, 0x3C, 0x42, 0x99, 0xA5, - 0xA1, 0xA1, 0xA5, 0x99, 0x42, 0x3C, 0x00, 0x00}; - -static const __flash uint8_t FEMININE_ORDINAL_INDICATOR[] = { - 0x00, 0x00, 0x1C, 0x02, 0x1E, 0x22, 0x1E, 0x00, - 0x3E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; - -static const __flash uint8_t LEFT_POINTING_DOUBLE_ANGLE_QUOTATION_MARK[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x12, 0x24, - 0x24, 0x48, 0x24, 0x24, 0x12, 0x12, 0x00, 0x00}; - -static const __flash uint8_t NOT_SIGN[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x7E, 0x02, 0x02, 0x02, 0x00, 0x00}; - -static const __flash uint8_t REGISTERED_SIGN[] = { - 0x00, 0x00, 0x00, 0x00, 0x3C, 0x42, 0xB9, 0xA5, - 0xA5, 0xB9, 0xA9, 0xA5, 0x42, 0x3C, 0x00, 0x00}; - -static const __flash uint8_t MACRON[] = { - 0x00, 0x00, 0x7E, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; - -static const __flash uint8_t DEGREE_SIGN[] = { - 0x00, 0x00, 0x00, 0x00, 0x18, 0x24, 0x24, 0x18, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; - -static const __flash uint8_t PLUS_MINUS_SIGN[] = { - 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x08, 0x7F, - 0x08, 0x08, 0x08, 0x00, 0x7F, 0x00, 0x00, 0x00}; - -static const __flash uint8_t SUPERSCRIPT_TWO[] = { - 0x00, 0x00, 0x00, 0x38, 0x44, 0x04, 0x18, 0x20, - 0x40, 0x7C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; - -static const __flash uint8_t SUPERSCRIPT_THREE[] = { - 0x00, 0x00, 0x00, 0x38, 0x44, 0x04, 0x38, 0x04, - 0x44, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; - -static const __flash uint8_t ACUTE_ACCENT[] = { - 0x00, 0x04, 0x08, 0x10, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; - -static const __flash uint8_t MICRO_SIGN[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x42, - 0x42, 0x42, 0x42, 0x42, 0x66, 0x59, 0x40, 0x80}; - -static const __flash uint8_t PILCROW_SIGN[] = { - 0x00, 0x00, 0x00, 0x00, 0x3F, 0x7A, 0x7A, 0x7A, - 0x3A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x00}; - -static const __flash uint8_t MIDDLE_DOT[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; - -static const __flash uint8_t CEDILLA[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x30}; - -static const __flash uint8_t SUPERSCRIPT_ONE[] = { - 0x00, 0x00, 0x00, 0x10, 0x30, 0x50, 0x10, 0x10, - 0x10, 0x7C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; - -static const __flash uint8_t MASCULINE_ORDINAL_INDICATOR[] = { - 0x00, 0x00, 0x1C, 0x22, 0x22, 0x22, 0x1C, 0x00, - 0x3E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; - -static const __flash uint8_t RIGHT_POINTING_DOUBLE_ANGLE_QUOTATION_MARK[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x48, 0x24, - 0x24, 0x12, 0x24, 0x24, 0x48, 0x48, 0x00, 0x00}; - -static const __flash uint8_t VULGAR_FRACTION_ONE_QUARTER[] = { - 0x00, 0x00, 0x00, 0x00, 0x22, 0x62, 0x24, 0x28, - 0x28, 0x12, 0x16, 0x2A, 0x4E, 0x42, 0x00, 0x00}; - -static const __flash uint8_t VULGAR_FRACTION_ONE_HALF[] = { - 0x00, 0x00, 0x00, 0x00, 0x22, 0x62, 0x24, 0x28, - 0x28, 0x14, 0x1A, 0x22, 0x44, 0x4E, 0x00, 0x00}; - -static const __flash uint8_t VULGAR_FRACTION_THREE_QUARTERS[] = { - 0x00, 0x00, 0x00, 0x00, 0x62, 0x12, 0x24, 0x18, - 0x68, 0x12, 0x16, 0x2A, 0x4E, 0x42, 0x00, 0x00}; - -static const __flash uint8_t INVERTED_QUESTION_MARK[] = { - 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x00, 0x10, - 0x10, 0x20, 0x40, 0x42, 0x42, 0x3C, 0x00, 0x00}; - -static const __flash uint8_t A_GRAVE[] = { - 0x30, 0x0C, 0x00, 0x00, 0x18, 0x24, 0x24, 0x42, - 0x42, 0x7E, 0x42, 0x42, 0x42, 0x42, 0x00, 0x00}; - -static const __flash uint8_t A_ACUTE[] = { - 0x0C, 0x30, 0x00, 0x00, 0x18, 0x24, 0x24, 0x42, - 0x42, 0x7E, 0x42, 0x42, 0x42, 0x42, 0x00, 0x00}; - -static const __flash uint8_t A_CIRCUMFLEX[] = { - 0x18, 0x24, 0x00, 0x00, 0x18, 0x24, 0x24, 0x42, - 0x42, 0x7E, 0x42, 0x42, 0x42, 0x42, 0x00, 0x00}; - -static const __flash uint8_t A_TILDE[] = { - 0x32, 0x4C, 0x00, 0x00, 0x18, 0x24, 0x24, 0x42, - 0x42, 0x7E, 0x42, 0x42, 0x42, 0x42, 0x00, 0x00}; - -static const __flash uint8_t A_DIAERESIS[] = { - 0x24, 0x24, 0x00, 0x00, 0x18, 0x24, 0x24, 0x42, - 0x42, 0x7E, 0x42, 0x42, 0x42, 0x42, 0x00, 0x00}; - -static const __flash uint8_t A_RING[] = { - 0x18, 0x24, 0x18, 0x00, 0x18, 0x24, 0x24, 0x42, - 0x42, 0x7E, 0x42, 0x42, 0x42, 0x42, 0x00, 0x00}; - -static const __flash uint8_t AE[] = { - 0x00, 0x00, 0x00, 0x00, 0x1F, 0x28, 0x48, 0x48, - 0x7F, 0x48, 0x48, 0x48, 0x48, 0x4F, 0x00, 0x00}; - -static const __flash uint8_t C_CEDILLA[] = { - 0x00, 0x00, 0x00, 0x00, 0x3C, 0x42, 0x42, 0x40, - 0x40, 0x40, 0x40, 0x42, 0x42, 0x3C, 0x08, 0x30}; - -static const __flash uint8_t E_GRAVE[] = { - 0x30, 0x0C, 0x00, 0x00, 0x7E, 0x40, 0x40, 0x40, - 0x7C, 0x40, 0x40, 0x40, 0x40, 0x7E, 0x00, 0x00}; - -static const __flash uint8_t E_ACUTE[] = { - 0x0C, 0x30, 0x00, 0x00, 0x7E, 0x40, 0x40, 0x40, - 0x7C, 0x40, 0x40, 0x40, 0x40, 0x7E, 0x00, 0x00}; - -static const __flash uint8_t E_CIRCUMFLEX[] = { - 0x18, 0x24, 0x00, 0x00, 0x7E, 0x40, 0x40, 0x40, - 0x7C, 0x40, 0x40, 0x40, 0x40, 0x7E, 0x00, 0x00}; - -static const __flash uint8_t E_DIAERESIS[] = { - 0x24, 0x24, 0x00, 0x00, 0x7E, 0x40, 0x40, 0x40, - 0x7C, 0x40, 0x40, 0x40, 0x40, 0x7E, 0x00, 0x00}; - -static const __flash uint8_t I_GRAVE[] = { - 0x18, 0x06, 0x00, 0x00, 0x3E, 0x08, 0x08, 0x08, - 0x08, 0x08, 0x08, 0x08, 0x08, 0x3E, 0x00, 0x00}; - -static const __flash uint8_t I_ACUTE[] = { - 0x0C, 0x30, 0x00, 0x00, 0x3E, 0x08, 0x08, 0x08, - 0x08, 0x08, 0x08, 0x08, 0x08, 0x3E, 0x00, 0x00}; - -static const __flash uint8_t I_CIRCUMFLEX[] = { - 0x18, 0x24, 0x00, 0x00, 0x3E, 0x08, 0x08, 0x08, - 0x08, 0x08, 0x08, 0x08, 0x08, 0x3E, 0x00, 0x00}; - -static const __flash uint8_t I_DIAERESIS[] = { - 0x24, 0x24, 0x00, 0x00, 0x3E, 0x08, 0x08, 0x08, - 0x08, 0x08, 0x08, 0x08, 0x08, 0x3E, 0x00, 0x00}; - -static const __flash uint8_t ETH[] = { - 0x00, 0x00, 0x00, 0x00, 0x78, 0x44, 0x42, 0x42, - 0xF2, 0x42, 0x42, 0x42, 0x44, 0x78, 0x00, 0x00}; - -static const __flash uint8_t N_TILDE[] = { - 0x32, 0x4C, 0x00, 0x00, 0x42, 0x62, 0x62, 0x52, - 0x52, 0x4A, 0x4A, 0x46, 0x46, 0x42, 0x00, 0x00}; - -static const __flash uint8_t O_GRAVE[] = { - 0x30, 0x0C, 0x00, 0x00, 0x3C, 0x42, 0x42, 0x42, - 0x42, 0x42, 0x42, 0x42, 0x42, 0x3C, 0x00, 0x00}; - -static const __flash uint8_t O_ACUTE[] = { - 0x0C, 0x30, 0x00, 0x00, 0x3C, 0x42, 0x42, 0x42, - 0x42, 0x42, 0x42, 0x42, 0x42, 0x3C, 0x00, 0x00}; - -static const __flash uint8_t O_CIRCUMFLEX[] = { - 0x18, 0x24, 0x00, 0x00, 0x3C, 0x42, 0x42, 0x42, - 0x42, 0x42, 0x42, 0x42, 0x42, 0x3C, 0x00, 0x00}; - -static const __flash uint8_t O_TILDE[] = { - 0x32, 0x4C, 0x00, 0x00, 0x3C, 0x42, 0x42, 0x42, - 0x42, 0x42, 0x42, 0x42, 0x42, 0x3C, 0x00, 0x00}; - -static const __flash uint8_t O_DIAERESIS[] = { - 0x24, 0x24, 0x00, 0x00, 0x3C, 0x42, 0x42, 0x42, - 0x42, 0x42, 0x42, 0x42, 0x42, 0x3C, 0x00, 0x00}; - -static const __flash uint8_t MULTIPLICATION_SIGN[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, - 0x24, 0x18, 0x24, 0x42, 0x00, 0x00, 0x00, 0x00}; - -static const __flash uint8_t O_STROKE[] = { - 0x00, 0x00, 0x00, 0x02, 0x3A, 0x44, 0x46, 0x4A, - 0x4A, 0x52, 0x52, 0x62, 0x22, 0x5C, 0x40, 0x00}; - -static const __flash uint8_t U_GRAVE[] = { - 0x30, 0x0C, 0x00, 0x00, 0x42, 0x42, 0x42, 0x42, - 0x42, 0x42, 0x42, 0x42, 0x42, 0x3C, 0x00, 0x00}; - -static const __flash uint8_t U_ACUTE[] = { - 0x0C, 0x30, 0x00, 0x00, 0x42, 0x42, 0x42, 0x42, - 0x42, 0x42, 0x42, 0x42, 0x42, 0x3C, 0x00, 0x00}; - -static const __flash uint8_t U_CIRCUMFLEX[] = { - 0x18, 0x24, 0x00, 0x00, 0x42, 0x42, 0x42, 0x42, - 0x42, 0x42, 0x42, 0x42, 0x42, 0x3C, 0x00, 0x00}; - -static const __flash uint8_t U_DIAERESIS[] = { - 0x24, 0x24, 0x00, 0x00, 0x42, 0x42, 0x42, 0x42, - 0x42, 0x42, 0x42, 0x42, 0x42, 0x3C, 0x00, 0x00}; - -static const __flash uint8_t Y_ACUTE[] = { - 0x0C, 0x30, 0x00, 0x00, 0x41, 0x41, 0x22, 0x22, - 0x14, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00}; - -static const __flash uint8_t THORN[] = { - 0x00, 0x00, 0x00, 0x40, 0x40, 0x78, 0x44, 0x42, - 0x42, 0x44, 0x78, 0x40, 0x40, 0x40, 0x00, 0x00}; - -static const __flash uint8_t SHARP_S[] = { - 0x00, 0x00, 0x00, 0x00, 0x38, 0x44, 0x44, 0x48, - 0x58, 0x44, 0x42, 0x42, 0x52, 0x4C, 0x00, 0x00}; - -static const __flash uint8_t a_grave[] = { - 0x00, 0x00, 0x30, 0x0C, 0x00, 0x00, 0x3C, 0x42, - 0x02, 0x3E, 0x42, 0x42, 0x46, 0x3A, 0x00, 0x00}; - -static const __flash uint8_t a_acute[] = { - 0x00, 0x00, 0x0C, 0x30, 0x00, 0x00, 0x3C, 0x42, - 0x02, 0x3E, 0x42, 0x42, 0x46, 0x3A, 0x00, 0x00}; - -static const __flash uint8_t a_circumflex[] = { - 0x00, 0x00, 0x18, 0x24, 0x00, 0x00, 0x3C, 0x42, - 0x02, 0x3E, 0x42, 0x42, 0x46, 0x3A, 0x00, 0x00}; - -static const __flash uint8_t a_tilde[] = { - 0x00, 0x00, 0x32, 0x4C, 0x00, 0x00, 0x3C, 0x42, - 0x02, 0x3E, 0x42, 0x42, 0x46, 0x3A, 0x00, 0x00}; - -static const __flash uint8_t a_diaeresis[] = { - 0x00, 0x00, 0x24, 0x24, 0x00, 0x00, 0x3C, 0x42, - 0x02, 0x3E, 0x42, 0x42, 0x46, 0x3A, 0x00, 0x00}; - -static const __flash uint8_t a_ring[] = { - 0x00, 0x18, 0x24, 0x18, 0x00, 0x00, 0x3C, 0x42, - 0x02, 0x3E, 0x42, 0x42, 0x46, 0x3A, 0x00, 0x00}; - -static const __flash uint8_t ae[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3E, 0x49, - 0x09, 0x3F, 0x48, 0x48, 0x49, 0x3E, 0x00, 0x00}; - -static const __flash uint8_t c_cedilla[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x42, - 0x40, 0x40, 0x40, 0x40, 0x42, 0x3C, 0x08, 0x30}; - -static const __flash uint8_t e_grave[] = { - 0x00, 0x00, 0x30, 0x0C, 0x00, 0x00, 0x3C, 0x42, - 0x42, 0x7E, 0x40, 0x40, 0x42, 0x3C, 0x00, 0x00}; - -static const __flash uint8_t e_acute[] = { - 0x00, 0x00, 0x0C, 0x30, 0x00, 0x00, 0x3C, 0x42, - 0x42, 0x7E, 0x40, 0x40, 0x42, 0x3C, 0x00, 0x00}; - -static const __flash uint8_t e_circumflex[] = { - 0x00, 0x00, 0x18, 0x24, 0x00, 0x00, 0x3C, 0x42, - 0x42, 0x7E, 0x40, 0x40, 0x42, 0x3C, 0x00, 0x00}; - -static const __flash uint8_t e_diaeresis[] = { - 0x00, 0x00, 0x24, 0x24, 0x00, 0x00, 0x3C, 0x42, - 0x42, 0x7E, 0x40, 0x40, 0x42, 0x3C, 0x00, 0x00}; - -static const __flash uint8_t i_grave[] = { - 0x00, 0x00, 0x30, 0x0C, 0x00, 0x00, 0x18, 0x08, - 0x08, 0x08, 0x08, 0x08, 0x08, 0x3E, 0x00, 0x00}; - -static const __flash uint8_t i_acute[] = { - 0x00, 0x00, 0x0C, 0x30, 0x00, 0x00, 0x18, 0x08, - 0x08, 0x08, 0x08, 0x08, 0x08, 0x3E, 0x00, 0x00}; - -static const __flash uint8_t i_circumflex[] = { - 0x00, 0x00, 0x18, 0x24, 0x00, 0x00, 0x18, 0x08, - 0x08, 0x08, 0x08, 0x08, 0x08, 0x3E, 0x00, 0x00}; - -static const __flash uint8_t i_diaeresis[] = { - 0x00, 0x00, 0x24, 0x24, 0x00, 0x00, 0x18, 0x08, - 0x08, 0x08, 0x08, 0x08, 0x08, 0x3E, 0x00, 0x00}; - -static const __flash uint8_t eth[] = { - 0x00, 0x00, 0x32, 0x0C, 0x14, 0x22, 0x02, 0x3E, - 0x42, 0x42, 0x42, 0x42, 0x42, 0x3C, 0x00, 0x00}; - -static const __flash uint8_t n_tilde[] = { - 0x00, 0x00, 0x32, 0x4C, 0x00, 0x00, 0x5C, 0x62, - 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x00, 0x00}; - -static const __flash uint8_t o_grave[] = { - 0x00, 0x00, 0x30, 0x0C, 0x00, 0x00, 0x3C, 0x42, - 0x42, 0x42, 0x42, 0x42, 0x42, 0x3C, 0x00, 0x00}; - -static const __flash uint8_t o_acute[] = { - 0x00, 0x00, 0x0C, 0x30, 0x00, 0x00, 0x3C, 0x42, - 0x42, 0x42, 0x42, 0x42, 0x42, 0x3C, 0x00, 0x00}; - -static const __flash uint8_t o_circumflex[] = { - 0x00, 0x00, 0x18, 0x24, 0x00, 0x00, 0x3C, 0x42, - 0x42, 0x42, 0x42, 0x42, 0x42, 0x3C, 0x00, 0x00}; - -static const __flash uint8_t o_tilde[] = { - 0x00, 0x00, 0x32, 0x4C, 0x00, 0x00, 0x3C, 0x42, - 0x42, 0x42, 0x42, 0x42, 0x42, 0x3C, 0x00, 0x00}; - -static const __flash uint8_t o_diaeresis[] = { - 0x00, 0x00, 0x24, 0x24, 0x00, 0x00, 0x3C, 0x42, - 0x42, 0x42, 0x42, 0x42, 0x42, 0x3C, 0x00, 0x00}; - -static const __flash uint8_t DIVISION_SIGN[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, - 0x00, 0x7E, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00}; - -static const __flash uint8_t o_stroke[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x3C, 0x46, - 0x4A, 0x4A, 0x52, 0x52, 0x62, 0x3C, 0x40, 0x00}; - -static const __flash uint8_t u_grave[] = { - 0x00, 0x00, 0x30, 0x0C, 0x00, 0x00, 0x42, 0x42, - 0x42, 0x42, 0x42, 0x42, 0x46, 0x3A, 0x00, 0x00}; - -static const __flash uint8_t u_acute[] = { - 0x00, 0x00, 0x0C, 0x30, 0x00, 0x00, 0x42, 0x42, - 0x42, 0x42, 0x42, 0x42, 0x46, 0x3A, 0x00, 0x00}; - -static const __flash uint8_t u_circumflex[] = { - 0x00, 0x00, 0x18, 0x24, 0x00, 0x00, 0x42, 0x42, - 0x42, 0x42, 0x42, 0x42, 0x46, 0x3A, 0x00, 0x00}; - -static const __flash uint8_t u_diaeresis[] = { - 0x00, 0x00, 0x24, 0x24, 0x00, 0x00, 0x42, 0x42, - 0x42, 0x42, 0x42, 0x42, 0x46, 0x3A, 0x00, 0x00}; - -static const __flash uint8_t y_acute[] = { - 0x00, 0x00, 0x0C, 0x30, 0x00, 0x00, 0x42, 0x42, - 0x42, 0x42, 0x42, 0x26, 0x1A, 0x02, 0x02, 0x3C}; - -static const __flash uint8_t thorn[] = { - 0x00, 0x00, 0x00, 0x40, 0x40, 0x40, 0x5C, 0x62, - 0x42, 0x42, 0x42, 0x42, 0x62, 0x5C, 0x40, 0x40}; - -static const __flash uint8_t y_diaeresis[] = { - 0x00, 0x00, 0x24, 0x24, 0x00, 0x00, 0x42, 0x42, - 0x42, 0x42, 0x42, 0x26, 0x1A, 0x02, 0x02, 0x3C}; - -static const __flash uint8_t SMILING_FACE[] = { - 0x00, 0x00, 0x00, 0x00, 0x3C, 0x42, 0x81, 0xA5, - 0x81, 0xA5, 0x99, 0x42, 0x3C, 0x00, 0x00, 0x00}; - -/* -static const __flash uint8_t YIN_YANG[] = { - 0x07, 0xE0, 0x18, 0x18, 0x20, 0x04, 0x40, 0x02, - 0x40, 0x02, 0x9C, 0x31, 0xBE, 0x31, 0xFF, 0x03, - 0xE7, 0x83, 0xE7, 0xC7, 0xFF, 0xFF, 0x7F, 0xFE, - 0x7F, 0xFE, 0x3F, 0xFC, 0x1F, 0xF8, 0x07, 0xE0 -}; - */ - -static const __flash Glyph glyphs[] = { - // bell (\a) maps to SMILING_FACE - {0x0007, WIDTH, SMILING_FACE}, - {0x0020, WIDTH, SPACE}, - {0x0021, WIDTH, EXCLAMATION_MARK}, - {0x0022, WIDTH, QUOTATION_MARK}, - {0x0023, WIDTH, NUMBER_SIGN}, - {0x0024, WIDTH, DOLLAR_SIGN}, - {0x0025, WIDTH, PERCENT_SIGN}, - {0x0026, WIDTH, AMPERSAND}, - {0x0027, WIDTH, APOSTROPHE}, - {0x0028, WIDTH, LEFT_PARENTHESIS}, - {0x0029, WIDTH, RIGHT_PARENTHESIS}, - {0x002a, WIDTH, ASTERISK}, - {0x002b, WIDTH, PLUS_SIGN}, - {0x002c, WIDTH, COMMA}, - {0x002d, WIDTH, HYPHEN_MINUS}, - {0x002e, WIDTH, FULL_STOP}, - {0x002f, WIDTH, SOLIDUS}, - {0x0030, WIDTH, DIGIT_0}, - {0x0031, WIDTH, DIGIT_1}, - {0x0032, WIDTH, DIGIT_2}, - {0x0033, WIDTH, DIGIT_3}, - {0x0034, WIDTH, DIGIT_4}, - {0x0035, WIDTH, DIGIT_5}, - {0x0036, WIDTH, DIGIT_6}, - {0x0037, WIDTH, DIGIT_7}, - {0x0038, WIDTH, DIGIT_8}, - {0x0039, WIDTH, DIGIT_9}, - {0x003a, WIDTH, COLON}, - {0x003b, WIDTH, SEMICOLON}, - {0x003c, WIDTH, LESS_THAN_SIGN}, - {0x003d, WIDTH, EQUALS_SIGN}, - {0x003e, WIDTH, GREATER_THAN_SIGN}, - {0x003f, WIDTH, QUESTION_MARK}, - {0x0040, WIDTH, COMMERCIAL_AT}, - {0x0041, WIDTH, A}, - {0x0042, WIDTH, B}, - {0x0043, WIDTH, C}, - {0x0044, WIDTH, D}, - {0x0045, WIDTH, E}, - {0x0046, WIDTH, F}, - {0x0047, WIDTH, G}, - {0x0048, WIDTH, H}, - {0x0049, WIDTH, I}, - {0x004a, WIDTH, J}, - {0x004b, WIDTH, K}, - {0x004c, WIDTH, L}, - {0x004d, WIDTH, M}, - {0x004e, WIDTH, N}, - {0x004f, WIDTH, O}, - {0x0050, WIDTH, P}, - {0x0051, WIDTH, Q}, - {0x0052, WIDTH, R}, - {0x0053, WIDTH, S}, - {0x0054, WIDTH, T}, - {0x0055, WIDTH, U}, - {0x0056, WIDTH, V}, - {0x0057, WIDTH, W}, - {0x0058, WIDTH, X}, - {0x0059, WIDTH, Y}, - {0x005a, WIDTH, Z}, - {0x005b, WIDTH, LEFT_SQUARE_BRACKET}, - {0x005c, WIDTH, REVERSE_SOLIDUS}, - {0x005d, WIDTH, RIGHT_SQUARE_BRACKET}, - {0x005e, WIDTH, CIRCUMFLEX_ACCENT}, - {0x005f, WIDTH, LOW_LINE}, - {0x0060, WIDTH, GRAVE_ACCENT}, - {0x0061, WIDTH, a}, - {0x0062, WIDTH, b}, - {0x0063, WIDTH, c}, - {0x0064, WIDTH, d}, - {0x0065, WIDTH, e}, - {0x0066, WIDTH, f}, - {0x0067, WIDTH, g}, - {0x0068, WIDTH, h}, - {0x0069, WIDTH, i}, - {0x006a, WIDTH, j}, - {0x006b, WIDTH, k}, - {0x006c, WIDTH, l}, - {0x006d, WIDTH, m}, - {0x006e, WIDTH, n}, - {0x006f, WIDTH, o}, - {0x0070, WIDTH, p}, - {0x0071, WIDTH, q}, - {0x0072, WIDTH, r}, - {0x0073, WIDTH, s}, - {0x0074, WIDTH, t}, - {0x0075, WIDTH, u}, - {0x0076, WIDTH, v}, - {0x0077, WIDTH, w}, - {0x0078, WIDTH, x}, - {0x0079, WIDTH, y}, - {0x007a, WIDTH, z}, - {0x007b, WIDTH, LEFT_CURLY_BRACKET}, - {0x007c, WIDTH, VERTICAL_LINE}, - {0x007d, WIDTH, RIGHT_CURLY_BRACKET}, - {0x007e, WIDTH, TILDE}, - // skipped NO-BREAK SPACE - {0x00a1, WIDTH, INVERTED_EXCLAMATION_MARK}, - {0x00a2, WIDTH, CENT_SIGN}, - {0x00a3, WIDTH, POUND_SIGN}, - {0x00a4, WIDTH, CURRENCY_SIGN}, - {0x00a5, WIDTH, YEN_SIGN}, - {0x00a6, WIDTH, BROKEN_BAR}, - {0x00a7, WIDTH, SECTION_SIGN}, - {0x00a8, WIDTH, DIAERESIS}, - {0x00a9, WIDTH, COPYRIGHT_SIGN}, - {0x00aa, WIDTH, FEMININE_ORDINAL_INDICATOR}, - {0x00ab, WIDTH, LEFT_POINTING_DOUBLE_ANGLE_QUOTATION_MARK}, - {0x00ac, WIDTH, NOT_SIGN}, - // skipped SOFT HYPHEN - {0x00ae, WIDTH, REGISTERED_SIGN}, - {0x00af, WIDTH, MACRON}, - {0x00b0, WIDTH, DEGREE_SIGN}, - {0x00b1, WIDTH, PLUS_MINUS_SIGN}, - {0x00b2, WIDTH, SUPERSCRIPT_TWO}, - {0x00b3, WIDTH, SUPERSCRIPT_THREE}, - {0x00b4, WIDTH, ACUTE_ACCENT}, - {0x00b5, WIDTH, MICRO_SIGN}, - {0x00b6, WIDTH, PILCROW_SIGN}, - {0x00b7, WIDTH, MIDDLE_DOT}, - {0x00b8, WIDTH, CEDILLA}, - {0x00b9, WIDTH, SUPERSCRIPT_ONE}, - {0x00ba, WIDTH, MASCULINE_ORDINAL_INDICATOR}, - {0x00bb, WIDTH, RIGHT_POINTING_DOUBLE_ANGLE_QUOTATION_MARK}, - {0x00bc, WIDTH, VULGAR_FRACTION_ONE_QUARTER}, - {0x00bd, WIDTH, VULGAR_FRACTION_ONE_HALF}, - {0x00be, WIDTH, VULGAR_FRACTION_THREE_QUARTERS}, - {0x00bf, WIDTH, INVERTED_QUESTION_MARK}, - {0x00c0, WIDTH, A_GRAVE}, - {0x00c1, WIDTH, A_ACUTE}, - {0x00c2, WIDTH, A_CIRCUMFLEX}, - {0x00c3, WIDTH, A_TILDE}, - {0x00c4, WIDTH, A_DIAERESIS}, - {0x00c5, WIDTH, A_RING}, - {0x00c6, WIDTH, AE}, - {0x00c7, WIDTH, C_CEDILLA}, - {0x00c8, WIDTH, E_GRAVE}, - {0x00c9, WIDTH, E_ACUTE}, - {0x00ca, WIDTH, E_CIRCUMFLEX}, - {0x00cb, WIDTH, E_DIAERESIS}, - {0x00cc, WIDTH, I_GRAVE}, - {0x00cd, WIDTH, I_ACUTE}, - {0x00ce, WIDTH, I_CIRCUMFLEX}, - {0x00cf, WIDTH, I_DIAERESIS}, - {0x00d0, WIDTH, ETH}, - {0x00d1, WIDTH, N_TILDE}, - {0x00d2, WIDTH, O_GRAVE}, - {0x00d3, WIDTH, O_ACUTE}, - {0x00d4, WIDTH, O_CIRCUMFLEX}, - {0x00d5, WIDTH, O_TILDE}, - {0x00d6, WIDTH, O_DIAERESIS}, - {0x00d7, WIDTH, MULTIPLICATION_SIGN}, - {0x00d8, WIDTH, O_STROKE}, - {0x00d9, WIDTH, U_GRAVE}, - {0x00da, WIDTH, U_ACUTE}, - {0x00db, WIDTH, U_CIRCUMFLEX}, - {0x00dc, WIDTH, U_DIAERESIS}, - {0x00dd, WIDTH, Y_ACUTE}, - {0x00de, WIDTH, THORN}, - {0x00df, WIDTH, SHARP_S}, - {0x00e0, WIDTH, a_grave}, - {0x00e1, WIDTH, a_acute}, - {0x00e2, WIDTH, a_circumflex}, - {0x00e3, WIDTH, a_tilde}, - {0x00e4, WIDTH, a_diaeresis}, - {0x00e5, WIDTH, a_ring}, - {0x00e6, WIDTH, ae}, - {0x00e7, WIDTH, c_cedilla}, - {0x00e8, WIDTH, e_grave}, - {0x00e9, WIDTH, e_acute}, - {0x00ea, WIDTH, e_circumflex}, - {0x00eb, WIDTH, e_diaeresis}, - {0x00ec, WIDTH, i_grave}, - {0x00ed, WIDTH, i_acute}, - {0x00ee, WIDTH, i_circumflex}, - {0x00ef, WIDTH, i_diaeresis}, - {0x00f0, WIDTH, eth}, - {0x00f1, WIDTH, n_tilde}, - {0x00f2, WIDTH, o_grave}, - {0x00f3, WIDTH, o_acute}, - {0x00f4, WIDTH, o_circumflex}, - {0x00f5, WIDTH, o_tilde}, - {0x00f6, WIDTH, o_diaeresis}, - {0x00f7, WIDTH, DIVISION_SIGN}, - {0x00f8, WIDTH, o_stroke}, - {0x00f9, WIDTH, u_grave}, - {0x00fa, WIDTH, u_acute}, - {0x00fb, WIDTH, u_circumflex}, - {0x00fc, WIDTH, u_diaeresis}, - {0x00fd, WIDTH, y_acute}, - {0x00fe, WIDTH, thorn}, - {0x00ff, WIDTH, y_diaeresis} -}; - -const __flash Font unifontFont = {glyphs, array_length(glyphs), HEIGHT, SPACE_MONO1}; diff --git a/unifont.h b/unifont.h index 305edfe..0850793 100644 --- a/unifont.h +++ b/unifont.h @@ -10,7 +10,6 @@ #define UNIFONT_H #include "font.h" -#include "colorspace.h" /** * Unifont font.