make the HAL sleep function obey the chip documentation
the sleep mode doesn't get set immediately, and needs to be waited upon.
This commit is contained in:
@@ -57,6 +57,9 @@ 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.
|
||||
while(_get_sleep_mode() != mode);
|
||||
|
||||
_go_to_sleep();
|
||||
|
||||
return ERR_NONE;
|
||||
|
||||
Reference in New Issue
Block a user