Device drive interface for the DS1307 real-time clock.
More...
Device drive interface for the DS1307 real-time clock.
◆ ds1307_sqw_mode_t
Modes for the DS1307 square wave / output driver.
Enumerator |
---|
DS1307_SQW_MODE_0 | OUT: 0.
|
DS1307_SQW_MODE_1000HZ | SQW: 1kHz.
|
DS1307_SQW_MODE_4096HZ | SQW: 4.096 kHz.
|
DS1307_SQW_MODE_8192HZ | SQW: 8.192 kHz.
|
DS1307_SQW_MODE_32768HZ | SQW: 32.768 kHz.
|
DS1307_SQW_MODE_1 | OUT: 1.
|
Definition at line 76 of file ds1307.h.
◆ ds1307_get_sqw_mode()
int ds1307_get_sqw_mode |
( |
const ds1307_t * |
dev | ) |
|
Get current mode of square wave / output driver.
- Note
- To get the actual output of the driver, attach the pin via GPIO
- Parameters
-
[in] | dev | device descriptor of the targeted device |
- Returns
- current mode of the square wave / output driver (see ds1307_sqw_mode_t)
-
< 0 if unable to speak to the device
◆ ds1307_get_time()
int ds1307_get_time |
( |
const ds1307_t * |
dev, |
|
|
struct tm * |
time |
|
) |
| |
Get current RTC time.
- Parameters
-
[in] | dev | device descriptor of the targeted device |
[out] | time | pointer to the struct to write the time to. |
- Returns
- 0 on success
-
< 0 if unable to speak to the device
◆ ds1307_halt()
Halt clock.
- Note
- Can be reversed using ds1307_set_time()
- Parameters
-
[in] | dev | device descriptor of the targeted device |
- Returns
- 0 on success
-
< 0 if unable to speak to the device
◆ ds1307_init()
Initialize the given DS1307 device.
- Parameters
-
[out] | dev | device descriptor of the targeted device |
[in] | params | device configuration (i2c bus, address and bus clock) |
- Returns
- 0 on success
-
< 0 if unable to speak to the device
◆ ds1307_set_sqw_mode()
Set mode of square wave / output driver.
- Note
- To get the actual output of the driver, attach the pin via GPIO
- Parameters
-
[in] | dev | device descriptor of the targeted device |
[in] | mode | mode for the square wave / output driver |
- Returns
- 0 on success
-
< 0 if unable to speak to the device
◆ ds1307_set_time()
int ds1307_set_time |
( |
const ds1307_t * |
dev, |
|
|
const struct tm * |
time |
|
) |
| |
Set RTC to a given time.
- Parameters
-
[in] | dev | device descriptor of the targeted device |
[in] | time | pointer to the struct holding the time to set. |
- Returns
- 0 on success
-
< 0 if unable to speak to the device