Add analog_only option, though this is a stub for now.

This commit is contained in:
2021-11-13 05:56:21 +00:00
parent e09c21edf1
commit e8a1235a95
4 changed files with 20 additions and 15 deletions

View File

@ -38,7 +38,9 @@ class Joystick {
// Button types are documented in the ButtonType enum.
// 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.
void AddButton(uint8_t pin, ButtonType type, bool pullup=true, Mux* mux=NULL);
// Setting `analogOnly` to true indicates your button *must* be read with analog code, such as the A6 and A7 pins
// on the Arduino Nano.
void AddButton(uint8_t pin, ButtonType type, bool pullup=true, Mux* mux=NULL, bool analog_only=false);
// Add a rotary encoder. ENCODER button types allow you to treat an encoder as a momentary button or an axis (TODO)
void AddEncoder(uint8_t pin1, uint8_t pin2, ButtonType type);
@ -50,7 +52,6 @@ class Joystick {
// These members should not be used by end users; todo: remember how friend classes work
void PressButton(uint8_t button);
void ReleaseButton(uint8_t button);
bool _debug;
private:
void SetAxis(uint8_t axis, int16_t value);
@ -69,6 +70,8 @@ class Joystick {
uint8_t _num_axes;
JoyReport _joyReport;
bool _debug;
};
#endif