@@ -208,6 +208,44 @@ def sequence(self) -> "_DRV2605_Sequence":
208
208
"""
209
209
return self ._sequence
210
210
211
+ @property
212
+ def realtime_value (self ) -> int :
213
+ """The output value used in Real-Time Playback mode. When the device is
214
+ switched to ``MODE_REALTIME``, the motor is driven continuously with an
215
+ amplitude/direction determined by this value.
216
+
217
+ By default, the device expects a SIGNED 8-bit integer, and its exact
218
+ effect depends on both the type of motor (ERM/LRA) and whether the device
219
+ is operating in open- or closed-loop (unidirectional/bidirectional) mode.
220
+
221
+ See the datasheet for more information!
222
+
223
+ E.g.:
224
+
225
+ .. code-block:: python
226
+
227
+ # Start real-time playback
228
+ drv.realtime_value = 0
229
+ drv.mode = adafruit_drv2605.MODE_REALTIME
230
+
231
+ # Buzz the motor briefly at 50% and 100% amplitude
232
+ drv.realtime_value = 64
233
+ time.sleep(0.5)
234
+ drv.realtime_value = 127
235
+ time.sleep(0.5)
236
+
237
+ # Stop real-time playback
238
+ drv.realtime_value = 0
239
+ drv.mode = adafruit_drv2605.MODE_INTTRIG
240
+ """
241
+ return self ._read_u8 (_DRV2605_REG_RTPIN )
242
+
243
+ @realtime_value .setter
244
+ def realtime_value (self , val : int ) -> None :
245
+ if not - 127 <= val <= 255 :
246
+ raise ValueError ("Real-Time Playback value must be between -127 and 255!" )
247
+ self ._write_u8 (_DRV2605_REG_RTPIN , val )
248
+
211
249
def set_waveform (self , effect_id : int , slot : int = 0 ) -> None :
212
250
"""Select an effect waveform for the specified slot (default is slot 0,
213
251
but up to 8 effects can be combined with slot values 0 to 7). See the
0 commit comments