public TOLEDDisplayAdapter(TOLEDDisplay dsp) { this.dsp = dsp; deviceImage = new int[dsp.width, dsp.height]; }
public void init() { var device = new RPI(); var namedPins = new TNamedPins(); //namedPins.Add("LOW", device.createPin(GPIOPins.V2_GPIO_03, GPIODirection.Out, false)); //namedPins.Add("HI", device.createPin(GPIOPins.V2_GPIO_27, GPIODirection.Out, true)); //namedPins.Add("SER", device.createPin(GPIOPins.V2_GPIO_02, GPIODirection.Out, false)); //namedPins.Add("OE", null); //namedPins.Add("RCLK", device.createPin(GPIOPins.V2_GPIO_04, GPIODirection.Out, false)); //namedPins.Add("SRCLK", device.createPin(GPIOPins.V2_GPIO_17, GPIODirection.Out, false)); //namedPins.Add("SRCLR", null); //namedPins.Add("O7", device.createPin(GPIOPins.V2_GPIO_10, GPIODirection.In)); //namedPins.Add("CP", device.createPin(GPIOPins.V2_GPIO_09, GPIODirection.Out, false)); //namedPins.Add("PL", device.createPin(GPIOPins.V2_GPIO_11, GPIODirection.Out, false)); //--- namedPins.Add("SER", device.createPin(GPIOPins.V2_GPIO_17, GPIODirection.Out, false)); namedPins.Add("OE", null); namedPins.Add("RCLK", device.createPin(GPIOPins.V2_GPIO_22, GPIODirection.Out, false)); namedPins.Add("SRCLK", device.createPin(GPIOPins.V2_GPIO_27, GPIODirection.Out, false)); namedPins.Add("SRCLR", null); namedPins.Add("O7", device.createPin(GPIOPins.V2_GPIO_23, GPIODirection.In)); namedPins.Add("CP", device.createPin(GPIOPins.V2_GPIO_24, GPIODirection.Out, false)); namedPins.Add("PL", device.createPin(GPIOPins.V2_GPIO_25, GPIODirection.Out, false)); sipo = new TSIPO(namedPins["SER"], namedPins["OE"], namedPins["RCLK"], namedPins["SRCLK"], namedPins["SRCLR"]); //sipo.setBits(new int[200]); //clear all //WARNING: CAN DESTROY SCREEN! USE POWER UP / DOWN SEQUENCE!! piso = new TPISO(namedPins["O7"], namedPins["PL"], namedPins["CP"]); ledMapping = new TBitMapping(8); ledMapping.setMapping(0, 1, 2, 3, 7, 6, 5, 4); ledMappingBottom = new TBitMapping(8); ledMappingBottom.setMapping(0, 1, 2, 3, 7, 6, 5, 4); //OK? ledMappingRight = new TBitMapping(8); ledMappingRight.setMapping(0, 1, 2, 3, 7, 6, 5, 4); //OK //1000 0000 ledMappingSpecial = new TBitMapping(8); ledMappingSpecial.setMapping(0, 1, 2, 3, 7, 6, 5, 4); //CHECK outMapping = new TBitMapping(8); //outMapping.setMapping(4, 0, 1, 2, 5, 6, 7, 3); //outMapping.setMapping(3, 7, 6, 5, 2, 1, 0, 4); outMapping.setMapping(7, 6, 5, 4, 3, 2, 1, 0); //0000 //0001 //outMappingBugFix = new TBitMapping(8); //outMappingBugFix.setMapping(4, 0, 1, 2, 5, 7, 6, 3); sideMapping = new TBitMapping(8); //sideMapping.setMapping(7, 0, 1, 2, 3, 4, 5, 6); sideMapping.setMapping(0, 1, 2, 3, 4, 5, 6, 7); sideSwitchesOld = new bool[sideSwitchCount]; sideSwitchesNew = new bool[sideSwitchCount]; sideSwitchesOldDelay = new bool[sideSwitchCount]; sideSwitchesNewDelay = new bool[sideSwitchCount]; //screen var D16_SDI = new GPIOMem(GPIOPins.V2_GPIO_10, GPIODirection.Out, false); var D17_CLK = new GPIOMem(GPIOPins.V2_GPIO_11, GPIODirection.Out, false); var CS = new GPIOMem(GPIOPins.V2_GPIO_08, GPIODirection.Out, false); var RST = device.createPin(GPIOPins.V2_GPIO_18, GPIODirection.Out, false); var RS = new GPIOMem(GPIOPins.V2_GPIO_04, GPIODirection.Out, false); var spi = new TSPIEmulator(D16_SDI, null, D17_CLK, CS); var watch = new System.Diagnostics.Stopwatch(); var bus = new TOLEDSPIFastDataBus(spi, RST, RS); lcd = new TOLEDDisplay(bus, this); lcd.orientation(3); lcd.background(Color.Black); displayPowerOff(); }