From 96d516cb7cbbe607ab477b5eaefa059e26c3ad06 Mon Sep 17 00:00:00 2001 From: Larry Bank Date: Sat, 2 Nov 2024 16:47:09 +0000 Subject: [PATCH] Fixes for RPI --- rpi/README.txt | 9 +++++++++ rpi/examples/hello_epaper/main.cpp | 12 ++++++++---- rpi/rpi_io.inl | 4 +++- 3 files changed, 20 insertions(+), 5 deletions(-) create mode 100644 rpi/README.txt diff --git a/rpi/README.txt b/rpi/README.txt new file mode 100644 index 0000000..b6ffed9 --- /dev/null +++ b/rpi/README.txt @@ -0,0 +1,9 @@ +The default Raspberry Pi Linux installation is missing a few tools that are required to build this library. Execute the following in a terminal command line: +>sudo apt install libgpiod-dev + +The SPI bus access is off by default, so to enable it, type the following: +>sudo raspi-config +Select option 3 (Interface Options), then option I4 (SPI). Choose yes, then +finish. + + diff --git a/rpi/examples/hello_epaper/main.cpp b/rpi/examples/hello_epaper/main.cpp index b410853..296b626 100644 --- a/rpi/examples/hello_epaper/main.cpp +++ b/rpi/examples/hello_epaper/main.cpp @@ -5,7 +5,8 @@ // Copyright (c) 2024 BitBank Software, Inc. // #include "../../../src/bb_epaper.h" -BBEPAPER bbep(EPD213_104x212); // InkyPHAT 2.13" +//BBEPAPER bbep(EPD213_104x212); // InkyPHAT 2.13" +BBEPAPER bbep(EPD295_128x296); // BCM GPIO numbers #define PIN_DC 22 #define PIN_RST 27 @@ -14,12 +15,15 @@ BBEPAPER bbep(EPD213_104x212); // InkyPHAT 2.13" #define SPI_BUS 0 int main(int argc, const char * argv[]) { + bbep.initIO(PIN_DC, PIN_RST, PIN_BUSY, PIN_CS, SPI_BUS, 4000000); - bbep.fillRect(0,0,104,212, BBEP_WHITE); +// bbep.allocBuffer(); + bbep.fillScreen(BBEP_WHITE); bbep.setRotation(90); - bbep.setFont(FONT_12x16); - bbep.setTextColor(BBEP_BLACK, BBEP_WHITE); + bbep.setFont(FONT_16x16); + bbep.setTextColor(BBEP_BLACK); bbep.drawString("Hello World!", 0, 0); +// bbep.writePlane(); bbep.refresh(REFRESH_FULL); bbep.sleep(DEEP_SLEEP); diff --git a/rpi/rpi_io.inl b/rpi/rpi_io.inl index 38d5095..e7c86fb 100644 --- a/rpi/rpi_io.inl +++ b/rpi/rpi_io.inl @@ -34,7 +34,9 @@ #ifndef CONSUMER #define CONSUMER "Consumer" #endif -#define pgm_read_byte(a) *(uint8_t *)a +#define pgm_read_byte(a) (*(uint8_t *)a) +#define pgm_read_word(a) (*(uint16_t *)a) +#define pgm_read_dword(a) (*(uint32_t *)a) #define memcpy_P memcpy struct gpiod_chip *chip = NULL; struct gpiod_line *lines[64];