ds1307.h File Reference

DS1307 definitions. More...

Detailed Description

DS1307 definitions.

Author
Martine Lenders m.len.nosp@m.ders.nosp@m.@fu-b.nosp@m.erli.nosp@m.n.de

Definition in file ds1307.h.

#include <stdbool.h>
#include <time.h>
#include "nvram.h"
#include "periph/i2c.h"
#include "periph/gpio.h"
+ Include dependency graph for ds1307.h:

Go to the source code of this file.

Data Structures

struct  ds1307_t
 Device descriptor for DS1307 devices. More...
 
struct  ds1307_params_t
 Set of configuration parameters for DS1307 devices. More...
 

Macros

#define DS1307_I2C_ADDRESS   (0x68)
 I2C address of DS1307 RTC.
 
#define DS1307_I2C_MAX_CLK   (I2C_SPEED_FAST)
 Maximum I2C bus speed to use with the device.
 
#define DS1307_NVRAM_MAX_SIZE   (56U)
 Maximum size in byte of on-chip NVRAM.
 

Enumerations

enum  ds1307_sqw_mode_t {
  DS1307_SQW_MODE_0 = 0x00, DS1307_SQW_MODE_1000HZ = 0x10, DS1307_SQW_MODE_4096HZ = 0x11, DS1307_SQW_MODE_8192HZ = 0x12,
  DS1307_SQW_MODE_32768HZ = 0x13, DS1307_SQW_MODE_1 = 0x80
}
 Modes for the DS1307 square wave / output driver. More...
 

Functions

int ds1307_init (ds1307_t *dev, const ds1307_params_t *params)
 Initialize the given DS1307 device. More...
 
int ds1307_set_time (const ds1307_t *dev, const struct tm *time)
 Set RTC to a given time. More...
 
int ds1307_get_time (const ds1307_t *dev, struct tm *time)
 Get current RTC time. More...
 
int ds1307_halt (const ds1307_t *dev)
 Halt clock. More...
 
int ds1307_set_sqw_mode (const ds1307_t *dev, ds1307_sqw_mode_t mode)
 Set mode of square wave / output driver. More...
 
int ds1307_get_sqw_mode (const ds1307_t *dev)
 Get current mode of square wave / output driver. More...