Complete the code to enter idle mode using the correct instruction.
void enter_idle_mode() {
__[1]();
}The WFI instruction puts the processor into idle mode, waiting for an interrupt.
Complete the code to enable the idle mode by setting the correct bit in the power control register.
POWER_CTRL_REG |= (1 << [1]);
Bit 1 in the power control register enables idle mode.
Fix the error in the code that attempts to enter idle mode but uses the wrong instruction.
void idle_mode() {
__[1]();
}The correct instruction to enter idle mode is WFI, not NOP or others.
Fill both blanks to create a dictionary that maps power modes to their bit positions.
const int power_modes_bits[] = { [1], [2] };Bit 0 is for sleep mode, bit 1 is for idle mode.
Fill all three blanks to complete the function that sets the processor to idle mode and enables the correct power control bit.
void set_idle_mode() {
POWER_CTRL_REG |= (1 << [1]);
__[2]();
while (!(STATUS_REG & (1 << [3]))) {
;
}
}Bit 1 enables idle mode, WFI enters idle mode, and bit 0 in status register indicates idle state.