fork/GramFirmware

git clone https://git.julia.blue/fork/GramFirmware

Jonathan HaylettAdd N64 support for Pico153b25e

v0.1.2
614 B22 linesraw
1#include "joybus_utils.hpp"
2
3#include <GamecubeConsole.hpp>
4#include <N64Console.hpp>
5
6#define VBUS_SENSE_PIN 24
7
8ConnectedConsole detect_console(uint joybus_pin) {
9    gpio_init(VBUS_SENSE_PIN);
10    gpio_set_dir(VBUS_SENSE_PIN, GPIO_IN);
11    bool vbus_powered = gpio_get(VBUS_SENSE_PIN);
12
13    if (GamecubeConsole(joybus_pin).Detect()) {
14        return ConnectedConsole::GAMECUBE;
15    }
16    // 5V is not connected when plugged into N64 so we check that first to save time.
17    if (!vbus_powered && N64Console(joybus_pin).Detect()) {
18        return ConnectedConsole::N64;
19    }
20
21    return ConnectedConsole::NONE;
22}