sunday low power work
This commit is contained in:
parent
88a38cc235
commit
471bdc60c0
@ -979,7 +979,7 @@ drivers:
|
|||||||
functionality: Segment_LCD
|
functionality: Segment_LCD
|
||||||
api: HAL:Driver:SLCD_Sync
|
api: HAL:Driver:SLCD_Sync
|
||||||
configuration:
|
configuration:
|
||||||
slcd_arch_advanced_settings: false
|
slcd_arch_advanced_settings: true
|
||||||
slcd_arch_bbd: 2
|
slcd_arch_bbd: 2
|
||||||
slcd_arch_bben: true
|
slcd_arch_bben: true
|
||||||
slcd_arch_bias: THIRD
|
slcd_arch_bias: THIRD
|
||||||
@ -1233,7 +1233,7 @@ drivers:
|
|||||||
slcd_arch_presc: '64'
|
slcd_arch_presc: '64'
|
||||||
slcd_arch_prf: 250Hz
|
slcd_arch_prf: 250Hz
|
||||||
slcd_arch_rrf: 2kHz
|
slcd_arch_rrf: 2kHz
|
||||||
slcd_arch_runstdby: false
|
slcd_arch_runstdby: true
|
||||||
slcd_arch_seg_num: 24
|
slcd_arch_seg_num: 24
|
||||||
slcd_arch_wmod: Low Power Waveform(frame-inversion)
|
slcd_arch_wmod: Low Power Waveform(frame-inversion)
|
||||||
slcd_arch_xvlcd: false
|
slcd_arch_xvlcd: false
|
||||||
|
@ -169,14 +169,14 @@
|
|||||||
// <e> Advanced configuration
|
// <e> Advanced configuration
|
||||||
// <id> slcd_arch_advanced_settings
|
// <id> slcd_arch_advanced_settings
|
||||||
#ifndef CONF_SLCD_ADVANCED_SETTINGS
|
#ifndef CONF_SLCD_ADVANCED_SETTINGS
|
||||||
#define CONF_SLCD_ADVANCED_SETTINGS 0
|
#define CONF_SLCD_ADVANCED_SETTINGS 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// <q> Run in standby
|
// <q> Run in standby
|
||||||
// <i> Indicates whether the SLCD will continue running in standby sleep mode or not
|
// <i> Indicates whether the SLCD will continue running in standby sleep mode or not
|
||||||
// <id> slcd_arch_runstdby
|
// <id> slcd_arch_runstdby
|
||||||
#ifndef CONF_SLCD_RUNSTDBY
|
#ifndef CONF_SLCD_RUNSTDBY
|
||||||
#define CONF_SLCD_RUNSTDBY 0
|
#define CONF_SLCD_RUNSTDBY 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// </e>
|
// </e>
|
||||||
|
@ -202,7 +202,7 @@
|
|||||||
<AcmeProjectActionInfo Action="File" Source="config/hpl_port_config.h" IsConfig="true" Hash="rMTNR+5FXtu+wfT1NbfRRA" />
|
<AcmeProjectActionInfo Action="File" Source="config/hpl_port_config.h" IsConfig="true" Hash="rMTNR+5FXtu+wfT1NbfRRA" />
|
||||||
<AcmeProjectActionInfo Action="File" Source="config/hpl_rtc_config.h" IsConfig="true" Hash="oTcobT9ydLDOqfpwUidHvg" />
|
<AcmeProjectActionInfo Action="File" Source="config/hpl_rtc_config.h" IsConfig="true" Hash="oTcobT9ydLDOqfpwUidHvg" />
|
||||||
<AcmeProjectActionInfo Action="File" Source="config/hpl_sercom_config.h" IsConfig="true" Hash="x/EmsaDJwEm2EI8zXUSlWw" />
|
<AcmeProjectActionInfo Action="File" Source="config/hpl_sercom_config.h" IsConfig="true" Hash="x/EmsaDJwEm2EI8zXUSlWw" />
|
||||||
<AcmeProjectActionInfo Action="File" Source="config/hpl_slcd_config.h" IsConfig="true" Hash="ErbI2VSUDy3ufREFJTO9Uw" />
|
<AcmeProjectActionInfo Action="File" Source="config/hpl_slcd_config.h" IsConfig="true" Hash="dUpqyZg3KRMbt3sjYhNt1Q" />
|
||||||
<AcmeProjectActionInfo Action="File" Source="config/hpl_systick_config.h" IsConfig="true" Hash="tlT3lNDKWFe82MiGWfQzcA" />
|
<AcmeProjectActionInfo Action="File" Source="config/hpl_systick_config.h" IsConfig="true" Hash="tlT3lNDKWFe82MiGWfQzcA" />
|
||||||
<AcmeProjectActionInfo Action="File" Source="config/hpl_tc_config.h" IsConfig="true" Hash="s9fqdoBaH2BH7Id2JoCHTg" />
|
<AcmeProjectActionInfo Action="File" Source="config/hpl_tc_config.h" IsConfig="true" Hash="s9fqdoBaH2BH7Id2JoCHTg" />
|
||||||
<AcmeProjectActionInfo Action="File" Source="config/hpl_tcc_config.h" IsConfig="true" Hash="5OifPvGmHqsckywrqS3ctQ" />
|
<AcmeProjectActionInfo Action="File" Source="config/hpl_tcc_config.h" IsConfig="true" Hash="5OifPvGmHqsckywrqS3ctQ" />
|
||||||
|
@ -4,47 +4,49 @@
|
|||||||
#include "mars_clock.h"
|
#include "mars_clock.h"
|
||||||
|
|
||||||
Watch watch;
|
Watch watch;
|
||||||
int light = 1;
|
bool locked = true;
|
||||||
|
|
||||||
void calendar_callback(struct calendar_descriptor *const calendar) {
|
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() {
|
static void mode_callback() {
|
||||||
|
locked = !locked;
|
||||||
|
gpio_set_pin_level(GREEN, !locked);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void light_callback() {
|
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() {
|
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() {
|
static void tick_callback() {
|
||||||
gpio_set_pin_level(GREEN, lightOn == 0);
|
struct calendar_date_time date_time;
|
||||||
lightOn = (lightOn + 1) % 10;
|
calendar_get_date_time(&CALENDAR_0, &date_time);
|
||||||
|
update_display(&watch, date_time);
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
atmel_start_init();
|
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);
|
gpio_set_pin_level(GREEN, false);
|
||||||
|
|
||||||
// Set pin direction to output
|
|
||||||
gpio_set_pin_direction(GREEN, GPIO_DIRECTION_OUT);
|
gpio_set_pin_direction(GREEN, GPIO_DIRECTION_OUT);
|
||||||
|
|
||||||
gpio_set_pin_function(GREEN, GPIO_PIN_FUNCTION_OFF);
|
gpio_set_pin_function(GREEN, GPIO_PIN_FUNCTION_OFF);
|
||||||
|
|
||||||
watch_init(&watch);
|
watch_init(&watch);
|
||||||
@ -59,25 +61,26 @@ int main(void)
|
|||||||
|
|
||||||
watch_enable_date_time(&watch);
|
watch_enable_date_time(&watch);
|
||||||
struct calendar_date_time date_time;
|
struct calendar_date_time date_time;
|
||||||
date_time.date.year = 2021;
|
date_time.date.year = 1; // reference year is 2020, add this to that.
|
||||||
date_time.date.month = 4;
|
date_time.date.month = 5;
|
||||||
date_time.date.day = 30;
|
date_time.date.day = 2;
|
||||||
date_time.time.hour = 9;
|
date_time.time.hour = 7;
|
||||||
date_time.time.min = 40;
|
date_time.time.min = 15;
|
||||||
date_time.time.sec = 0;
|
date_time.time.sec = 0;
|
||||||
watch_set_date_time(date_time);
|
watch_set_date_time(date_time);
|
||||||
struct calendar_alarm alarm;
|
/* struct calendar_alarm alarm;
|
||||||
alarm.cal_alarm.mode = REPEAT;
|
alarm.cal_alarm.mode = REPEAT;
|
||||||
alarm.cal_alarm.datetime = date_time;
|
alarm.cal_alarm.datetime = date_time;
|
||||||
alarm.cal_alarm.datetime.time.sec = 0;
|
alarm.cal_alarm.datetime.time.sec = 0;
|
||||||
alarm.cal_alarm.option = CALENDAR_ALARM_MATCH_SEC;
|
alarm.cal_alarm.option = CALENDAR_ALARM_MATCH_SEC;
|
||||||
alarm.callback = calendar_callback;
|
alarm.callback = calendar_callback;
|
||||||
update_display(&watch, date_time);
|
|
||||||
calendar_set_alarm(&CALENDAR_0, &alarm, &calendar_callback);
|
calendar_set_alarm(&CALENDAR_0, &alarm, &calendar_callback);
|
||||||
|
*/
|
||||||
|
update_display(&watch, date_time);
|
||||||
watch_enable_tick(tick_callback);
|
watch_enable_tick(tick_callback);
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
sleep(2);
|
sleep(4);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -12,6 +12,6 @@
|
|||||||
|
|
||||||
void update_display(Watch *watch, struct calendar_date_time date_time) {
|
void update_display(Watch *watch, struct calendar_date_time date_time) {
|
||||||
char buf[6];
|
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);
|
watch_display_string(watch, buf, 0);
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,8 @@
|
|||||||
|
|
||||||
void watch_init(Watch *watch) {
|
void watch_init(Watch *watch) {
|
||||||
memset(watch, 0, sizeof(*watch));
|
memset(watch, 0, sizeof(*watch));
|
||||||
|
SUPC->VREG.bit.SEL = 1;
|
||||||
|
while(!SUPC->STATUS.bit.VREGRDY);
|
||||||
}
|
}
|
||||||
|
|
||||||
const uint8_t Character_Set[] =
|
const uint8_t Character_Set[] =
|
||||||
|
Loading…
x
Reference in New Issue
Block a user