Beispiel #1
0
        private static bool SetupLCD()
        {
            if (_lcd == null)
            {
                try
                {
                    //_lcd = new Lcd(new GpioLcdTransferProvider(Pins.GPIO_PIN_D13 // rs
                    //                                           , Pins.GPIO_PIN_D12 // enable
                    //                                           , Pins.GPIO_PIN_D8 // d4
                    //                                           , Pins.GPIO_PIN_D9 // d5
                    //                                           , Pins.GPIO_PIN_D10 // d6
                    //                                           , Pins.GPIO_PIN_D11 // d7
                    //                   )
                    //               , Pins.GPIO_NONE // Back light
                    //    );

                    var shifter = new BaseShifterLcdTransferProvider.ShifterSetup
                    {
                        RW     = ShifterPin.GP1, // not used
                        RS     = ShifterPin.GP0,
                        Enable = ShifterPin.GP2,
                        D4     = ShifterPin.GP4,
                        D5     = ShifterPin.GP5,
                        D6     = ShifterPin.GP6,
                        D7     = ShifterPin.GP7,
                        BL     = ShifterPin.GP3,
                    };
                    _lcd = new Lcd(new MCP23008LcdTransferProvider(I2CBusExtension.GetSingleton(), 0x27, shifter));
                    _lcd.Initialize(16, 2);
                    // LCD is now ready, let's test it!
                    _lcd.BackLightDuration = Timeout.Infinite;
                    _lcd.Backlight         = true;
                    _lcd.Clear();
                    _lcd.SetCursorPosition(0, 0);
                    _lcd.Write("LCD Ready");
                }
                catch (Exception ex)
                {
                    DebugLogger.TryLog(Resources.GetString(Resources.StringResources.LCDError));
                    _lcd = null;
                }
            }
            return(_lcd != null);
        }
Beispiel #2
0
 public static DS1307 GetSingleton()
 {
     return(_singleton ?? (_singleton = new DS1307(I2CBusExtension.GetSingleton())));
 }