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 2323#define HardwareI2C TwoWire
2424#endif
2525
26+ typedef enum {
27+ STOP = 0 ,
28+ GENTLE = 25 ,
29+ MODERATE = 30 ,
30+ MEDIUM = 35 ,
31+ INTENSE = 40 ,
32+ POWERFUL = 45 ,
33+ MAXIMUM = 50
34+ } VibroPowerLevel;
35+
2636void __increaseI2CPriority ();
2737
2838class ModulinoClass {
@@ -266,12 +276,23 @@ class ModulinoVibro : public Module {
266276public:
267277 ModulinoVibro (uint8_t address = 0xFF )
268278 : Module(address, " VIBRO" ) {}
269- void on (size_t len_ms) {
270- uint8_t buf[8 ];
271- uint32_t freq = 100 ;
279+ void on (size_t len_ms, bool block, int power = MAXIMUM ) {
280+ uint8_t buf[12 ];
281+ uint32_t freq = 1000 ;
272282 memcpy (&buf[0 ], &freq, 4 );
273283 memcpy (&buf[4 ], &len_ms, 4 );
274- write (buf, 8 );
284+ memcpy (&buf[8 ], &power, 4 );
285+ write (buf, 12 );
286+ if (block) {
287+ delay (len_ms);
288+ off ();
289+ }
290+ }
291+ void on (size_t len_ms) {
292+ on (len_ms, false );
293+ }
294+ void on (size_t len_ms, int power) {
295+ on (len_ms, false , power);
275296 }
276297 void off () {
277298 uint8_t buf[8 ];
You can’t perform that action at this time.
0 commit comments