-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmain.cpp
51 lines (42 loc) · 1.17 KB
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#include <stdio.h>
#include <stdlib.h>
#include "pico/stdlib.h"
#include "pico/util/datetime.h"
#include "hardware/rtc.h"
#include "dev_config.h"
#include "lcd.h"
#include "default_watchface.h"
static uint16_t img[LCD_HEIGHT * LCD_WIDTH];
int main(void)
{
// init
if (dev_module_init() != 0)
return -1;
LCD lcd((uint16_t *)&img, RIGHT);
Watchface *default_clock = new DefaultWatchface();
datetime_t t = {
.year = 2024,
.month = 11,
.day = 05,
.dotw = 2, // 0 is Sunday, so 5 is Friday
.hour = 01,
.min = 22,
.sec = 00
};
rtc_init();
rtc_set_datetime(&t);
// clk_sys is >2000x faster than clk_rtc, so datetime is not updated immediately when rtc_get_datetime() is called.
// The delay is up to 3 RTC clock cycles (which is 64us with the default clock settings)
sleep_us(64);
// lcd.gradient(0, 0, lcd.width, lcd.height, BLUE, BLACK, 0);
// lcd.display();
// loop
while(true)
{
rtc_get_datetime(&t);
default_clock->draw_clock(&lcd, &t);
sleep_ms(100);
};
delete default_clock;
return 0;
}