Skip to content

Commit

Permalink
update portduino test program
Browse files Browse the repository at this point in the history
  • Loading branch information
jp-bennett committed Apr 30, 2024
1 parent 0e0f307 commit 3898392
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
5 changes: 2 additions & 3 deletions examples/Test/build_test/platformio_native.ini
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

[env:native-default]
platform = https://github.com/geeksville/platform-native.git
;build_flags = ${env.build_flags} -O0 -lgpiod
Expand All @@ -24,7 +23,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#784007630ca43b4811c6637606440588bb5acf39
framework = arduino
board = cross_platform
;build_src_filter = +<**/*.cpp> -<main/>
Expand All @@ -41,4 +40,4 @@ build_flags =
lib_deps =
SPI
Wire
LovyanGFX
LovyanGFX
6 changes: 4 additions & 2 deletions examples/Test/build_test/portduino/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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);
}


Expand Down
7 changes: 5 additions & 2 deletions examples/Test/build_test/portduino/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
#include "PortduinoGPIO.h"
#include <iostream>

HardwareSPI *DisplaySPI;
int initGPIOPin(int pinNum, std::string gpioChipName);

class LGFX : public lgfx::LGFX_Device
Expand All @@ -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.
}
Expand Down

0 comments on commit 3898392

Please sign in to comment.