mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2025-01-31 04:03:44 +01:00
fatal: Finish StopSoundTask
This commit is contained in:
parent
f8abd2b402
commit
5d5f8ad3d5
@ -20,39 +20,54 @@
|
|||||||
|
|
||||||
void StopSoundTask::StopSound() {
|
void StopSoundTask::StopSound() {
|
||||||
/* Talk to the ALC5639 over I2C, and disable audio output. */
|
/* Talk to the ALC5639 over I2C, and disable audio output. */
|
||||||
I2cSession audio;
|
{
|
||||||
if (R_SUCCEEDED(i2cOpenSession(&audio, I2cDevice_AudioCodec))) {
|
I2cSession audio;
|
||||||
struct {
|
if (R_SUCCEEDED(i2cOpenSession(&audio, I2cDevice_AudioCodec))) {
|
||||||
u16 dev;
|
struct {
|
||||||
u8 val;
|
u16 dev;
|
||||||
} __attribute__((packed)) cmd;
|
u8 val;
|
||||||
static_assert(sizeof(cmd) == 3, "I2C command definition!");
|
} __attribute__((packed)) cmd;
|
||||||
|
static_assert(sizeof(cmd) == 3, "I2C command definition!");
|
||||||
|
|
||||||
cmd.dev = 0xC801;
|
cmd.dev = 0xC801;
|
||||||
cmd.val = 200;
|
cmd.val = 200;
|
||||||
i2csessionSendAuto(&audio, &cmd, sizeof(cmd), I2cTransactionOption_All);
|
|
||||||
|
|
||||||
cmd.dev = 0xC802;
|
|
||||||
cmd.val = 200;
|
|
||||||
i2csessionSendAuto(&audio, &cmd, sizeof(cmd), I2cTransactionOption_All);
|
|
||||||
|
|
||||||
cmd.dev = 0xC802;
|
|
||||||
cmd.val = 200;
|
|
||||||
i2csessionSendAuto(&audio, &cmd, sizeof(cmd), I2cTransactionOption_All);
|
|
||||||
|
|
||||||
for (u16 dev = 97; dev <= 102; dev++) {
|
|
||||||
cmd.dev = dev;
|
|
||||||
cmd.val = 0;
|
|
||||||
i2csessionSendAuto(&audio, &cmd, sizeof(cmd), I2cTransactionOption_All);
|
i2csessionSendAuto(&audio, &cmd, sizeof(cmd), I2cTransactionOption_All);
|
||||||
|
|
||||||
|
cmd.dev = 0xC802;
|
||||||
|
cmd.val = 200;
|
||||||
|
i2csessionSendAuto(&audio, &cmd, sizeof(cmd), I2cTransactionOption_All);
|
||||||
|
|
||||||
|
cmd.dev = 0xC802;
|
||||||
|
cmd.val = 200;
|
||||||
|
i2csessionSendAuto(&audio, &cmd, sizeof(cmd), I2cTransactionOption_All);
|
||||||
|
|
||||||
|
for (u16 dev = 97; dev <= 102; dev++) {
|
||||||
|
cmd.dev = dev;
|
||||||
|
cmd.val = 0;
|
||||||
|
i2csessionSendAuto(&audio, &cmd, sizeof(cmd), I2cTransactionOption_All);
|
||||||
|
}
|
||||||
|
|
||||||
|
i2csessionClose(&audio);
|
||||||
}
|
}
|
||||||
|
|
||||||
i2csessionClose(&audio);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TODO: Talk to the ALC5639 over GPIO */
|
/* Talk to the ALC5639 over GPIO, and disable audio output */
|
||||||
|
{
|
||||||
|
GpioPadSession audio;
|
||||||
|
if (R_SUCCEEDED(gpioOpenSession(&audio, GpioPadName_AudioCodec))) {
|
||||||
|
/* Set direction output, sleep 200 ms so it can take effect. */
|
||||||
|
gpioPadSetDirection(&audio, GpioDirection_Output);
|
||||||
|
svcSleepThread(200000000UL);
|
||||||
|
|
||||||
|
/* Pull audio codec low. */
|
||||||
|
gpioPadSetValue(&audio, GpioValue_Low);
|
||||||
|
|
||||||
|
gpioPadClose(&audio);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Result StopSoundTask::Run() {
|
Result StopSoundTask::Run() {
|
||||||
StopSound();
|
StopSound();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -28,4 +28,4 @@ class StopSoundTask : public IFatalTask {
|
|||||||
virtual const char *GetName() const override {
|
virtual const char *GetName() const override {
|
||||||
return "SoundTask";
|
return "SoundTask";
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user