#include "ds1307.h"
Go to the source code of this file.
Functions | |
uns8 | bcd_to_dec (uns8 bcd) |
uns8 | dec_to_bcd (uns8 dec) |
uns8 | rtc_get_config () |
Get the config register from the ds1307. | |
uns8 | rtc_get_date () |
Get the date register from the ds1307. | |
uns8 | rtc_get_day () |
Get the day register from the ds1307. | |
uns8 | rtc_get_hours () |
Get the decoded hours register from the ds1307. | |
uns8 | rtc_get_minutes () |
Get the decoded minutes register from the ds1307. | |
uns8 | rtc_get_month () |
Get the month register from the ds1307. | |
uns8 | rtc_get_seconds () |
Get the decoded seconds register from the ds1307. | |
uns8 | rtc_get_year () |
Get the year register from the ds1307. | |
uns8 | rtc_set_config (uns8 config) |
Set the config register in the ds1307. | |
void | rtc_set_date (uns8 date) |
Set the date register from the ds1307. | |
void | rtc_set_day (uns8 day) |
Set the day of the week register from the ds1307. | |
void | rtc_set_hours (uns8 hours) |
Set the hours register in the ds1307. | |
void | rtc_set_minutes (uns16 minutes) |
Set the minutes register from the ds1307. | |
void | rtc_set_month (uns8 month) |
Set the month register in the ds1307. | |
void | rtc_set_seconds (uns8 seconds) |
Set the seconds register in the ds1307. | |
void | rtc_set_year (uns16 year) |
Set the year register from the ds1307. | |
void | rtc_setup_io () |
Setup ports and pins for use in the ds1307. | |
void | rtc_start_clock () |
Starts the clock in the ds1307. | |
void | rtc_stop_clock () |
Stop the clock in the ds1307. |
uns8 bcd_to_dec | ( | uns8 | bcd | ) |
Definition at line 39 of file ds1307.c.
Referenced by rtc_get_date(), rtc_get_day(), rtc_get_dow(), rtc_get_hours(), rtc_get_minutes(), rtc_get_month(), rtc_get_seconds(), and rtc_get_year().
uns8 dec_to_bcd | ( | uns8 | dec | ) |
Definition at line 43 of file ds1307.c.
Referenced by rtc_set_date(), rtc_set_day(), rtc_set_hours(), rtc_set_minutes(), rtc_set_month(), rtc_set_seconds(), and rtc_set_year().
uns8 rtc_get_config | ( | ) |
Returns the config register from the ds1307. Bit 7 - Out - Value on SQWE pin if not outputting square wave Bit 6 - 0 Bit 5 - 0 Bit 4 - SQWE - Enable square wave output Bit 3 - 0 Bit 2 - 0 Bit 1 - RS1 Bit 0 - RS0
RS1/0 determin the speed of the square wave output. Set to 0/0 for 1 Hz.
Definition at line 76 of file ds1307.c.
References ds1307_control_register, ds1307_device, and i2c_read_eeprom().
uns8 rtc_get_date | ( | ) |
uns8 rtc_get_day | ( | ) |
Returns the day of the week from the ds1307. The result is coverted to decimal from BCD and is ready to use. Range - 1 through 7
Definition at line 61 of file ds1307.c.
References bcd_to_dec(), ds1307_day_register, ds1307_device, and i2c_read_eeprom().
uns8 rtc_get_hours | ( | ) |
uns8 rtc_get_minutes | ( | ) |
uns8 rtc_get_month | ( | ) |
uns8 rtc_get_seconds | ( | ) |
uns8 rtc_get_year | ( | ) |
uns8 rtc_set_config | ( | uns8 | config | ) |
Set the config register in the m41t81s.
Sets the config register in the ds1307.
Bit 7 - Out - Value on SQWE pin if not outputting square wave Bit 6 - 0 Bit 5 - 0 Bit 4 - SQWE - Enable square wave output Bit 3 - 0 Bit 2 - 0 Bit 1 - RS1 Bit 0 - RS0
RS1/0 determin the speed of the square wave output. Set to 0/0 for 1 Hz.
config | Value to set the config register to |
Definition at line 80 of file ds1307.c.
References ds1307_control_register, ds1307_device, and i2c_write_eeprom().
void rtc_set_date | ( | uns8 | date | ) |
void rtc_set_day | ( | uns8 | day | ) |
void rtc_set_hours | ( | uns8 | hours | ) |
void rtc_set_minutes | ( | uns16 | minutes | ) |
Changes the minutes in the ds1307.
seconds | Value to set minutes to |
Definition at line 96 of file ds1307.c.
References dec_to_bcd(), ds1307_device, ds1307_minutes_register, and i2c_write_eeprom().
void rtc_set_month | ( | uns8 | month | ) |
void rtc_set_seconds | ( | uns8 | seconds | ) |
void rtc_set_year | ( | uns16 | year | ) |
Changes the year in the ds1307.
Definition at line 93 of file ds1307.c.
References dec_to_bcd(), ds1307_device, ds1307_year_register, and i2c_write_eeprom().
void rtc_setup_io | ( | ) |
Setup ports and pins for use in the m41t81s.
Calls i2c_setup() to configure ports and pins ready for use
void rtc_start_clock | ( | ) |