File tree Expand file tree Collapse file tree 2 files changed +1398
-1377
lines changed Expand file tree Collapse file tree 2 files changed +1398
-1377
lines changed Original file line number Diff line number Diff line change 1818#define HardwareI2C TwoWire
1919#endif
2020
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+
2131void __increaseI2CPriority ();
2232
2333class ModulinoClass {
@@ -242,12 +252,23 @@ class ModulinoVibro : public Module {
242252public:
243253 ModulinoVibro (uint8_t address = 0xFF )
244254 : 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 ;
248258 memcpy (&buf[0 ], &freq, 4 );
249259 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);
251272 }
252273 void off () {
253274 uint8_t buf[8 ];
You can’t perform that action at this time.
0 commit comments