Yes, the code I'm working with is RTClib which is hundreds of lines long. I'll extract just the classes involved:
class RTC_I2C {
protected:
/*!
@brief Convert a binary coded decimal value to binary. RTC stores
time/date values as BCD.
@param val BCD value
@return Binary value
*/
static uint8_t bcd2bin(uint8_t val) { return val - 6 * (val >> 4); }
/*!
@brief Convert a binary value to BCD format for the RTC registers
@param val Binary value
@return BCD value
*/
static uint8_t bin2bcd(uint8_t val) { return val + 6 * (val / 10); }
Adafruit_I2CDevice *i2c_dev = NULL; ///< Pointer to I2C bus interface
uint8_t read_register(uint8_t reg);
void write_register(uint8_t reg, uint8_t val);
};
/**************************************************************************/
/*!
@brief RTC based on the DS1307 chip connected via I2C and the Wire library
*/
/**************************************************************************/
class RTC_DS1307 : public RTC_I2C {
public:
bool begin(TwoWire *wireInstance = &Wire);
void adjust(const DateTime &dt);
uint8_t isrunning(void);
DateTime now();
Ds1307SqwPinMode readSqwPinMode();
void writeSqwPinMode(Ds1307SqwPinMode mode);
uint8_t readnvram(uint8_t address);
void readnvram(uint8_t *buf, uint8_t size, uint8_t address);
void writenvram(uint8_t address, uint8_t data);
void writenvram(uint8_t address, const uint8_t *buf, uint8_t size);
};
The Arduino compiler complains about 'public' expected a class.
Yes, things like non-trivial initialization aren't implemented.
I'm writing the code to support several boards for the Binary Clock Shield I got from NixieTesters.com. It only supported the UNO and I wanted to have it work on a Wemos D1 R32 ESP32 based UNO style board. I want to have it use the WiFi for syncing with a NTP server and create an app to change the colors of the LEDs and change the Alarm Melody. The D1 R32 UNO board has hardware issues, the pin defined for the Neopixel data output is an INPUT only pin (GPIO 34) so that required hardware changes to the board. I got a new ESP32-S3 based UNO board that works without hardware modifications.
The ESP32 uses RTOS as the base OS and with dual cores and lots of RAM it's like desktop development. The UNO R3 is another beast.