Skip to content

Commit adcd972

Browse files
committed
Provide a manual mock of the keypad module
This resolves a doc building problem where the `key_count` property of the Keys object needed to be used.
1 parent 2e300a8 commit adcd972

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import sys
99

1010
sys.path.insert(0, os.path.abspath(".."))
11+
sys.path.insert(0, os.path.abspath("mocks"))
1112

1213
# -- General configuration ------------------------------------------------
1314

@@ -45,7 +46,6 @@
4546
"audiopwmio",
4647
"audiobusio",
4748
"audiomp3",
48-
"keypad",
4949
]
5050

5151
# Add any paths that contain templates here, relative to this directory.

docs/mocks/keypad.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# SPDX-FileCopyrightText: 2021 Jeff Eplerfor Adafruit Industries
2+
#
3+
# SPDX-License-Identifier: MIT
4+
class EventQueue:
5+
def __init__(self):
6+
self.overflowed = False
7+
8+
def get(self):
9+
return None
10+
11+
12+
class Keys:
13+
def __init__(self, pins, value_when_pressed, pull):
14+
self.key_count = len(pins)
15+
self.events = EventQueue()

0 commit comments

Comments
 (0)