File tree Expand file tree Collapse file tree 2 files changed +3
-35
lines changed Expand file tree Collapse file tree 2 files changed +3
-35
lines changed Original file line number Diff line number Diff line change 1
- package keyboard
1
+ package ble
2
2
3
3
import (
4
4
"errors"
5
- "machine"
6
5
"machine/usb/hid"
7
6
)
8
7
@@ -57,13 +56,6 @@ const (
57
56
decodeByte3
58
57
)
59
58
60
- func init () {
61
- if Keyboard == nil {
62
- Keyboard = newKeyboard ()
63
- hid .SetHandler (Keyboard )
64
- }
65
- }
66
-
67
59
// New returns the USB hid-keyboard port.
68
60
// Deprecated, better to just use Port()
69
61
func New () * keyboard {
@@ -81,32 +73,8 @@ func newKeyboard() *keyboard {
81
73
}
82
74
}
83
75
84
- func (kb * keyboard ) TxHandler () bool {
85
- kb .waitTxc = false
86
- if b , ok := kb .buf .Get (); ok {
87
- kb .waitTxc = true
88
- hid .SendUSBPacket (b )
89
- return true
90
- }
91
- return false
92
- }
93
-
94
- func (kb * keyboard ) RxHandler (b []byte ) bool {
95
- if len (b ) >= 2 && b [0 ] == 2 /* ReportID */ {
96
- kb .led = b [1 ]
97
- }
98
- return false
99
- }
100
-
101
76
func (kb * keyboard ) tx (b []byte ) {
102
- if machine .USBDev .InitEndpointComplete {
103
- if kb .waitTxc {
104
- kb .buf .Put (b )
105
- } else {
106
- kb .waitTxc = true
107
- hid .SendUSBPacket (b )
108
- }
109
- }
77
+ sendBLEPacket (b )
110
78
}
111
79
112
80
func (kb * keyboard ) NumLockLed () bool {
Original file line number Diff line number Diff line change 1
- package keyboard
1
+ package ble
2
2
3
3
// Keycode is a package-defined bitmap used to encode the value of a given key.
4
4
type Keycode uint16
You can’t perform that action at this time.
0 commit comments