4747import digitalio
4848import audioio
4949from gamepad import GamePad
50- import adafruit_lsm6ds
5150from adafruit_pybadger .pybadger_base import PyBadgerBase
5251
5352__version__ = "0.0.0-auto.0"
5453__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_PyBadger.git"
5554
56- Buttons = namedtuple ("Buttons" , "b a start right down up left" )
55+ Buttons = namedtuple ("Buttons" , ( "o" , "x" , "z" , " right" , " down" , "up" , " left") )
5756
5857
5958class PewPewM4 (PyBadgerBase ):
@@ -65,10 +64,14 @@ class PewPewM4(PyBadgerBase):
6564 def __init__ (self ):
6665 super ().__init__ ()
6766
68-
6967 self ._buttons = GamePad (
70- digitalio .DigitalInOut (board .BUTTON_A ),
71- digitalio .DigitalInOut (board .BUTTON_B ),
68+ digitalio .DigitalInOut (board .BUTTON_O ),
69+ digitalio .DigitalInOut (board .BUTTON_X ),
70+ digitalio .DigitalInOut (board .BUTTON_Z ),
71+ digitalio .DigitalInOut (board .BUTTON_RIGHT ),
72+ digitalio .DigitalInOut (board .BUTTON_DOWN ),
73+ digitalio .DigitalInOut (board .BUTTON_UP ),
74+ digitalio .DigitalInOut (board .BUTTON_LEFT ),
7275 )
7376
7477 @property
@@ -82,27 +85,39 @@ def button(self):
8285 from adafruit_pybadger import pybadger
8386
8487 while True:
85- if pybadger.button.a :
86- print("Button A ")
87- elif pybadger.button.b :
88- print("Button B ")
88+ if pybadger.button.x :
89+ print("Button X ")
90+ elif pybadger.button.o :
91+ print("Button O ")
8992 """
9093 button_values = self ._buttons .get_pressed ()
9194 return Buttons (
92- button_values & PyBadgerBase .BUTTON_B , button_values & PyBadgerBase .BUTTON_A
95+ * [
96+ button_values & button
97+ for button in (
98+ PyBadgerBase .BUTTON_B ,
99+ PyBadgerBase .BUTTON_A ,
100+ PyBadgerBase .BUTTON_START ,
101+ PyBadgerBase .BUTTON_SELECT ,
102+ PyBadgerBase .BUTTON_RIGHT ,
103+ PyBadgerBase .BUTTON_DOWN ,
104+ PyBadgerBase .BUTTON_UP ,
105+ )
106+ ]
93107 )
94108
95109 @property
96110 def _unsupported (self ):
97- """This feature is not supported on CLUE ."""
98- raise NotImplementedError ("This feature is not supported on CLUE ." )
111+ """This feature is not supported on PewPew M4 ."""
112+ raise NotImplementedError ("This feature is not supported on PewPew M4 ." )
99113
100114 # The following is a list of the features available in other PyBadger modules but
101115 # not available for CLUE. If called while using a CLUE, they will result in the
102116 # NotImplementedError raised in the property above.
103117 light = _unsupported
118+ acceleration = _unsupported
119+ pixels = _unsupported
104120
105121
106-
107- clue = Clue () # pylint: disable=invalid-name
122+ pewpewm4 = PewPewM4 () # pylint: disable=invalid-name
108123"""Object that is automatically created on import."""
0 commit comments