Subsection 7.2.4 Diagnostic printf Patterns
The diagnostic questions from class, as copy-ready patterns (format specifiers are Day 5 material; the full table is in Section 3.4):
/* Did execution reach this point? */
printf("pa0_adc_init: entered\r\n");
printf("made it past the config loop\r\n");
/* Is this value reasonable? (decimal and hex of the same value) */
printf("ADC value: %u\t0x%x\r\n", value, value);
/* Does actual match expected? Print them side by side. */
printf("count = %d (expect 0..4095)\r\n", count);
/* What does that I/O register actually hold? 32-bit needs %08lx. */
printf("GPIOA->ODR = 0x%08lx\r\n", GPIOA->ODR);
Remember from Day 5: every line ends in
\r\n; a 16-bit value prints with %x, a 32-bit register with %08lx. Floating-point printf is off by default in the course library; Lab 4 Appendix A shows the one project setting that enables it. Even then, prefer scaling to an integer and printing %d: the STM32C031C6 has no floating point hardware, so every float operation is emulated in software. Remove diagnostic prints once the bug is fixed.
