12345678910111213141516171819202122232425262728293031323334353637383940 |
- /*
- * SPDX-FileCopyrightText: 2022 Helmut Pozimski <helmut@pozimski.eu>
- *
- * SPDX-License-Identifier: GPL-2.0-only
- */
- #include <stdio.h>
- #include "ds3231.h"
- #include "freertos/FreeRTOS.h"
- #include "freertos/task.h"
- #define DS3231_SDA_PIN 4
- #define DS3231_SCL_PIN 5
- void app_main() {
- ESP_ERROR_CHECK(ds3231_init(DS3231_SDA_PIN, DS3231_SCL_PIN));
- for (int i=0; i<100; i++) {
- date_time date_time = { .seconds = 58,
- .minutes = 15,
- .hours = 23,
- .dow = 3,
- .day = 21,
- .month = 8,
- .year = 22 };
- ds3231_write_date_time(date_time);
- ds3231_read_date_time(&date_time);
- printf("Seconds: %d\n", date_time.seconds);
- printf("Minutes: %d\n", date_time.minutes);
- printf("Hours: %d\n", date_time.hours);
- printf("Day of week: %d\n", date_time.dow);
- printf("Day of month: %d\n", date_time.day);
- printf("Month: %d\n", date_time.month);
- printf("Year: %d\n", date_time.year);
- vTaskDelay(1000 / portTICK_PERIOD_MS);
- }
- printf("Hello World\n");
- }
|