Question.4
A developer manages peripheral power using RAII:
class PowerGuard {
Peripheral& periph;
public:
PowerGuard(Peripheral& p) : periph(p) {
periph.power_on();
}
~PowerGuard() { periph.power_off(); }
};
void read_sensor(Peripheral& adc) {
PowerGuard pg(adc); // ADC powered on
int val = adc.read();
process(val);
} // ADC powered off automaticallyWhat firmware benefit does this provide?