This switch-mode power supply example focuses on higher integration and cost reduction – essentially showcasing how the microcontroller itself can be used instead of additional external components, decreasing the BOM for a solution.
The ultrasonic distance sensor example uses many different peripherals and focuses on deterministic behavior.