diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c0ac4b8..0d288ae 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -40,6 +40,7 @@ jobs: nix build -L .?submodules=1#sonata-exercises nix build -L .?submodules=1#sonata-examples nix build -L .?submodules=1#sonata-automotive-demo-legacy-component + nix build -L .?submodules=1#sonata-heartbleed-demo-legacy-component nix build -L .?submodules=1#sonata-tests - name: Run Nix Checks diff --git a/examples/heartbleed/legacy/heartbleed.c b/examples/heartbleed/legacy/heartbleed.c index cbf549e..0532f10 100644 --- a/examples/heartbleed/legacy/heartbleed.c +++ b/examples/heartbleed/legacy/heartbleed.c @@ -8,7 +8,6 @@ #include #include -#include #include #include #include @@ -21,8 +20,8 @@ #define DEBUG_DEMO true #define LENGTH_SCROLL_MILLIS 150u -#define BACKGROUND_COLOR BGRColorBlack -#define FOREGROUND_COLOR BGRColorWhite +#define BACKGROUND_COLOR RGBColorBlack +#define FOREGROUND_COLOR RGBColorWhite // Define our own GPIO_IN_DBNC as the version from `sonata-system` uses void // pointer arithmetic, which clang-tidy forbids. @@ -233,8 +232,8 @@ void network_send(void *handle, const char *package, size_t len) const uint32_t CharsPerLine = 29u; St7735Context *lcd = (St7735Context *)handle; - const uint32_t TextAreaBgColor = BGRColorGrey; - const uint32_t TextAreaFgColor = BGRColorBlack; + const uint32_t TextAreaBgColor = RGBColorGrey; + const uint32_t TextAreaFgColor = RGBColorBlack; // Clean the botton of the display. lcd_fill_rect( lcd, 0, 50, lcd->parent.width, lcd->parent.height - 50, TextAreaBgColor); @@ -304,6 +303,8 @@ int main() spi_init(&lcdSpi, LCD_SPI, LcdSpiSpeedHz); lcd_init(&lcdSpi, lcd_bl, &lcd, &lcdInterface); lcd_clean(&lcd, BACKGROUND_COLOR); + lcd_fill_rect( + &lcd, 0, 50, lcd.parent.width, lcd.parent.height - 50, RGBColorGrey); size_t req_len = 8; while (true) diff --git a/examples/heartbleed/legacy/lcd.c b/examples/heartbleed/legacy/lcd.c index 9844e58..4cdf146 100644 --- a/examples/heartbleed/legacy/lcd.c +++ b/examples/heartbleed/legacy/lcd.c @@ -21,7 +21,7 @@ // pointer arithmetic, which clang-tidy forbids. #define GPIO_OUT_LCD GPIO_FROM_BASE_ADDR((GPIO_BASE + GPIO_OUT_REG)) -static void timer_delay(uint32_t ms) +static void timer_delay(void *handle, uint32_t ms) { uint32_t timeout = get_elapsed_time() + ms; while (get_elapsed_time() < timeout) @@ -55,7 +55,7 @@ int lcd_init(spi_t *spi, // Reset the LCD set_output_bit(GPIO_OUT_LCD, LcdRstPin, 0x0); - timer_delay(150); + timer_delay(NULL, 150); set_output_bit(GPIO_OUT_LCD, LcdRstPin, 0x1); // Init LCD Driver, and set the SPI driver @@ -64,13 +64,14 @@ int lcd_init(spi_t *spi, interface->gpio_write = gpio_write; // GPIO write callback. interface->timer_delay = timer_delay; // Timer delay callback. lcd_st7735_init(lcd, interface); + lcd_st7735_startup(lcd); // Set the LCD orientation lcd_st7735_set_orientation(lcd, LCD_Rotate180); // Setup text font bitmaps to be used and the colors. lcd_st7735_set_font(lcd, &m3x6_16ptFont); - lcd_st7735_set_font_colors(lcd, BGRColorWhite, BGRColorBlack); + lcd_st7735_set_font_colors(lcd, RGBColorWhite, RGBColorBlack); // Clean display with a white rectangle. lcd_st7735_clean(lcd); @@ -104,6 +105,9 @@ void lcd_draw_str(St7735Context *lcd, case LcdFontLucidaConsole_12pt: stringFont = lucidaConsole_12ptFont; break; + case LcdFontM5x7_16pt: + stringFont = m5x7_16ptFont; + break; default: stringFont = m3x6_16ptFont; } diff --git a/examples/heartbleed/legacy/lcd.h b/examples/heartbleed/legacy/lcd.h index ece6fc8..31d8994 100644 --- a/examples/heartbleed/legacy/lcd.h +++ b/examples/heartbleed/legacy/lcd.h @@ -29,17 +29,19 @@ extern "C" enum { - BGRColorBlack = 0x000000, - BGRColorWhite = 0xFFFFFF, - BGRColorBlue = 0xFF0000, - BGRColorGreen = 0x00FF00, - BGRColorRed = 0x0000FF, + RGBColorBlack = 0x000000, + RGBColorWhite = 0xFFFFFF, + RGBColorBlue = 0xFF0000, + RGBColorGreen = 0x00FF00, + RGBColorRed = 0x0000FF, + RGBColorGrey = 0xAAAAAA, }; // Fonts available for LCD rendering typedef enum LcdFont { LcdFontM3x6_16pt, // NOLINT + LcdFontM5x7_16pt, // NOLINT LcdFontLucidaConsole_10pt, // NOLINT LcdFontLucidaConsole_12pt, // NOLINT } LcdFont; diff --git a/examples/heartbleed/legacy/xmake.lua b/examples/heartbleed/legacy/xmake.lua index c3eb22e..aa94116 100644 --- a/examples/heartbleed/legacy/xmake.lua +++ b/examples/heartbleed/legacy/xmake.lua @@ -76,12 +76,13 @@ set_toolchains("legacy-gcc") -- Legacy-specific LCD library for using the display drivers target("lcd_st7735_lib_am") set_kind("static") - local lcd_dir = path.join(rootdir, "third_party/display_drivers") + local lcd_dir = path.join(rootdir, "third_party/display_drivers/src") add_files( path.join(lcd_dir, "core/lcd_base.c"), path.join(lcd_dir, "core/lucida_console_10pt.c"), path.join(lcd_dir, "core/lucida_console_12pt.c"), path.join(lcd_dir, "core/m3x6_16pt.c"), + path.join(lcd_dir, "core/m5x7_16pt.c"), path.join(lcd_dir, "st7735/lcd_st7735.c") ) @@ -89,14 +90,13 @@ target("lcd_st7735_lib_am") legacy_firmware("heartbleed_demo_legacy") add_deps("lcd_st7735_lib_am") add_includedirs( - "../../../third_party/display_drivers/core/", - "../../../third_party/display_drivers/st7735/", - "../../../third_party/sonata-system/sw/legacy/common/", - "../../../libraries/" + "../../../third_party/display_drivers/src/core/", + "../../../third_party/display_drivers/src/st7735/", + "../../../third_party/sonata-system/sw/legacy/common/" ) add_ldflags("-specs=nosys.specs", {force = true}) add_files( - "../../../third_party/sonata-system/vendor/cheriot_debug_module/tb/prog/syscalls.c", - "../../../libraries/m5x7_16pt.c" + "../../../third_party/sonata-system/vendor/cheriot_debug_module/tb/prog/syscalls.c" ) - add_files("heartbleed.c", "../common.c", "lcd.c") + -- Keep the "-g3 -O0" flags as an example of a legacy flow that supports using a debugger + add_files("heartbleed.c", "../common.c", "lcd.c", {force = {cxflags = {"-g3", "-O0"}}}) diff --git a/flake.nix b/flake.nix index 983c852..cfe4b0a 100644 --- a/flake.nix +++ b/flake.nix @@ -60,6 +60,21 @@ dontFixup = true; }; + sonata-heartbleed-demo-legacy-component = pkgs.stdenvNoCC.mkDerivation { + name = "sonata-heartbleed-demo-legacy-component"; + src = fileset.toSource { + root = ./.; + fileset = fileset.unions [./examples/heartbleed ./common.lua ./third_party]; + }; + buildInputs = [pkgs.srecord] ++ (with lrPkgs; [xmake lowrisc-toolchain-gcc-rv32imcb uf2conv]); + buildPhase = "xmake -P ./examples/heartbleed/legacy/"; + installPhase = '' + mkdir -p $out/share/ + cp build/ilp32/rv32imc/release/heartbleed_demo_legacy $out/share + ''; + dontFixup = true; + }; + sonata-software-documentation = lrDoc.buildMdbookSite { version = ""; pname = "sonata-software-documentation"; @@ -204,6 +219,7 @@ sonata-tests sonata-software-documentation sonata-automotive-demo-legacy-component + sonata-heartbleed-demo-legacy-component ; }; checks = {inherit tests-simulator;}; diff --git a/libraries/m5x7_16pt.c b/libraries/m5x7_16pt.c deleted file mode 100644 index ffb6cbb..0000000 --- a/libraries/m5x7_16pt.c +++ /dev/null @@ -1,1164 +0,0 @@ -// Copyright lowRISC Contributors. -// SPDX-License-Identifier: Apache-2.0 -// -// This is a rasterized version of the m5x7 font. -// The m5x7 font is created by Daniel Linssen and is free to use with -// attribution. The original TTF font can be found at -// https://managore.itch.io/m5x7 - -#include -// Character bitmaps for m5x7_16pt -const unsigned char m5x7_16ptBitmaps[] = { - // @32 ' ' (5 pixels wide) - 0x00, // - 0x00, // - 0x00, // - 0x00, // - 0x00, // - 0x00, // - 0x00, // - 0x00, // - 0x00, // - - // @33 '!' (2 pixels wide) - 0x01, // # - 0x01, // # - 0x01, // # - 0x01, // # - 0x01, // # - 0x00, // - 0x01, // # - 0x00, // - 0x00, // - - // @34 '"' (4 pixels wide) - 0x05, // # # - 0x05, // # # - 0x00, // - 0x00, // - 0x00, // - 0x00, // - 0x00, // - 0x00, // - 0x00, // - - // @35 '#' (6 pixels wide) - 0x00, // - 0x0a, // # # - 0x1f, // ##### - 0x0a, // # # - 0x0a, // # # - 0x1f, // ##### - 0x0a, // # # - 0x00, // - 0x00, // - - // @36 '$' (6 pixels wide) - 0x04, // # - 0x1e, // #### - 0x05, // # # - 0x0e, // ### - 0x14, // # # - 0x0f, // #### - 0x04, // # - 0x00, // - 0x00, // - - // @37 '%' (6 pixels wide) - 0x13, // ## # - 0x13, // ## # - 0x08, // # - 0x04, // # - 0x02, // # - 0x19, // # ## - 0x19, // # ## - 0x00, // - 0x00, // - - // @38 '&' (7 pixels wide) - 0x04, // # - 0x0a, // # # - 0x0a, // # # - 0x06, // ## - 0x11, // # # - 0x11, // # # - 0x2e, // ### # - 0x00, // - 0x00, // - - // @39 ''' (2 pixels wide) - 0x01, // # - 0x01, // # - 0x00, // - 0x00, // - 0x00, // - 0x00, // - 0x00, // - 0x00, // - 0x00, // - - // @40 '(' (3 pixels wide) - 0x02, // # - 0x01, // # - 0x01, // # - 0x01, // # - 0x01, // # - 0x01, // # - 0x01, // # - 0x02, // # - 0x00, // - - // @41 ')' (3 pixels wide) - 0x01, // # - 0x02, // # - 0x02, // # - 0x02, // # - 0x02, // # - 0x02, // # - 0x02, // # - 0x01, // # - 0x00, // - - // @42 '*' (4 pixels wide) - 0x05, // # # - 0x02, // # - 0x05, // # # - 0x00, // - 0x00, // - 0x00, // - 0x00, // - 0x00, // - 0x00, // - - // @43 '+' (6 pixels wide) - 0x00, // - 0x04, // # - 0x04, // # - 0x1f, // ##### - 0x04, // # - 0x04, // # - 0x00, // - 0x00, // - 0x00, // - - // @44 ',' (3 pixels wide) - 0x00, // - 0x00, // - 0x00, // - 0x00, // - 0x00, // - 0x00, // - 0x02, // # - 0x01, // # - 0x00, // - - // @45 '-' (6 pixels wide) - 0x00, // - 0x00, // - 0x00, // - 0x1f, // ##### - 0x00, // - 0x00, // - 0x00, // - 0x00, // - 0x00, // - - // @46 '.' (2 pixels wide) - 0x00, // - 0x00, // - 0x00, // - 0x00, // - 0x00, // - 0x00, // - 0x01, // # - 0x00, // - 0x00, // - - // @47 '/' (4 pixels wide) - 0x04, // # - 0x04, // # - 0x02, // # - 0x02, // # - 0x02, // # - 0x01, // # - 0x01, // # - 0x00, // - 0x00, // - - // @48 '0' (6 pixels wide) - 0x0e, // ### - 0x11, // # # - 0x11, // # # - 0x11, // # # - 0x11, // # # - 0x11, // # # - 0x0e, // ### - 0x00, // - 0x00, // - - // @49 '1' (6 pixels wide) - 0x04, // # - 0x06, // ## - 0x04, // # - 0x04, // # - 0x04, // # - 0x04, // # - 0x1f, // ##### - 0x00, // - 0x00, // - - // @50 '2' (6 pixels wide) - 0x0e, // ### - 0x11, // # # - 0x10, // # - 0x08, // # - 0x04, // # - 0x02, // # - 0x1f, // ##### - 0x00, // - 0x00, // - - // @51 '3' (6 pixels wide) - 0x0e, // ### - 0x11, // # # - 0x10, // # - 0x0c, // ## - 0x10, // # - 0x11, // # # - 0x0e, // ### - 0x00, // - 0x00, // - - // @52 '4' (6 pixels wide) - 0x08, // # - 0x0c, // ## - 0x0a, // # # - 0x09, // # # - 0x1f, // ##### - 0x08, // # - 0x08, // # - 0x00, // - 0x00, // - - // @53 '5' (6 pixels wide) - 0x1f, // ##### - 0x01, // # - 0x0f, // #### - 0x10, // # - 0x10, // # - 0x10, // # - 0x0f, // #### - 0x00, // - 0x00, // - - // @54 '6' (6 pixels wide) - 0x0e, // ### - 0x01, // # - 0x0f, // #### - 0x11, // # # - 0x11, // # # - 0x11, // # # - 0x0e, // ### - 0x00, // - 0x00, // - - // @55 '7' (6 pixels wide) - 0x1f, // ##### - 0x10, // # - 0x10, // # - 0x08, // # - 0x08, // # - 0x04, // # - 0x04, // # - 0x00, // - 0x00, // - - // @56 '8' (6 pixels wide) - 0x0e, // ### - 0x11, // # # - 0x11, // # # - 0x0e, // ### - 0x11, // # # - 0x11, // # # - 0x0e, // ### - 0x00, // - 0x00, // - - // @57 '9' (6 pixels wide) - 0x0e, // ### - 0x11, // # # - 0x11, // # # - 0x11, // # # - 0x1e, // #### - 0x10, // # - 0x0e, // ### - 0x00, // - 0x00, // - - // @58 ':' (2 pixels wide) - 0x00, // - 0x00, // - 0x00, // - 0x01, // # - 0x00, // - 0x00, // - 0x01, // # - 0x00, // - 0x00, // - - // @59 ';' (3 pixels wide) - 0x00, // - 0x00, // - 0x00, // - 0x02, // # - 0x00, // - 0x00, // - 0x02, // # - 0x01, // # - 0x00, // - - // @60 '<' (4 pixels wide) - 0x00, // - 0x04, // # - 0x02, // # - 0x01, // # - 0x02, // # - 0x04, // # - 0x00, // - 0x00, // - 0x00, // - - // @61 '=' (5 pixels wide) - 0x00, // - 0x00, // - 0x0f, // #### - 0x00, // - 0x0f, // #### - 0x00, // - 0x00, // - 0x00, // - 0x00, // - - // @62 '>' (4 pixels wide) - 0x00, // - 0x01, // # - 0x02, // # - 0x04, // # - 0x02, // # - 0x01, // # - 0x00, // - 0x00, // - 0x00, // - - // @63 '?' (6 pixels wide) - 0x0e, // ### - 0x11, // # # - 0x10, // # - 0x08, // # - 0x04, // # - 0x00, // - 0x04, // # - 0x00, // - 0x00, // - - // @64 '@' (6 pixels wide) - 0x0e, // ### - 0x11, // # # - 0x1d, // # ### - 0x15, // # # # - 0x1d, // # ### - 0x01, // # - 0x1e, // #### - 0x00, // - 0x00, // - - // @65 'A' (6 pixels wide) - 0x0e, // ### - 0x11, // # # - 0x11, // # # - 0x11, // # # - 0x1f, // ##### - 0x11, // # # - 0x11, // # # - 0x00, // - 0x00, // - - // @66 'B' (6 pixels wide) - 0x0f, // #### - 0x11, // # # - 0x0f, // #### - 0x11, // # # - 0x11, // # # - 0x11, // # # - 0x0f, // #### - 0x00, // - 0x00, // - - // @67 'C' (6 pixels wide) - 0x1c, // ### - 0x02, // # - 0x01, // # - 0x01, // # - 0x01, // # - 0x01, // # - 0x1e, // #### - 0x00, // - 0x00, // - - // @68 'D' (6 pixels wide) - 0x07, // ### - 0x09, // # # - 0x11, // # # - 0x11, // # # - 0x11, // # # - 0x11, // # # - 0x0f, // #### - 0x00, // - 0x00, // - - // @69 'E' (6 pixels wide) - 0x1e, // #### - 0x01, // # - 0x0f, // #### - 0x01, // # - 0x01, // # - 0x01, // # - 0x1e, // #### - 0x00, // - 0x00, // - - // @70 'F' (6 pixels wide) - 0x1e, // #### - 0x01, // # - 0x0f, // #### - 0x01, // # - 0x01, // # - 0x01, // # - 0x01, // # - 0x00, // - 0x00, // - - // @71 'G' (6 pixels wide) - 0x0e, // ### - 0x11, // # # - 0x01, // # - 0x1d, // # ### - 0x11, // # # - 0x11, // # # - 0x0e, // ### - 0x00, // - 0x00, // - - // @72 'H' (6 pixels wide) - 0x11, // # # - 0x11, // # # - 0x1f, // ##### - 0x11, // # # - 0x11, // # # - 0x11, // # # - 0x11, // # # - 0x00, // - 0x00, // - - // @73 'I' (6 pixels wide) - 0x1f, // ##### - 0x04, // # - 0x04, // # - 0x04, // # - 0x04, // # - 0x04, // # - 0x1f, // ##### - 0x00, // - 0x00, // - - // @74 'J' (6 pixels wide) - 0x1f, // ##### - 0x10, // # - 0x10, // # - 0x10, // # - 0x10, // # - 0x08, // # - 0x07, // ### - 0x00, // - 0x00, // - - // @75 'K' (6 pixels wide) - 0x11, // # # - 0x11, // # # - 0x09, // # # - 0x07, // ### - 0x09, // # # - 0x11, // # # - 0x11, // # # - 0x00, // - 0x00, // - - // @76 'L' (6 pixels wide) - 0x01, // # - 0x01, // # - 0x01, // # - 0x01, // # - 0x01, // # - 0x01, // # - 0x1e, // #### - 0x00, // - 0x00, // - - // @77 'M' (8 pixels wide) - 0x36, // ## ## - 0x49, // # # # - 0x49, // # # # - 0x49, // # # # - 0x49, // # # # - 0x49, // # # # - 0x41, // # # - 0x00, // - 0x00, // - - // @78 'N' (6 pixels wide) - 0x07, // ### - 0x09, // # # - 0x11, // # # - 0x11, // # # - 0x11, // # # - 0x11, // # # - 0x11, // # # - 0x00, // - 0x00, // - - // @79 'O' (6 pixels wide) - 0x0e, // ### - 0x11, // # # - 0x11, // # # - 0x11, // # # - 0x11, // # # - 0x11, // # # - 0x0e, // ### - 0x00, // - 0x00, // - - // @80 'P' (6 pixels wide) - 0x0f, // #### - 0x11, // # # - 0x11, // # # - 0x11, // # # - 0x0f, // #### - 0x01, // # - 0x01, // # - 0x00, // - 0x00, // - - // @81 'Q' (6 pixels wide) - 0x0e, // ### - 0x11, // # # - 0x11, // # # - 0x11, // # # - 0x15, // # # # - 0x09, // # # - 0x16, // ## # - 0x00, // - 0x00, // - - // @82 'R' (6 pixels wide) - 0x0f, // #### - 0x11, // # # - 0x11, // # # - 0x11, // # # - 0x0f, // #### - 0x11, // # # - 0x11, // # # - 0x00, // - 0x00, // - - // @83 'S' (6 pixels wide) - 0x1e, // #### - 0x01, // # - 0x01, // # - 0x0e, // ### - 0x10, // # - 0x10, // # - 0x0f, // #### - 0x00, // - 0x00, // - - // @84 'T' (6 pixels wide) - 0x1f, // ##### - 0x04, // # - 0x04, // # - 0x04, // # - 0x04, // # - 0x04, // # - 0x04, // # - 0x00, // - 0x00, // - - // @85 'U' (6 pixels wide) - 0x11, // # # - 0x11, // # # - 0x11, // # # - 0x11, // # # - 0x11, // # # - 0x11, // # # - 0x0e, // ### - 0x00, // - 0x00, // - - // @86 'V' (6 pixels wide) - 0x11, // # # - 0x11, // # # - 0x11, // # # - 0x11, // # # - 0x11, // # # - 0x0a, // # # - 0x04, // # - 0x00, // - 0x00, // - - // @87 'W' (8 pixels wide) - 0x41, // # # - 0x41, // # # - 0x49, // # # # - 0x49, // # # # - 0x49, // # # # - 0x49, // # # # - 0x36, // ## ## - 0x00, // - 0x00, // - - // @88 'X' (6 pixels wide) - 0x11, // # # - 0x11, // # # - 0x0a, // # # - 0x04, // # - 0x0a, // # # - 0x11, // # # - 0x11, // # # - 0x00, // - 0x00, // - - // @89 'Y' (6 pixels wide) - 0x11, // # # - 0x11, // # # - 0x11, // # # - 0x0a, // # # - 0x04, // # - 0x04, // # - 0x04, // # - 0x00, // - 0x00, // - - // @90 'Z' (6 pixels wide) - 0x1f, // ##### - 0x10, // # - 0x08, // # - 0x04, // # - 0x02, // # - 0x01, // # - 0x1f, // ##### - 0x00, // - 0x00, // - - // @91 '[' (3 pixels wide) - 0x03, // ## - 0x01, // # - 0x01, // # - 0x01, // # - 0x01, // # - 0x01, // # - 0x01, // # - 0x03, // ## - 0x00, // - - // @92 '\' (4 pixels wide) - 0x01, // # - 0x01, // # - 0x02, // # - 0x02, // # - 0x02, // # - 0x04, // # - 0x04, // # - 0x00, // - 0x00, // - - // @93 ']' (3 pixels wide) - 0x03, // ## - 0x02, // # - 0x02, // # - 0x02, // # - 0x02, // # - 0x02, // # - 0x02, // # - 0x03, // ## - 0x00, // - - // @94 '^' (6 pixels wide) - 0x04, // # - 0x0a, // # # - 0x11, // # # - 0x00, // - 0x00, // - 0x00, // - 0x00, // - 0x00, // - 0x00, // - - // @95 '_' (6 pixels wide) - 0x00, // - 0x00, // - 0x00, // - 0x00, // - 0x00, // - 0x00, // - 0x1f, // ##### - 0x00, // - 0x00, // - - // @96 '`' (3 pixels wide) - 0x01, // # - 0x02, // # - 0x00, // - 0x00, // - 0x00, // - 0x00, // - 0x00, // - 0x00, // - 0x00, // - - // @97 'a' (6 pixels wide) - 0x00, // - 0x00, // - 0x0e, // ### - 0x10, // # - 0x1e, // #### - 0x11, // # # - 0x1e, // #### - 0x00, // - 0x00, // - - // @98 'b' (6 pixels wide) - 0x01, // # - 0x01, // # - 0x0f, // #### - 0x11, // # # - 0x11, // # # - 0x11, // # # - 0x0f, // #### - 0x00, // - 0x00, // - - // @99 'c' (5 pixels wide) - 0x00, // - 0x00, // - 0x0e, // ### - 0x01, // # - 0x01, // # - 0x01, // # - 0x0e, // ### - 0x00, // - 0x00, // - - // @100 'd' (6 pixels wide) - 0x10, // # - 0x10, // # - 0x1e, // #### - 0x11, // # # - 0x11, // # # - 0x11, // # # - 0x1e, // #### - 0x00, // - 0x00, // - - // @101 'e' (6 pixels wide) - 0x00, // - 0x00, // - 0x0e, // ### - 0x11, // # # - 0x1f, // ##### - 0x01, // # - 0x0e, // ### - 0x00, // - 0x00, // - - // @102 'f' (5 pixels wide) - 0x0c, // ## - 0x02, // # - 0x0f, // #### - 0x02, // # - 0x02, // # - 0x02, // # - 0x02, // # - 0x00, // - 0x00, // - - // @103 'g' (6 pixels wide) - 0x00, // - 0x00, // - 0x0e, // ### - 0x11, // # # - 0x11, // # # - 0x11, // # # - 0x1e, // #### - 0x10, // # - 0x0e, // ### - - // @104 'h' (6 pixels wide) - 0x01, // # - 0x01, // # - 0x0f, // #### - 0x11, // # # - 0x11, // # # - 0x11, // # # - 0x11, // # # - 0x00, // - 0x00, // - - // @105 'i' (3 pixels wide) - 0x02, // # - 0x00, // - 0x03, // ## - 0x02, // # - 0x02, // # - 0x02, // # - 0x02, // # - 0x00, // - 0x00, // - - // @106 'j' (4 pixels wide) - 0x04, // # - 0x00, // - 0x06, // ## - 0x04, // # - 0x04, // # - 0x04, // # - 0x04, // # - 0x04, // # - 0x03, // ## - - // @107 'k' (5 pixels wide) - 0x01, // # - 0x01, // # - 0x09, // # # - 0x05, // # # - 0x03, // ## - 0x05, // # # - 0x09, // # # - 0x00, // - 0x00, // - - // @108 'l' (3 pixels wide) - 0x01, // # - 0x01, // # - 0x01, // # - 0x01, // # - 0x01, // # - 0x01, // # - 0x02, // # - 0x00, // - 0x00, // - - // @109 'm' (8 pixels wide) - 0x00, // - 0x00, // - 0x3d, // # #### - 0x4b, // ## # # - 0x49, // # # # - 0x49, // # # # - 0x49, // # # # - 0x00, // - 0x00, // - - // @110 'n' (6 pixels wide) - 0x00, // - 0x00, // - 0x0d, // # ## - 0x13, // ## # - 0x11, // # # - 0x11, // # # - 0x11, // # # - 0x00, // - 0x00, // - - // @111 'o' (6 pixels wide) - 0x00, // - 0x00, // - 0x0e, // ### - 0x11, // # # - 0x11, // # # - 0x11, // # # - 0x0e, // ### - 0x00, // - 0x00, // - - // @112 'p' (6 pixels wide) - 0x00, // - 0x00, // - 0x0f, // #### - 0x11, // # # - 0x11, // # # - 0x11, // # # - 0x0f, // #### - 0x01, // # - 0x01, // # - - // @113 'q' (6 pixels wide) - 0x00, // - 0x00, // - 0x1e, // #### - 0x11, // # # - 0x11, // # # - 0x11, // # # - 0x1e, // #### - 0x10, // # - 0x10, // # - - // @114 'r' (5 pixels wide) - 0x00, // - 0x00, // - 0x0d, // # ## - 0x03, // ## - 0x01, // # - 0x01, // # - 0x01, // # - 0x00, // - 0x00, // - - // @115 's' (6 pixels wide) - 0x00, // - 0x00, // - 0x1e, // #### - 0x01, // # - 0x0e, // ### - 0x10, // # - 0x0f, // #### - 0x00, // - 0x00, // - - // @116 't' (5 pixels wide) - 0x02, // # - 0x02, // # - 0x0f, // #### - 0x02, // # - 0x02, // # - 0x02, // # - 0x0c, // ## - 0x00, // - 0x00, // - - // @117 'u' (6 pixels wide) - 0x00, // - 0x00, // - 0x11, // # # - 0x11, // # # - 0x11, // # # - 0x19, // # ## - 0x16, // ## # - 0x00, // - 0x00, // - - // @118 'v' (6 pixels wide) - 0x00, // - 0x00, // - 0x11, // # # - 0x11, // # # - 0x11, // # # - 0x0a, // # # - 0x04, // # - 0x00, // - 0x00, // - - // @119 'w' (8 pixels wide) - 0x00, // - 0x00, // - 0x41, // # # - 0x49, // # # # - 0x49, // # # # - 0x49, // # # # - 0x36, // ## ## - 0x00, // - 0x00, // - - // @120 'x' (6 pixels wide) - 0x00, // - 0x00, // - 0x11, // # # - 0x0a, // # # - 0x04, // # - 0x0a, // # # - 0x11, // # # - 0x00, // - 0x00, // - - // @121 'y' (6 pixels wide) - 0x00, // - 0x00, // - 0x11, // # # - 0x11, // # # - 0x11, // # # - 0x11, // # # - 0x1e, // #### - 0x10, // # - 0x0e, // ### - - // @122 'z' (6 pixels wide) - 0x00, // - 0x00, // - 0x1f, // ##### - 0x08, // # - 0x04, // # - 0x02, // # - 0x1f, // ##### - 0x00, // - 0x00, // - - // @123 '{' (4 pixels wide) - 0x06, // ## - 0x02, // # - 0x02, // # - 0x03, // ## - 0x02, // # - 0x02, // # - 0x02, // # - 0x06, // ## - 0x00, // - - // @124 '|' (2 pixels wide) - 0x01, // # - 0x01, // # - 0x01, // # - 0x01, // # - 0x01, // # - 0x01, // # - 0x01, // # - 0x00, // - 0x00, // - - // @125 '}' (4 pixels wide) - 0x03, // ## - 0x02, // # - 0x02, // # - 0x06, // ## - 0x02, // # - 0x02, // # - 0x02, // # - 0x03, // ## - 0x00, // - - // @126 '~' (6 pixels wide) - 0x00, // - 0x00, // - 0x02, // # - 0x15, // # # # - 0x08, // # - 0x00, // - 0x00, // - 0x00, // - 0x00, // -}; - -// Character descriptors for 16pt -const FontCharInfo m5x7_16ptDescriptors[] = { - {5, 0}, // ' ' - {2, 9}, // '!' - {4, 18}, // '"' - {6, 27}, // '#' - {6, 36}, // '$' - {6, 45}, // '%' - {7, 54}, // '&' - {2, 63}, // ''' - {3, 72}, // '(' - {3, 81}, // ')' - {4, 90}, // '*' - {6, 99}, // '+' - {3, 108}, // ',' - {6, 117}, // '-' - {2, 126}, // '.' - {4, 135}, // '/' - {6, 144}, // '0' - {6, 153}, // '1' - {6, 162}, // '2' - {6, 171}, // '3' - {6, 180}, // '4' - {6, 189}, // '5' - {6, 198}, // '6' - {6, 207}, // '7' - {6, 216}, // '8' - {6, 225}, // '9' - {2, 234}, // ':' - {3, 243}, // ';' - {4, 252}, // '<' - {5, 261}, // '=' - {4, 270}, // '>' - {6, 279}, // '?' - {6, 288}, // '@' - {6, 297}, // 'A' - {6, 306}, // 'B' - {6, 315}, // 'C' - {6, 324}, // 'D' - {6, 333}, // 'E' - {6, 342}, // 'F' - {6, 351}, // 'G' - {6, 360}, // 'H' - {6, 369}, // 'I' - {6, 378}, // 'J' - {6, 387}, // 'K' - {6, 396}, // 'L' - {8, 405}, // 'M' - {6, 414}, // 'N' - {6, 423}, // 'O' - {6, 432}, // 'P' - {6, 441}, // 'Q' - {6, 450}, // 'R' - {6, 459}, // 'S' - {6, 468}, // 'T' - {6, 477}, // 'U' - {6, 486}, // 'V' - {8, 495}, // 'W' - {6, 504}, // 'X' - {6, 513}, // 'Y' - {6, 522}, // 'Z' - {3, 531}, // '[' - {4, 540}, // '\' - {3, 549}, // ']' - {6, 558}, // '^' - {6, 567}, // '_' - {3, 576}, // '`' - {6, 585}, // 'a' - {6, 594}, // 'b' - {5, 603}, // 'c' - {6, 612}, // 'd' - {6, 621}, // 'e' - {5, 630}, // 'f' - {6, 639}, // 'g' - {6, 648}, // 'h' - {3, 657}, // 'i' - {4, 666}, // 'j' - {5, 675}, // 'k' - {3, 684}, // 'l' - {8, 693}, // 'm' - {6, 702}, // 'n' - {6, 711}, // 'o' - {6, 720}, // 'p' - {6, 729}, // 'q' - {5, 738}, // 'r' - {6, 747}, // 's' - {5, 756}, // 't' - {6, 765}, // 'u' - {6, 774}, // 'v' - {8, 783}, // 'w' - {6, 792}, // 'x' - {6, 801}, // 'y' - {6, 810}, // 'z' - {4, 819}, // '{' - {2, 828}, // '|' - {4, 837}, // '}' - {6, 846}, // '~' -}; - -// Font information for 16pt -const Font m5x7_16ptFont = { - 9, // Character height - ' ', // Start character - '~', // End character - m5x7_16ptDescriptors, // Character descriptor array - m5x7_16ptBitmaps, // Character bitmap array -}; diff --git a/libraries/m5x7_16pt.h b/libraries/m5x7_16pt.h deleted file mode 100644 index dcd7c33..0000000 --- a/libraries/m5x7_16pt.h +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright lowRISC Contributors. -// SPDX-License-Identifier: Apache-2.0 -// -// This is a rasterized version of the m5x7 font. -// The m5x7 font is created by Daniel Linssen and is free to use with -// attribution. The original TTF font can be found at -// https://managore.itch.io/m5x7 - -#ifndef M5X7_16PT_H_ -#define M5X7_16PT_H_ - -#include - -#include "font.h" - -extern const unsigned char m5x7_16ptBitmaps[]; -extern const Font m5x7_16ptFont; -extern const FontCharInfo m5x7_16ptDescriptors[]; - -#endif /* M5X7_16PT_H_ */