G80 has many GHI exclusive feature that we are proud of. We would like to dedicate this post to the SPI display support.
Normally, using SPI graphical displays with NETMF is extremely slow due to two reasons. First the image data has to be fetched from the internal bitmap class. What make this even slower is that the bitmap data is 16bit internally but then the returned data is 32bit! This results in a lot of memory allocation and fragmentation every time the screen is flushed. Most SPI displays are 16bit so after allocating and fragmenting memory, the data will have to be converted back to 16bit, yet another cause for more memory a location and fragmentation.
Converting the data from 32bit to 16bit will take a very long time. We are talking about few seconds. This doesn’t end here as the data may not be formatted to what the display expects. Is it RGB or BGR? Is it little endian or big endian? A few more seconds is needed to correct the format.
The second issue is covered by utilities data converter that has always been provided in the GHI libraries, but the first problem of the need of fetching the bitmap data was not resolved till the 2015 SDK added a built in feature that flush the data (internally) from the internal bitmap data directly to the SPI bus. Not only that, the data can be formatted internally to fit the display’s requirements. This feature is available only on G80 today but will be moved to all products in future releases. Note that products based on G80, like the FEZ Panda III, will automatically have this feature.
This feature gets better as it can be used to draw on large displays with systems that do not have enough memory, like G80 drawing on a 320x240 display. This should be impossible as 320x240x2= about 150KBytes. But this feature can be used to draw regions on the screen. For example, the full screen can be drawn by dividing it into 4 regions. A product, like thermostat for example, may only need to refresh one area of the screen. The Bitmap class with shapes and fonts are all available to draw on that area.
Good examples are the displays based on the ILI9341 controller. These are low cost ($6) 320x240 displays available from websites like eBay. Very few wires are needed to connect these SPI based displays and then used though the internal support. We will be providing complete code on codeshare but here is a snippet f what to expect.
// Create a bitmap like always and draw something on it, shapes, images fonts. var bmp = new Bitmap(160, 128); bmp.DrawEllipse(Colors.Red, 5, 5, 5, 5); // Tell the display where to draw tft.SetWindow(0, 159, 0, 119); tft.PrepareSendData(); // This call will internally convert the data and send over SPI bmp.Flush(0, 0, 160, 120);
So make sure you have one of these displays on your desk when you receive your FEZ Panda III and if you haven’t gotten you FEZ then here is where to get one https://www.ghielectronics.com/catalog/product/474
PS: There is a bug in the current SDK and the only bitmap size allowed is 160x128 but you can use a display of any size. This will be fixed in coming SDKs.
PPS: special thanks to Brett who pointed out this great display and who also shipped us one to test.