Tech News
← Back to articles

Mousefood – Build embedded terminal UIs for microcontrollers

read original related products more articles

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

Quickstart

Add mousefood as a dependency:

cargo add mousefood

Exemplary setup:

use mousefood :: embedded_graphics :: { mock_display :: MockDisplay , pixelcolor :: Rgb888 } ; use mousefood :: prelude :: * ; use ratatui :: widgets :: { Block , Paragraph } ; use ratatui :: { Frame , Terminal } ; fn main ( ) -> Result < ( ) , Box < dyn std :: error :: Error > > { // replace this with your display driver // e.g. ILI9341, ST7735, SSD1306, etc. let mut display = MockDisplay :: < Rgb888 > :: new ( ) ; let backend = EmbeddedBackend :: new ( & mut display , EmbeddedBackendConfig :: default ( ) ) ; let mut terminal = Terminal :: new ( backend ) ? ; terminal . draw ( draw ) ? ; Ok ( ( ) ) } fn draw ( frame : & mut Frame ) { let block = Block :: bordered ( ) . title ( "Mousefood" ) ; let paragraph = Paragraph :: new ( "Hello from Mousefood!" ) . block ( block ) ; frame . render_widget ( paragraph , frame . area ( ) ) ; }

Special characters

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.

Mousefood by default uses embedded-graphics-unicodefonts , which provides embedded-graphics fonts with a much larger set of characters.

Alternatives

... continue reading