![]() |
CHGame 0.3.0
Libraries for the CHGame handheld
|
Wire-speed ST7735 graphics: a 16-colour framebuffer, DMA flushes, sprites, shapes, text and fonts. More...
Modules | |
| Configuration | |
| Screen geometry, the panel's wiring, colour modes and SPI dividers: the build options and the constants they define. | |
| Setup | |
| Starting the panel and changing its SPI clock, colour mode, orientation and scan rate. | |
| Palette | |
| The 16 colours the framebuffer's indices stand for, and a fade applied on top of them. | |
| Presenting the framebuffer | |
| Sending the framebuffer to the panel: whole or a rectangle, blocking or by DMA in the background, and waiting for it. | |
| Direct streaming | |
| Full-colour procedural frames computed straight into the DMA's buffers, with no framebuffer and no palette. | |
| Drawing | |
| The clip rectangle, pixels, lines, rectangles, circles and sprite blits, drawn into the 4 bpp framebuffer. | |
| Shapes | |
| Rounded rectangles, ellipses, dithered fills and in-place recolouring. | |
| Span sprites | |
| The compact run-length sprite format (sprite4): plain, scaled, recoloured and rotated. | |
| Row operations | |
| Scrolling and stamping whole framebuffer rows at word speed. | |
| Text | |
| Text in the built-in 5x7 font or any GFXfont: plain, scaled, measured, and outlined/shadowed banners. | |
| Fonts | |
The bundled fonts in src/fonts/, the GFXfont format they use, and the built-in 5x7. | |
| Direct to the panel | |
| Talking to the ST7735 without the framebuffer: chip select, commands, address windows, DMA fills and raw blits. | |
| Internals and scratch | |
| The converters the Benchmark example measures, the flush's chunk buffers as scratch memory, and the frame size. | |
| The Gfx object | |
| The CHGfx class and its one instance, Gfx: the same API with Arduino-style names. | |
| Adafruit_GFX bridge | |
CHGfx_GFX: an Adafruit_GFX whose drawing lands in CHGfx's framebuffer, from CHGfx_AdafruitGFX.h (needs the Adafruit GFX Library). | |
Wire-speed ST7735 graphics: a 16-colour framebuffer, DMA flushes, sprites, shapes, text and fonts.
CHGfx drives the 128x128 ST7735S panel on SPI1 with DMA. It keeps a 4 bpp (16-colour) framebuffer of 8 KB in SRAM and expands it through a palette to the panel's 12 or 16 bpp while the DMA is already sending it, so a full frame goes out at 90 fps (16 bpp) or 119 fps (12 bpp). CHGame is built on it, and a sketch that includes CHGame.h has all of CHGfx too.
Everything is a plain C function (gfx_clear(), gfx_flushAsync() ...); the CHGfx class and its one instance Gfx are zero-cost forwarders for those who prefer Gfx.clear(0).
The rule that matters: drawing goes into the framebuffer, and the framebuffer is free to draw into only after gfx_wait() (or gfx_waitRow()), once the previous flush has finished reading it.