We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 53aa89e commit 36bb2e9Copy full SHA for 36bb2e9
src/Modulino.h
@@ -320,12 +320,27 @@ class ModulinoKnob : public Module {
320
}
321
return ret;
322
323
- int16_t get() {
+ bool update() {
324
uint8_t buf[3];
325
auto res = read(buf, 3);
326
if (res == false) {
327
return 0;
328
329
+ get(buf);
330
+ return 1;
331
+ }
332
+ int16_t get(uint8_t * buf = nullptr) {
333
+ if (buf == nullptr) {
334
+ buf = (uint8_t*)malloc(3);
335
336
+ return 0;
337
338
+ auto res = read(buf, 3);
339
+ if (res == false) {
340
+ _pressed = false;
341
342
343
344
_pressed = (buf[2] != 0);
345
int16_t ret = buf[0] | (buf[1] << 8);
346
0 commit comments