Refactor code substantially, moving buttons into separate classes and using a lot more pointers to conserve memory until it is needed.

This commit is contained in:
2021-11-08 01:37:30 +00:00
parent 346e612f65
commit a69c2d3364
6 changed files with 285 additions and 185 deletions

View File

@ -5,7 +5,7 @@
#include <Joystick.h>
#include <Mux.h>
using admux::Pinset;
using namespace admux;
bool debug = false;
Joystick joystick(debug);
@ -26,7 +26,9 @@ void setup() {
Pinset addr_pins = Pinset(10, 11, 12, 13);
uint8_t mux_id = joystick.AddMux(9, addr_pins);
joystick.AddMuxButton(mux_id, 0, BUTTON_PASSTHRU);
Mux* mux = new Mux(Pin(9, INPUT_PULLUP, PinType::Digital), Pinset(10, 11, 12, 13));
joystick.AddButton(0, BUTTON_PASSTHRU, true, mux);
// start up serial communication
joystick.Init();