]> git.earman.xyz Git - sensor-watch.git/commitdiff
annotate SLEEPCFG-register detail
authorAlex Maestas <git@se30.xyz>
Mon, 22 Jan 2024 00:37:25 +0000 (00:37 +0000)
committerAlex Maestas <git@se30.xyz>
Mon, 22 Jan 2024 00:39:20 +0000 (00:39 +0000)
watch-library/hardware/hal/src/hal_sleep.c

index fd9c84cbe055e31123c7124920659fe677473275..2fac64d547362c5b81ac90305539def77d1f5b4e 100644 (file)
@@ -57,7 +57,13 @@ int sleep(const uint8_t mode)
        if (ERR_NONE != _set_sleep_mode(mode))
                return ERR_INVALID_ARG;
 
-        // wait for the mode set to actually take, per chip doc.
+        // wait for the mode set to actually take, per note in Microchip data
+        // sheet DS60001465, section 19.8.2:
+        //
+        // A small latency happens between the store instruction and actual
+        // writing of the SLEEPCFG register due to bridges. Software has to make
+        // sure the SLEEPCFG register reads the wanted value before issuing WFI
+        // instruction.
         while(_get_sleep_mode() != mode);
 
        _go_to_sleep();