diff options
author | Joey Castillo <joeycastillo@utexas.edu> | 2021-12-05 23:06:25 -0600 |
---|---|---|
committer | Joey Castillo <joeycastillo@utexas.edu> | 2021-12-10 11:54:16 -0500 |
commit | 316e1f292c603885f2af3dcd69ce797d64776425 (patch) | |
tree | 96eeba3e256e49ec6393a39767098e3975426454 /apps/Sensor Watch BME280 Project/app.h | |
parent | 616587a2030be054277ef74fdbf0be626684db3c (diff) | |
download | Sensor-Watch-316e1f292c603885f2af3dcd69ce797d64776425.tar.gz Sensor-Watch-316e1f292c603885f2af3dcd69ce797d64776425.tar.bz2 Sensor-Watch-316e1f292c603885f2af3dcd69ce797d64776425.zip |
rename project files
Diffstat (limited to 'apps/Sensor Watch BME280 Project/app.h')
-rw-r--r-- | apps/Sensor Watch BME280 Project/app.h | 76 |
1 files changed, 0 insertions, 76 deletions
diff --git a/apps/Sensor Watch BME280 Project/app.h b/apps/Sensor Watch BME280 Project/app.h deleted file mode 100644 index e0bbe1c2..00000000 --- a/apps/Sensor Watch BME280 Project/app.h +++ /dev/null @@ -1,76 +0,0 @@ -// Sensor Watch: Hiking Log Demo App -// This app displays a clock and temperature data from a BME280 temperature and humidiity sensor. -// It also logs up to 36 hours of temperature data for playback. -// You can use this app on backcountry treks: take the watch off at night and place it outside your tent. -// It will log overnight low temperatures for review in the morning and optional transfer to your notepad. - -#define MAX_DATA_POINTS 36 - -typedef enum ApplicationMode { - MODE_CLOCK = 0, // Displays month, day and current time. - MODE_TEMP, // (TE) Displays temperature and an optional humidity reading (0-10 representing 0-100%) - MODE_LOG, // (LO) Plays back temperature data (temperature in seconds slot) - MODE_PREFS, // (PR) Allows setting options for the application - MODE_SET, // (ST) Set time and date - NUM_MODES // Last item in the enum, it's the number of cases. -} ApplicationMode; - -typedef struct SensorReading { - bool is_valid; - uint8_t hour; - int8_t temperature; -} SensorReading; - -typedef struct ApplicationState { - // Internal application state - ApplicationMode mode; // Current mode - bool mode_changed; // Lets us perform one-time setup for a given mode - uint16_t mode_ticks; // Timeout for the mode (returns to clock after timeout expires) - uint8_t light_ticks; // Timeout for the light - bool led_on; // Indicates that the LED is on - uint8_t page; // Tracks the current page in log, prefs or settings. - bool is_fahrenheit; // User preference, C or F - - // Data logging - SensorReading logged_data[MAX_DATA_POINTS]; - - // User preference - bool show_humidity; // Indicates that the LED is on - - // BME280 calibration values - uint16_t dig_T1; - int16_t dig_T2; - int16_t dig_T3; - uint8_t dig_H1; - int16_t dig_H2; - uint8_t dig_H3; - int16_t dig_H4; - int16_t dig_H5; - int8_t dig_H6; -} ApplicationState; - -float read_temperature(int32_t *p_t_fine); -float read_humidity(int32_t t_fine); - -void log_data(); - -void do_clock_mode(); - -void do_temp_mode(); -void temp_mode_handle_primary_button(); - -void do_log_mode(); -void log_mode_handle_primary_button(); - -void do_prefs_mode(); -void prefs_mode_handle_primary_button(); -void prefs_mode_handle_secondary_button(); - -void do_set_time_mode(); -void set_time_mode_handle_primary_button(); -void set_time_mode_handle_secondary_button(); - -void cb_light_pressed(); -void cb_mode_pressed(); -void cb_alarm_pressed(); -void cb_tick(); |