Merge pull request #243 from wheremyfoodat/panda

[MIC] Add GetPower
This commit is contained in:
wheremyfoodat 2023-08-28 18:59:34 +03:00 committed by GitHub
commit bf924942fa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 0 deletions

View file

@ -17,6 +17,7 @@ class MICService {
// Service commands
void getEventHandle(u32 messagePointer);
void getGain(u32 messagePointer);
void getPower(u32 messagePointer);
void isSampling(u32 messagePointer);
void mapSharedMem(u32 messagePointer);
void setClamp(u32 messagePointer);

View file

@ -13,6 +13,7 @@ namespace MICCommands {
SetGain = 0x00080040,
GetGain = 0x00090000,
SetPower = 0x000A0040,
GetPower = 0x000B0000,
SetIirFilter = 0x000C0042,
SetClamp = 0x000D0040,
CaptainToadFunction = 0x00100040,
@ -33,6 +34,7 @@ void MICService::handleSyncRequest(u32 messagePointer) {
switch (command) {
case MICCommands::GetEventHandle: getEventHandle(messagePointer); break;
case MICCommands::GetGain: getGain(messagePointer); break;
case MICCommands::GetPower: getPower(messagePointer); break;
case MICCommands::IsSampling: isSampling(messagePointer); break;
case MICCommands::MapSharedMem: mapSharedMem(messagePointer); break;
case MICCommands::SetClamp: setClamp(messagePointer); break;
@ -101,6 +103,14 @@ void MICService::setPower(u32 messagePointer) {
mem.write32(messagePointer + 4, Result::Success);
}
void MICService::getPower(u32 messagePointer) {
log("MIC::GetPower\n");
mem.write32(messagePointer, IPC::responseHeader(0xB, 2, 0));
mem.write32(messagePointer + 4, Result::Success);
mem.write8(messagePointer + 8, micEnabled ? 1 : 0);
}
void MICService::setClamp(u32 messagePointer) {
u8 val = mem.read8(messagePointer + 4);
log("MIC::SetClamp (value = %d)\n", val);