diff options
Diffstat (limited to 'pico-watch.c')
-rw-r--r-- | pico-watch.c | 35 |
1 files changed, 2 insertions, 33 deletions
diff --git a/pico-watch.c b/pico-watch.c index b5bb792..a07cd23 100644 --- a/pico-watch.c +++ b/pico-watch.c @@ -5,38 +5,9 @@ #include "pico/util/datetime.h" #include "oled/ss_oled.h" -// To modify the I2C port used, change the `#define I2C_PORT` in "oled/BitBang_I2C.c" -// Pin numbers are GPIO pins. -#define SDA_PIN 6 -#define SCL_PIN 7 -#define RESET_PIN -1 -#define OLED_DEFAULT_CONTRAST 40 -SSOLED oled; -// Unused but useful for reference: -#define OLED_WIDTH 128 -#define OLED_HEIGHT 64 +#include "init.h" -void init_display() { - oledInit(&oled, OLED_128x64, 0x3d, 0, 0, 1, SDA_PIN, SCL_PIN, RESET_PIN, 1000000L); - oledFill(&oled, 0,1); - oledSetContrast(&oled, OLED_DEFAULT_CONTRAST); - //oledSetTextWrap(&oled, true); -} - -void init_rtc() { - datetime_t init_date = { - .year = 2020, - .month = 06, - .day = 05, - .dotw = 5, // 0 is Sunday, so 5 is Friday - .hour = 15, - .min = 45, - .sec = 00 }; - rtc_init(); - rtc_set_datetime(&init_date); -} - // Time as string // Adapted from pico-sdk/scr/common/pico_util/datetime.c void time_as_str(char *buf, uint buf_size, const datetime_t *t) { @@ -82,9 +53,7 @@ void show_datetime() { } int main() { - stdio_init_all(); - init_display(); - init_rtc(); + init_all(); oledWriteString(&oled, 0,15,0, (char *)"Test clock", FONT_8x8, 0, 1); while (1) { show_datetime(); |