aboutsummaryrefslogtreecommitdiffstats
path: root/init.cpp
blob: 7e7056d07dc8faabf7a249834e76a2891b159428 (plain)
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
#include <stdio.h>
#include "pico/stdlib.h"
#ifndef SDL2_BUILD
#include "hardware/i2c.h"
extern "C" {
#include "hardware/rtc.h"
}
#endif

#include "init.hpp"

#ifndef SDL2_BUILD
void init_rtc() {
    datetime_t init_date = {
        .year = INIT_DATETIME_YEAR,
        .month = INIT_DATETIME_MONTH,
        .day = INIT_DATETIME_DAY,
        .dotw = INIT_DATETIME_DOTW, // 0 is Sunday, so 5 is Friday
        .hour = INIT_DATETIME_HOUR,
        .min = INIT_DATETIME_MIN,
        .sec = INIT_DATETIME_SEC };
    rtc_init();
    rtc_set_datetime(&init_date);
}
#endif

void init_all() {
#ifndef SDL2_BUILD
    stdio_init_all();
    init_rtc();
#endif
}