Skip to content

Commit

Permalink
Make nunchuk support opt-in
Browse files Browse the repository at this point in the history
  • Loading branch information
JonnyHaystack committed May 12, 2021
1 parent 30d85f0 commit 940cd3d
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 4 deletions.
12 changes: 8 additions & 4 deletions HayB0XX/HayB0XX.ino
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
HayB0XX Version 0.1.0
HayB0XX Version 0.1.1
Some parts of this code were originally based on GCCPCB2 v1.208 code by Crane.
Expand All @@ -20,6 +20,8 @@
#include "ProjectM.h"
#include "src/NintendoExtensionCtrl/src/Nunchuk.h"

#define NUNCHUK_ENABLE false

enum reportState : byte {
ReportOff = 0x30,
ReportOn = 0x31,
Expand Down Expand Up @@ -100,8 +102,10 @@ void readInputs() {
}

void setup() {
gNunchuk.begin();
gNunchuk.connect();
if (NUNCHUK_ENABLE) {
gNunchuk.begin();
gNunchuk.connect();
}

pinMode(pinout::L, INPUT_PULLUP);
pinMode(pinout::LEFT, INPUT_PULLUP);
Expand All @@ -126,7 +130,7 @@ void setup() {
pinMode(pinout::LIGHTSHIELD, INPUT_PULLUP);
pinMode(pinout::MIDSHIELD, INPUT_PULLUP);

// Read inputs into gInputState initially to make backend selection logic in
// Read initial inputs into gInputState to make backend selection logic in
// initialise() a bit cleaner.
readInputs();

Expand Down
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ Features include:
* [Creating custom input modes](#creating-custom-input-modes)
* [Mod X lightshield and R shield tilt](#mod-x-lightshield-and-r-shield-tilt)
* [Project M/Project+ mode](#project-mproject-mode)
* [Enable Nunchuk support](#enable-nunchuk-support)
* [Troubleshooting](#troubleshooting)
* [Contributing](#contributing)
* [Contributors](#contributors)
Expand Down Expand Up @@ -295,9 +296,29 @@ can press Mod X + Z to send a true Z input.
If this bothers you, and you just want to send a true Z input by default when
pressing Z, you can set the `trueZPress` parameter to true.

### Enable Nunchuk support

Nunchuk support is disabled by default as it can cause a number of issues if the
i2c pins (pin 2 and 3 on Arduino Leonardo) are used for GPIO. To enable it, find
the line `#define NUNCHUK_ENABLE false` at the top of HayB0XX.ino and change it
to `true`.

## Troubleshooting

### Controller not working with console or GameCube adapter

- Make sure you are holding C-Down on plugin (if using default bindings).
- If you are using an official adapter you will likely have to disable the
polling latency optimisation by passing in a polling rate of 0 to the
GamecubeBackend constructor.
- If using pins 2 or 3 for your GameCube circuit, make sure Nunchuk support is
disabled

### Joystick.h, nintendo.h, arduino_vector.h, and keyboard.h files are missing

If the libraries are missing it's because you didn't download the release
correctly. Do not click "download repo as zip" or "download source". Download
the latest release artifact from the releases page.

## Contributing

Expand Down

0 comments on commit 940cd3d

Please sign in to comment.