mirror of
https://github.com/joel16/SwitchIdent.git
synced 2024-11-23 03:39:40 +00:00
System: Display headphone connection status
This commit is contained in:
parent
8892836e58
commit
57c75634e6
@ -76,6 +76,7 @@ namespace SwitchIdent {
|
||||
u32 GetClock(PcvModule module);
|
||||
SetCalBdAddress GetBluetoothBdAddress(void);
|
||||
SetCalMacAddress GetWirelessLanMacAddress(void);
|
||||
const char *GetHeadphoneStatus(void);
|
||||
|
||||
// Wlan
|
||||
u32 GetWlanState(void);
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
namespace Services {
|
||||
void Exit(void) {
|
||||
gpioExit();
|
||||
hiddbgExit();
|
||||
tsExit();
|
||||
wlaninfExit();
|
||||
@ -103,6 +104,10 @@ namespace Services {
|
||||
if (R_FAILED(ret = hiddbgInitialize())) {
|
||||
std::printf("hiddbgInitialize() failed: 0x%x.\n\n", ret);
|
||||
}
|
||||
|
||||
if (R_FAILED(ret = gpioInitialize())) {
|
||||
std::printf("gpioInitialize() failed: 0x%x.\n\n", ret);
|
||||
}
|
||||
|
||||
GUI::Init();
|
||||
}
|
||||
|
@ -78,6 +78,7 @@ namespace Menus {
|
||||
Menus::DrawItem(g_start_x, g_start_y + ((g_item_dist - g_item_height) / 2) + 420, "NFC:", SwitchIdent::GetNfcEnableFlag()? "Enabled" : "Disabled");
|
||||
Menus::DrawItemf(g_start_x, g_start_y + ((g_item_dist - g_item_height) / 2) + 480, "Internal (PCB) temperature:", "%d °C (%d °F)", int_temp, ((int_temp * 9/5) + 32));
|
||||
Menus::DrawItemf(g_start_x, g_start_y + ((g_item_dist - g_item_height) / 2) + 540, "External (SoC) temperature:", "%d °C (%d °F)", ext_temp, ((ext_temp * 9/5) + 32));
|
||||
Menus::DrawItem(g_start_x, g_start_y + ((g_item_dist - g_item_height) / 2) + 600, "Headphone Status:", SwitchIdent::GetHeadphoneStatus());
|
||||
}
|
||||
|
||||
void BatteryInfo(void) {
|
||||
|
@ -87,4 +87,21 @@ namespace SwitchIdent {
|
||||
|
||||
return mac_addr;
|
||||
}
|
||||
|
||||
const char *GetHeadphoneStatus(void) {
|
||||
Result ret = 0;
|
||||
GpioPadSession button;
|
||||
GpioValue value;
|
||||
|
||||
if (R_FAILED(ret = gpioOpenSession(&button, static_cast<GpioPadName>(21)))) {
|
||||
std::printf("gpioOpenSession() failed: 0x%x.\n\n", ret);
|
||||
}
|
||||
|
||||
if (R_FAILED(ret = gpioPadGetValue(&button, &value))) {
|
||||
std::printf("gpioPadGetValue() failed: 0x%x.\n\n", ret);
|
||||
}
|
||||
|
||||
gpioPadClose(&button);
|
||||
return (value == GpioValue_Low)? "Inserted": "Not inserted";
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user