pimoroni-pico/libraries/interstate75
Gee Bartlett 104c819412
Hub75: Update to use Picographics (#601)
* have a basic pg working needs optimizing

* working well ported some examples from GU

* started on micropython module

* Fixes to get new Hub75 compiling in MP

* stripped down for faster compilling

* Update hub75.cmake

* added hub75 to galatic and eviro as it is needed for picographics

* Update picographics.c

* added hu75 update

* added _ModPicoGraphics_obj_t

* Update hub75.cpp

* update bindings

* some examples needs linting

* added other panel sizes and linted

* Update picographics.cpp

* Update picographics.c

* fixing gc memory allocation

* Update hub75.cpp

* Update interstate75_balls_demo.cpp

* review

* broke

* working with built in panel defs

* still borked

* not much change needs review

* Update hub75.cpp

* reverted alot of things

* adding i75 lib

* lots of updates ready to test compile mp

* Update picographics.h

* little tweaks

* an inability to count fixed!

* fixed some readme's

* lots of tiding

* fixed linting and removed experimental code

* Minor formatting

* Minor formatting and cmake tidy

* Removed unneeded parts of examples

* Final tidy

* tidy examples and adding more

* updated to new library

* documentation tweaks

* fixed inclusion of interstate75 module

* syncing some stuff

* fixed linting

Co-authored-by: ZodiusInfuser <christopher.parrott2@gmail.com>
2022-12-16 20:53:16 +00:00
..
CMakeLists.txt Hub75: Update to use Picographics (#601) 2022-12-16 20:53:16 +00:00
README.md Hub75: Update to use Picographics (#601) 2022-12-16 20:53:16 +00:00
interstate75.cmake Hub75: Update to use Picographics (#601) 2022-12-16 20:53:16 +00:00
interstate75.hpp Hub75: Update to use Picographics (#601) 2022-12-16 20:53:16 +00:00

README.md

Interstate 75 (C++)

This library offers convenient functions for interacting with Interstate75 and Interstate75W - Interstate75 and Interstate75W offer an convenient way and 2 input buttons for all your display and control needs.

Example Program

The following example sets up Pico Display, displays some basic demo text and graphics and will illuminate the LED green if the A button is pressed.

#include "libraries/pico_graphics/pico_graphics.hpp"
#include "libraries/interstate75/interstate75.hpp"
#include "rgbled.hpp"
#include "button.hpp"

using namespace pimoroni;

// Display driver for a single 32x32 hub75 matrix
Hub75 hub75(32, 32, nullptr, PANEL_GENERIC, false);

// Graphics library - in 24Bit mode with 16M colours
PicoGraphics_PenRGB888 graphics(hub75.width, hub75.height, nullptr);

// And each button
Button button_a(Interstate75::A);
Button button_b(Interstate75::B);

// RGB LED
RGBLED led(Interstate75::LED_R, Interstate75::LED_G, Interstate75::LED_B);

// Interrupt callback required function 
void __isr dma_complete() {
  hub75.dma_complete();
}

int main() {
    hub75.start(dma_complete);

    while(true) {
        // detect if the A button is pressed (could be A, B, C, D or E)
        if(button_a.raw()) {
            // make the led glow green
            // parameters are red, green, blue all between 0 and 255
            // these are also gamma corrected
            led.set_rgb(0, 255, 0);
        }

        // set the colour of the pen
        // parameters are red, green, blue all between 0 and 255
        graphics.set_pen(100, 40, 50);

        // fill the screen with the current pen colour
        graphics.clear();

        // draw a box to put some text in
        graphics.set_pen(10, 20, 100);
        Rect text_rect(1, 1, hub75.width-2, hub75.height-2);
        graphics.rectangle(text_rect);

        // write some text inside the box with 10 pixels of margin
        // automatically word wrapping
        text_rect.deflate(1);
        graphics.set_pen(110, 120, 130);
        graphics.text("This is text", Point(text_rect.x, text_rect.y), text_rect.w, 1.0f);

        // now we've done our drawing let's update the screen
        hub75.update(&graphics);
    }
}

Function Reference

PicoGraphics

Pico GFX Pack uses our Pico Graphics library to draw graphics and text. For more information read the Pico Graphics function reference..

HUB75

Pico Display uses the HUB75 display driver to handle the led matrix. For more information read the HUB75 README..