summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Maestas <git@se30.xyz>2024-01-22 00:37:25 +0000
committerAlex Maestas <git@se30.xyz>2024-01-22 00:39:20 +0000
commita2a60eb31a9bd8990705d4799406697bc9b0888f (patch)
tree25bcfc09cd4f6deb54818dc15bae5e59f9dc436a
parentaf49d3cfcb5437cf2c476197095fed0210c87ff5 (diff)
downloadSensor-Watch-a2a60eb31a9bd8990705d4799406697bc9b0888f.tar.gz
Sensor-Watch-a2a60eb31a9bd8990705d4799406697bc9b0888f.tar.bz2
Sensor-Watch-a2a60eb31a9bd8990705d4799406697bc9b0888f.zip
annotate SLEEPCFG-register detail
-rw-r--r--watch-library/hardware/hal/src/hal_sleep.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/watch-library/hardware/hal/src/hal_sleep.c b/watch-library/hardware/hal/src/hal_sleep.c
index fd9c84cb..2fac64d5 100644
--- a/watch-library/hardware/hal/src/hal_sleep.c
+++ b/watch-library/hardware/hal/src/hal_sleep.c
@@ -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();