File tree 1 file changed +25
-4
lines changed
1 file changed +25
-4
lines changed Original file line number Diff line number Diff line change 18
18
#define HardwareI2C TwoWire
19
19
#endif
20
20
21
+ typedef enum {
22
+ STOP = 0 ,
23
+ GENTLE = 25 ,
24
+ MODERATE = 30 ,
25
+ MEDIUM = 35 ,
26
+ INTENSE = 40 ,
27
+ POWERFUL = 45 ,
28
+ MAXIMUM = 50
29
+ } VibroPowerLevel;
30
+
21
31
void __increaseI2CPriority ();
22
32
23
33
class ModulinoClass {
@@ -226,12 +236,23 @@ class ModulinoVibro : public Module {
226
236
public:
227
237
ModulinoVibro (uint8_t address = 0xFF )
228
238
: Module(address, " VIBRO" ) {}
229
- void on (size_t len_ms) {
230
- uint8_t buf[8 ];
231
- uint32_t freq = 100 ;
239
+ void on (size_t len_ms, bool block, int power = MAXIMUM ) {
240
+ uint8_t buf[12 ];
241
+ uint32_t freq = 1000 ;
232
242
memcpy (&buf[0 ], &freq, 4 );
233
243
memcpy (&buf[4 ], &len_ms, 4 );
234
- write (buf, 8 );
244
+ memcpy (&buf[8 ], &power, 4 );
245
+ write (buf, 12 );
246
+ if (block) {
247
+ delay (len_ms);
248
+ off ();
249
+ }
250
+ }
251
+ void on (size_t len_ms) {
252
+ on (len_ms, false );
253
+ }
254
+ void on (size_t len_ms, int power) {
255
+ on (len_ms, false , power);
235
256
}
236
257
void off () {
237
258
uint8_t buf[8 ];
You can’t perform that action at this time.
0 commit comments