diff --git a/Smol Watch Project/My Project/.atmelstart/atmel_start_config.atstart b/Smol Watch Project/My Project/.atmelstart/atmel_start_config.atstart
index 95c9e7f..0c082b9 100644
--- a/Smol Watch Project/My Project/.atmelstart/atmel_start_config.atstart
+++ b/Smol Watch Project/My Project/.atmelstart/atmel_start_config.atstart
@@ -979,7 +979,7 @@ drivers:
functionality: Segment_LCD
api: HAL:Driver:SLCD_Sync
configuration:
- slcd_arch_advanced_settings: false
+ slcd_arch_advanced_settings: true
slcd_arch_bbd: 2
slcd_arch_bben: true
slcd_arch_bias: THIRD
@@ -1233,7 +1233,7 @@ drivers:
slcd_arch_presc: '64'
slcd_arch_prf: 250Hz
slcd_arch_rrf: 2kHz
- slcd_arch_runstdby: false
+ slcd_arch_runstdby: true
slcd_arch_seg_num: 24
slcd_arch_wmod: Low Power Waveform(frame-inversion)
slcd_arch_xvlcd: false
diff --git a/Smol Watch Project/My Project/Config/hpl_slcd_config.h b/Smol Watch Project/My Project/Config/hpl_slcd_config.h
index e3bb1bd..7221343 100644
--- a/Smol Watch Project/My Project/Config/hpl_slcd_config.h
+++ b/Smol Watch Project/My Project/Config/hpl_slcd_config.h
@@ -169,14 +169,14 @@
// Advanced configuration
// slcd_arch_advanced_settings
#ifndef CONF_SLCD_ADVANCED_SETTINGS
-#define CONF_SLCD_ADVANCED_SETTINGS 0
+#define CONF_SLCD_ADVANCED_SETTINGS 1
#endif
// Run in standby
// Indicates whether the SLCD will continue running in standby sleep mode or not
// slcd_arch_runstdby
#ifndef CONF_SLCD_RUNSTDBY
-#define CONF_SLCD_RUNSTDBY 0
+#define CONF_SLCD_RUNSTDBY 1
#endif
//
diff --git a/Smol Watch Project/My Project/My Project.cproj b/Smol Watch Project/My Project/My Project.cproj
index a4a9b38..ac2e0cd 100644
--- a/Smol Watch Project/My Project/My Project.cproj
+++ b/Smol Watch Project/My Project/My Project.cproj
@@ -202,7 +202,7 @@
-
+
diff --git a/Smol Watch Project/My Project/main.c b/Smol Watch Project/My Project/main.c
index 45bb5dc..3af1ed0 100644
--- a/Smol Watch Project/My Project/main.c
+++ b/Smol Watch Project/My Project/main.c
@@ -4,47 +4,49 @@
#include "mars_clock.h"
Watch watch;
-int light = 1;
+bool locked = true;
void calendar_callback(struct calendar_descriptor *const calendar) {
- struct calendar_date_time date_time;
- calendar_get_date_time(&CALENDAR_0, &date_time);
-
- update_display(&watch, date_time);
-/*
- if (date_time.time.min % 2 == 0) {
- watch_set_led_color(50, 0);
- } else {
- watch_set_led_color(0, 50);
- }
-*/
}
static void mode_callback() {
+ locked = !locked;
+ gpio_set_pin_level(GREEN, !locked);
}
static void light_callback() {
+ if (locked) return;
+ struct calendar_date_time date_time;
+ calendar_get_date_time(&CALENDAR_0, &date_time);
+ date_time.time.min = (date_time.time.min + 1) % 60;
+ watch_set_date_time(date_time);
+ update_display(&watch, date_time);
}
static void alarm_callback() {
+ if (locked) return;
+ struct calendar_date_time date_time;
+ calendar_get_date_time(&CALENDAR_0, &date_time);
+ date_time.time.sec = 0;
+ watch_set_date_time(date_time);
+ update_display(&watch, date_time);
}
-int lightOn = 0;
-
static void tick_callback() {
- gpio_set_pin_level(GREEN, lightOn == 0);
- lightOn = (lightOn + 1) % 10;
+ struct calendar_date_time date_time;
+ calendar_get_date_time(&CALENDAR_0, &date_time);
+ update_display(&watch, date_time);
}
int main(void)
{
atmel_start_init();
+ gpio_set_pin_level(RED, false);
+ gpio_set_pin_direction(RED, GPIO_DIRECTION_OUT);
+ gpio_set_pin_function(RED, GPIO_PIN_FUNCTION_OFF);
gpio_set_pin_level(GREEN, false);
-
- // Set pin direction to output
gpio_set_pin_direction(GREEN, GPIO_DIRECTION_OUT);
-
gpio_set_pin_function(GREEN, GPIO_PIN_FUNCTION_OFF);
watch_init(&watch);
@@ -59,25 +61,26 @@ int main(void)
watch_enable_date_time(&watch);
struct calendar_date_time date_time;
- date_time.date.year = 2021;
- date_time.date.month = 4;
- date_time.date.day = 30;
- date_time.time.hour = 9;
- date_time.time.min = 40;
+ date_time.date.year = 1; // reference year is 2020, add this to that.
+ date_time.date.month = 5;
+ date_time.date.day = 2;
+ date_time.time.hour = 7;
+ date_time.time.min = 15;
date_time.time.sec = 0;
watch_set_date_time(date_time);
- struct calendar_alarm alarm;
+/* struct calendar_alarm alarm;
alarm.cal_alarm.mode = REPEAT;
alarm.cal_alarm.datetime = date_time;
alarm.cal_alarm.datetime.time.sec = 0;
alarm.cal_alarm.option = CALENDAR_ALARM_MATCH_SEC;
alarm.callback = calendar_callback;
- update_display(&watch, date_time);
calendar_set_alarm(&CALENDAR_0, &alarm, &calendar_callback);
+*/
+ update_display(&watch, date_time);
watch_enable_tick(tick_callback);
while (1) {
- sleep(2);
+ sleep(4);
}
return 0;
diff --git a/Smol Watch Project/My Project/mars_clock.c b/Smol Watch Project/My Project/mars_clock.c
index ad7562e..82a47d0 100644
--- a/Smol Watch Project/My Project/mars_clock.c
+++ b/Smol Watch Project/My Project/mars_clock.c
@@ -12,6 +12,6 @@
void update_display(Watch *watch, struct calendar_date_time date_time) {
char buf[6];
- sprintf(&buf[0], "TE %02d%02d", date_time.time.hour, date_time.time.min);
+ sprintf(&buf[0], "TE %02d%02d%02d", date_time.time.hour, date_time.time.min, date_time.time.sec);
watch_display_string(watch, buf, 0);
}
diff --git a/Smol Watch Project/My Project/watch-library/watch.c b/Smol Watch Project/My Project/watch-library/watch.c
index 69eacde..cb12b28 100644
--- a/Smol Watch Project/My Project/watch-library/watch.c
+++ b/Smol Watch Project/My Project/watch-library/watch.c
@@ -12,6 +12,8 @@
void watch_init(Watch *watch) {
memset(watch, 0, sizeof(*watch));
+ SUPC->VREG.bit.SEL = 1;
+ while(!SUPC->STATUS.bit.VREGRDY);
}
const uint8_t Character_Set[] =