File tree Expand file tree Collapse file tree 1 file changed +22
-1
lines changed
Expand file tree Collapse file tree 1 file changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -23,9 +23,13 @@ class Keyboard:
2323 """Send HID keyboard reports."""
2424
2525 LED_NUM_LOCK = 0x01
26+ """LED Usage ID for Num Lock"""
2627 LED_CAPS_LOCK = 0x02
28+ """LED Usage ID for Caps Lock"""
2729 LED_SCROLL_LOCK = 0x04
30+ """LED Usage ID for Scroll Lock"""
2831 LED_COMPOSE = 0x08
32+ """LED Usage ID for Compose"""
2933
3034 # No more than _MAX_KEYPRESSES regular keys may be pressed at once.
3135
@@ -155,5 +159,22 @@ def led_status(self):
155159 return self ._keyboard_device .last_received_report
156160
157161 def led_on (self , led_code ):
158- """Returns whether an LED is on based on the led code"""
162+ """Returns whether an LED is on based on the led code
163+
164+ Examples::
165+
166+ import usb_hid
167+ from adafruit_hid.keyboard import Keyboard
168+ from adafruit_hid.keycode import Keycode
169+ import time
170+
171+ # Press and release CapsLock.
172+ kbd.press(Keycode.CAPS_LOCK)
173+ time.sleep(.09)
174+ kbd.release(Keycode.CAPS_LOCK)
175+
176+ # Check status of the LED_CAPS_LOCK
177+ print(kbd.led_on(Keyboard.LED_CAPS_LOCK))
178+
179+ """
159180 return bool (self .led_status [0 ] & led_code )
You can’t perform that action at this time.
0 commit comments