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.Socket14.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; JoinWifi(); Thread.Sleep(500); if (client == null) { // create client instance MQTT_BROKER_ADDRESS = "cloud.makestro.com"; client = new MqttClient(MQTT_BROKER_ADDRESS); string clientId = Guid.NewGuid().ToString(); client.Connect(clientId, "mifmasterz", "123qweasd"); SubscribeMessage(); } Thread th1 = new Thread(new ThreadStart(Loop)); th1.Start(); }
// 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.Socket14.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; Thread th1 = new Thread(new ThreadStart(Loop)); th1.Start(); }