public static void Initialize(Cpu.Pin PortId)
 {
     if (_this == null)
     {
         _this = new CapacitiveTouchController(PortId);
     }
 }
        // This method is run when the mainboard is powered up or reset.
        void ProgramStarted()
        {
            multicolorLED.BlinkOnce(GT.Color.Red);
            //7" Displays
            Display.Width  = 800;
            Display.Height = 480;
            Display.OutputEnableIsFixed      = false;
            Display.OutputEnablePolarity     = true;
            Display.PixelPolarity            = false;
            Display.PixelClockRateKHz        = 30000;
            Display.HorizontalSyncPolarity   = false;
            Display.HorizontalSyncPulseWidth = 48;
            Display.HorizontalBackPorch      = 88;
            Display.HorizontalFrontPorch     = 40;
            Display.VerticalSyncPolarity     = false;
            Display.VerticalSyncPulseWidth   = 3;
            Display.VerticalBackPorch        = 32;
            Display.VerticalFrontPorch       = 13;
            Display.Type = Display.DisplayType.Lcd;
            if (Display.Save())      // Reboot required?
            {
                PowerState.RebootDevice(false);
            }
            //set up touch screen
            CapacitiveTouchController.Initialize(GHI.Pins.FEZRaptor.Socket13.Pin3);

            window = GlideLoader.LoadWindow(Resources.GetString(Resources.StringResources.MyForm));
            //glide init
            GlideTouch.Initialize();

            GHI.Glide.UI.Button btn = (GHI.Glide.UI.Button)window.GetChildByName("btnTest");
            img          = (GHI.Glide.UI.Image)window.GetChildByName("img1");
            txtLora      = (GHI.Glide.UI.TextBlock)window.GetChildByName("txtLora");
            txtStatus    = (GHI.Glide.UI.TextBlock)window.GetChildByName("txtStatus");
            txtSPO2      = (GHI.Glide.UI.TextBlock)window.GetChildByName("txtSPO2");
            txtSignal    = (GHI.Glide.UI.TextBlock)window.GetChildByName("txtSignal");
            txtPulseRate = (GHI.Glide.UI.TextBlock)window.GetChildByName("txtPulseRate");
            txtDesc      = (GHI.Glide.UI.TextBlock)window.GetChildByName("txtDesc");
            img.Visible  = false;

            btn.TapEvent += btn_TapEvent;

            Glide.MainWindow = window;
            //reset lora
            _restPort.Write(false);
            Thread.Sleep(1000);
            _restPort.Write(true);
            Thread.Sleep(1000);

            _loraSerial = new SimpleSerial(GHI.Pins.FEZRaptor.Socket10.SerialPortName, 57600);
            _loraSerial.Open();
            _loraSerial.DataReceived += _loraSerial_DataReceived;
            //get version
            _loraSerial.WriteLine("sys get ver");
            Thread.Sleep(1000);
            //pause join
            _loraSerial.WriteLine("mac pause");
            Thread.Sleep(1000);
            //antena power
            _loraSerial.WriteLine("radio set pwr 14");
            Thread.Sleep(1000);
            //set device to receive
            _loraSerial.WriteLine("radio rx 0"); //set module to RX
        }
 public static void Initialize(Cpu.Pin PortId)
 {
     if (_this == null)
         _this = new CapacitiveTouchController(PortId);
 }