New quiz in Ziglings - Bit manipulation in embedded devices

Quiz time again at Ziglings, this time it’s about bit manipulation in embedded devices. All your Zig skills are needed to help fix the errors! Many thanks to our new contributor @alexsisco who created this exercise.

//  ============ PINOUT DIAGRAM FOR ATMEGA328 MICROCONTROLLER ============
//                                _____ _____
//                               |     U     |
//                 (RESET) PC6 --|  1     28 |-- PC5
//                         PD0 --|  2     27 |-- PC4
//                         PD1 --|  3     26 |-- PC3
//                         PD2 --|  4     25 |-- PC2
//                         PD3 --|  5     24 |-- PC1
//                         PD4 --|  6     23 |-- PC0
//                         VCC --|  7     22 |-- GND
//                         GND --|  8     21 |-- AREF
//                     |-- PB6 --|  9     20 |-- AVCC
//                     |-- PB7 --| 10     19 |-- PB5 --|
//                     |   PD5 --| 11     18 |-- PB4 --|
//                     |   PD6 --| 12     17 |-- PB3 --|
//                     |   PD7 --| 13     16 |-- PB2 --|
//                     |-- PB0 --| 14     15 |-- PB1 --|
//                     |         |___________|         |
//                     \_______________________________/
//                                    |
//                                  PORTB
//

Ziglings.org/Quiztime

7 Likes

I think this is also a use case for volatile pointers to packed structs?