Skip to content

Commit e579106

Browse files
changed to I2C type and added acceleration, light, buttons, and boop type.
1 parent e72e6ec commit e579106

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

adafruit_monsterm4sk.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@
4040
import adafruit_lis3dh
4141

4242
try:
43-
from circuitpython_typing.device_drivers import I2CDeviceDriver
44-
from typing import Optional
43+
from busio import I2C
44+
from typing import Optional, Dict, Union
4545
except ImportError:
4646
pass
4747

@@ -68,7 +68,7 @@ class MonsterM4sk:
6868
The right screen is the one USB port directly above it.
6969
"""
7070

71-
def __init__(self, i2c: Optional[I2CDeviceDriver] = None):
71+
def __init__(self, i2c: Optional[I2C] = None):
7272
"""
7373
:param i2c: The I2C bus to use, will try board.I2C()
7474
if not supplied
@@ -156,7 +156,7 @@ def __init__(self, i2c: Optional[I2CDeviceDriver] = None):
156156
self.nose.threshold = 180
157157

158158
@property
159-
def acceleration(self):
159+
def acceleration(self) -> Union[float, None]:
160160
"""Accelerometer data, +/- 2G sensitivity.
161161
162162
This example initializes the mask and prints the accelerometer data.
@@ -175,7 +175,7 @@ def acceleration(self):
175175
)
176176

177177
@property
178-
def light(self):
178+
def light(self) -> int:
179179
"""Light sensor data.
180180
181181
This example initializes the mask and prints the light sensor data.
@@ -190,7 +190,7 @@ def light(self):
190190
return self._ss.analog_read(SS_LIGHTSENSOR_PIN)
191191

192192
@property
193-
def buttons(self):
193+
def buttons(self) -> Dict[str, bool]:
194194
"""Buttons dictionary.
195195
196196
This example initializes the mask and prints when the S9 button
@@ -214,7 +214,7 @@ def buttons(self):
214214
}
215215

216216
@property
217-
def boop(self):
217+
def boop(self) -> bool:
218218
"""Nose touch sense.
219219
220220
This example initializes the mask and prints when the nose touch pad

0 commit comments

Comments
 (0)