So while you all wait for Meadow and if you have a N3…
Netduino3 running NETMF 4.4 with VS2017 driving a 240x240px 1.3in IPS SPI display plugged into a GO socket.
using System;
using System.Threading;
using IngenuityMicro.Displays;
using IngenuityMicro.STM.Hardware;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using Microsoft.SPOT.Presentation.Media;
namespace DisplayTest
{
public class Program
{
private static Display13 _display;
private static Bitmap _bitMap;
private static Font _font;
private static int _counter;
private static uint _freeRam;
private static OutputPort _port2;
public static void Main()
{
Debug.EnableGCMessages(false);
_port2 = new OutputPort(Pin.PD10,true); // Juice pin for GO socket 2
_display = new Display13(Pin.PD14, Pin.PE8, Pin.PE7, Pin.PD1, SPI.SPI_module.SPI4);
_display.SetBacklight(true);
for (; ; )
{
if (_counter == 0)
{
_display.Clear();
_display.DrawRaw(Resources.GetBytes(Resources.BinaryResources.wl), 240, 36, 0, 100);
Thread.Sleep(2000);
DrawString("Ram: ", 10, 180, 32, ColorUtility.ColorFromRGB(255, 0, 0));
}
DrawString(_counter.ToString(), 20, 20, 72, ColorUtility.ColorFromRGB(255, 0, 255));
if (_counter % 25 == 0)
{
_freeRam = Debug.GC(false);
DrawString((_freeRam / 1024) + " kb", 80, 180, 32, ColorUtility.ColorFromRGB(0, 255, 0));
}
_counter++;
if (_counter == 100)
{
_display.Clear();
_display.DrawRaw(Resources.GetBytes(Resources.BinaryResources.min), 240, 240, 0, 0);
Thread.Sleep(2000);
_display.Clear();
DrawString("Ram: ", 10, 180, 32, ColorUtility.ColorFromRGB(255, 0, 0));
_display.DrawRaw(Resources.GetBytes(Resources.BinaryResources.wl), 240, 36, 0, 100);
}
if (_counter == 200)
{
_display.Clear();
_display.DrawRaw(Resources.GetBytes(Resources.BinaryResources.lion), 240, 240, 0, 0);
Thread.Sleep(2000);
_display.Clear();
DrawString("Ram: ", 10, 180, 32, ColorUtility.ColorFromRGB(255, 0, 0));
_counter = 0;
}
}
}
static void DrawString(string text, int x, int y, int s = 32, Microsoft.SPOT.Presentation.Media.Color colour = Microsoft.SPOT.Presentation.Media.Color.White)
{
switch (s)
{
case 32:
_font = Resources.GetFont(Resources.FontResources.Arial32);
_bitMap = new Bitmap(text.Length * 26, 52);
break;
case 72:
_font = Resources.GetFont(Resources.FontResources.Arial72);
_bitMap = new Bitmap(text.Length * 40, 72);
break;
}
_bitMap.DrawText(text, _font, colour, 0, 0);
_display.Draw(_bitMap, x, y);
_bitMap.Dispose();
}
}
}