Remix.run Logo
Mousefood – Build embedded terminal UIs for microcontrollers(github.com)
67 points by orhunp_ 3 hours ago | 22 comments
zokier an hour ago | parent | next [-]

> Embedded-graphics includes bitmap fonts that have a very limited set of characters to save space (ASCII, ISO 8859 or JIS X0201). This makes it impossible to draw most of Ratatui's widgets, which heavily use box-drawing glyphs, Braille, and other special characters

You have a bitmap display, you can just draw lines and stuff without needing to rely on font-based hacks.

weinzierl an hour ago | parent [-]

Sure, but that's beside the point.

Text based graphics with fancy or custom fonts is just crazy efficient. That is exactly how we got the amazing graphics of The Last Ninja or Turrican on machines with less than 64KiB useable RAM.

Same for more modern embedded devices. If you constrain yourself to text you increase both runtime performance and your developer productivity.

orbital-decay an hour ago | parent | next [-]

It was crazy efficient on character or tile-based hardware. It makes no difference on bitmap displays, or rather adds some overhead.

weinzierl 35 minutes ago | parent [-]

At the end of the day it's always pixels - alway has been [1] - and the efficiency of storing and blitting a small number of fixed size rectangles is hard to beat if you can get away with it.

[1] Except for the early oscilloscope style vector displays maybe.

orbital-decay 7 minutes ago | parent | next [-]

Character-based hardware only stores the characters and the grid instead of the full bitmap for the frame, which is very efficient memory-wise. Tile-based hardware (e.g. most console graphics chips in the 8/16 bit era) also had scrolling and layers, and was extremely memory-efficient as well. With bitmap displays you already store full frames.

gmueckl 16 minutes ago | parent | prev [-]

No, this is technically not fully correct. Early text based display output systems were relying on special character generator hardware to generate the display signals producing the text on screen. Those systems did not have any means of generating arbitrary pixel patterns.

weinzierl 5 minutes ago | parent [-]

Do you have an example? All the 8-bitters I know drew the characters from memory, which was a character ROM per default but could be changed either with a screw driver or by bank switching some RAM in-place.

zokier an hour ago | parent | prev [-]

Are you claiming that scrapping together boxes and whatnot with line drawing characters is more efficient than just drawing the lines directly?

orhunp_ an hour ago | parent | prev | next [-]

Hey all, thanks for the interest to the crate!

I'm currently live on YouTube (doing some maintenance & testing). Feel free to join if you have any questions!

https://www.youtube.com/watch?v=PoYEQJbYNMc

nine_k 2 hours ago | parent | prev | next [-]

«Mousefood - a no-std embedded-graphics backend for Ratatui!»

Hence 100% Rust. Works on ESP32, RPi2040, and even STM32. Several displays mentioned, including e-ink.

GeertJohan 2 hours ago | parent | prev | next [-]

This is awesome! I love ratatui, having it available on embedded is very cool! I wonder if it will work with async on embedded e.g. embassy..

orhunp_ an hour ago | parent [-]

absolutely, it will work with any other embedded Rust application. The backend only provides a bridge between the embedded-graphics library and the Ratatui widget renderer.

wjholden 2 hours ago | parent | prev | next [-]

Cool! I just recently began learning the Raspberry Pi Pico. Could anyone recommend a specific display that I could use with the Pico 2/2W and Mousefood?

onjectic 2 hours ago | parent | prev | next [-]

Reminds me a lot of the UI styles in the Minecraft mod ComputerCraft.

orhunp_ an hour ago | parent [-]

we're bringing back those aesthetics!

dbacar 2 hours ago | parent | prev | next [-]

Hi Orhun, Could it be used with CYD (Cheap yellow display) ?

orhunp_ an hour ago | parent | next [-]

Most likely. I just checked and it uses embedded-graphics already which means you can plug in Mousefood directly. The touchscreen might be a bit tricky though, it might need some hacking on the event handler side. But it will most likely work if you map the coordinates to the terminal cells abstraction somehow.

nine_k 2 hours ago | parent | prev | next [-]

At the bottom of the page there is a mention of "Phone-OS - A modern phone OS for ESP32 CYD", so apparently it must be supported.

01HNNWZ0MV43FF 2 hours ago | parent | prev [-]

Today I Learned: https://github.com/witnessmenow/ESP32-Cheap-Yellow-Display

IamDaedalus 2 hours ago | parent | prev [-]

aaaaand this how I learn rust I learned go because of bubbletea and mousefood (which combines my work as an embedded systems programmer and love for torminals) is here

redanddead 2 hours ago | parent [-]

Oh bubbletea is really cool. Is this how most interactive CLIs are made?

GeertJohan 2 hours ago | parent [-]

I used bubbletea for a while but quit it because of inconsistencies in the design. Went to ratatui and never looked back. Go and Bubbletea are nice, but rust is much more suited for building tuis.