File tree Expand file tree Collapse file tree 1 file changed +5
-0
lines changed Expand file tree Collapse file tree 1 file changed +5
-0
lines changed Original file line number Diff line number Diff line change 80
80
# pylint: enable=bad-whitespace
81
81
82
82
class MPR121_Channel ():
83
+ """Helper class to represent a touch channel on the MPR121. Not meant to
84
+ be used directly."""
83
85
def __init__ (self , mpr121 , channel ):
84
86
self ._mpr121 = mpr121
85
87
self ._channel = channel
86
88
87
89
@property
88
90
def value (self ):
91
+ """Whether the touch pad is being touched or not."""
89
92
return self ._mpr121 .touched () & (1 << self ._channel ) != 0
90
93
91
94
@property
95
+ """The raw touch measurement."""
92
96
def raw_value (self ):
93
97
return self ._mpr121 .filtered_data (self ._channel )
94
98
@@ -110,6 +114,7 @@ def __getitem__(self, key):
110
114
111
115
@property
112
116
def touched_pins (self ):
117
+ """A tuple of touched state for all pins."""
113
118
touched = self .touched ()
114
119
return tuple ([bool (touched >> i & 0x01 ) for i in range (12 )])
115
120
You can’t perform that action at this time.
0 commit comments