From fab3332c6520ef7b2f8697fc02fe43cc3252f818 Mon Sep 17 00:00:00 2001 From: Max Regan Date: Mon, 4 Mar 2019 00:22:01 -0800 Subject: [PATCH] Enable text display on Sharp display 1. Add basic code for Sharp Display 2. Add embedded font (generated by fontem) 3. Add the worst code possible to print strings to the display 4. Rejoice in the beautiful (small) text. --- Makefile | 2 + lib/fonts/font-notomono-10.c | 2468 ++++++++++++++++++++++++++++++++++ lib/fonts/font-notomono-10.h | 15 + lib/fonts/fontem.h | 84 ++ macros.h | 74 + test.c | 221 ++- 6 files changed, 2822 insertions(+), 42 deletions(-) create mode 100644 lib/fonts/font-notomono-10.c create mode 100644 lib/fonts/font-notomono-10.h create mode 100644 lib/fonts/fontem.h create mode 100644 macros.h diff --git a/Makefile b/Makefile index 9954114..0063f9b 100644 --- a/Makefile +++ b/Makefile @@ -80,6 +80,8 @@ CFLAGS += -D$(DEVICE_DEFINE) CFLAGS += -I./lib/stm32/$(DEVICE_LINE)/Include CFLAGS += -I./lib/CMSIS/Core/Include +CFLAGS += -I./lib/fonts/ + # Startup Definitions ASFLAGS += -D__STARTUP_CLEAR_BSS ASFLAGS += -D__HEAP_SIZE=0 # No heap- let the linker decide it all diff --git a/lib/fonts/font-notomono-10.c b/lib/fonts/font-notomono-10.c new file mode 100644 index 0000000..3048130 --- /dev/null +++ b/lib/fonts/font-notomono-10.c @@ -0,0 +1,2468 @@ +/* AUTOMATICALLY GENERATED FILE! EDITING NOT RECOMMENDED! + * + * This file is distributed under the terms of the MIT License. + * See the LICENSE file at the top of this tree, or if it is missing a copy can + * be found at http://opensource.org/licenses/MIT + */ + +#include +#include +#include "fontem.h" +#include "font-notomono-10.h" + +/* Character list: @#$%^&*()_+-={}|[]\:;<>?,./~ ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'! */ + +/** Glyph definition for character ' '. */ +static const struct glyph glyph_notomono_10_0020 = { + .glyph = 32, + .left = 0, + .top = 0, + .advance = 8, + .cols = 0, + .rows = 0, + .bitmap = NULL, + .kerning = NULL, +}; + +/** Bitmap definition for character '!'. */ +static const uint8_t bitmap_notomono_10_0021[] = { + 0xc0, 0x00, + 0xc0, 0x00, + 0xc0, 0x00, + 0x80, 0x00, + 0x80, 0x00, + 0x80, 0x00, + 0x80, 0x00, + 0x00, 0x00, + 0xc0, 0x00, + 0xc0, 0x00, +}; + +/** Glyph definition for character '!'. */ +static const struct glyph glyph_notomono_10_0021 = { + .glyph = 33, + .left = 3, + .top = 10, + .advance = 8, + .cols = 2, + .rows = 10, + .bitmap = bitmap_notomono_10_0021, + .kerning = NULL, +}; + +/** Bitmap definition for character '#'. */ +static const uint8_t bitmap_notomono_10_0023[] = { + 0x12, 0x00, + 0x12, 0x00, + 0x36, 0x00, + 0x7f, 0x00, + 0x24, 0x00, + 0x24, 0x00, + 0xfe, 0x00, + 0x6c, 0x00, + 0x48, 0x00, + 0x48, 0x00, +}; + +/** Glyph definition for character '#'. */ +static const struct glyph glyph_notomono_10_0023 = { + .glyph = 35, + .left = 0, + .top = 10, + .advance = 8, + .cols = 8, + .rows = 10, + .bitmap = bitmap_notomono_10_0023, + .kerning = NULL, +}; + +/** Bitmap definition for character '$'. */ +static const uint8_t bitmap_notomono_10_0024[] = { + 0x20, 0x00, + 0x20, 0x00, + 0x78, 0x00, + 0xa0, 0x00, + 0xa0, 0x00, + 0xa0, 0x00, + 0x60, 0x00, + 0x30, 0x00, + 0x28, 0x00, + 0x28, 0x00, + 0x28, 0x00, + 0xf0, 0x00, + 0x20, 0x00, + 0x20, 0x00, +}; + +/** Glyph definition for character '$'. */ +static const struct glyph glyph_notomono_10_0024 = { + .glyph = 36, + .left = 1, + .top = 12, + .advance = 8, + .cols = 5, + .rows = 14, + .bitmap = bitmap_notomono_10_0024, + .kerning = NULL, +}; + +/** Bitmap definition for character '%'. */ +static const uint8_t bitmap_notomono_10_0025[] = { + 0x62, 0x00, + 0x94, 0x00, + 0x94, 0x00, + 0x98, 0x00, + 0x68, 0x00, + 0x16, 0x00, + 0x19, 0x00, + 0x29, 0x00, + 0x29, 0x00, + 0x46, 0x00, +}; + +/** Glyph definition for character '%'. */ +static const struct glyph glyph_notomono_10_0025 = { + .glyph = 37, + .left = 0, + .top = 10, + .advance = 8, + .cols = 8, + .rows = 10, + .bitmap = bitmap_notomono_10_0025, + .kerning = NULL, +}; + +/** Bitmap definition for character '&'. */ +static const uint8_t bitmap_notomono_10_0026[] = { + 0x30, 0x00, + 0x48, 0x00, + 0x48, 0x00, + 0x58, 0x00, + 0x30, 0x00, + 0x54, 0x00, + 0x94, 0x00, + 0x8c, 0x00, + 0xcc, 0x00, + 0x76, 0x00, +}; + +/** Glyph definition for character '&'. */ +static const struct glyph glyph_notomono_10_0026 = { + .glyph = 38, + .left = 1, + .top = 10, + .advance = 8, + .cols = 7, + .rows = 10, + .bitmap = bitmap_notomono_10_0026, + .kerning = NULL, +}; + +/** Bitmap definition for character '''. */ +static const uint8_t bitmap_notomono_10_0027[] = { + 0xc0, 0x00, + 0x80, 0x00, + 0x80, 0x00, +}; + +/** Glyph definition for character '''. */ +static const struct glyph glyph_notomono_10_0027 = { + .glyph = 39, + .left = 3, + .top = 10, + .advance = 8, + .cols = 2, + .rows = 3, + .bitmap = bitmap_notomono_10_0027, + .kerning = NULL, +}; + +/** Bitmap definition for character '('. */ +static const uint8_t bitmap_notomono_10_0028[] = { + 0x20, 0x00, + 0x60, 0x00, + 0x40, 0x00, + 0xc0, 0x00, + 0x80, 0x00, + 0x80, 0x00, + 0x80, 0x00, + 0x80, 0x00, + 0xc0, 0x00, + 0x40, 0x00, + 0x60, 0x00, + 0x20, 0x00, +}; + +/** Glyph definition for character '('. */ +static const struct glyph glyph_notomono_10_0028 = { + .glyph = 40, + .left = 2, + .top = 10, + .advance = 8, + .cols = 4, + .rows = 12, + .bitmap = bitmap_notomono_10_0028, + .kerning = NULL, +}; + +/** Bitmap definition for character ')'. */ +static const uint8_t bitmap_notomono_10_0029[] = { + 0x40, 0x00, + 0x60, 0x00, + 0x20, 0x00, + 0x30, 0x00, + 0x10, 0x00, + 0x10, 0x00, + 0x10, 0x00, + 0x10, 0x00, + 0x30, 0x00, + 0x20, 0x00, + 0x60, 0x00, + 0x40, 0x00, +}; + +/** Glyph definition for character ')'. */ +static const struct glyph glyph_notomono_10_0029 = { + .glyph = 41, + .left = 2, + .top = 10, + .advance = 8, + .cols = 4, + .rows = 12, + .bitmap = bitmap_notomono_10_0029, + .kerning = NULL, +}; + +/** Bitmap definition for character '*'. */ +static const uint8_t bitmap_notomono_10_002a[] = { + 0x10, 0x00, + 0x10, 0x00, + 0xfe, 0x00, + 0x10, 0x00, + 0x28, 0x00, + 0x6c, 0x00, +}; + +/** Glyph definition for character '*'. */ +static const struct glyph glyph_notomono_10_002a = { + .glyph = 42, + .left = 1, + .top = 11, + .advance = 8, + .cols = 7, + .rows = 6, + .bitmap = bitmap_notomono_10_002a, + .kerning = NULL, +}; + +/** Bitmap definition for character '+'. */ +static const uint8_t bitmap_notomono_10_002b[] = { + 0x10, 0x00, + 0x10, 0x00, + 0x10, 0x00, + 0xfe, 0x00, + 0x10, 0x00, + 0x10, 0x00, + 0x10, 0x00, +}; + +/** Glyph definition for character '+'. */ +static const struct glyph glyph_notomono_10_002b = { + .glyph = 43, + .left = 1, + .top = 8, + .advance = 8, + .cols = 7, + .rows = 7, + .bitmap = bitmap_notomono_10_002b, + .kerning = NULL, +}; + +/** Bitmap definition for character ','. */ +static const uint8_t bitmap_notomono_10_002c[] = { + 0xc0, 0x00, + 0xc0, 0x00, + 0x80, 0x00, +}; + +/** Glyph definition for character ','. */ +static const struct glyph glyph_notomono_10_002c = { + .glyph = 44, + .left = 3, + .top = 2, + .advance = 8, + .cols = 2, + .rows = 3, + .bitmap = bitmap_notomono_10_002c, + .kerning = NULL, +}; + +/** Bitmap definition for character '-'. */ +static const uint8_t bitmap_notomono_10_002d[] = { + 0xf0, 0x00, +}; + +/** Glyph definition for character '-'. */ +static const struct glyph glyph_notomono_10_002d = { + .glyph = 45, + .left = 2, + .top = 4, + .advance = 8, + .cols = 4, + .rows = 1, + .bitmap = bitmap_notomono_10_002d, + .kerning = NULL, +}; + +/** Bitmap definition for character '.'. */ +static const uint8_t bitmap_notomono_10_002e[] = { + 0xc0, 0x00, + 0xc0, 0x00, +}; + +/** Glyph definition for character '.'. */ +static const struct glyph glyph_notomono_10_002e = { + .glyph = 46, + .left = 3, + .top = 2, + .advance = 8, + .cols = 2, + .rows = 2, + .bitmap = bitmap_notomono_10_002e, + .kerning = NULL, +}; + +/** Bitmap definition for character '/'. */ +static const uint8_t bitmap_notomono_10_002f[] = { + 0x04, 0x00, + 0x08, 0x00, + 0x08, 0x00, + 0x10, 0x00, + 0x10, 0x00, + 0x20, 0x00, + 0x20, 0x00, + 0x40, 0x00, + 0x40, 0x00, + 0x80, 0x00, +}; + +/** Glyph definition for character '/'. */ +static const struct glyph glyph_notomono_10_002f = { + .glyph = 47, + .left = 1, + .top = 10, + .advance = 8, + .cols = 6, + .rows = 10, + .bitmap = bitmap_notomono_10_002f, + .kerning = NULL, +}; + +/** Bitmap definition for character '0'. */ +static const uint8_t bitmap_notomono_10_0030[] = { + 0x78, 0x00, + 0x48, 0x00, + 0xcc, 0x00, + 0x84, 0x00, + 0x84, 0x00, + 0x84, 0x00, + 0x84, 0x00, + 0xcc, 0x00, + 0x48, 0x00, + 0x78, 0x00, +}; + +/** Glyph definition for character '0'. */ +static const struct glyph glyph_notomono_10_0030 = { + .glyph = 48, + .left = 1, + .top = 10, + .advance = 8, + .cols = 6, + .rows = 10, + .bitmap = bitmap_notomono_10_0030, + .kerning = NULL, +}; + +/** Bitmap definition for character '1'. */ +static const uint8_t bitmap_notomono_10_0031[] = { + 0x20, 0x00, + 0x60, 0x00, + 0xa0, 0x00, + 0x20, 0x00, + 0x20, 0x00, + 0x20, 0x00, + 0x20, 0x00, + 0x20, 0x00, + 0x20, 0x00, + 0x20, 0x00, +}; + +/** Glyph definition for character '1'. */ +static const struct glyph glyph_notomono_10_0031 = { + .glyph = 49, + .left = 2, + .top = 10, + .advance = 8, + .cols = 3, + .rows = 10, + .bitmap = bitmap_notomono_10_0031, + .kerning = NULL, +}; + +/** Bitmap definition for character '2'. */ +static const uint8_t bitmap_notomono_10_0032[] = { + 0x78, 0x00, + 0x8c, 0x00, + 0x04, 0x00, + 0x04, 0x00, + 0x08, 0x00, + 0x18, 0x00, + 0x30, 0x00, + 0x60, 0x00, + 0x40, 0x00, + 0xfc, 0x00, +}; + +/** Glyph definition for character '2'. */ +static const struct glyph glyph_notomono_10_0032 = { + .glyph = 50, + .left = 1, + .top = 10, + .advance = 8, + .cols = 6, + .rows = 10, + .bitmap = bitmap_notomono_10_0032, + .kerning = NULL, +}; + +/** Bitmap definition for character '3'. */ +static const uint8_t bitmap_notomono_10_0033[] = { + 0x78, 0x00, + 0x8c, 0x00, + 0x04, 0x00, + 0x0c, 0x00, + 0x30, 0x00, + 0x0c, 0x00, + 0x04, 0x00, + 0x04, 0x00, + 0x0c, 0x00, + 0xf8, 0x00, +}; + +/** Glyph definition for character '3'. */ +static const struct glyph glyph_notomono_10_0033 = { + .glyph = 51, + .left = 1, + .top = 10, + .advance = 8, + .cols = 6, + .rows = 10, + .bitmap = bitmap_notomono_10_0033, + .kerning = NULL, +}; + +/** Bitmap definition for character '4'. */ +static const uint8_t bitmap_notomono_10_0034[] = { + 0x08, 0x00, + 0x18, 0x00, + 0x28, 0x00, + 0x28, 0x00, + 0x48, 0x00, + 0x48, 0x00, + 0x88, 0x00, + 0xfc, 0x00, + 0x08, 0x00, + 0x08, 0x00, +}; + +/** Glyph definition for character '4'. */ +static const struct glyph glyph_notomono_10_0034 = { + .glyph = 52, + .left = 1, + .top = 10, + .advance = 8, + .cols = 6, + .rows = 10, + .bitmap = bitmap_notomono_10_0034, + .kerning = NULL, +}; + +/** Bitmap definition for character '5'. */ +static const uint8_t bitmap_notomono_10_0035[] = { + 0xfc, 0x00, + 0x80, 0x00, + 0x80, 0x00, + 0x80, 0x00, + 0xf8, 0x00, + 0x0c, 0x00, + 0x04, 0x00, + 0x04, 0x00, + 0x0c, 0x00, + 0xf8, 0x00, +}; + +/** Glyph definition for character '5'. */ +static const struct glyph glyph_notomono_10_0035 = { + .glyph = 53, + .left = 1, + .top = 10, + .advance = 8, + .cols = 6, + .rows = 10, + .bitmap = bitmap_notomono_10_0035, + .kerning = NULL, +}; + +/** Bitmap definition for character '6'. */ +static const uint8_t bitmap_notomono_10_0036[] = { + 0x3c, 0x00, + 0x60, 0x00, + 0x40, 0x00, + 0xc0, 0x00, + 0xb8, 0x00, + 0xcc, 0x00, + 0x84, 0x00, + 0x84, 0x00, + 0x4c, 0x00, + 0x78, 0x00, +}; + +/** Glyph definition for character '6'. */ +static const struct glyph glyph_notomono_10_0036 = { + .glyph = 54, + .left = 1, + .top = 10, + .advance = 8, + .cols = 6, + .rows = 10, + .bitmap = bitmap_notomono_10_0036, + .kerning = NULL, +}; + +/** Bitmap definition for character '7'. */ +static const uint8_t bitmap_notomono_10_0037[] = { + 0xfc, 0x00, + 0x04, 0x00, + 0x08, 0x00, + 0x08, 0x00, + 0x10, 0x00, + 0x10, 0x00, + 0x30, 0x00, + 0x20, 0x00, + 0x20, 0x00, + 0x40, 0x00, +}; + +/** Glyph definition for character '7'. */ +static const struct glyph glyph_notomono_10_0037 = { + .glyph = 55, + .left = 1, + .top = 10, + .advance = 8, + .cols = 6, + .rows = 10, + .bitmap = bitmap_notomono_10_0037, + .kerning = NULL, +}; + +/** Bitmap definition for character '8'. */ +static const uint8_t bitmap_notomono_10_0038[] = { + 0x78, 0x00, + 0xcc, 0x00, + 0x84, 0x00, + 0xcc, 0x00, + 0x70, 0x00, + 0x48, 0x00, + 0x84, 0x00, + 0x84, 0x00, + 0xcc, 0x00, + 0x78, 0x00, +}; + +/** Glyph definition for character '8'. */ +static const struct glyph glyph_notomono_10_0038 = { + .glyph = 56, + .left = 1, + .top = 10, + .advance = 8, + .cols = 6, + .rows = 10, + .bitmap = bitmap_notomono_10_0038, + .kerning = NULL, +}; + +/** Bitmap definition for character '9'. */ +static const uint8_t bitmap_notomono_10_0039[] = { + 0x78, 0x00, + 0xc8, 0x00, + 0x84, 0x00, + 0x84, 0x00, + 0xcc, 0x00, + 0x74, 0x00, + 0x0c, 0x00, + 0x08, 0x00, + 0x18, 0x00, + 0xf0, 0x00, +}; + +/** Glyph definition for character '9'. */ +static const struct glyph glyph_notomono_10_0039 = { + .glyph = 57, + .left = 1, + .top = 10, + .advance = 8, + .cols = 6, + .rows = 10, + .bitmap = bitmap_notomono_10_0039, + .kerning = NULL, +}; + +/** Bitmap definition for character ':'. */ +static const uint8_t bitmap_notomono_10_003a[] = { + 0xc0, 0x00, + 0xc0, 0x00, + 0x00, 0x00, + 0x00, 0x00, + 0x00, 0x00, + 0x00, 0x00, + 0xc0, 0x00, + 0xc0, 0x00, +}; + +/** Glyph definition for character ':'. */ +static const struct glyph glyph_notomono_10_003a = { + .glyph = 58, + .left = 3, + .top = 8, + .advance = 8, + .cols = 2, + .rows = 8, + .bitmap = bitmap_notomono_10_003a, + .kerning = NULL, +}; + +/** Bitmap definition for character ';'. */ +static const uint8_t bitmap_notomono_10_003b[] = { + 0xc0, 0x00, + 0xc0, 0x00, + 0x00, 0x00, + 0x00, 0x00, + 0x00, 0x00, + 0x00, 0x00, + 0xc0, 0x00, + 0xc0, 0x00, + 0x80, 0x00, +}; + +/** Glyph definition for character ';'. */ +static const struct glyph glyph_notomono_10_003b = { + .glyph = 59, + .left = 3, + .top = 8, + .advance = 8, + .cols = 2, + .rows = 9, + .bitmap = bitmap_notomono_10_003b, + .kerning = NULL, +}; + +/** Bitmap definition for character '<'. */ +static const uint8_t bitmap_notomono_10_003c[] = { + 0x04, 0x00, + 0x18, 0x00, + 0x60, 0x00, + 0x80, 0x00, + 0x60, 0x00, + 0x18, 0x00, + 0x04, 0x00, +}; + +/** Glyph definition for character '<'. */ +static const struct glyph glyph_notomono_10_003c = { + .glyph = 60, + .left = 1, + .top = 8, + .advance = 8, + .cols = 6, + .rows = 7, + .bitmap = bitmap_notomono_10_003c, + .kerning = NULL, +}; + +/** Bitmap definition for character '='. */ +static const uint8_t bitmap_notomono_10_003d[] = { + 0xfc, 0x00, + 0x00, 0x00, + 0xfc, 0x00, +}; + +/** Glyph definition for character '='. */ +static const struct glyph glyph_notomono_10_003d = { + .glyph = 61, + .left = 1, + .top = 6, + .advance = 8, + .cols = 6, + .rows = 3, + .bitmap = bitmap_notomono_10_003d, + .kerning = NULL, +}; + +/** Bitmap definition for character '>'. */ +static const uint8_t bitmap_notomono_10_003e[] = { + 0x80, 0x00, + 0x60, 0x00, + 0x18, 0x00, + 0x04, 0x00, + 0x18, 0x00, + 0x60, 0x00, + 0x80, 0x00, +}; + +/** Glyph definition for character '>'. */ +static const struct glyph glyph_notomono_10_003e = { + .glyph = 62, + .left = 1, + .top = 8, + .advance = 8, + .cols = 6, + .rows = 7, + .bitmap = bitmap_notomono_10_003e, + .kerning = NULL, +}; + +/** Bitmap definition for character '?'. */ +static const uint8_t bitmap_notomono_10_003f[] = { + 0xf8, 0x00, + 0x8c, 0x00, + 0x04, 0x00, + 0x0c, 0x00, + 0x18, 0x00, + 0x10, 0x00, + 0x20, 0x00, + 0x00, 0x00, + 0x30, 0x00, + 0x30, 0x00, +}; + +/** Glyph definition for character '?'. */ +static const struct glyph glyph_notomono_10_003f = { + .glyph = 63, + .left = 1, + .top = 10, + .advance = 8, + .cols = 6, + .rows = 10, + .bitmap = bitmap_notomono_10_003f, + .kerning = NULL, +}; + +/** Bitmap definition for character '@'. */ +static const uint8_t bitmap_notomono_10_0040[] = { + 0x3c, 0x00, + 0x42, 0x00, + 0x41, 0x00, + 0x9d, 0x00, + 0xa5, 0x00, + 0xa5, 0x00, + 0xa5, 0x00, + 0x9a, 0x00, + 0xc0, 0x00, + 0x40, 0x00, + 0x3e, 0x00, +}; + +/** Glyph definition for character '@'. */ +static const struct glyph glyph_notomono_10_0040 = { + .glyph = 64, + .left = 0, + .top = 10, + .advance = 8, + .cols = 8, + .rows = 11, + .bitmap = bitmap_notomono_10_0040, + .kerning = NULL, +}; + +/** Bitmap definition for character 'A'. */ +static const uint8_t bitmap_notomono_10_0041[] = { + 0x18, 0x00, + 0x18, 0x00, + 0x18, 0x00, + 0x24, 0x00, + 0x24, 0x00, + 0x24, 0x00, + 0x7e, 0x00, + 0x42, 0x00, + 0x42, 0x00, + 0x81, 0x00, +}; + +/** Glyph definition for character 'A'. */ +static const struct glyph glyph_notomono_10_0041 = { + .glyph = 65, + .left = 0, + .top = 10, + .advance = 8, + .cols = 8, + .rows = 10, + .bitmap = bitmap_notomono_10_0041, + .kerning = NULL, +}; + +/** Bitmap definition for character 'B'. */ +static const uint8_t bitmap_notomono_10_0042[] = { + 0xf8, 0x00, + 0x8c, 0x00, + 0x84, 0x00, + 0x8c, 0x00, + 0xf0, 0x00, + 0x8c, 0x00, + 0x84, 0x00, + 0x84, 0x00, + 0x8c, 0x00, + 0xf8, 0x00, +}; + +/** Glyph definition for character 'B'. */ +static const struct glyph glyph_notomono_10_0042 = { + .glyph = 66, + .left = 1, + .top = 10, + .advance = 8, + .cols = 6, + .rows = 10, + .bitmap = bitmap_notomono_10_0042, + .kerning = NULL, +}; + +/** Bitmap definition for character 'C'. */ +static const uint8_t bitmap_notomono_10_0043[] = { + 0x3c, 0x00, + 0x64, 0x00, + 0xc0, 0x00, + 0x80, 0x00, + 0x80, 0x00, + 0x80, 0x00, + 0x80, 0x00, + 0xc0, 0x00, + 0x60, 0x00, + 0x3c, 0x00, +}; + +/** Glyph definition for character 'C'. */ +static const struct glyph glyph_notomono_10_0043 = { + .glyph = 67, + .left = 1, + .top = 10, + .advance = 8, + .cols = 6, + .rows = 10, + .bitmap = bitmap_notomono_10_0043, + .kerning = NULL, +}; + +/** Bitmap definition for character 'D'. */ +static const uint8_t bitmap_notomono_10_0044[] = { + 0xf0, 0x00, + 0x98, 0x00, + 0x8c, 0x00, + 0x84, 0x00, + 0x84, 0x00, + 0x84, 0x00, + 0x84, 0x00, + 0x8c, 0x00, + 0x98, 0x00, + 0xf0, 0x00, +}; + +/** Glyph definition for character 'D'. */ +static const struct glyph glyph_notomono_10_0044 = { + .glyph = 68, + .left = 1, + .top = 10, + .advance = 8, + .cols = 6, + .rows = 10, + .bitmap = bitmap_notomono_10_0044, + .kerning = NULL, +}; + +/** Bitmap definition for character 'E'. */ +static const uint8_t bitmap_notomono_10_0045[] = { + 0xfc, 0x00, + 0x80, 0x00, + 0x80, 0x00, + 0x80, 0x00, + 0xfc, 0x00, + 0x80, 0x00, + 0x80, 0x00, + 0x80, 0x00, + 0x80, 0x00, + 0xfc, 0x00, +}; + +/** Glyph definition for character 'E'. */ +static const struct glyph glyph_notomono_10_0045 = { + .glyph = 69, + .left = 1, + .top = 10, + .advance = 8, + .cols = 6, + .rows = 10, + .bitmap = bitmap_notomono_10_0045, + .kerning = NULL, +}; + +/** Bitmap definition for character 'F'. */ +static const uint8_t bitmap_notomono_10_0046[] = { + 0xfc, 0x00, + 0x80, 0x00, + 0x80, 0x00, + 0x80, 0x00, + 0xfc, 0x00, + 0x80, 0x00, + 0x80, 0x00, + 0x80, 0x00, + 0x80, 0x00, + 0x80, 0x00, +}; + +/** Glyph definition for character 'F'. */ +static const struct glyph glyph_notomono_10_0046 = { + .glyph = 70, + .left = 1, + .top = 10, + .advance = 8, + .cols = 6, + .rows = 10, + .bitmap = bitmap_notomono_10_0046, + .kerning = NULL, +}; + +/** Bitmap definition for character 'G'. */ +static const uint8_t bitmap_notomono_10_0047[] = { + 0x3c, 0x00, + 0x60, 0x00, + 0xc0, 0x00, + 0x80, 0x00, + 0x9c, 0x00, + 0x84, 0x00, + 0x84, 0x00, + 0xc4, 0x00, + 0x44, 0x00, + 0x3c, 0x00, +}; + +/** Glyph definition for character 'G'. */ +static const struct glyph glyph_notomono_10_0047 = { + .glyph = 71, + .left = 1, + .top = 10, + .advance = 8, + .cols = 6, + .rows = 10, + .bitmap = bitmap_notomono_10_0047, + .kerning = NULL, +}; + +/** Bitmap definition for character 'H'. */ +static const uint8_t bitmap_notomono_10_0048[] = { + 0x84, 0x00, + 0x84, 0x00, + 0x84, 0x00, + 0x84, 0x00, + 0xfc, 0x00, + 0x84, 0x00, + 0x84, 0x00, + 0x84, 0x00, + 0x84, 0x00, + 0x84, 0x00, +}; + +/** Glyph definition for character 'H'. */ +static const struct glyph glyph_notomono_10_0048 = { + .glyph = 72, + .left = 1, + .top = 10, + .advance = 8, + .cols = 6, + .rows = 10, + .bitmap = bitmap_notomono_10_0048, + .kerning = NULL, +}; + +/** Bitmap definition for character 'I'. */ +static const uint8_t bitmap_notomono_10_0049[] = { + 0xf8, 0x00, + 0x20, 0x00, + 0x20, 0x00, + 0x20, 0x00, + 0x20, 0x00, + 0x20, 0x00, + 0x20, 0x00, + 0x20, 0x00, + 0x20, 0x00, + 0xf8, 0x00, +}; + +/** Glyph definition for character 'I'. */ +static const struct glyph glyph_notomono_10_0049 = { + .glyph = 73, + .left = 1, + .top = 10, + .advance = 8, + .cols = 5, + .rows = 10, + .bitmap = bitmap_notomono_10_0049, + .kerning = NULL, +}; + +/** Bitmap definition for character 'J'. */ +static const uint8_t bitmap_notomono_10_004a[] = { + 0x08, 0x00, + 0x08, 0x00, + 0x08, 0x00, + 0x08, 0x00, + 0x08, 0x00, + 0x08, 0x00, + 0x08, 0x00, + 0x08, 0x00, + 0x18, 0x00, + 0xf0, 0x00, +}; + +/** Glyph definition for character 'J'. */ +static const struct glyph glyph_notomono_10_004a = { + .glyph = 74, + .left = 1, + .top = 10, + .advance = 8, + .cols = 5, + .rows = 10, + .bitmap = bitmap_notomono_10_004a, + .kerning = NULL, +}; + +/** Bitmap definition for character 'K'. */ +static const uint8_t bitmap_notomono_10_004b[] = { + 0x86, 0x00, + 0x8c, 0x00, + 0x88, 0x00, + 0x90, 0x00, + 0xa0, 0x00, + 0xd0, 0x00, + 0x98, 0x00, + 0x88, 0x00, + 0x84, 0x00, + 0x86, 0x00, +}; + +/** Glyph definition for character 'K'. */ +static const struct glyph glyph_notomono_10_004b = { + .glyph = 75, + .left = 1, + .top = 10, + .advance = 8, + .cols = 7, + .rows = 10, + .bitmap = bitmap_notomono_10_004b, + .kerning = NULL, +}; + +/** Bitmap definition for character 'L'. */ +static const uint8_t bitmap_notomono_10_004c[] = { + 0x80, 0x00, + 0x80, 0x00, + 0x80, 0x00, + 0x80, 0x00, + 0x80, 0x00, + 0x80, 0x00, + 0x80, 0x00, + 0x80, 0x00, + 0x80, 0x00, + 0xfc, 0x00, +}; + +/** Glyph definition for character 'L'. */ +static const struct glyph glyph_notomono_10_004c = { + .glyph = 76, + .left = 1, + .top = 10, + .advance = 8, + .cols = 6, + .rows = 10, + .bitmap = bitmap_notomono_10_004c, + .kerning = NULL, +}; + +/** Bitmap definition for character 'M'. */ +static const uint8_t bitmap_notomono_10_004d[] = { + 0x82, 0x00, + 0xc6, 0x00, + 0xc6, 0x00, + 0xc6, 0x00, + 0xaa, 0x00, + 0xaa, 0x00, + 0xaa, 0x00, + 0xb2, 0x00, + 0x92, 0x00, + 0x92, 0x00, +}; + +/** Glyph definition for character 'M'. */ +static const struct glyph glyph_notomono_10_004d = { + .glyph = 77, + .left = 0, + .top = 10, + .advance = 8, + .cols = 7, + .rows = 10, + .bitmap = bitmap_notomono_10_004d, + .kerning = NULL, +}; + +/** Bitmap definition for character 'N'. */ +static const uint8_t bitmap_notomono_10_004e[] = { + 0x84, 0x00, + 0xc4, 0x00, + 0xc4, 0x00, + 0xa4, 0x00, + 0xa4, 0x00, + 0x94, 0x00, + 0x94, 0x00, + 0x8c, 0x00, + 0x8c, 0x00, + 0x84, 0x00, +}; + +/** Glyph definition for character 'N'. */ +static const struct glyph glyph_notomono_10_004e = { + .glyph = 78, + .left = 1, + .top = 10, + .advance = 8, + .cols = 6, + .rows = 10, + .bitmap = bitmap_notomono_10_004e, + .kerning = NULL, +}; + +/** Bitmap definition for character 'O'. */ +static const uint8_t bitmap_notomono_10_004f[] = { + 0x78, 0x00, + 0x48, 0x00, + 0xcc, 0x00, + 0x84, 0x00, + 0x84, 0x00, + 0x84, 0x00, + 0x84, 0x00, + 0xcc, 0x00, + 0x48, 0x00, + 0x78, 0x00, +}; + +/** Glyph definition for character 'O'. */ +static const struct glyph glyph_notomono_10_004f = { + .glyph = 79, + .left = 1, + .top = 10, + .advance = 8, + .cols = 6, + .rows = 10, + .bitmap = bitmap_notomono_10_004f, + .kerning = NULL, +}; + +/** Bitmap definition for character 'P'. */ +static const uint8_t bitmap_notomono_10_0050[] = { + 0xf8, 0x00, + 0x8c, 0x00, + 0x84, 0x00, + 0x84, 0x00, + 0x8c, 0x00, + 0xf8, 0x00, + 0x80, 0x00, + 0x80, 0x00, + 0x80, 0x00, + 0x80, 0x00, +}; + +/** Glyph definition for character 'P'. */ +static const struct glyph glyph_notomono_10_0050 = { + .glyph = 80, + .left = 1, + .top = 10, + .advance = 8, + .cols = 6, + .rows = 10, + .bitmap = bitmap_notomono_10_0050, + .kerning = NULL, +}; + +/** Bitmap definition for character 'Q'. */ +static const uint8_t bitmap_notomono_10_0051[] = { + 0x78, 0x00, + 0x48, 0x00, + 0xcc, 0x00, + 0x84, 0x00, + 0x84, 0x00, + 0x84, 0x00, + 0x84, 0x00, + 0xcc, 0x00, + 0x48, 0x00, + 0x70, 0x00, + 0x08, 0x00, + 0x0c, 0x00, + 0x04, 0x00, +}; + +/** Glyph definition for character 'Q'. */ +static const struct glyph glyph_notomono_10_0051 = { + .glyph = 81, + .left = 1, + .top = 10, + .advance = 8, + .cols = 6, + .rows = 13, + .bitmap = bitmap_notomono_10_0051, + .kerning = NULL, +}; + +/** Bitmap definition for character 'R'. */ +static const uint8_t bitmap_notomono_10_0052[] = { + 0xf8, 0x00, + 0x8c, 0x00, + 0x84, 0x00, + 0x84, 0x00, + 0x8c, 0x00, + 0xf8, 0x00, + 0x98, 0x00, + 0x88, 0x00, + 0x84, 0x00, + 0x86, 0x00, +}; + +/** Glyph definition for character 'R'. */ +static const struct glyph glyph_notomono_10_0052 = { + .glyph = 82, + .left = 1, + .top = 10, + .advance = 8, + .cols = 7, + .rows = 10, + .bitmap = bitmap_notomono_10_0052, + .kerning = NULL, +}; + +/** Bitmap definition for character 'S'. */ +static const uint8_t bitmap_notomono_10_0053[] = { + 0x7c, 0x00, + 0xc4, 0x00, + 0x80, 0x00, + 0xc0, 0x00, + 0x70, 0x00, + 0x18, 0x00, + 0x04, 0x00, + 0x04, 0x00, + 0x0c, 0x00, + 0xf8, 0x00, +}; + +/** Glyph definition for character 'S'. */ +static const struct glyph glyph_notomono_10_0053 = { + .glyph = 83, + .left = 1, + .top = 10, + .advance = 8, + .cols = 6, + .rows = 10, + .bitmap = bitmap_notomono_10_0053, + .kerning = NULL, +}; + +/** Bitmap definition for character 'T'. */ +static const uint8_t bitmap_notomono_10_0054[] = { + 0xfe, 0x00, + 0x10, 0x00, + 0x10, 0x00, + 0x10, 0x00, + 0x10, 0x00, + 0x10, 0x00, + 0x10, 0x00, + 0x10, 0x00, + 0x10, 0x00, + 0x10, 0x00, +}; + +/** Glyph definition for character 'T'. */ +static const struct glyph glyph_notomono_10_0054 = { + .glyph = 84, + .left = 0, + .top = 10, + .advance = 8, + .cols = 7, + .rows = 10, + .bitmap = bitmap_notomono_10_0054, + .kerning = NULL, +}; + +/** Bitmap definition for character 'U'. */ +static const uint8_t bitmap_notomono_10_0055[] = { + 0x84, 0x00, + 0x84, 0x00, + 0x84, 0x00, + 0x84, 0x00, + 0x84, 0x00, + 0x84, 0x00, + 0x84, 0x00, + 0x84, 0x00, + 0xcc, 0x00, + 0x78, 0x00, +}; + +/** Glyph definition for character 'U'. */ +static const struct glyph glyph_notomono_10_0055 = { + .glyph = 85, + .left = 1, + .top = 10, + .advance = 8, + .cols = 6, + .rows = 10, + .bitmap = bitmap_notomono_10_0055, + .kerning = NULL, +}; + +/** Bitmap definition for character 'V'. */ +static const uint8_t bitmap_notomono_10_0056[] = { + 0x81, 0x00, + 0x42, 0x00, + 0x42, 0x00, + 0x42, 0x00, + 0x24, 0x00, + 0x24, 0x00, + 0x24, 0x00, + 0x18, 0x00, + 0x18, 0x00, + 0x18, 0x00, +}; + +/** Glyph definition for character 'V'. */ +static const struct glyph glyph_notomono_10_0056 = { + .glyph = 86, + .left = 0, + .top = 10, + .advance = 8, + .cols = 8, + .rows = 10, + .bitmap = bitmap_notomono_10_0056, + .kerning = NULL, +}; + +/** Bitmap definition for character 'W'. */ +static const uint8_t bitmap_notomono_10_0057[] = { + 0x81, 0x00, + 0x81, 0x00, + 0x81, 0x00, + 0xd1, 0x00, + 0x5a, 0x00, + 0x5a, 0x00, + 0x66, 0x00, + 0x66, 0x00, + 0x62, 0x00, + 0x42, 0x00, +}; + +/** Glyph definition for character 'W'. */ +static const struct glyph glyph_notomono_10_0057 = { + .glyph = 87, + .left = 0, + .top = 10, + .advance = 8, + .cols = 8, + .rows = 10, + .bitmap = bitmap_notomono_10_0057, + .kerning = NULL, +}; + +/** Bitmap definition for character 'X'. */ +static const uint8_t bitmap_notomono_10_0058[] = { + 0xc3, 0x00, + 0x42, 0x00, + 0x24, 0x00, + 0x3c, 0x00, + 0x18, 0x00, + 0x18, 0x00, + 0x2c, 0x00, + 0x24, 0x00, + 0x42, 0x00, + 0x83, 0x00, +}; + +/** Glyph definition for character 'X'. */ +static const struct glyph glyph_notomono_10_0058 = { + .glyph = 88, + .left = 0, + .top = 10, + .advance = 8, + .cols = 8, + .rows = 10, + .bitmap = bitmap_notomono_10_0058, + .kerning = NULL, +}; + +/** Bitmap definition for character 'Y'. */ +static const uint8_t bitmap_notomono_10_0059[] = { + 0xc2, 0x00, + 0x44, 0x00, + 0x64, 0x00, + 0x28, 0x00, + 0x28, 0x00, + 0x10, 0x00, + 0x10, 0x00, + 0x10, 0x00, + 0x10, 0x00, + 0x10, 0x00, +}; + +/** Glyph definition for character 'Y'. */ +static const struct glyph glyph_notomono_10_0059 = { + .glyph = 89, + .left = 0, + .top = 10, + .advance = 8, + .cols = 7, + .rows = 10, + .bitmap = bitmap_notomono_10_0059, + .kerning = NULL, +}; + +/** Bitmap definition for character 'Z'. */ +static const uint8_t bitmap_notomono_10_005a[] = { + 0xfc, 0x00, + 0x0c, 0x00, + 0x08, 0x00, + 0x18, 0x00, + 0x10, 0x00, + 0x20, 0x00, + 0x60, 0x00, + 0x40, 0x00, + 0xc0, 0x00, + 0xfc, 0x00, +}; + +/** Glyph definition for character 'Z'. */ +static const struct glyph glyph_notomono_10_005a = { + .glyph = 90, + .left = 1, + .top = 10, + .advance = 8, + .cols = 6, + .rows = 10, + .bitmap = bitmap_notomono_10_005a, + .kerning = NULL, +}; + +/** Bitmap definition for character '['. */ +static const uint8_t bitmap_notomono_10_005b[] = { + 0xe0, 0x00, + 0x80, 0x00, + 0x80, 0x00, + 0x80, 0x00, + 0x80, 0x00, + 0x80, 0x00, + 0x80, 0x00, + 0x80, 0x00, + 0x80, 0x00, + 0x80, 0x00, + 0x80, 0x00, + 0xe0, 0x00, +}; + +/** Glyph definition for character '['. */ +static const struct glyph glyph_notomono_10_005b = { + .glyph = 91, + .left = 3, + .top = 10, + .advance = 8, + .cols = 3, + .rows = 12, + .bitmap = bitmap_notomono_10_005b, + .kerning = NULL, +}; + +/** Bitmap definition for character '\'. */ +static const uint8_t bitmap_notomono_10_005c[] = { + 0x80, 0x00, + 0x40, 0x00, + 0x40, 0x00, + 0x20, 0x00, + 0x20, 0x00, + 0x10, 0x00, + 0x10, 0x00, + 0x08, 0x00, + 0x08, 0x00, + 0x04, 0x00, +}; + +/** Glyph definition for character '\'. */ +static const struct glyph glyph_notomono_10_005c = { + .glyph = 92, + .left = 1, + .top = 10, + .advance = 8, + .cols = 6, + .rows = 10, + .bitmap = bitmap_notomono_10_005c, + .kerning = NULL, +}; + +/** Bitmap definition for character ']'. */ +static const uint8_t bitmap_notomono_10_005d[] = { + 0xe0, 0x00, + 0x20, 0x00, + 0x20, 0x00, + 0x20, 0x00, + 0x20, 0x00, + 0x20, 0x00, + 0x20, 0x00, + 0x20, 0x00, + 0x20, 0x00, + 0x20, 0x00, + 0x20, 0x00, + 0xe0, 0x00, +}; + +/** Glyph definition for character ']'. */ +static const struct glyph glyph_notomono_10_005d = { + .glyph = 93, + .left = 2, + .top = 10, + .advance = 8, + .cols = 3, + .rows = 12, + .bitmap = bitmap_notomono_10_005d, + .kerning = NULL, +}; + +/** Bitmap definition for character '^'. */ +static const uint8_t bitmap_notomono_10_005e[] = { + 0x30, 0x00, + 0x30, 0x00, + 0x30, 0x00, + 0x48, 0x00, + 0x48, 0x00, + 0x84, 0x00, +}; + +/** Glyph definition for character '^'. */ +static const struct glyph glyph_notomono_10_005e = { + .glyph = 94, + .left = 1, + .top = 10, + .advance = 8, + .cols = 6, + .rows = 6, + .bitmap = bitmap_notomono_10_005e, + .kerning = NULL, +}; + +/** Bitmap definition for character '_'. */ +static const uint8_t bitmap_notomono_10_005f[] = { + 0xff, 0x00, +}; + +/** Glyph definition for character '_'. */ +static const struct glyph glyph_notomono_10_005f = { + .glyph = 95, + .left = 0, + .top = -1, + .advance = 8, + .cols = 8, + .rows = 1, + .bitmap = bitmap_notomono_10_005f, + .kerning = NULL, +}; + +/** Bitmap definition for character 'a'. */ +static const uint8_t bitmap_notomono_10_0061[] = { + 0x78, 0x00, + 0x0c, 0x00, + 0x04, 0x00, + 0x7c, 0x00, + 0xc4, 0x00, + 0x84, 0x00, + 0x8c, 0x00, + 0x74, 0x00, +}; + +/** Glyph definition for character 'a'. */ +static const struct glyph glyph_notomono_10_0061 = { + .glyph = 97, + .left = 1, + .top = 8, + .advance = 8, + .cols = 6, + .rows = 8, + .bitmap = bitmap_notomono_10_0061, + .kerning = NULL, +}; + +/** Bitmap definition for character 'b'. */ +static const uint8_t bitmap_notomono_10_0062[] = { + 0x80, 0x00, + 0x80, 0x00, + 0x80, 0x00, + 0xb8, 0x00, + 0xcc, 0x00, + 0x84, 0x00, + 0x84, 0x00, + 0x84, 0x00, + 0x84, 0x00, + 0xcc, 0x00, + 0xb8, 0x00, +}; + +/** Glyph definition for character 'b'. */ +static const struct glyph glyph_notomono_10_0062 = { + .glyph = 98, + .left = 1, + .top = 11, + .advance = 8, + .cols = 6, + .rows = 11, + .bitmap = bitmap_notomono_10_0062, + .kerning = NULL, +}; + +/** Bitmap definition for character 'c'. */ +static const uint8_t bitmap_notomono_10_0063[] = { + 0x3c, 0x00, + 0x40, 0x00, + 0xc0, 0x00, + 0x80, 0x00, + 0x80, 0x00, + 0x80, 0x00, + 0x40, 0x00, + 0x3c, 0x00, +}; + +/** Glyph definition for character 'c'. */ +static const struct glyph glyph_notomono_10_0063 = { + .glyph = 99, + .left = 1, + .top = 8, + .advance = 8, + .cols = 6, + .rows = 8, + .bitmap = bitmap_notomono_10_0063, + .kerning = NULL, +}; + +/** Bitmap definition for character 'd'. */ +static const uint8_t bitmap_notomono_10_0064[] = { + 0x04, 0x00, + 0x04, 0x00, + 0x04, 0x00, + 0x74, 0x00, + 0xcc, 0x00, + 0x84, 0x00, + 0x84, 0x00, + 0x84, 0x00, + 0x84, 0x00, + 0xcc, 0x00, + 0x74, 0x00, +}; + +/** Glyph definition for character 'd'. */ +static const struct glyph glyph_notomono_10_0064 = { + .glyph = 100, + .left = 1, + .top = 11, + .advance = 8, + .cols = 6, + .rows = 11, + .bitmap = bitmap_notomono_10_0064, + .kerning = NULL, +}; + +/** Bitmap definition for character 'e'. */ +static const uint8_t bitmap_notomono_10_0065[] = { + 0x78, 0x00, + 0x4c, 0x00, + 0x84, 0x00, + 0xfc, 0x00, + 0x80, 0x00, + 0x80, 0x00, + 0x44, 0x00, + 0x3c, 0x00, +}; + +/** Glyph definition for character 'e'. */ +static const struct glyph glyph_notomono_10_0065 = { + .glyph = 101, + .left = 1, + .top = 8, + .advance = 8, + .cols = 6, + .rows = 8, + .bitmap = bitmap_notomono_10_0065, + .kerning = NULL, +}; + +/** Bitmap definition for character 'f'. */ +static const uint8_t bitmap_notomono_10_0066[] = { + 0x1c, 0x00, + 0x20, 0x00, + 0x20, 0x00, + 0xfc, 0x00, + 0x20, 0x00, + 0x20, 0x00, + 0x20, 0x00, + 0x20, 0x00, + 0x20, 0x00, + 0x20, 0x00, + 0x20, 0x00, +}; + +/** Glyph definition for character 'f'. */ +static const struct glyph glyph_notomono_10_0066 = { + .glyph = 102, + .left = 1, + .top = 11, + .advance = 8, + .cols = 6, + .rows = 11, + .bitmap = bitmap_notomono_10_0066, + .kerning = NULL, +}; + +/** Bitmap definition for character 'g'. */ +static const uint8_t bitmap_notomono_10_0067[] = { + 0x7e, 0x00, + 0x84, 0x00, + 0x84, 0x00, + 0x84, 0x00, + 0x78, 0x00, + 0x80, 0x00, + 0xfc, 0x00, + 0xc2, 0x00, + 0x82, 0x00, + 0x86, 0x00, + 0x7c, 0x00, +}; + +/** Glyph definition for character 'g'. */ +static const struct glyph glyph_notomono_10_0067 = { + .glyph = 103, + .left = 1, + .top = 8, + .advance = 8, + .cols = 7, + .rows = 11, + .bitmap = bitmap_notomono_10_0067, + .kerning = NULL, +}; + +/** Bitmap definition for character 'h'. */ +static const uint8_t bitmap_notomono_10_0068[] = { + 0x80, 0x00, + 0x80, 0x00, + 0x80, 0x00, + 0xb8, 0x00, + 0xcc, 0x00, + 0x84, 0x00, + 0x84, 0x00, + 0x84, 0x00, + 0x84, 0x00, + 0x84, 0x00, + 0x84, 0x00, +}; + +/** Glyph definition for character 'h'. */ +static const struct glyph glyph_notomono_10_0068 = { + .glyph = 104, + .left = 1, + .top = 11, + .advance = 8, + .cols = 6, + .rows = 11, + .bitmap = bitmap_notomono_10_0068, + .kerning = NULL, +}; + +/** Bitmap definition for character 'i'. */ +static const uint8_t bitmap_notomono_10_0069[] = { + 0x10, 0x00, + 0x10, 0x00, + 0x00, 0x00, + 0x70, 0x00, + 0x10, 0x00, + 0x10, 0x00, + 0x10, 0x00, + 0x10, 0x00, + 0x10, 0x00, + 0x10, 0x00, + 0xfc, 0x00, +}; + +/** Glyph definition for character 'i'. */ +static const struct glyph glyph_notomono_10_0069 = { + .glyph = 105, + .left = 1, + .top = 11, + .advance = 8, + .cols = 6, + .rows = 11, + .bitmap = bitmap_notomono_10_0069, + .kerning = NULL, +}; + +/** Bitmap definition for character 'j'. */ +static const uint8_t bitmap_notomono_10_006a[] = { + 0x08, 0x00, + 0x08, 0x00, + 0x00, 0x00, + 0x78, 0x00, + 0x08, 0x00, + 0x08, 0x00, + 0x08, 0x00, + 0x08, 0x00, + 0x08, 0x00, + 0x08, 0x00, + 0x08, 0x00, + 0x08, 0x00, + 0x18, 0x00, + 0xf0, 0x00, +}; + +/** Glyph definition for character 'j'. */ +static const struct glyph glyph_notomono_10_006a = { + .glyph = 106, + .left = 1, + .top = 11, + .advance = 8, + .cols = 5, + .rows = 14, + .bitmap = bitmap_notomono_10_006a, + .kerning = NULL, +}; + +/** Bitmap definition for character 'k'. */ +static const uint8_t bitmap_notomono_10_006b[] = { + 0x80, 0x00, + 0x80, 0x00, + 0x80, 0x00, + 0x84, 0x00, + 0x88, 0x00, + 0x90, 0x00, + 0xa0, 0x00, + 0xf0, 0x00, + 0x98, 0x00, + 0x8c, 0x00, + 0x86, 0x00, +}; + +/** Glyph definition for character 'k'. */ +static const struct glyph glyph_notomono_10_006b = { + .glyph = 107, + .left = 1, + .top = 11, + .advance = 8, + .cols = 7, + .rows = 11, + .bitmap = bitmap_notomono_10_006b, + .kerning = NULL, +}; + +/** Bitmap definition for character 'l'. */ +static const uint8_t bitmap_notomono_10_006c[] = { + 0x70, 0x00, + 0x10, 0x00, + 0x10, 0x00, + 0x10, 0x00, + 0x10, 0x00, + 0x10, 0x00, + 0x10, 0x00, + 0x10, 0x00, + 0x10, 0x00, + 0x10, 0x00, + 0xfc, 0x00, +}; + +/** Glyph definition for character 'l'. */ +static const struct glyph glyph_notomono_10_006c = { + .glyph = 108, + .left = 1, + .top = 11, + .advance = 8, + .cols = 6, + .rows = 11, + .bitmap = bitmap_notomono_10_006c, + .kerning = NULL, +}; + +/** Bitmap definition for character 'm'. */ +static const uint8_t bitmap_notomono_10_006d[] = { + 0xac, 0x00, + 0xd2, 0x00, + 0x92, 0x00, + 0x92, 0x00, + 0x92, 0x00, + 0x92, 0x00, + 0x92, 0x00, + 0x92, 0x00, +}; + +/** Glyph definition for character 'm'. */ +static const struct glyph glyph_notomono_10_006d = { + .glyph = 109, + .left = 0, + .top = 8, + .advance = 8, + .cols = 7, + .rows = 8, + .bitmap = bitmap_notomono_10_006d, + .kerning = NULL, +}; + +/** Bitmap definition for character 'n'. */ +static const uint8_t bitmap_notomono_10_006e[] = { + 0xb8, 0x00, + 0xcc, 0x00, + 0x84, 0x00, + 0x84, 0x00, + 0x84, 0x00, + 0x84, 0x00, + 0x84, 0x00, + 0x84, 0x00, +}; + +/** Glyph definition for character 'n'. */ +static const struct glyph glyph_notomono_10_006e = { + .glyph = 110, + .left = 1, + .top = 8, + .advance = 8, + .cols = 6, + .rows = 8, + .bitmap = bitmap_notomono_10_006e, + .kerning = NULL, +}; + +/** Bitmap definition for character 'o'. */ +static const uint8_t bitmap_notomono_10_006f[] = { + 0x78, 0x00, + 0x48, 0x00, + 0x84, 0x00, + 0x84, 0x00, + 0x84, 0x00, + 0x84, 0x00, + 0x48, 0x00, + 0x78, 0x00, +}; + +/** Glyph definition for character 'o'. */ +static const struct glyph glyph_notomono_10_006f = { + .glyph = 111, + .left = 1, + .top = 8, + .advance = 8, + .cols = 6, + .rows = 8, + .bitmap = bitmap_notomono_10_006f, + .kerning = NULL, +}; + +/** Bitmap definition for character 'p'. */ +static const uint8_t bitmap_notomono_10_0070[] = { + 0xb8, 0x00, + 0xcc, 0x00, + 0x84, 0x00, + 0x84, 0x00, + 0x84, 0x00, + 0x84, 0x00, + 0xcc, 0x00, + 0xb8, 0x00, + 0x80, 0x00, + 0x80, 0x00, + 0x80, 0x00, +}; + +/** Glyph definition for character 'p'. */ +static const struct glyph glyph_notomono_10_0070 = { + .glyph = 112, + .left = 1, + .top = 8, + .advance = 8, + .cols = 6, + .rows = 11, + .bitmap = bitmap_notomono_10_0070, + .kerning = NULL, +}; + +/** Bitmap definition for character 'q'. */ +static const uint8_t bitmap_notomono_10_0071[] = { + 0x74, 0x00, + 0xcc, 0x00, + 0x84, 0x00, + 0x84, 0x00, + 0x84, 0x00, + 0x84, 0x00, + 0xcc, 0x00, + 0x74, 0x00, + 0x04, 0x00, + 0x04, 0x00, + 0x04, 0x00, +}; + +/** Glyph definition for character 'q'. */ +static const struct glyph glyph_notomono_10_0071 = { + .glyph = 113, + .left = 1, + .top = 8, + .advance = 8, + .cols = 6, + .rows = 11, + .bitmap = bitmap_notomono_10_0071, + .kerning = NULL, +}; + +/** Bitmap definition for character 'r'. */ +static const uint8_t bitmap_notomono_10_0072[] = { + 0xb8, 0x00, + 0xc0, 0x00, + 0x80, 0x00, + 0x80, 0x00, + 0x80, 0x00, + 0x80, 0x00, + 0x80, 0x00, + 0x80, 0x00, +}; + +/** Glyph definition for character 'r'. */ +static const struct glyph glyph_notomono_10_0072 = { + .glyph = 114, + .left = 2, + .top = 8, + .advance = 8, + .cols = 5, + .rows = 8, + .bitmap = bitmap_notomono_10_0072, + .kerning = NULL, +}; + +/** Bitmap definition for character 's'. */ +static const uint8_t bitmap_notomono_10_0073[] = { + 0x7c, 0x00, + 0x84, 0x00, + 0x80, 0x00, + 0x70, 0x00, + 0x1c, 0x00, + 0x04, 0x00, + 0x04, 0x00, + 0xf8, 0x00, +}; + +/** Glyph definition for character 's'. */ +static const struct glyph glyph_notomono_10_0073 = { + .glyph = 115, + .left = 1, + .top = 8, + .advance = 8, + .cols = 6, + .rows = 8, + .bitmap = bitmap_notomono_10_0073, + .kerning = NULL, +}; + +/** Bitmap definition for character 't'. */ +static const uint8_t bitmap_notomono_10_0074[] = { + 0x20, 0x00, + 0x20, 0x00, + 0xfc, 0x00, + 0x20, 0x00, + 0x20, 0x00, + 0x20, 0x00, + 0x20, 0x00, + 0x20, 0x00, + 0x20, 0x00, + 0x1c, 0x00, +}; + +/** Glyph definition for character 't'. */ +static const struct glyph glyph_notomono_10_0074 = { + .glyph = 116, + .left = 1, + .top = 10, + .advance = 8, + .cols = 6, + .rows = 10, + .bitmap = bitmap_notomono_10_0074, + .kerning = NULL, +}; + +/** Bitmap definition for character 'u'. */ +static const uint8_t bitmap_notomono_10_0075[] = { + 0x84, 0x00, + 0x84, 0x00, + 0x84, 0x00, + 0x84, 0x00, + 0x84, 0x00, + 0x84, 0x00, + 0xcc, 0x00, + 0x74, 0x00, +}; + +/** Glyph definition for character 'u'. */ +static const struct glyph glyph_notomono_10_0075 = { + .glyph = 117, + .left = 1, + .top = 8, + .advance = 8, + .cols = 6, + .rows = 8, + .bitmap = bitmap_notomono_10_0075, + .kerning = NULL, +}; + +/** Bitmap definition for character 'v'. */ +static const uint8_t bitmap_notomono_10_0076[] = { + 0x84, 0x00, + 0xcc, 0x00, + 0x48, 0x00, + 0x48, 0x00, + 0x48, 0x00, + 0x30, 0x00, + 0x30, 0x00, + 0x30, 0x00, +}; + +/** Glyph definition for character 'v'. */ +static const struct glyph glyph_notomono_10_0076 = { + .glyph = 118, + .left = 1, + .top = 8, + .advance = 8, + .cols = 6, + .rows = 8, + .bitmap = bitmap_notomono_10_0076, + .kerning = NULL, +}; + +/** Bitmap definition for character 'w'. */ +static const uint8_t bitmap_notomono_10_0077[] = { + 0x99, 0x00, + 0x99, 0x00, + 0x99, 0x00, + 0xa5, 0x00, + 0xa5, 0x00, + 0x66, 0x00, + 0x46, 0x00, + 0x42, 0x00, +}; + +/** Glyph definition for character 'w'. */ +static const struct glyph glyph_notomono_10_0077 = { + .glyph = 119, + .left = 0, + .top = 8, + .advance = 8, + .cols = 8, + .rows = 8, + .bitmap = bitmap_notomono_10_0077, + .kerning = NULL, +}; + +/** Bitmap definition for character 'x'. */ +static const uint8_t bitmap_notomono_10_0078[] = { + 0xcc, 0x00, + 0x48, 0x00, + 0x30, 0x00, + 0x30, 0x00, + 0x30, 0x00, + 0x78, 0x00, + 0x48, 0x00, + 0x84, 0x00, +}; + +/** Glyph definition for character 'x'. */ +static const struct glyph glyph_notomono_10_0078 = { + .glyph = 120, + .left = 1, + .top = 8, + .advance = 8, + .cols = 6, + .rows = 8, + .bitmap = bitmap_notomono_10_0078, + .kerning = NULL, +}; + +/** Bitmap definition for character 'y'. */ +static const uint8_t bitmap_notomono_10_0079[] = { + 0x84, 0x00, + 0xcc, 0x00, + 0x48, 0x00, + 0x48, 0x00, + 0x48, 0x00, + 0x30, 0x00, + 0x30, 0x00, + 0x30, 0x00, + 0x20, 0x00, + 0x20, 0x00, + 0xc0, 0x00, +}; + +/** Glyph definition for character 'y'. */ +static const struct glyph glyph_notomono_10_0079 = { + .glyph = 121, + .left = 1, + .top = 8, + .advance = 8, + .cols = 6, + .rows = 11, + .bitmap = bitmap_notomono_10_0079, + .kerning = NULL, +}; + +/** Bitmap definition for character 'z'. */ +static const uint8_t bitmap_notomono_10_007a[] = { + 0xfc, 0x00, + 0x0c, 0x00, + 0x08, 0x00, + 0x10, 0x00, + 0x20, 0x00, + 0x60, 0x00, + 0xc0, 0x00, + 0xfc, 0x00, +}; + +/** Glyph definition for character 'z'. */ +static const struct glyph glyph_notomono_10_007a = { + .glyph = 122, + .left = 1, + .top = 8, + .advance = 8, + .cols = 6, + .rows = 8, + .bitmap = bitmap_notomono_10_007a, + .kerning = NULL, +}; + +/** Bitmap definition for character '{'. */ +static const uint8_t bitmap_notomono_10_007b[] = { + 0x18, 0x00, + 0x20, 0x00, + 0x20, 0x00, + 0x20, 0x00, + 0x20, 0x00, + 0xc0, 0x00, + 0x20, 0x00, + 0x20, 0x00, + 0x20, 0x00, + 0x20, 0x00, + 0x20, 0x00, + 0x18, 0x00, +}; + +/** Glyph definition for character '{'. */ +static const struct glyph glyph_notomono_10_007b = { + .glyph = 123, + .left = 2, + .top = 10, + .advance = 8, + .cols = 5, + .rows = 12, + .bitmap = bitmap_notomono_10_007b, + .kerning = NULL, +}; + +/** Bitmap definition for character '|'. */ +static const uint8_t bitmap_notomono_10_007c[] = { + 0x80, 0x00, + 0x80, 0x00, + 0x80, 0x00, + 0x80, 0x00, + 0x80, 0x00, + 0x80, 0x00, + 0x80, 0x00, + 0x80, 0x00, + 0x80, 0x00, + 0x80, 0x00, + 0x80, 0x00, + 0x80, 0x00, + 0x80, 0x00, + 0x80, 0x00, +}; + +/** Glyph definition for character '|'. */ +static const struct glyph glyph_notomono_10_007c = { + .glyph = 124, + .left = 4, + .top = 11, + .advance = 8, + .cols = 1, + .rows = 14, + .bitmap = bitmap_notomono_10_007c, + .kerning = NULL, +}; + +/** Bitmap definition for character '}'. */ +static const uint8_t bitmap_notomono_10_007d[] = { + 0xc0, 0x00, + 0x20, 0x00, + 0x20, 0x00, + 0x20, 0x00, + 0x20, 0x00, + 0x18, 0x00, + 0x20, 0x00, + 0x20, 0x00, + 0x20, 0x00, + 0x20, 0x00, + 0x20, 0x00, + 0xc0, 0x00, +}; + +/** Glyph definition for character '}'. */ +static const struct glyph glyph_notomono_10_007d = { + .glyph = 125, + .left = 1, + .top = 10, + .advance = 8, + .cols = 5, + .rows = 12, + .bitmap = bitmap_notomono_10_007d, + .kerning = NULL, +}; + +/** Bitmap definition for character '~'. */ +static const uint8_t bitmap_notomono_10_007e[] = { + 0xe0, 0x00, + 0x1c, 0x00, +}; + +/** Glyph definition for character '~'. */ +static const struct glyph glyph_notomono_10_007e = { + .glyph = 126, + .left = 1, + .top = 6, + .advance = 8, + .cols = 6, + .rows = 2, + .bitmap = bitmap_notomono_10_007e, + .kerning = NULL, +}; + +/** Glyphs table for font "Noto Mono". */ +static const struct glyph *glyphs_notomono_10[] = { + &glyph_notomono_10_0020, /* U+0020 ' ' */ + &glyph_notomono_10_0021, /* U+0021 '!' */ + &glyph_notomono_10_0023, /* U+0023 '#' */ + &glyph_notomono_10_0024, /* U+0024 '$' */ + &glyph_notomono_10_0025, /* U+0025 '%' */ + &glyph_notomono_10_0026, /* U+0026 '&' */ + &glyph_notomono_10_0027, /* U+0027 ''' */ + &glyph_notomono_10_0028, /* U+0028 '(' */ + &glyph_notomono_10_0029, /* U+0029 ')' */ + &glyph_notomono_10_002a, /* U+002A '*' */ + &glyph_notomono_10_002b, /* U+002B '+' */ + &glyph_notomono_10_002c, /* U+002C ',' */ + &glyph_notomono_10_002d, /* U+002D '-' */ + &glyph_notomono_10_002e, /* U+002E '.' */ + &glyph_notomono_10_002f, /* U+002F '/' */ + &glyph_notomono_10_0030, /* U+0030 '0' */ + &glyph_notomono_10_0031, /* U+0031 '1' */ + &glyph_notomono_10_0032, /* U+0032 '2' */ + &glyph_notomono_10_0033, /* U+0033 '3' */ + &glyph_notomono_10_0034, /* U+0034 '4' */ + &glyph_notomono_10_0035, /* U+0035 '5' */ + &glyph_notomono_10_0036, /* U+0036 '6' */ + &glyph_notomono_10_0037, /* U+0037 '7' */ + &glyph_notomono_10_0038, /* U+0038 '8' */ + &glyph_notomono_10_0039, /* U+0039 '9' */ + &glyph_notomono_10_003a, /* U+003A ':' */ + &glyph_notomono_10_003b, /* U+003B ';' */ + &glyph_notomono_10_003c, /* U+003C '<' */ + &glyph_notomono_10_003d, /* U+003D '=' */ + &glyph_notomono_10_003e, /* U+003E '>' */ + &glyph_notomono_10_003f, /* U+003F '?' */ + &glyph_notomono_10_0040, /* U+0040 '@' */ + &glyph_notomono_10_0041, /* U+0041 'A' */ + &glyph_notomono_10_0042, /* U+0042 'B' */ + &glyph_notomono_10_0043, /* U+0043 'C' */ + &glyph_notomono_10_0044, /* U+0044 'D' */ + &glyph_notomono_10_0045, /* U+0045 'E' */ + &glyph_notomono_10_0046, /* U+0046 'F' */ + &glyph_notomono_10_0047, /* U+0047 'G' */ + &glyph_notomono_10_0048, /* U+0048 'H' */ + &glyph_notomono_10_0049, /* U+0049 'I' */ + &glyph_notomono_10_004a, /* U+004A 'J' */ + &glyph_notomono_10_004b, /* U+004B 'K' */ + &glyph_notomono_10_004c, /* U+004C 'L' */ + &glyph_notomono_10_004d, /* U+004D 'M' */ + &glyph_notomono_10_004e, /* U+004E 'N' */ + &glyph_notomono_10_004f, /* U+004F 'O' */ + &glyph_notomono_10_0050, /* U+0050 'P' */ + &glyph_notomono_10_0051, /* U+0051 'Q' */ + &glyph_notomono_10_0052, /* U+0052 'R' */ + &glyph_notomono_10_0053, /* U+0053 'S' */ + &glyph_notomono_10_0054, /* U+0054 'T' */ + &glyph_notomono_10_0055, /* U+0055 'U' */ + &glyph_notomono_10_0056, /* U+0056 'V' */ + &glyph_notomono_10_0057, /* U+0057 'W' */ + &glyph_notomono_10_0058, /* U+0058 'X' */ + &glyph_notomono_10_0059, /* U+0059 'Y' */ + &glyph_notomono_10_005a, /* U+005A 'Z' */ + &glyph_notomono_10_005b, /* U+005B '[' */ + &glyph_notomono_10_005c, /* U+005C '\' */ + &glyph_notomono_10_005d, /* U+005D ']' */ + &glyph_notomono_10_005e, /* U+005E '^' */ + &glyph_notomono_10_005f, /* U+005F '_' */ + &glyph_notomono_10_0061, /* U+0061 'a' */ + &glyph_notomono_10_0062, /* U+0062 'b' */ + &glyph_notomono_10_0063, /* U+0063 'c' */ + &glyph_notomono_10_0064, /* U+0064 'd' */ + &glyph_notomono_10_0065, /* U+0065 'e' */ + &glyph_notomono_10_0066, /* U+0066 'f' */ + &glyph_notomono_10_0067, /* U+0067 'g' */ + &glyph_notomono_10_0068, /* U+0068 'h' */ + &glyph_notomono_10_0069, /* U+0069 'i' */ + &glyph_notomono_10_006a, /* U+006A 'j' */ + &glyph_notomono_10_006b, /* U+006B 'k' */ + &glyph_notomono_10_006c, /* U+006C 'l' */ + &glyph_notomono_10_006d, /* U+006D 'm' */ + &glyph_notomono_10_006e, /* U+006E 'n' */ + &glyph_notomono_10_006f, /* U+006F 'o' */ + &glyph_notomono_10_0070, /* U+0070 'p' */ + &glyph_notomono_10_0071, /* U+0071 'q' */ + &glyph_notomono_10_0072, /* U+0072 'r' */ + &glyph_notomono_10_0073, /* U+0073 's' */ + &glyph_notomono_10_0074, /* U+0074 't' */ + &glyph_notomono_10_0075, /* U+0075 'u' */ + &glyph_notomono_10_0076, /* U+0076 'v' */ + &glyph_notomono_10_0077, /* U+0077 'w' */ + &glyph_notomono_10_0078, /* U+0078 'x' */ + &glyph_notomono_10_0079, /* U+0079 'y' */ + &glyph_notomono_10_007a, /* U+007A 'z' */ + &glyph_notomono_10_007b, /* U+007B '{' */ + &glyph_notomono_10_007c, /* U+007C '|' */ + &glyph_notomono_10_007d, /* U+007D '}' */ + &glyph_notomono_10_007e, /* U+007E '~' */ +}; + +/** Definition for font "Noto Mono". */ +const struct font font_notomono_10 = { + .name = "Noto Mono", + .style = "Regular", + .size = 10, + .dpi = 100, + .count = 93, + .max = 126, + .ascender = 13, + .descender = -4, + .height = 16, + .glyphs = glyphs_notomono_10, + .compressed = 0, +}; + diff --git a/lib/fonts/font-notomono-10.h b/lib/fonts/font-notomono-10.h new file mode 100644 index 0000000..a4eda1c --- /dev/null +++ b/lib/fonts/font-notomono-10.h @@ -0,0 +1,15 @@ +/* AUTOMATICALLY GENERATED FILE! EDITING NOT RECOMMENDED! + * + * This file is distributed under the terms of the MIT License. + * See the LICENSE file at the top of this tree, or if it is missing a copy can + * be found at http://opensource.org/licenses/MIT + */ + +#ifndef _FONTEM_notomono_10_H +#define _FONTEM_notomono_10_H + +#include "fontem.h" + +extern const struct font font_notomono_10; + +#endif /* _FONTEM_notomono_10_H */ diff --git a/lib/fonts/fontem.h b/lib/fonts/fontem.h new file mode 100644 index 0000000..23a93ca --- /dev/null +++ b/lib/fonts/fontem.h @@ -0,0 +1,84 @@ +/** Font structure definitions. + * + * This file is distributed under the terms of the MIT License. + * See the LICENSE file at the top of this tree, or if it is missing a copy can + * be found at http://opensource.org/licenses/MIT + */ + +#ifndef _FONTEM_H +#define _FONTEM_H + +#include +#include + +/** Alpha compositing "A over B" mechanism */ +#define alpha_blend(in, in_alpha, out, out_alpha) \ + ((0x100 * in * in_alpha * (255 - out_alpha) + out * out_alpha * (255 - in_alpha)) >> 16) +#define blend(a, b, alpha) \ + (((a) * (255 - (alpha)) + (b) * (alpha)) >> 8) + +/** Extract the Alpha channel from a 32-bit RGBA value */ +#define rgba32_get_a(rgba) ((rgba >> 24) & 0xff) +/** Extract the Red channel from a 32-bit RGBA value */ +#define rgba32_get_r(rgba) ((rgba >> 16) & 0xff) +/** Extract the Green channel from a 32-bit RGBA value */ +#define rgba32_get_g(rgba) ((rgba >> 8) & 0xff) +/** Extract the Blue channel from a 32-bit RGBA value */ +#define rgba32_get_b(rgba) (rgba & 0xff) + +/** Extract the Red channel from a 16-bit RGB value */ +#define rgb16_get_r(rgb) ((rgb >> 8) & 0xf8) +/** Extract the Green channel from a 16-bit RGB value */ +#define rgb16_get_g(rgb) ((rgb >> 3) & 0xfc) +/** Extract the Blue channel from a 16-bit RGB value */ +#define rgb16_get_b(rgb) ((rgb << 3) & 0xf8) +/** Combine Red, Green and Blue channels into a 16-bit RGB value */ +#define rgb16_combine(r, g, b) \ + ((((r) & 0xf8) << 8) | \ + (((g) & 0xfc) << 3) | \ + (((b) & 0xf8) >> 3)) + + +/** Glyph character value rype */ +typedef uint16_t glyph_t; + +/** Description of a glyph; a single character in a font. */ +struct glyph { + glyph_t glyph; /** The glyph this entry refers to */ + + int16_t left; /** Offset of the left edge of the glyph */ + int16_t top; /** Offset of the top edge of the glyph */ + int16_t advance; /** Horizonal offset when advancing to the next glyph */ + + uint16_t cols; /** Width of the bitmap */ + uint16_t rows; /** Height of the bitmap */ + const uint8_t *bitmap; /** Bitmap data */ + + const struct kerning *kerning; /** Font kerning data */ +}; + +/** Kerning table; for a pair of glyphs, provides the horizontal adjustment. */ +struct kerning { + glyph_t left; /** The left-glyph */ + int16_t offset; /** The kerning offset for this glyph pair */ +}; + +/** Description of a font. */ +struct font { + char *name; /** Name of the font */ + char *style; /** Style of the font */ + + uint16_t size; /** Point size of the font */ + uint16_t dpi; /** Resolution of the font */ + + int16_t ascender; /** Ascender height */ + int16_t descender; /** Descender height */ + int16_t height; /** Baseline-to-baseline height */ + + uint16_t count; /** Number of glyphs */ + uint16_t max; /** Maximum glyph index */ + const struct glyph **glyphs; /** Font glyphs */ + char compressed; /** TRUE if glyph bitmaps are RLE compressed */ +}; + +#endif /* _FONTEM_H */ diff --git a/macros.h b/macros.h new file mode 100644 index 0000000..711b921 --- /dev/null +++ b/macros.h @@ -0,0 +1,74 @@ + +/** + Copyright 2019, Max Regan + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +**/ + +#ifndef _MACROS_H_ +#define _MACROS_H_ + +#include + +#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0])) + +/* + * Bitwise Operations + */ + +#define SET(x, y) \ + do { \ + (x) |= (y); \ + } while (0) + +#define SET_POS(x, y) \ + do { \ + (x) |= 1u << (y); \ + } while (0) + +#define CLEAR(x, y) \ + do { \ + (x) &= ~(y); \ + } while (0) + +#define CLEAR_POS(x, y) \ + do { \ + (x) &= ~(1u << (y)); \ + } while (0) + +#define FLIP(x, y) \ + do { \ + (x) ^= (y); \ + } while (0) + +#define FLIP_POS(x, y) \ + do { \ + (x) ^= 1u << y; \ + } while (0) + +#define SET_TO(x, clear_mask, val) \ + static_assert((clear_mask & val) == val, \ + "'value' in SET_TO() has bits set that are not in clear_mask"); \ + do { \ + CLEAR(x, clear_mask); \ + SET(x, val); \ + } while (0) + +#endif diff --git a/test.c b/test.c index 577809e..b872c6e 100644 --- a/test.c +++ b/test.c @@ -21,10 +21,15 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. **/ +#include +#include #include -#include "stm32l0xx.h" -#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0])) +#include "macros.h" +#include "stm32l0xx.h" +#include "font-notomono-10.h" + +/* TODO: Start cleaning up code and adding bounds checking! */ void SystemInit() { @@ -38,10 +43,10 @@ void SystemInit() * of the HSE oscillator used directly or indirectly as system * clock. This bit cannot be cleared if the MSI is used as system * clock. */ - RCC->CR |= RCC_CR_MSION; + SET(RCC->CR, RCC_CR_MSION); + CLEAR(RCC->ICSCR, RCC_ICSCR_MSIRANGE); - RCC->ICSCR &= ~RCC_ICSCR_MSIRANGE; - RCC->ICSCR |= RCC_ICSCR_MSIRANGE_6; // | RCC_ICSCR_MSIRANGE_0;; + SET_TO(RCC->ICSCR, RCC_ICSCR_MSIRANGE, RCC_ICSCR_MSIRANGE_6); /*!< Reset * SW[1:0] (use MSI oscillator as system clock), @@ -50,8 +55,9 @@ void SystemInit() * PPRE2[2:0] (do not divide APB high-speed clock), * MCOSEL[2:0] (disable MCO clock), * MCOPRE[2:0] (disable MCO prescaler) */ - RCC->CFGR &= ~RCC_CFGR_SW & ~RCC_CFGR_HPRE & ~RCC_CFGR_PPRE1 & - ~RCC_CFGR_PPRE2 & ~RCC_CFGR_MCOSEL & ~RCC_CFGR_MCOPRE; + CLEAR(RCC->CFGR, + RCC_CFGR_SW | ~RCC_CFGR_HPRE | RCC_CFGR_PPRE1 | RCC_CFGR_PPRE2 | + RCC_CFGR_MCOSEL | RCC_CFGR_MCOPRE); /*!< Reset * HSION (disable HSI), @@ -60,8 +66,9 @@ void SystemInit() * CSSHSEON (disable HSE clock monitoring) * PLLON (disable PLL) */ - RCC->CR &= ~RCC_CR_HSION & ~RCC_CR_HSIDIVEN & ~RCC_CR_HSEON & - ~RCC_CR_CSSHSEON & ~RCC_CR_PLLON; + CLEAR(RCC->CR, + RCC_CR_HSION | RCC_CR_HSIDIVEN | RCC_CR_HSEON | + RCC_CR_CSSHSEON | RCC_CR_PLLON); /*!< Reset HSEBYP bit (disable HSE bypass) */ RCC->CR &= ~RCC_CR_HSEBYP; @@ -77,8 +84,8 @@ void SystemInit() /*!< Disable all interrupts */ RCC->CIER = 0x00000000; - /* Configure the Vector Table location add offset address ------------------*/ - SCB->VTOR = FLASH_BASE; /* Vector Table Relocation in Internal FLASH */ + /* Vector Table Relocation in Internal FLASH */ + SCB->VTOR = FLASH_BASE; } void init_lptim() @@ -91,8 +98,7 @@ void init_lptim() while (!(RCC->CSR & RCC_CSR_LSIRDY)) {}; /*!< Set the LSI clock to be the source of the LPTIM */ - RCC->CCIPR &= ~RCC_CCIPR_LPTIM1SEL; - RCC->CCIPR |= RCC_CCIPR_LPTIM1SEL_0; + SET_TO(RCC->CCIPR, RCC_CCIPR_LPTIM1SEL, RCC_CCIPR_LPTIM1SEL_0); /** Write CR CFGR and IER while LPTIM is disabled (LPTIM_CR_ENABLE not yet set) */ @@ -134,9 +140,65 @@ void init_lptim() } /*!< The buffer that will be used in the future to display on the watch display. */ -//static uint8_t display_buffer[144 * 168 / 8]; -void init_lptim_toggler() { +#define DISPLAY_WIDTH 144 +#define DISPLAY_HEIGHT 168 + +struct display_line +{ + uint8_t mode; + uint8_t line; + uint8_t data[DISPLAY_WIDTH / 8]; +}; + +struct display_buffer +{ + struct display_line lines[DISPLAY_HEIGHT]; + uint16_t dummy; +}; + +static_assert(sizeof(struct display_buffer) == (DISPLAY_WIDTH / 8 + 2) * DISPLAY_HEIGHT + 2, + "The display buffer structure must be packed"); + +void display_buffer_init(struct display_buffer *buffer) +{ + for (size_t i = 0; i < ARRAY_SIZE(buffer->lines); i++) { + struct display_line *line = &buffer->lines[i]; + line->mode = 1; // Update display + line->line = i; + for (size_t j = 0; j < ARRAY_SIZE(line->data); j++) { + line->data[j] = 0xFF; + } + } + + buffer->dummy = 0; +} + +void display_set_bit(struct display_buffer *buffer, unsigned int x, unsigned int y, uint8_t val) +{ + struct display_line *line = &buffer->lines[y]; + uint8_t *byte = &line->data[x >> 3]; + if (val) { + CLEAR_POS(*byte, x & 7); + } else { + SET_POS(*byte, x & 7); + } +} + +void display_set_byte(struct display_buffer *buffer, unsigned int x, unsigned int y, uint8_t val) +{ + if (x & 7) { + return; + } + + struct display_line *line = &buffer->lines[y]; + line->data[x >> 3] = val; +} + +static struct display_buffer buffer; + +void init_lptim_toggler() +{ init_lptim(); /* Assign LPTIM1_OUT to PA7 */ @@ -159,70 +221,145 @@ void init_spi_display() /* Assign SPI_MOSI to PA12 (AFRH5), since PA7 is taken by LPTIM_OUT */ GPIOA->AFR[1] &= ~GPIO_AFRH_AFRH4; - GPIOA->MODER &= ~GPIO_MODER_MODE12; - GPIOA->MODER |= 2u << GPIO_MODER_MODE12_Pos; + SET_TO(GPIOA->MODER, GPIO_MODER_MODE12, 2u << GPIO_MODER_MODE12_Pos); GPIOA->OTYPER &= ~GPIO_OTYPER_OT_12; GPIOA->PUPDR &= ~GPIO_PUPDR_PUPD12; - // SPI1 NSS + // SPI1 NSS (PA4) GPIOA->AFR[0] &= ~GPIO_AFRL_AFRL4; - GPIOA->MODER &= ~GPIO_MODER_MODE4; - GPIOA->MODER |= 2u << GPIO_MODER_MODE4_Pos; + SET_TO(GPIOA->MODER, GPIO_MODER_MODE4, 2u << GPIO_MODER_MODE4_Pos); GPIOA->OTYPER &= ~GPIO_OTYPER_OT_4; GPIOA->PUPDR &= ~GPIO_PUPDR_PUPD4; // enable pullup, since the pin doesn't seem to stay up GPIOA->PUPDR |= 2u << GPIO_PUPDR_PUPD4_Pos; - // SPI1 SCK + // SPI1 SCK (PA5) GPIOA->AFR[0] &= ~GPIO_AFRL_AFRL5; - GPIOA->MODER &= ~GPIO_MODER_MODE5; - GPIOA->MODER |= 2u << GPIO_MODER_MODE5_Pos; + SET_TO(GPIOA->MODER, GPIO_MODER_MODE5, 2u << GPIO_MODER_MODE5_Pos); GPIOA->OTYPER &= ~GPIO_OTYPER_OT_5; GPIOA->PUPDR &= ~GPIO_PUPDR_PUPD5; - // SPI1 MISO + // SPI1 MISO (PA6) GPIOA->AFR[0] &= ~GPIO_AFRL_AFRL6; - GPIOA->MODER &= ~GPIO_MODER_MODE6; - GPIOA->MODER |= 2u << GPIO_MODER_MODE6_Pos; + SET_TO(GPIOA->MODER, GPIO_MODER_MODE6, 2u << GPIO_MODER_MODE6_Pos); GPIOA->OTYPER &= ~GPIO_OTYPER_OT_6; GPIOA->PUPDR &= ~GPIO_PUPDR_PUPD6; - SPI1->CR1 |= SPI_CR1_SPE | SPI_CR1_MSTR | SPI_CR1_SSOE;// | SPI_CR1_SSM | SPI_CR1_SSI; - // SPI1->CR1 |= SPI_CR1_BR; + // Enable Master mode and half the baud rate, so it's set to ~1MHz + SPI1->CR1 |= SPI_CR1_MSTR | SPI_CR1_LSBFIRST; + SPI1->CR1 |= 1u << SPI_CR1_BR_Pos; + SPI1->CR2 |= SPI_CR2_SSOE; } -int main() { +void spi_send_blocking(SPI_TypeDef *spi, const uint8_t *data, size_t len) +{ + if (len <= 0) { + return; + } + + spi->CR1 |= SPI_CR1_SPE; + + for (size_t i = 0; i < len; i++) { + while (!(spi->SR & SPI_SR_TXE)) {} + spi->DR = data[i]; + } + + while (!(spi->SR & SPI_SR_TXE)) {} + + // Ensure that NSS is held for long enough to meet the display's thSCS + for (int i = 0; i < 4; i++); + + spi->CR1 &= ~SPI_CR1_SPE; +} + +const struct glyph *glyph_for_char(const struct font *font, char c) +{ + // TODO: This is almost the least efficient way imaginable to implement this + for (int i = 0; i < font->max; i++) { + const struct glyph *g = font->glyphs[i]; + if (g == NULL) { + continue; + } + + if (g->glyph == c) { + return g; + } + } + + return NULL; +} + +void display_char_at(int *x_off, int y_off, char c) +{ + const struct glyph *g = glyph_for_char(&font_notomono_10, c); + if (g == NULL) { + return; + } + + int byte_cols = 2; + for (size_t x = 0; x < g->cols; x++) { + for (size_t y = 0; y < g->rows; y++) { + int byte_x = x >> 3; + int byte_y = y; + uint8_t bit = (g->bitmap[byte_y * byte_cols + byte_x] >> (7 - (x & 7))) & 1; + /* 16 is font max height */ + display_set_bit(&buffer, g->left + *x_off + x, y_off + y + 16 - g->top, bit); + } + } + *x_off += g->advance; +} + +void display_string_at(int x_off, int y_off, const char *string) +{ + int i = 0; + while (string[i]) { + display_char_at(&x_off, y_off, string[i]); + i++; + } +} + +void display_update() +{ + static uint16_t count = 0; + + // for (size_t x = 0; x < DISPLAY_WIDTH / 8; x++) { + // for (size_t y = 0; y < DISPLAY_HEIGHT; y++) { + // display_set_byte(&buffer, (x << 3), y, (((y + count) >> 4) & 1) ? 0xFF : 0); + // } + // } + + display_string_at(0, 0, "Hello world!"); + count++; +} + +int main() +{ /** Enable Port A,B clock */ RCC->IOPENR |= RCC_IOPENR_IOPAEN; RCC->IOPENR |= RCC_IOPENR_IOPBEN; /** Enable pin P3 for output */ - GPIOB->MODER &= ~GPIO_MODER_MODE3; - GPIOB->MODER |= GPIO_MODER_MODE3_0; + SET_TO(GPIOB->MODER, GPIO_MODER_MODE3, GPIO_MODER_MODE3_0); - GPIOB->OTYPER &= ~GPIO_OTYPER_OT_3; - GPIOB->PUPDR &= GPIO_PUPDR_PUPD3; + CLEAR(GPIOB->OTYPER, GPIO_OTYPER_OT_3); + CLEAR(GPIOB->PUPDR, GPIO_PUPDR_PUPD3); init_lptim_toggler(); init_spi_display(); - // GPIOB->ODR |= GPIO_ODR_OD3; - // for (volatile int i = 0; i < 100000; i++) {} - // GPIOB->ODR &= ~GPIO_ODR_OD3; + display_buffer_init(&buffer); while (1) { - if (SPI1->SR & SPI_SR_TXE) { - SPI1->DR = 0xA5; - GPIOB->ODR |= GPIO_ODR_OD3; - } else { - GPIOB->ODR &= ~GPIO_ODR_OD3; - } + display_update(); + spi_send_blocking(SPI1, (uint8_t *) &buffer, sizeof(buffer)); + FLIP(GPIOB->ODR, GPIO_ODR_OD3); + // for (int i = 0; i < 100000; i++); } }