Skip to content

Commit 11450fd

Browse files
committed
consumer_control: Add press and release
Adds support for pressing and releasing the consumer control code
1 parent 1f4ced5 commit 11450fd

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

adafruit_hid/consumer_control.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,13 @@ def send(self, consumer_code):
6161
# Advance to next track (song).
6262
consumer_control.send(ConsumerControlCode.SCAN_NEXT_TRACK)
6363
"""
64+
self.press(consumer_code)
65+
self.release()
66+
67+
def press(self, consumer_code):
6468
struct.pack_into("<H", self._report, 0, consumer_code)
6569
self._consumer_device.send_report(self._report)
70+
71+
def release(self):
6672
self._report[0] = self._report[1] = 0x0
6773
self._consumer_device.send_report(self._report)

0 commit comments

Comments
 (0)