3.6.1. ds3231 — RTC clock

DS3231 is a real time clock.

../../../_images/DS3231-High-Precision-Real-Time-Clock-Module-600x600.jpg

Source code: src/drivers/various/ds3231.h, src/drivers/various/ds3231.c

Test code: tst/drivers/hardware/various/ds3231/main.c


Functions

int ds3231_init(struct ds3231_driver_t *self_p, struct i2c_driver_t *i2c_p)

Initialize given driver object.

Return
zero(0) or negative error code.
Parameters
  • self_p: Driver object to be initialized.
  • i2c_p: I2C driver to use.

int ds3231_set_date(struct ds3231_driver_t *self_p, struct date_t *date_p)

Set date in the DS3231 device.

Return
zero(0) or negative error code.
Parameters
  • self_p: Driver object.
  • date_p: Date to set in the device.

int ds3231_get_date(struct ds3231_driver_t *self_p, struct date_t *date_p)

Get date from the DS3231 device.

Return
zero(0) or negative error code.
Parameters
  • self_p: Driver object.
  • date_p: Date read from the device.

struct ds3231_driver_t
#include <ds3231.h>

Public Members

struct i2c_driver_t *i2c_p