Add multiple SPI devices for Radio, Display, and Touchscreen (#3638)

This changeset gives us the ability to specify a separate SPI device for the LoRa, Display, and Touchscreen. The changes in Portduino also add support for specifying a new SPI speed for each transaction. All together, this means that we can let the Linux OS manage the CS lines, and also get much faster SPI speeds, leading to better framerates.

* Add multiple SPI devices to put Radio, Display, and Touchscreen on each their own

---------

Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
This commit is contained in:
Jonathan Bennett
2024-04-17 14:25:52 -05:00
committed by GitHub
parent bc085ab840
commit d47e9bed19
10 changed files with 340 additions and 12 deletions

View File

@@ -1,6 +1,7 @@
#include "configuration.h"
#include "main.h"
#if ARCH_PORTDUINO
#include "mesh_bus_spi.h"
#include "platform/portduino/PortduinoGlue.h"
#endif
@@ -339,7 +340,7 @@ static TFT_eSPI *tft = nullptr; // Invoke library, pins defined in User_Setup.h
class LGFX : public lgfx::LGFX_Device
{
lgfx::Panel_LCD *_panel_instance;
lgfx::Bus_SPI _bus_instance;
lgfx::Mesh_Bus_SPI _bus_instance;
lgfx::ITouch *_touch_instance;
@@ -356,6 +357,7 @@ class LGFX : public lgfx::LGFX_Device
_panel_instance = new lgfx::Panel_ILI9341;
auto buscfg = _bus_instance.config();
buscfg.spi_mode = 0;
_bus_instance.spi_device(DisplaySPI, settingsStrings[displayspidev]);
buscfg.pin_dc = settingsMap[displayDC]; // Set SPI DC pin number (-1 = disable)