EMBEDDED SYSTEMS & MICROCONTROLLERS · PAGE 83
From Arduino Code to Bare-Metal
Peeling off the convenience layer.
Start with a sketch that works, then replace library calls with direct register writes one at a time, checking it still behaves. The result is smaller and faster.
Read the chip's manual to see which registers each call really sets, such as pin direction and timer modes. Keep the friendly version beside you as a reference while you learn.