Ersa Wearable Platform
Embedded smartwatch firmware and application framework
Loading...
Searching...
No Matches
ds3231.h
Go to the documentation of this file.
1#pragma once
2
3#if defined(ARDUINO)
4
5#include <Arduino.h>
6#include <Wire.h>
7
8namespace ersa::drivers::rtc {
9
11class Ds3231 {
12public:
14 explicit Ds3231(TwoWire& wire = Wire, uint8_t address = 0x68);
15
17 bool begin(int sda, int scl, uint32_t frequencyHz = 100000);
19 bool probe();
21 bool read(uint16_t& year, uint8_t& month, uint8_t& day, uint8_t& hour,
22 uint8_t& minute, uint8_t& second, uint8_t& dayOfWeek);
24 bool write(uint16_t year, uint8_t month, uint8_t day, uint8_t hour,
25 uint8_t minute, uint8_t second, uint8_t dayOfWeek);
27 bool lostPower(bool& stopped);
28
29private:
30 bool readRegisters(uint8_t first, uint8_t* data, size_t size);
31 bool writeRegisters(uint8_t first, const uint8_t* data, size_t size);
32
33 TwoWire& wire_;
34 uint8_t address_;
35};
36
37} // namespace ersa::drivers::rtc
38
39#endif
void begin()
Definition app_agenda.cpp:27
size_t size
Definition ota_service.cpp:47
char data[MANIFEST_LIMIT]
Definition ota_service.cpp:33