Cerberus + N18 Display using Util.SetSpecialDisplayConfig

Before I dig into the code, has anyone successfully used Util.SetSpecialDisplayConfig to enable flushing of a bitmap to the N18 display connected to a Cerberus?

By allocating the bitmap early I am able to successfully allocate the full bitmap of 128*160 without memory issues. The problem is that when I flush the bitmap it seems that the data is corrupted, it looks like the center of the screen is considered 0, 0 and everything rendered is limited to the bottom right corner.

Here is the code I am testing with
Note: I have restricted the amount of the bitmap that is flushed so that the issue is visible. When flushing the full bitmap the same problem exists, but it wraps around and clears the ellipse.


using GHI.OSHW.Hardware;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using GT = Gadgeteer;

namespace TinkerKitGame
{
    public partial class Program
    {
        // Allocate the bitmap early ensures that there is enough memory
        private Bitmap _surface = new Bitmap(128, 160);

        void ProgramStarted()
        {
            display_N18.Clear();

            // SPI Configuration for socket 5
            SPI.Configuration spi = new SPI.Configuration((Cpu.Pin)47, false, 0, 0, false, true, 12000, SPI.SPI_module.SPI1);
            Util.SetSpecialDisplayConfig(spi, Util.BPP_Type.BPP16_BGR_LE);

            // Draw on the bitmap
            _surface.DrawRectangle(GT.Color.Red, 1, 0, 0, 160, 128, 0, 0, GT.Color.Red, 0, 0, GT.Color.Red, 0, 0, Bitmap.OpacityOpaque);
            _surface.DrawEllipse(GT.Color.White, 25, 25, 20, 20);

            // I have restricted the amount of the bitmap that is flushed so that the issue is visible.
            // When flushing the full bitmap the same problem exists, but it wraps around and clears the ellipse.
            //_surface.Flush();
            _surface.Flush(0, 0, 128, 50);            
        }
    }
}


I found the issue, out of laziness I did not pass all the arguments to the Util.SetSpecialDisplayConfig call, I incorrectly thought the defaults for the last 2 arguments would be fine, but I needed to pass the CpuPin for the last argument.

The following works on socket 5 on the Cerberus.


Util.SetSpecialDisplayConfig(spi, Util.BPP_Type.BPP16_BGR_BE, 0, (Cpu.Pin)24);