diff options
author | Jesse Talavera <jesse@jesse.tg> | 2023-12-12 05:07:22 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-12 11:07:22 +0100 |
commit | 9bfc9c08ffe88de4b54734d6fd03182c0a51e181 (patch) | |
tree | 28a9177f377f6ab85f9aabc54c3a523fd7d610ff /src/DSi_I2C.cpp | |
parent | 2cba2e783a2ef3a83b7d8bf0cb6e42a6298edbf6 (diff) |
Sprinkle `const` around where appropriate (#1909)
* Sprinkle `const` around where appropriate
- This will make it easier to use `NDS` objects in `const` contexts (e.g. `const` parameters or methods)
* Remove the `const` qualifier on `DSi_DSP::DSPRead16`
- MMIO reads can be non-pure, so this may not be `const` in the future
Diffstat (limited to 'src/DSi_I2C.cpp')
-rw-r--r-- | src/DSi_I2C.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/DSi_I2C.cpp b/src/DSi_I2C.cpp index d5ea60c..28f98dc 100644 --- a/src/DSi_I2C.cpp +++ b/src/DSi_I2C.cpp @@ -117,20 +117,20 @@ void DSi_BPTWL::DoSavestate(Savestate* file) } // TODO: Needs more investigation on the other bits -inline bool DSi_BPTWL::GetIRQMode() +inline bool DSi_BPTWL::GetIRQMode() const { return Registers[0x12] & 0x01; } -u8 DSi_BPTWL::GetBootFlag() { return Registers[0x70]; } +u8 DSi_BPTWL::GetBootFlag() const { return Registers[0x70]; } -bool DSi_BPTWL::GetBatteryCharging() { return Registers[0x20] >> 7; } +bool DSi_BPTWL::GetBatteryCharging() const { return Registers[0x20] >> 7; } void DSi_BPTWL::SetBatteryCharging(bool charging) { Registers[0x20] = (((charging ? 0x8 : 0x0) << 4) | (Registers[0x20] & 0x0F)); } -u8 DSi_BPTWL::GetBatteryLevel() { return Registers[0x20] & 0xF; } +u8 DSi_BPTWL::GetBatteryLevel() const { return Registers[0x20] & 0xF; } void DSi_BPTWL::SetBatteryLevel(u8 batteryLevel) { Registers[0x20] = ((Registers[0x20] & 0xF0) | (batteryLevel & 0x0F)); @@ -143,13 +143,13 @@ void DSi_BPTWL::SetBatteryLevel(u8 batteryLevel) } -u8 DSi_BPTWL::GetVolumeLevel() { return Registers[0x40]; } +u8 DSi_BPTWL::GetVolumeLevel() const { return Registers[0x40]; } void DSi_BPTWL::SetVolumeLevel(u8 volume) { Registers[0x40] = volume & 0x1F; } -u8 DSi_BPTWL::GetBacklightLevel() { return Registers[0x41]; } +u8 DSi_BPTWL::GetBacklightLevel() const { return Registers[0x41]; } void DSi_BPTWL::SetBacklightLevel(u8 backlight) { Registers[0x41] = backlight > 4 ? 4 : backlight; @@ -246,7 +246,7 @@ void DSi_BPTWL::SetVolumeSwitchReleased(u32 key) VolumeSwitchRepeatTime = 0.0; } -inline bool DSi_BPTWL::CheckVolumeSwitchKeysValid() +inline bool DSi_BPTWL::CheckVolumeSwitchKeysValid() const { bool up = VolumeSwitchKeysDown & (1 << volumeKey_Up); bool down = VolumeSwitchKeysDown & (1 << volumeKey_Down); |