Fix compile-time errors, which necessitated some refactoring of the interface.

This commit is contained in:
2021-11-02 23:17:25 +00:00
parent 5c2a2736dc
commit fbd786fe96
4 changed files with 39 additions and 26 deletions

View File

@ -7,6 +7,7 @@
// would require as few as 10 inputs in this scenario, for example. This is just a demo :)
#include <Joystick.h>
#include <Mux.h>
bool debug = false;
Joystick joystick(debug);
@ -28,17 +29,17 @@ void setup() {
joystick.AddButton(A0, BUTTON_PASSTHRU);
// to get more room for our inputs, we add an 8-bit multiplexer
uint8_t mux = joystick.AddMux(A1, {A2, A3, A4, A5}, 4);
uint8_t mux = joystick.AddMux(A1, admux::Pinset(A2, A3, A4, A5), 4);
// now we can add the rest of the buttons
joystick.AddButton(A1, BUTTON_PASSTHRU, true, true, mux, 1); // the last parameter is which channel/pin the input is attached to on the multiplexer
joystick.AddButton(A1, BUTTON_PASSTHRU, true, true, mux, 2);
joystick.AddButton(A1, BUTTON_PASSTHRU, true, true, mux, 3);
joystick.AddButton(A1, BUTTON_PASSTHRU, true, true, mux, 4);
joystick.AddButton(A1, BUTTON_PASSTHRU, true, true, mux, 5);
joystick.AddButton(A1, BUTTON_PASSTHRU, true, true, mux, 6);
joystick.AddButton(A1, BUTTON_PASSTHRU, true, true, mux, 7);
joystick.AddButton(A1, BUTTON_PASSTHRU, true, true, mux, 8);
joystick.AddMuxButton(A1, mux, 0, BUTTON_PASSTHRU);
joystick.AddMuxButton(A1, mux, 1, BUTTON_PASSTHRU);
joystick.AddMuxButton(A1, mux, 2, BUTTON_PASSTHRU);
joystick.AddMuxButton(A1, mux, 3, BUTTON_PASSTHRU);
joystick.AddMuxButton(A1, mux, 4, BUTTON_PASSTHRU);
joystick.AddMuxButton(A1, mux, 5, BUTTON_PASSTHRU);
joystick.AddMuxButton(A1, mux, 6, BUTTON_PASSTHRU);
joystick.AddMuxButton(A1, mux, 7, BUTTON_PASSTHRU);
joystick.Init();
}