public SensorsHandler(USBHost usbHostObject, Button buttonObject) { // Set objects usbHost = usbHostObject; button = buttonObject; // Initialize variables oldX = oldY = ""; oldTempC = oldPressureMb = oldPressureMb = 0; lastWrittenX = lastWrittenY = 0; wasMouseFailed = wasSensorFailed = true; bme280Working = false; isMouseConnected = false; // Setup USBHost patched module and get mouse if already connected InitMouse(); // Setup bosch bme280 sensor Thread setupSensor = new Thread(InitSensor); setupSensor.Start(); // Mouse timers GT.Timer mouseTimer = new GT.Timer(500); mouseTimer.Tick += mouseTimer_Tick; mouseTimer.Start(); // Mouse persistence timer GT.Timer persistenceTimer = new GT.Timer(6000); persistenceTimer.Tick += persistenceTimer_Tick; persistenceTimer.Start(); }
void usbHost_MouseConnected(USBHost sender, GHI.Usb.Host.Mouse mouse) { // Get Mouse information uint id = mouse.Id; byte interfaceIndex = mouse.InterfaceIndex; ushort vendorId = mouse.VendorId; ushort productId = mouse.ProductId; byte portNumber = mouse.PortNumber; BaseDevice.DeviceType type = mouse.Type; // Remove ghi mouse object Mouse.CleanGhiMouse(); // Create new PLCS Mouse Object this.mouse = new Mouse(id, interfaceIndex, vendorId, productId, portNumber, type); this.mouse.Disconnected += mouse_Disconnected; if (mouseFirstConnect) { LoadMouseData(); } isMouseConnected = true; Debug.Print("Mouse Connected"); Display.UpdateMouseState(true); }
private void usbHost_MouseConnected(USBHost sender, GHI.Usb.Host.Mouse mouse) { mouse.ButtonChanged += (s, e) => { switch (e.Which) { case GHI.Usb.Buttons.Left: Move(Action.Left); break; case GHI.Usb.Buttons.Middle: Move(Action.Stop); break; case GHI.Usb.Buttons.Right: Move(Action.Right); break; case GHI.Usb.Buttons.Extended1: // back button Move(Action.Backward); break; case GHI.Usb.Buttons.Extended2: // forward button Move(Action.Forward); break; } ; }; Log("Mouse Connected!"); }
public PromptForm(ref GHI.Glide.Display.Window window, ref Gadgeteer.Modules.GHIElectronics.DisplayTE35 displayTE35, ref SDCard sdCard, ref USBHost usbHost, ref USBClientEDP usbClientEDP, ref WiFiRS21 wifiRS21) : base(ref window) { this.usbClientEDP = usbClientEDP; this.usbHost = usbHost; this.sdCard = sdCard; this.displayTE35 = displayTE35; this.wifiRS21 = wifiRS21; }
static public void Init(TextScreenBase textScreen) { if (textScreen != null) { TextScreen = textScreen; } mDebugger.Send("Before Core.Global.Init"); Core.Global.Init(); //TODO Redo this - Global init should be other. // Move PCI detection to hardware? Or leave it in core? Is Core PC specific, or deeper? // If we let hardware do it, we need to protect it from being used by System. // Probably belongs in hardware, and core is more specific stuff like CPU, memory, etc. //Core.PCI.OnPCIDeviceFound = PCIDeviceFound; //TODO: Since this is FCL, its "common". Otherwise it should be // system level and not accessible from Core. Need to think about this // for the future. Console.Clear(); Console.WriteLine("Finding PCI Devices"); mDebugger.Send("PCI Devices"); PCI.Setup(); Console.WriteLine("Starting USB"); mDebugger.Send("USB Devices"); USBHost.Initialize(); Console.WriteLine("Starting ACPI"); mDebugger.Send("ACPI Init"); ACPI.Start(); // http://wiki.osdev.org/%228042%22_PS/2_Controller#Initialising_the_PS.2F2_Controller // TODO: USB should be initialized before the PS/2 controller // TODO: ACPI should be used to check if a PS/2 controller exists mDebugger.Send("PS/2 Controller Init"); PS2Controller.Initialize(); IDE.InitDriver(); AHCI.InitDriver(); //EHCI.InitDriver(); mDebugger.Send("Done initializing Cosmos.HAL.Global"); }
public GvShell(ref SDCard sdCard, ref USBHost usbHost, ref DisplayTE35 displayT35, ref USBClientEDP usbClientEdp, ref WiFiRS21 wifiRS21) { //initial / default params ForeGround = GT.Color.White; BackGround = GT.Color.Black; ScreenWidth = 320; ScreenHeight = 240; this.wifiRS21 = wifiRS21; this.displayTE35 = displayT35; this.usbHost = usbHost; this.usbClientEDP = usbClientEdp; this.sdCard = sdCard; Screen = new Bitmap(ScreenWidth, ScreenHeight); ClearScreen(); MaxLine = ScreenHeight / 20; CurrentLine = 0; CurrentFont = Resources.GetFont(Resources.FontResources.NinaB); CurrentPath = "\\SD\\"; DataLines = new ArrayList(); for (int i = 0; i < MaxLine; i++) { DataLines.Add(string.Empty); } TypedCommand = string.Empty; if (basic == null) { if (basic == null) { basic = new SBASIC(); basic.Print += Basic_Print; basic.ClearScreen += Basic_ClearScreen; } } //setup network wifiRS21.DebugPrintEnabled = true; NetworkChange.NetworkAvailabilityChanged += NetworkChange_NetworkAvailabilityChanged; NetworkChange.NetworkAddressChanged += NetworkChange_NetworkAddressChanged; //setup network wifiRS21.NetworkInterface.Open(); wifiRS21.NetworkInterface.EnableDhcp(); wifiRS21.NetworkInterface.EnableDynamicDns(); }