diff --git a/Source/Meadow.Foundation.Peripherals/Displays.TftSpi/Driver/Drivers/St7789.cs b/Source/Meadow.Foundation.Peripherals/Displays.TftSpi/Driver/Drivers/St7789.cs
index 42a6b73b5..4d0797bf3 100644
--- a/Source/Meadow.Foundation.Peripherals/Displays.TftSpi/Driver/Drivers/St7789.cs
+++ b/Source/Meadow.Foundation.Peripherals/Displays.TftSpi/Driver/Drivers/St7789.cs
@@ -45,7 +45,7 @@ public class St7789 : TftSpiBase, IRotatableDisplay
/// Width of display in pixels
/// Height of display in pixels
/// The color mode to use for the display buffer
- public St7789(ISpiBus spiBus, IPin chipSelectPin, IPin dcPin, IPin resetPin,
+ public St7789(ISpiBus spiBus, IPin chipSelectPin, IPin dcPin, IPin? resetPin,
int width, int height, ColorMode colorMode = ColorMode.Format12bppRgb444)
: base(spiBus, chipSelectPin, dcPin, resetPin, width, height, colorMode)
{
@@ -63,7 +63,7 @@ public St7789(ISpiBus spiBus, IPin chipSelectPin, IPin dcPin, IPin resetPin,
/// Height of display in pixels
/// The color mode to use for the display buffer
public St7789(ISpiBus spiBus, IDigitalOutputPort chipSelectPort,
- IDigitalOutputPort dataCommandPort, IDigitalOutputPort resetPort,
+ IDigitalOutputPort dataCommandPort, IDigitalOutputPort? resetPort,
int width, int height, ColorMode colorMode = ColorMode.Format12bppRgb444) :
base(spiBus, chipSelectPort, dataCommandPort, resetPort, width, height, colorMode)
{
diff --git a/Source/Meadow.Foundation.Peripherals/Displays.TftSpi/Driver/TftSpiBase.cs b/Source/Meadow.Foundation.Peripherals/Displays.TftSpi/Driver/TftSpiBase.cs
index fb51072c8..03f627ff2 100644
--- a/Source/Meadow.Foundation.Peripherals/Displays.TftSpi/Driver/TftSpiBase.cs
+++ b/Source/Meadow.Foundation.Peripherals/Displays.TftSpi/Driver/TftSpiBase.cs
@@ -109,11 +109,6 @@ public SpiClockConfiguration.Mode SpiBusMode
///
protected IPixelBuffer imageBuffer = default!;
- ///
- /// The read buffer
- ///
- protected Memory readBuffer;
-
///
/// Data convenience bool
///
@@ -271,7 +266,6 @@ protected void CreateBuffer(ColorMode colorMode, int width, int height)
{
imageBuffer = new BufferRgb444(width, height);
}
- readBuffer = new byte[imageBuffer.ByteCount];
}
///
@@ -415,7 +409,7 @@ public void Show()
dataCommandPort.State = Data;
- spiDisplay.Bus.Exchange(chipSelectPort, imageBuffer.Buffer, readBuffer.Span);
+ spiDisplay.Bus.Write(chipSelectPort, imageBuffer.Buffer);
}
///
@@ -467,10 +461,9 @@ public void Show(int left, int top, int right, int bottom)
{
int sourceIndex = (int)((y * Width + left) * bytesPerPixel);
- spiDisplay.Bus.Exchange(
+ spiDisplay.Bus.Write(
chipSelectPort,
- imageBuffer.Buffer[sourceIndex..(sourceIndex + len)],
- readBuffer.Span[0..len]);
+ imageBuffer.Buffer[sourceIndex..(sourceIndex + len)]);
}
}
diff --git a/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.Ftxxxx/Samples/Ft232h_Sample/Ft232h_Sample.csproj b/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.Ftxxxx/Samples/Ft232h_Sample/Ft232h_Sample.csproj
index fe9d33e45..0a999b65e 100644
--- a/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.Ftxxxx/Samples/Ft232h_Sample/Ft232h_Sample.csproj
+++ b/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.Ftxxxx/Samples/Ft232h_Sample/Ft232h_Sample.csproj
@@ -8,6 +8,7 @@
+
diff --git a/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.Ftxxxx/Samples/Ft232h_Sample/Program.cs b/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.Ftxxxx/Samples/Ft232h_Sample/Program.cs
index 052e70ad2..4c666698c 100644
--- a/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.Ftxxxx/Samples/Ft232h_Sample/Program.cs
+++ b/Source/Meadow.Foundation.Peripherals/ICs.IOExpanders.Ftxxxx/Samples/Ft232h_Sample/Program.cs
@@ -1,8 +1,11 @@
// See https://aka.ms/new-console-template for more information
using Meadow;
+using Meadow.Foundation.Displays;
+using Meadow.Foundation.Graphics;
using Meadow.Foundation.ICs.IOExpanders;
using Meadow.Foundation.Sensors.Light;
using Meadow.Hardware;
+using Meadow.Peripherals.Displays;
using System.Diagnostics;
Console.WriteLine("HELLO FROM THE WILDERNESS FT232H DRIVER!");
@@ -12,7 +15,37 @@
//await TestGpio(FtdiExpanderCollection.Devices);
//await TestI2C(FtdiExpanderCollection.Devices[0]);
-await TestSPI(FtdiExpanderCollection.Devices[0]);
+//await TestSPI(FtdiExpanderCollection.Devices[0]);
+await TestSPIDisplay(FtdiExpanderCollection.Devices[0]);
+
+async Task TestSPIDisplay(FtdiExpander expander)
+{
+ var display = new St7789
+ (
+ spiBus: expander.CreateSpiBus(),
+ chipSelectPin: expander.Pins.D0,
+ dcPin: expander.Pins.D1,
+ resetPin: null,
+ 135, 240
+ );
+
+ var microGraphics = new MicroGraphics(display)
+ {
+ CurrentFont = new Font12x16(),
+ Rotation = RotationType._270Degrees
+ };
+
+ microGraphics.Clear();
+ microGraphics.DrawText(0, 0, "Loading Menu");
+ microGraphics.Show();
+
+ while (true)
+ {
+ Debug.WriteLine("Sleeping...");
+
+ await Task.Delay(1000);
+ }
+}
async Task TestSPI(FtdiExpander expander)
{