All devices now also have a native SPI display provider that is used just like the existing parallel displays. On a DisplayController created for the SPI native API, call ApplySettings with an instance of SpiDisplayControllerSettings. Then just create an instance of Graphics like previously. Some displays, like the N18, require certain configuration before flushing data, so make sure to do that yourself before calling Flush. It’s also expected that you initialize the display itself as well.
Is there any example code available using this controller for the N18? I am experimenting with the G80 Development Board.
Reworking TinyCLR 0.9 code for G400 Development Board:
static void Main()
DisplayController displayController = DisplayController.GetDefault();
// Enter the proper display configurations
Width = 128,
Height = 160,
SpiSelector = G80.SpiBus.Spi2
Font font = Resource1.GetFont(Resource1.FontResources.small);
// Some needed objects
Graphics screen = Graphics.FromHdc(displayController.Hdc);
Pen GreenPen = new Pen(Color.Green);
// Start Drawing (to memroy)
screen.DrawEllipse(GreenPen, 40, 30, 20, 40);
// Flush the memory to the display. This is a very fast operation.
screen.DrawString("Text", font, new SolidBrush(Color.White), 50, 50);
// screen.FillRectangle(new SolidBrush(Color.Red), 10, 136, 460, 100);
// screen.DrawString("Overlay", font, new SolidBrush(Color.Black), 50, 150);
The following exception is thrown at runtime:
An unhandled exception of type ‘System.ArgumentException’ occurred in mscorlib.dll occurred
Also, what string is required for the “SpiSelector” setting?
I think you need to know the SPI port attached to the display. You are using SPI2 port. Anyway the driver doesn’t initialize the spi display. You need to send via direct SPI connection all the init commands BEFORE using the spi display driver itself.
I can’t help you about N18, but I think you can find info on the internet (arduino, netmf and so on…).