Use new fancy way to set values at build time

This commit is contained in:
Jaby
2022-09-02 12:07:22 +02:00
parent 2306cddeeb
commit 024e94f7b2
3 changed files with 51 additions and 2 deletions

View File

@@ -9,7 +9,7 @@ namespace SPU {
}
static void clear_main_volume() {
static constexpr auto StartVol = SweepVolume().clear_bit(SweepVolume::SweepEnable).set_value(static_cast<int16_t>(I16_MAX >> 2), SweepVolume::Volume);
static constexpr auto StartVol = SweepVolume() | !SweepVolume::SweepEnable | (SweepVolume::Volume << static_cast<int16_t>(I16_MAX >> 2));
MainVolume::left.write(StartVol);
MainVolume::right.write(StartVol);
@@ -19,9 +19,17 @@ namespace SPU {
Control.write(ControlRegister());
}
static void setup_control_register() {
static constexpr auto SetupValue = ControlRegister() | ControlRegister::Enable | ControlRegister::Unmute | ControlRegister::CDAudioEnable;
Control.write(SetupValue);
}
void setup() {
clear_key();
clear_main_volume();
clear_control_register();
setup_control_register();
}
}