Complete the code to correctly initialize the pointer.
int value = 10; int *ptr = [1];
The pointer must be initialized with the address of the variable using the & operator.
Complete the code to correctly check if a bit is set in a register.
if ((reg & [1]) != 0) { // bit is set }
Use a mask with the bit set (0x01) to check the first bit in the register.
Fix the error in the interrupt service routine declaration.
void [1] ISR_Handler(void) {
// ISR code
}In embedded C, the ISR function must be declared with the __interrupt keyword to be recognized as an interrupt handler.
Fill both blanks to correctly define a volatile pointer to a hardware register.
volatile [1] *[2] = (volatile [1] *)0x40021000;
The hardware register is usually accessed as a volatile uint32_t pointer. The pointer variable can be named 'ptr'.
Fill all three blanks to correctly implement a delay loop using a volatile counter.
void delay(void) {
volatile int [1] = [2];
while ([1] > 0) {
[1]--;
}
}The volatile variable 'counter' is initialized to 10000 and decremented until zero to create a delay.