USBHost 函式庫
86Duino IDE 從 Coding 104 開始加入此函式庫,此函式庫實做 Arduino Due’s USBHost 函式庫的 API,可以透過 86Duino 的 USB 2.0 接口存取 USB 鍵盤和滑鼠。
USBHost 類別
Mouse Controller
MouseController 函式庫建立 USB 滑鼠和 86Duino 的通訊。
- MouseController
- mouseMoved()
- mouseDragged()
- mousePressed()
- mouseReleased()
- getXChange()
- getYChange()
- getButton()
Keyboard Controller
KeyboardController 函式庫建立 USB 鍵盤和 86Duino 的通訊。
- KeyboardController
- keyPressed()
- keyReleased()
- getModifiers()
- getKey()
- getOemKey()
注意: 86Duino 的 BIOS 必須是 Guava 0.95 或以上,才能使用 KeyboardController 函式庫。(如果 86Duino 的 BIOS 版本是舊的,可以使用 SysImage 工具更新)
範例
以下是 Arduino 課程中 USBHost 函式庫的範例,這些範例可以在 86Duino 上運行:
- MouseController:在程式中示範 MouseController 的使用。
- KeyboardController:在程式中示範 KeyboardController 的使用。
Hack
事實上有了 86Duino BIOS 的幫助,處理 USB 鍵盤和滑鼠就和 PS/2 鍵盤和滑鼠一樣;所以在 86Duino 可以使用 C 輸入/輸出函式存取 USB 鍵盤,如 getchar() 和 scanf() ,存取 USB 滑鼠可以使用 INT 33H 滑鼠中斷服務常式。實做 USBHost 函式庫是為了與 Arduino Due 相容。
The text of the 86Duino reference is a modification of the Arduino reference, and is licensed under a Creative Commons Attribution-ShareAlike 3.0 License. Code samples in the reference are released into the public domain.