File tree Expand file tree Collapse file tree 1 file changed +25
-4
lines changed Expand file tree Collapse file tree 1 file changed +25
-4
lines changed Original file line number Diff line number Diff line change 2222#define HardwareI2C TwoWire
2323#endif
2424
25+ typedef enum {
26+ STOP = 0 ,
27+ GENTLE = 25 ,
28+ MODERATE = 30 ,
29+ MEDIUM = 35 ,
30+ INTENSE = 40 ,
31+ POWERFUL = 45 ,
32+ MAXIMUM = 50
33+ } VibroPowerLevel;
34+
2535void __increaseI2CPriority ();
2636
2737class ModulinoClass {
@@ -265,12 +275,23 @@ class ModulinoVibro : public Module {
265275public:
266276 ModulinoVibro (uint8_t address = 0xFF )
267277 : Module(address, " VIBRO" ) {}
268- void on (size_t len_ms) {
269- uint8_t buf[8 ];
270- uint32_t freq = 100 ;
278+ void on (size_t len_ms, bool block, int power = MAXIMUM ) {
279+ uint8_t buf[12 ];
280+ uint32_t freq = 1000 ;
271281 memcpy (&buf[0 ], &freq, 4 );
272282 memcpy (&buf[4 ], &len_ms, 4 );
273- write (buf, 8 );
283+ memcpy (&buf[8 ], &power, 4 );
284+ write (buf, 12 );
285+ if (block) {
286+ delay (len_ms);
287+ off ();
288+ }
289+ }
290+ void on (size_t len_ms) {
291+ on (len_ms, false );
292+ }
293+ void on (size_t len_ms, VibroPowerLevel power) {
294+ on (len_ms, false , power);
274295 }
275296 void off () {
276297 uint8_t buf[8 ];
You can’t perform that action at this time.
0 commit comments