88
99#include <stdbool.h>
1010
11- #include <contiki.h>
12-
13- #include <pbdrv/button.h>
14- #include <pbdrv/config.h>
15- #include <pbdrv/core.h>
1611#include <pbdrv/sound.h>
17- #include <pbio/config.h>
18- #include <pbio/dcmotor.h>
12+
1913#include <pbio/imu.h>
20- #include <pbio/light_matrix.h>
21- #include <pbio/light.h>
22- #include <pbio/main.h>
2314#include <pbio/motor_process.h>
2415#include <pbio/port_interface.h>
2516
3526 * tests that test one driver at a time.
3627 */
3728void pbio_init (bool start_processes ) {
38- pbdrv_init ();
3929
4030 pbio_imu_init ();
4131
@@ -51,14 +41,23 @@ void pbio_init(bool start_processes) {
5141}
5242
5343/**
54- * Stops all user-level background processes. Drivers and OS-level processes
55- * continue running.
44+ * Deinitialize pbio modules that are not needed after soft-poweroff.
45+ */
46+ void pbio_deinit (void ) {
47+ // Power off sensors and motors, including the ones that are always powered.
48+ pbio_port_power_off ();
49+ }
50+
51+ /**
52+ * Stops all user-level background processes. Called when the user application
53+ * completes to get these modules back into their default state. Drivers and
54+ * OS-level processes continue running.
5655 *
5756 * @param [in] reset Whether to reset all user-level processes to a clean
5857 * state (true), or whether to only stop active outputs
59- * like sound or motors (false). The latter is useful
60- * to preserve the state for debugging, without sound
61- * or movement getting in the way or out of control.
58+ * like sound or motors (false). The latter is useful to
59+ * preserve the state for debugging, without sound or
60+ * movement getting in the way, or out of control.
6261 */
6362void pbio_stop_all (bool reset ) {
6463 #if PBIO_CONFIG_LIGHT
0 commit comments