From 6413ce79e8cd53a8566dca143b5fae5f7e81c595 Mon Sep 17 00:00:00 2001 From: Jonathan Bennett Date: Sun, 28 Apr 2024 12:47:37 -0500 Subject: [PATCH] Update portduino test to use new SPI selection scheme --- examples/Test/build_test/platformio_native.ini | 2 +- examples/Test/build_test/portduino/main.cpp | 6 ++++-- examples/Test/build_test/portduino/main.h | 7 +++++-- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/examples/Test/build_test/platformio_native.ini b/examples/Test/build_test/platformio_native.ini index bfe2e39d..1dc6d9cd 100644 --- a/examples/Test/build_test/platformio_native.ini +++ b/examples/Test/build_test/platformio_native.ini @@ -24,7 +24,7 @@ build_flags = -O0 -xc++ -std=c++14 [env:native-portduino] -platform = https://github.com/meshtastic/platform-native.git#659e49346aa33008b150dfb206b1817ddabc7132 +platform = https://github.com/meshtastic/platform-native.git#2ef818943157a3ebea7cbbc283d124fb67c0ffc1 framework = arduino board = cross_platform ;build_src_filter = +<**/*.cpp> -
diff --git a/examples/Test/build_test/portduino/main.cpp b/examples/Test/build_test/portduino/main.cpp index 8442ff45..0bb562d8 100644 --- a/examples/Test/build_test/portduino/main.cpp +++ b/examples/Test/build_test/portduino/main.cpp @@ -8,8 +8,6 @@ void setup() initGPIOPin(25, "gpiochip4"); initGPIOPin(24, "gpiochip4"); - DisplaySPI = new HardwareSPI; - DisplaySPI->begin("/dev/spidev0.0"); Wire.begin(1); display = new LGFX(); display->init(); @@ -18,6 +16,10 @@ void setup() canvas.setFont(&fonts::lgfxJapanMinchoP_32); canvas.setTextWrap(false); // 右端到達時のカーソル折り返しを禁止 canvas.createSprite(display->width(), 36); + canvas.clear(); + canvas.setCursor(0, 0); + canvas.printf("Touch to start\n"); + canvas.pushSprite(display, 0, 0); } diff --git a/examples/Test/build_test/portduino/main.h b/examples/Test/build_test/portduino/main.h index 558c8302..6d8f226b 100644 --- a/examples/Test/build_test/portduino/main.h +++ b/examples/Test/build_test/portduino/main.h @@ -6,7 +6,6 @@ #include "PortduinoGPIO.h" #include -HardwareSPI *DisplaySPI; int initGPIOPin(int pinNum, std::string gpioChipName); class LGFX : public lgfx::LGFX_Device @@ -25,7 +24,11 @@ class LGFX : public lgfx::LGFX_Device auto buscfg = _bus_instance.config(); buscfg.spi_mode = 0; buscfg.pin_dc = 25; - _bus_instance.spi_device(DisplaySPI); + + // to use spidevX.Y + int x = 0; + int y = 0; + buscfg.spi_host = x + y << 4; _bus_instance.config(buscfg); // applies the set value to the bus. _panel_instance.setBus(&_bus_instance); // set the bus on the panel. }