File tree 2 files changed +1398
-1377
lines changed
2 files changed +1398
-1377
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 {
@@ -242,12 +252,23 @@ class ModulinoVibro : public Module {
242
252
public:
243
253
ModulinoVibro (uint8_t address = 0xFF )
244
254
: Module(address, " VIBRO" ) {}
245
- void on (size_t len_ms) {
246
- uint8_t buf[8 ];
247
- uint32_t freq = 100 ;
255
+ void on (size_t len_ms, bool block, int power = MAXIMUM ) {
256
+ uint8_t buf[12 ];
257
+ uint32_t freq = 1000 ;
248
258
memcpy (&buf[0 ], &freq, 4 );
249
259
memcpy (&buf[4 ], &len_ms, 4 );
250
- write (buf, 8 );
260
+ memcpy (&buf[8 ], &power, 4 );
261
+ write (buf, 12 );
262
+ if (block) {
263
+ delay (len_ms);
264
+ off ();
265
+ }
266
+ }
267
+ void on (size_t len_ms) {
268
+ on (len_ms, false );
269
+ }
270
+ void on (size_t len_ms, int power) {
271
+ on (len_ms, false , power);
251
272
}
252
273
void off () {
253
274
uint8_t buf[8 ];
You can’t perform that action at this time.
0 commit comments