Complete the code to read the value from the register REG_A.
uint8_t value = [1];To read the value stored at the memory address of REG_A, you need to dereference the pointer using *REG_A.
Complete the code to write the value 0xFF to the register REG_B.
[1] = 0xFF;
To write a value to the hardware register, you must dereference the pointer REG_B and assign the value.
Fix the error in the code to toggle bit 3 of the register REG_C.
*REG_C = *REG_C [1] (1 << 3);
To toggle a bit, use the XOR operator ^ with a mask that has that bit set.
Fill both blanks to check if bit 5 of REG_D is set and clear it if true.
if ((*REG_D [1] (1 << 5)) != 0) { *REG_D [2]= ~(1 << 5); }
Use & to check if bit 5 is set. Use &= ~ to clear that bit.
Fill all three blanks to create a mask for bits 0 to 3, set those bits in REG_E, and then read the masked value.
uint8_t mask = (1 [1] 4) - 1; *REG_E [2]= mask; uint8_t val = *REG_E [3] mask;
Shift 1 left by 4 to create mask bits 0-3. Use |= to set bits. Use & to read masked bits.