fork/GramFirmware
git clone https://git.julia.blue/fork/GramFirmware
153b25e
master
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 ) { 9gpio_init (VBUS_SENSE_PIN ); 10gpio_set_dir (VBUS_SENSE_PIN ,GPIO_IN ); 11bool vbus_powered = gpio_get (VBUS_SENSE_PIN ); 12 13if (GamecubeConsole (joybus_pin ).Detect ()) { 14return ConnectedConsole ::GAMECUBE ; 15 } 16// 5V is not connected when plugged into N64 so we check that first to save time. 17if (!vbus_powered && N64Console (joybus_pin ).Detect ()) { 18return ConnectedConsole ::N64 ; 19 } 20 21return ConnectedConsole ::NONE ; 22}