Sensor-Watch/movement/watch_faces/clock/simple_clock_face.h
TheOnePerson cb69a2c181
Add an Alarm face to movement (#96)
* Add movement_play_alarm_beeps() to movement.c and make alarm sounds customizable. Add alarm indicator to simple watch face.

* Add alarm face

* alarm_face: fix problem with disabling alarms for 00:00.

* Fix typos in comments and get rid of of unused variable warning

* remove unnecessary constant

* simple_clock_face: fix disappearing chime indicator after face switch, enable alarm indicator updates in app loop (for one-time alarms).
movement: handle situations where watch is in sleep mode and chimes fire off at the same time as alarms properly.

* alarm_face: tweak process of displaying things on the lcd. Add extra long and extra short alarms. Increase number of alarm slots to 16.

* alarm face: fix alarms playing one beeping round more than set.

* alarm face: add proper quick cycling of hour and minute setting

* alarm-face: correct am/pm indication and some minor tweaks. Reset movement_config.h to current main branch. simple-watch-face: Remove unnecessary check and swap indicators (alarm / hourly chime)

* alarm-face: reverse commit parts from another branch (accidentially commited logic depending on movement firmware auto firing the long press event)

Co-authored-by: joeycastillo <joeycastillo@utexas.edu>
2022-10-25 21:57:53 -05:00

54 lines
2.1 KiB
C

/*
* MIT License
*
* Copyright (c) 2022 Joey Castillo
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#ifndef SIMPLE_CLOCK_FACE_H_
#define SIMPLE_CLOCK_FACE_H_
#include "movement.h"
typedef struct {
uint32_t previous_date_time;
uint8_t last_battery_check;
uint8_t watch_face_index;
bool signal_enabled;
bool battery_low;
bool alarm_enabled;
} simple_clock_state_t;
void simple_clock_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr);
void simple_clock_face_activate(movement_settings_t *settings, void *context);
bool simple_clock_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
void simple_clock_face_resign(movement_settings_t *settings, void *context);
bool simple_clock_face_wants_background_task(movement_settings_t *settings, void *context);
#define simple_clock_face ((const watch_face_t){ \
simple_clock_face_setup, \
simple_clock_face_activate, \
simple_clock_face_loop, \
simple_clock_face_resign, \
simple_clock_face_wants_background_task, \
})
#endif // SIMPLE_CLOCK_FACE_H_