summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorJoey Castillo <jose.castillo@gmail.com>2021-10-20 13:45:22 -0400
committerJoey Castillo <jose.castillo@gmail.com>2021-10-20 13:45:22 -0400
commit38a2dff23491c4b22a8e55ffd6d096a198857c9f (patch)
tree2d3f87c41f0dbea12d2122defb2bf456acc7467c /apps
parent1020dd78981e0d4b4f20399aa5e76ea7d37beec6 (diff)
downloadSensor-Watch-38a2dff23491c4b22a8e55ffd6d096a198857c9f.tar.gz
Sensor-Watch-38a2dff23491c4b22a8e55ffd6d096a198857c9f.tar.bz2
Sensor-Watch-38a2dff23491c4b22a8e55ffd6d096a198857c9f.zip
more accurate names for deep sleep and shallow sleep modes
Diffstat (limited to 'apps')
-rw-r--r--apps/Sensor Watch BME280 Project/app.c8
-rw-r--r--apps/Sensor Watch Buzzer Demo/app.c6
-rw-r--r--apps/Sensor Watch Starter Project/app.c36
-rw-r--r--apps/beats-time/app.c8
4 files changed, 30 insertions, 28 deletions
diff --git a/apps/Sensor Watch BME280 Project/app.c b/apps/Sensor Watch BME280 Project/app.c
index 366ccde9..85439d9b 100644
--- a/apps/Sensor Watch BME280 Project/app.c
+++ b/apps/Sensor Watch BME280 Project/app.c
@@ -16,8 +16,8 @@ void app_init() {
memset(&application_state, 0, sizeof(application_state));
}
-void app_wake_from_deep_sleep() {
- // This app does not support deep sleep mode.
+void app_wake_from_backup() {
+ // This app does not support BACKUP mode.
}
void app_setup() {
@@ -63,13 +63,13 @@ void app_setup() {
/**
* Nothing to do here.
*/
-void app_prepare_for_sleep() {
+void app_prepare_for_standby() {
}
/**
* @todo restore the BME280's calibration values from backup memory
*/
-void app_wake_from_sleep() {
+void app_wake_from_standby() {
}
/**
diff --git a/apps/Sensor Watch Buzzer Demo/app.c b/apps/Sensor Watch Buzzer Demo/app.c
index 74777fcc..58158dff 100644
--- a/apps/Sensor Watch Buzzer Demo/app.c
+++ b/apps/Sensor Watch Buzzer Demo/app.c
@@ -17,7 +17,7 @@ void app_init() {
memset(&application_state, 0, sizeof(application_state));
}
-void app_wake_from_deep_sleep() {
+void app_wake_from_backup() {
}
void app_setup() {
@@ -28,11 +28,11 @@ void app_setup() {
watch_enable_buzzer();
}
-void app_prepare_for_sleep() {
+void app_prepare_for_standby() {
watch_display_string(" rains ", 2);
}
-void app_wake_from_sleep() {
+void app_wake_from_standby() {
}
bool app_loop() {
diff --git a/apps/Sensor Watch Starter Project/app.c b/apps/Sensor Watch Starter Project/app.c
index ae5aa6e8..fa887bae 100644
--- a/apps/Sensor Watch Starter Project/app.c
+++ b/apps/Sensor Watch Starter Project/app.c
@@ -51,14 +51,14 @@ void app_init() {
}
/**
- * @brief the app_wake_from_deep_sleep function is only called if your app is waking from
+ * @brief the app_wake_from_backup function is only called if your app is waking from
* the ultra-low power BACKUP sleep mode. You may have chosen to store some state in the
* RTC's backup registers prior to entering this mode. You may restore that state here.
*
* @see watch_enter_deep_sleep()
*/
-void app_wake_from_deep_sleep() {
- // this app only supports shallow sleep mode.
+void app_wake_from_backup() {
+ // This app does not support BACKUP mode.
}
/**
@@ -69,9 +69,12 @@ void app_wake_from_deep_sleep() {
* accelerometer that will run at all times should be configured here, whereas you may
* want to enable a more power-hungry environmental sensor only when you need it.
*
- * @note If your app enters the ultra-low power BACKUP sleep mode, this function will
- * be called again when it wakes from that deep sleep state. In this state, the RTC will
- * still be configured with the correct date and time.
+ * @note If your app enters the Sleep or Deep Sleep modes, this function will be called
+ * again on wake, since those modes will have disabled all pins and peripherals; you'll
+ * likely need to set them up again. This function will also be called again if your app
+ * entered the ultra-low power BACKUP mode, since BACKUP mode will have done all that and
+ * also wiped out the system RAM. Note that when this is called after waking from sleep,
+ * the RTC will still be configured with the correct date and time.
*/
void app_setup() {
watch_enable_leds();
@@ -94,25 +97,24 @@ void app_setup() {
}
/**
- * @brief the app_prepare_for_sleep function is called before the watch goes into the
- * STANDBY sleep mode. In STANDBY mode, most peripherals are shut down, and no code
- * will run until the watch receives an interrupt (generally either the 1Hz tick or
- * a press on one of the buttons).
+ * @brief the app_prepare_for_standby function is called before the watch goes into STANDBY mode.
+ * In STANDBY mode, most peripherals are shut down, and no code will run until the watch receives
+ * an interrupt (generally either the 1Hz tick or a press on one of the buttons).
*/
-void app_prepare_for_sleep() {
+void app_prepare_for_standby() {
}
/**
- * @brief the app_wake_from_sleep function is called after the watch wakes from the
- * STANDBY sleep mode.
+ * @brief the app_wake_from_standby function is called after the watch wakes from STANDBY mode,
+ * but before your main app_loop.
*/
-void app_wake_from_sleep() {
+void app_wake_from_standby() {
application_state.wake_count++;
}
/**
- * @brief the app_loop function is called once on app startup and then again each time
- * the watch STANDBY sleep mode.
+ * @brief the app_loop function is called once on app startup and then again each time the
+ * watch exits STANDBY mode.
*/
bool app_loop() {
if (application_state.beep) {
@@ -157,7 +159,7 @@ bool app_loop() {
delay_ms(250);
// nap time :)
- watch_enter_shallow_sleep(false);
+ watch_enter_deep_sleep_mode();
// we just woke up; wait a moment again for the user's finger to be off the button...
delay_ms(250);
diff --git a/apps/beats-time/app.c b/apps/beats-time/app.c
index 611e7f16..5c68a3e8 100644
--- a/apps/beats-time/app.c
+++ b/apps/beats-time/app.c
@@ -50,8 +50,8 @@ void app_init() {
memset(&application_state, 0, sizeof(application_state));
}
-void app_wake_from_deep_sleep() {
- // This app does not support deep sleep mode.
+void app_wake_from_backup() {
+ // This app does not support BACKUP mode.
}
void app_setup() {
@@ -67,10 +67,10 @@ void app_setup() {
watch_rtc_register_tick_callback(cb_tick);
}
-void app_prepare_for_sleep() {
+void app_prepare_for_standby() {
}
-void app_wake_from_sleep() {
+void app_wake_from_standby() {
}
void update_tick_frequency() {