Fix compile-time errors, which necessitated some refactoring of the interface.
This commit is contained in:
parent
5c2a2736dc
commit
fbd786fe96
4 changed files with 39 additions and 26 deletions
13
Joystick.h
13
Joystick.h
|
@ -1,9 +1,9 @@
|
|||
#ifndef _JOYSTICK_H_
|
||||
#define _JOYSTICK_H_
|
||||
|
||||
#include <Mux.h>
|
||||
#include <Arduino.h>
|
||||
#include <Bounce2.h>
|
||||
#include <Mux.h>
|
||||
|
||||
using namespace admux;
|
||||
|
||||
|
@ -63,7 +63,8 @@ class Joystick {
|
|||
// If `pullup` is true, your button should connect the pin to ground. (also be sure that your board supports INPUT_PULLUP on that pin)
|
||||
// If `pullup` is false, your button should connect the pin to VCC.
|
||||
// Mux parameters are ignored unless `mux` is true.
|
||||
void AddButton(uint8_t pin, ButtonType type, bool pullup=true, bool mux=false, uint8_t mux_id = 0; uint8_t mux_channel = 0);
|
||||
void AddButton(uint8_t pin, ButtonType type, bool pullup=true);
|
||||
void AddMuxButton(uint8_t pin, uint8_t mux_id, uint8_t mux_channel, ButtonType type, bool pullup=true);
|
||||
|
||||
// Add an analog axis to the joystick. THIS METHOD IS NOT CURRENTLY TESTED OR SUPPORTED. It might work, but probably not.
|
||||
void AddAxis(uint8_t pin);
|
||||
|
@ -71,7 +72,7 @@ class Joystick {
|
|||
// Add control for a multiplexer. To add a button that's connected via the multiplexer,
|
||||
// pass the mux's signal pin as the pin parameter to AddButton(), along with the mux* parameters.
|
||||
// mux_id is the array index of the mux (in the order you added them via AddMux())
|
||||
uint8_t AddMux(uint8_t signal_pin, uint8_t addr_pins[], uint8_t addr_width);
|
||||
uint8_t AddMux(uint8_t signal_pin, Pinset addr_pins, bool pullup=true);
|
||||
|
||||
private:
|
||||
void SetAxis(uint8_t axis, int16_t value);
|
||||
|
@ -83,7 +84,9 @@ class Joystick {
|
|||
void _ReleasePulsedButtons();
|
||||
void _UpdateButton(uint8_t index);
|
||||
void _UpdateAxis(uint8_t index);
|
||||
|
||||
|
||||
Button* _BuildButton(uint8_t pin, ButtonType type, bool pullup);
|
||||
|
||||
Button _buttons[JOYSTICK_NUM_BUTTONS];
|
||||
uint8_t _num_buttons;
|
||||
uint8_t _virtual_buttons; // a single user-defined button can have multiple virtual buttons.
|
||||
|
@ -95,7 +98,7 @@ class Joystick {
|
|||
JoyReport _joyReport;
|
||||
bool _debug;
|
||||
|
||||
Mux _mux[MAX_MUX];
|
||||
Mux *_mux[MAX_MUX];
|
||||
uint8_t _num_mux;
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue