\hypertarget{ds3231_8h}{
\section{ds3231.h File Reference}
\label{ds3231_8h}\index{ds3231.h@{ds3231.h}}
}
{\ttfamily \#include $<$avr/io.h$>$}\par
{\ttfamily \#include \char`\"{}config.h\char`\"{}}\par
{\ttfamily \#include $<$util/delay.h$>$}\par
{\ttfamily \#include $<$util/delay\_\-basic.h$>$}\par
{\ttfamily \#include \char`\"{}i2c.h\char`\"{}}\par
\subsection*{Functions}
\begin{DoxyCompactItemize}
\item 
void \hyperlink{ds3231_8h_ab1e1e4e0b72c8f2a5c6f135260e433d5}{reset\_\-rtc\_\-i2c} (void)
\begin{DoxyCompactList}\small\item\em Resets the I2C to RTC communications. \item\end{DoxyCompactList}\item 
uint8\_\-t \hyperlink{ds3231_8h_aa6c5594a2b9c64eeba1be22cfcd8c932}{read\_\-from\_\-rtc} (uint8\_\-t $\ast$store\_\-data)
\begin{DoxyCompactList}\small\item\em Read a set of data from the DS3231 Real time clock to memory. \item\end{DoxyCompactList}\item 
uint8\_\-t \hyperlink{ds3231_8h_a7f5203272b8222199211bd51bd75166f}{write\_\-to\_\-rtc} (uint8\_\-t $\ast$store\_\-data)
\begin{DoxyCompactList}\small\item\em Write a set of data from memory to the DS3231 Real time clock. \item\end{DoxyCompactList}\item 
uint8\_\-t \hyperlink{ds3231_8h_a022ec8bc8e5fbaeb6ea91b5dbe3e854c}{write\_\-alarm} (uint8\_\-t $\ast$alarm\_\-data)
\begin{DoxyCompactList}\small\item\em Write a set of data from memory to the alarm registers on the DS3231 Real time clock. \item\end{DoxyCompactList}\item 
uint8\_\-t \hyperlink{ds3231_8h_ad57ee46a709dc3e17d7274fca5066456}{read\_\-temp\_\-from\_\-rtc} (uint8\_\-t $\ast$store\_\-data)
\begin{DoxyCompactList}\small\item\em Read a temperature from the DS3231 internal temp sensor. \item\end{DoxyCompactList}\item 
uint8\_\-t \hyperlink{ds3231_8h_a36dee10e230ff135f99efd3aa95914d3}{set\_\-rtc\_\-register\_\-pointer} (uint8\_\-t val)
\begin{DoxyCompactList}\small\item\em Set the register pointer in the RTC to the parameter supplied. \item\end{DoxyCompactList}\item 
uint32\_\-t \hyperlink{ds3231_8h_a90d310b1f92cf36ef427b8d639e55405}{get\_\-fattime} (void)
\begin{DoxyCompactList}\small\item\em Reads the time into internal variable time\_\-store\mbox{[}7\mbox{]}, and converts for FAT filesystems. \item\end{DoxyCompactList}\item 
void \hyperlink{ds3231_8h_ae754a406c61eb6be8d05e26388b58116}{dirname\_\-from\_\-date} (uint8\_\-t $\ast$dirname, uint8\_\-t $\ast$time\_\-store)
\begin{DoxyCompactList}\small\item\em Convert a time read from the RTC into a directory name. DOESN'T READ THE RTC. \item\end{DoxyCompactList}\item 
void \hyperlink{ds3231_8h_a66680c0447b6a7c8bb36001e4a3b685a}{filename\_\-from\_\-date} (uint8\_\-t $\ast$filename, uint8\_\-t $\ast$time\_\-store)
\begin{DoxyCompactList}\small\item\em Convert a time read from the RTC into a file name. DOESN'T READ THE RTC. \item\end{DoxyCompactList}\item 
void \hyperlink{ds3231_8h_a8926a9eb22a1a790b619fbbf5a5ab9e1}{iso\_\-time} (uint8\_\-t $\ast$iso\_\-time\_\-store, uint8\_\-t $\ast$time\_\-store)
\begin{DoxyCompactList}\small\item\em Create an ISO time string from a set of data. DOESN'T READ THE RTC. \item\end{DoxyCompactList}\item 
void \hyperlink{ds3231_8h_a1d3fd050d58f81cf04440ab3ff9ecec6}{americandate} (uint8\_\-t $\ast$result, uint8\_\-t $\ast$time\_\-store)
\begin{DoxyCompactList}\small\item\em Create a string representing the data in the form mm/dd/yyyy from a set of data. DOESN'T READ THE RTC. \item\end{DoxyCompactList}\item 
void \hyperlink{ds3231_8h_a4bca99ec8c78c324c2ba477ed8de169b}{hms\_\-time} (uint8\_\-t $\ast$result, uint8\_\-t $\ast$time\_\-store)
\begin{DoxyCompactList}\small\item\em Create an ISO time string from a set of data read from the RTC. \item\end{DoxyCompactList}\item 
uint8\_\-t \hyperlink{ds3231_8h_af52153b03b1a05fea5b4eb3eadf52a25}{hex2ascii\_\-h} (uint8\_\-t hexval)
\begin{DoxyCompactList}\small\item\em Convert the high nibble of a supplied byte into an ASCII character. \item\end{DoxyCompactList}\item 
uint8\_\-t \hyperlink{ds3231_8h_a68043f0b43c0d8b5f39a370f055e7a74}{hex2ascii\_\-l} (uint8\_\-t hexval)
\begin{DoxyCompactList}\small\item\em Convert the low nibble of a supplied byte into an ASCII character. \item\end{DoxyCompactList}\item 
uint8\_\-t \hyperlink{ds3231_8h_a2f379772b393d02eab966d60b3491916}{bcd\_\-to\_\-hex} (uint8\_\-t bcd)
\begin{DoxyCompactList}\small\item\em Convert a BCD value in a byte to the correct hex value. \item\end{DoxyCompactList}\item 
uint8\_\-t \hyperlink{ds3231_8h_a699c069585ed4c01cc14aa0514de3f71}{set\_\-datetime} (uint8\_\-t $\ast$iso\_\-time\_\-store)
\begin{DoxyCompactList}\small\item\em Take in a pointer to time in ISO format (15 bytes) eg 20101203 141604 and set RTC to that time. Time format is xxyymmddxhhmmss where xx and x are don't care Time format does not need to be null terminated Day of week on RTC is set to 1, as I never use dow. \item\end{DoxyCompactList}\item 
void \hyperlink{ds3231_8h_aecec2c010f9f46eff5bc2295e9ab2efb}{addtime} (uint8\_\-t $\ast$result, uint8\_\-t $\ast$start, uint16\_\-t seconds)
\begin{DoxyCompactList}\small\item\em Take a BCD time eg as read from rtc, in form ss,mm,hh supplied as $\ast$start and add seconds seconds to it putting the result in $\ast$result OFFSET BY 1 Note that it only works for hh:mm:ss, not days, and also that hh will wrap. \item\end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Function Documentation}
\hypertarget{ds3231_8h_aecec2c010f9f46eff5bc2295e9ab2efb}{
\index{ds3231.h@{ds3231.h}!addtime@{addtime}}
\index{addtime@{addtime}!ds3231.h@{ds3231.h}}
\subsubsection[{addtime}]{\setlength{\rightskip}{0pt plus 5cm}void addtime (
\begin{DoxyParamCaption}
\item[{uint8\_\-t $\ast$}]{ result, }
\item[{uint8\_\-t $\ast$}]{ start, }
\item[{uint16\_\-t}]{ seconds}
\end{DoxyParamCaption}
)}}
\label{ds3231_8h_aecec2c010f9f46eff5bc2295e9ab2efb}


Take a BCD time eg as read from rtc, in form ss,mm,hh supplied as $\ast$start and add seconds seconds to it putting the result in $\ast$result OFFSET BY 1 Note that it only works for hh:mm:ss, not days, and also that hh will wrap. 


\begin{DoxyParams}{Parameters}
\item[{\em result}]pointer to location for resulting bcd 4 bytes: dummy,ss,mm,hh\item[{\em start}]Pointer to start time as bcd 3 bytes: ss,mm,hh\item[{\em seconds}]number of seconds to add to start to create result \end{DoxyParams}
\hypertarget{ds3231_8h_a1d3fd050d58f81cf04440ab3ff9ecec6}{
\index{ds3231.h@{ds3231.h}!americandate@{americandate}}
\index{americandate@{americandate}!ds3231.h@{ds3231.h}}
\subsubsection[{americandate}]{\setlength{\rightskip}{0pt plus 5cm}void americandate (
\begin{DoxyParamCaption}
\item[{uint8\_\-t $\ast$}]{ result, }
\item[{uint8\_\-t $\ast$}]{ time\_\-store}
\end{DoxyParamCaption}
)}}
\label{ds3231_8h_a1d3fd050d58f81cf04440ab3ff9ecec6}


Create a string representing the data in the form mm/dd/yyyy from a set of data. DOESN'T READ THE RTC. 


\begin{DoxyParams}{Parameters}
\item[{\em $\ast$time\_\-store}]Pointer to the 7 byte data to be converted Order of RTC values in time\_\-store is ss,mm,hh,dow,dd,mm,yy valid dow is 1-\/7\item[{\em $\ast$result}]Pointer to 11 byte result\end{DoxyParams}
note that this function doesn't read the time, or modify time\_\-store \hypertarget{ds3231_8h_a2f379772b393d02eab966d60b3491916}{
\index{ds3231.h@{ds3231.h}!bcd\_\-to\_\-hex@{bcd\_\-to\_\-hex}}
\index{bcd\_\-to\_\-hex@{bcd\_\-to\_\-hex}!ds3231.h@{ds3231.h}}
\subsubsection[{bcd\_\-to\_\-hex}]{\setlength{\rightskip}{0pt plus 5cm}uint8\_\-t bcd\_\-to\_\-hex (
\begin{DoxyParamCaption}
\item[{uint8\_\-t}]{ bcd}
\end{DoxyParamCaption}
)}}
\label{ds3231_8h_a2f379772b393d02eab966d60b3491916}


Convert a BCD value in a byte to the correct hex value. 


\begin{DoxyParams}{Parameters}
\item[{\em bcd}]uint8\_\-t value in BCD\end{DoxyParams}
\begin{DoxyReturn}{Returns}
returns uint8\_\-t hex value converted from BCD
\end{DoxyReturn}
For example, 23 -\/$>$ 0x17 \hypertarget{ds3231_8h_ae754a406c61eb6be8d05e26388b58116}{
\index{ds3231.h@{ds3231.h}!dirname\_\-from\_\-date@{dirname\_\-from\_\-date}}
\index{dirname\_\-from\_\-date@{dirname\_\-from\_\-date}!ds3231.h@{ds3231.h}}
\subsubsection[{dirname\_\-from\_\-date}]{\setlength{\rightskip}{0pt plus 5cm}void dirname\_\-from\_\-date (
\begin{DoxyParamCaption}
\item[{uint8\_\-t $\ast$}]{ dirname, }
\item[{uint8\_\-t $\ast$}]{ time\_\-store}
\end{DoxyParamCaption}
)}}
\label{ds3231_8h_ae754a406c61eb6be8d05e26388b58116}


Convert a time read from the RTC into a directory name. DOESN'T READ THE RTC. 


\begin{DoxyParams}{Parameters}
\item[{\em dirname}]Pointer to directory name. Directory name MUST be at least 8 characters + terminating null\item[{\em time\_\-store}]Pointer to the 7 byte time data\end{DoxyParams}
note that this function doesn't read the time, or modify time\_\-store The first character of the directory name is unchanged Creates a dirname xyymddhh where x is left unchanged The month is converted to an ASCII character as 1 hex digit (december=C for example) So for example a directory name xxxxxxxx plus a time such as 3rd Dec 2010 at 14:16:04 is converted to the characters x10C0314 \hypertarget{ds3231_8h_a66680c0447b6a7c8bb36001e4a3b685a}{
\index{ds3231.h@{ds3231.h}!filename\_\-from\_\-date@{filename\_\-from\_\-date}}
\index{filename\_\-from\_\-date@{filename\_\-from\_\-date}!ds3231.h@{ds3231.h}}
\subsubsection[{filename\_\-from\_\-date}]{\setlength{\rightskip}{0pt plus 5cm}void filename\_\-from\_\-date (
\begin{DoxyParamCaption}
\item[{uint8\_\-t $\ast$}]{ filename, }
\item[{uint8\_\-t $\ast$}]{ time\_\-store}
\end{DoxyParamCaption}
)}}
\label{ds3231_8h_a66680c0447b6a7c8bb36001e4a3b685a}


Convert a time read from the RTC into a file name. DOESN'T READ THE RTC. 


\begin{DoxyParams}{Parameters}
\item[{\em $\ast$filename}]Pointer to file name. File name MUST be at least 12 characters + terminating null\item[{\em $\ast$time\_\-store}]Pointer to the 7 byte data to be converted\end{DoxyParams}
note that this function doesn't read the time, or modify time\_\-store The first character of the filename is unchanged Creates a filename xmddhhmm where x is left unchanged The month is converted to an ASCII character as 1 hex digit (december=C for example) So for example a file name xxxxxxxx.zyx plus a time such as 3rd Dec 2010 at 14:16:04 is converted to the characters xC031416.zyx

Convert a time read from the RTC into a file name. DOESN'T READ THE RTC.


\begin{DoxyParams}{Parameters}
\item[{\em $\ast$time\_\-store}]memory location of 7 bytes of the time to be converted. \item[{\em $\ast$filename}]filename name to be created or overwritten.\end{DoxyParams}
Note that this function only converts. It doesn't update $\ast$time\_\-store with the correct time

IMPORTANT Several characters of filename are NOT changed or set. Make sure you set it to a valid character or the filesystem will generate an error.

filename is overwritten with $^\wedge$mddhhmm$^\wedge$ss$^\wedge$ where positions with $^\wedge$ are unchanged m is month 1-\/12 value expressed as a single Hex character (eg C for December). Other values (BCD from the clock) are copied as is, without any conversion.

eg filename ABCDEFGH.XYZ plus date (15th December 2010) 20101215 13:16:56 -\/$>$ AC151316.56Z

Note that both time\_\-store and filename must exist in memory as arrays of 7 and 12 (or more) bytes respectively. To use the filename as a string, use a 13 byte array and null the 13th, or create filename as a string of the correct length. \hypertarget{ds3231_8h_a90d310b1f92cf36ef427b8d639e55405}{
\index{ds3231.h@{ds3231.h}!get\_\-fattime@{get\_\-fattime}}
\index{get\_\-fattime@{get\_\-fattime}!ds3231.h@{ds3231.h}}
\subsubsection[{get\_\-fattime}]{\setlength{\rightskip}{0pt plus 5cm}uint32\_\-t get\_\-fattime (
\begin{DoxyParamCaption}
\item[{void}]{}
\end{DoxyParamCaption}
)}}
\label{ds3231_8h_a90d310b1f92cf36ef427b8d639e55405}


Reads the time into internal variable time\_\-store\mbox{[}7\mbox{]}, and converts for FAT filesystems. 

\begin{DoxyReturn}{Returns}
Returns the current time as a a 32 bit value formatted correctly for FAT filesystems, eg \hyperlink{structFATFS}{FATFS}
\end{DoxyReturn}
Reads the time into internal variable time\_\-store\mbox{[}7\mbox{]}, and converts for FAT filesystems.

\begin{DoxyReturn}{Returns}
uint32\_\-t FAT time encoded in a 32 bit value
\end{DoxyReturn}
See \hyperlink{structFATFS}{FATFS} documentation for the specification of FAT time stamp format time\_\-store must consist of an array of at least 7 bytes A side effect of calling this function is to update the time stores in time\_\-store Format of time\_\-store is (in BCD) ss,mm,hh,date,month,dow,yy \hypertarget{ds3231_8h_af52153b03b1a05fea5b4eb3eadf52a25}{
\index{ds3231.h@{ds3231.h}!hex2ascii\_\-h@{hex2ascii\_\-h}}
\index{hex2ascii\_\-h@{hex2ascii\_\-h}!ds3231.h@{ds3231.h}}
\subsubsection[{hex2ascii\_\-h}]{\setlength{\rightskip}{0pt plus 5cm}uint8\_\-t hex2ascii\_\-h (
\begin{DoxyParamCaption}
\item[{uint8\_\-t}]{ hexval}
\end{DoxyParamCaption}
)}}
\label{ds3231_8h_af52153b03b1a05fea5b4eb3eadf52a25}


Convert the high nibble of a supplied byte into an ASCII character. 


\begin{DoxyParams}{Parameters}
\item[{\em hexval}]Hex value\end{DoxyParams}
\begin{DoxyReturn}{Returns}
ASCII character of top nibble 
\end{DoxyReturn}
\hypertarget{ds3231_8h_a68043f0b43c0d8b5f39a370f055e7a74}{
\index{ds3231.h@{ds3231.h}!hex2ascii\_\-l@{hex2ascii\_\-l}}
\index{hex2ascii\_\-l@{hex2ascii\_\-l}!ds3231.h@{ds3231.h}}
\subsubsection[{hex2ascii\_\-l}]{\setlength{\rightskip}{0pt plus 5cm}uint8\_\-t hex2ascii\_\-l (
\begin{DoxyParamCaption}
\item[{uint8\_\-t}]{ hexval}
\end{DoxyParamCaption}
)}}
\label{ds3231_8h_a68043f0b43c0d8b5f39a370f055e7a74}


Convert the low nibble of a supplied byte into an ASCII character. 


\begin{DoxyParams}{Parameters}
\item[{\em hexval}]Hex value\end{DoxyParams}
\begin{DoxyReturn}{Returns}
ASCII character of bottom nibble 
\end{DoxyReturn}
\hypertarget{ds3231_8h_a4bca99ec8c78c324c2ba477ed8de169b}{
\index{ds3231.h@{ds3231.h}!hms\_\-time@{hms\_\-time}}
\index{hms\_\-time@{hms\_\-time}!ds3231.h@{ds3231.h}}
\subsubsection[{hms\_\-time}]{\setlength{\rightskip}{0pt plus 5cm}void hms\_\-time (
\begin{DoxyParamCaption}
\item[{uint8\_\-t $\ast$}]{ result, }
\item[{uint8\_\-t $\ast$}]{ time\_\-store}
\end{DoxyParamCaption}
)}}
\label{ds3231_8h_a4bca99ec8c78c324c2ba477ed8de169b}


Create an ISO time string from a set of data read from the RTC. 


\begin{DoxyParams}{Parameters}
\item[{\em $\ast$result}]Pointer to 9 byte result which is null terminated and of form hh:mm:ss\item[{\em $\ast$time\_\-store}]Pointer to the 7 byte data to be converted (only first 3 bytes used) in order ss,mm,hh Order of RTC values in time\_\-store is ss,mm,hh,dow,dd,mm,yy valid dow is 1-\/7\end{DoxyParams}
note that this function doesn't read the time, or modify time\_\-store \hypertarget{ds3231_8h_a8926a9eb22a1a790b619fbbf5a5ab9e1}{
\index{ds3231.h@{ds3231.h}!iso\_\-time@{iso\_\-time}}
\index{iso\_\-time@{iso\_\-time}!ds3231.h@{ds3231.h}}
\subsubsection[{iso\_\-time}]{\setlength{\rightskip}{0pt plus 5cm}void iso\_\-time (
\begin{DoxyParamCaption}
\item[{uint8\_\-t $\ast$}]{ iso\_\-time\_\-store, }
\item[{uint8\_\-t $\ast$}]{ time\_\-store}
\end{DoxyParamCaption}
)}}
\label{ds3231_8h_a8926a9eb22a1a790b619fbbf5a5ab9e1}


Create an ISO time string from a set of data. DOESN'T READ THE RTC. 


\begin{DoxyParams}{Parameters}
\item[{\em $\ast$iso\_\-time\_\-store}]Pointer to 16 byte result\item[{\em $\ast$time\_\-store}]Pointer to the 7 byte data to be converted Order of RTC values in time\_\-store is ss,mm,hh,dow,dd,mm,yy valid dow is 1-\/7\end{DoxyParams}
note that this function doesn't read the time, or modify time\_\-store A time such as 3rd Dec 2010 at 14:16:04 is converted from 0x04,0x16,0x14,dow,0x03,0x12,0x10 to the string \char`\"{}20101203 141604\char`\"{} with a trailing zero

Create an ISO time string from a set of data. DOESN'T READ THE RTC.


\begin{DoxyParams}{Parameters}
\item[{\em $\ast$time\_\-store}]memory location of 7 bytes of the time to be converted. \item[{\em $\ast$iso\_\-time\_\-store}]memory location for the 16 byte result.\end{DoxyParams}
Note that this function only converts. It doesn't update $\ast$time\_\-store with the correct time

time\_\-store format is ss,mm,hh,dd,mm,dow,yy yy counts from 2000 iso\_\-time\_\-store shows \char`\"{}20yymmdd hhmmss\char`\"{} 16 bytes including trailing null making it a string. \hypertarget{ds3231_8h_aa6c5594a2b9c64eeba1be22cfcd8c932}{
\index{ds3231.h@{ds3231.h}!read\_\-from\_\-rtc@{read\_\-from\_\-rtc}}
\index{read\_\-from\_\-rtc@{read\_\-from\_\-rtc}!ds3231.h@{ds3231.h}}
\subsubsection[{read\_\-from\_\-rtc}]{\setlength{\rightskip}{0pt plus 5cm}uint8\_\-t read\_\-from\_\-rtc (
\begin{DoxyParamCaption}
\item[{uint8\_\-t $\ast$}]{ store\_\-data}
\end{DoxyParamCaption}
)}}
\label{ds3231_8h_aa6c5594a2b9c64eeba1be22cfcd8c932}


Read a set of data from the DS3231 Real time clock to memory. 


\begin{DoxyParams}{Parameters}
\item[{\em $\ast$store\_\-data}]Pointer to location of 7 bytes to store RTC values Order of RTC values in time\_\-store is ss,mm,hh,dow,dd,mm,yy valid dow is 1-\/7\end{DoxyParams}
\begin{DoxyReturn}{Returns}
Returns the I2C error code from the transaction. 0=success. 
\end{DoxyReturn}
\hypertarget{ds3231_8h_ad57ee46a709dc3e17d7274fca5066456}{
\index{ds3231.h@{ds3231.h}!read\_\-temp\_\-from\_\-rtc@{read\_\-temp\_\-from\_\-rtc}}
\index{read\_\-temp\_\-from\_\-rtc@{read\_\-temp\_\-from\_\-rtc}!ds3231.h@{ds3231.h}}
\subsubsection[{read\_\-temp\_\-from\_\-rtc}]{\setlength{\rightskip}{0pt plus 5cm}uint8\_\-t read\_\-temp\_\-from\_\-rtc (
\begin{DoxyParamCaption}
\item[{uint8\_\-t $\ast$}]{ store\_\-data}
\end{DoxyParamCaption}
)}}
\label{ds3231_8h_ad57ee46a709dc3e17d7274fca5066456}


Read a temperature from the DS3231 internal temp sensor. 


\begin{DoxyParams}{Parameters}
\item[{\em $\ast$store\_\-data}]Pointer to 2 bytes of storage for the result. First byte temp as signed 8 bit hex value, second byte fraction of 1C (top 2 bits)\end{DoxyParams}
\begin{DoxyReturn}{Returns}
Returns the I2C error code from the transaction. 0=success. 
\end{DoxyReturn}
\hypertarget{ds3231_8h_ab1e1e4e0b72c8f2a5c6f135260e433d5}{
\index{ds3231.h@{ds3231.h}!reset\_\-rtc\_\-i2c@{reset\_\-rtc\_\-i2c}}
\index{reset\_\-rtc\_\-i2c@{reset\_\-rtc\_\-i2c}!ds3231.h@{ds3231.h}}
\subsubsection[{reset\_\-rtc\_\-i2c}]{\setlength{\rightskip}{0pt plus 5cm}void reset\_\-rtc\_\-i2c (
\begin{DoxyParamCaption}
\item[{void}]{}
\end{DoxyParamCaption}
)}}
\label{ds3231_8h_ab1e1e4e0b72c8f2a5c6f135260e433d5}


Resets the I2C to RTC communications. 

\hypertarget{ds3231_8h_a699c069585ed4c01cc14aa0514de3f71}{
\index{ds3231.h@{ds3231.h}!set\_\-datetime@{set\_\-datetime}}
\index{set\_\-datetime@{set\_\-datetime}!ds3231.h@{ds3231.h}}
\subsubsection[{set\_\-datetime}]{\setlength{\rightskip}{0pt plus 5cm}uint8\_\-t set\_\-datetime (
\begin{DoxyParamCaption}
\item[{uint8\_\-t $\ast$}]{ iso\_\-time\_\-store}
\end{DoxyParamCaption}
)}}
\label{ds3231_8h_a699c069585ed4c01cc14aa0514de3f71}


Take in a pointer to time in ISO format (15 bytes) eg 20101203 141604 and set RTC to that time. Time format is xxyymmddxhhmmss where xx and x are don't care Time format does not need to be null terminated Day of week on RTC is set to 1, as I never use dow. 


\begin{DoxyParams}{Parameters}
\item[{\em iso\_\-time\_\-store}]pointer to 15 bytes holding time as ISO value\end{DoxyParams}
\begin{DoxyReturn}{Returns}
Error code from I2C transaction. 0 = success.
\end{DoxyReturn}
Take in a pointer to time in ISO format (15 bytes) eg 20101203 141604 and set RTC to that time. Time format is xxyymmddxhhmmss where xx and x are don't care Time format does not need to be null terminated Day of week on RTC is set to 1, as I never use dow.


\begin{DoxyParams}{Parameters}
\item[{\em $\ast$iso\_\-time\_\-store}]pointer to memory location holding time as 15 bytes. \end{DoxyParams}
\hypertarget{ds3231_8h_a36dee10e230ff135f99efd3aa95914d3}{
\index{ds3231.h@{ds3231.h}!set\_\-rtc\_\-register\_\-pointer@{set\_\-rtc\_\-register\_\-pointer}}
\index{set\_\-rtc\_\-register\_\-pointer@{set\_\-rtc\_\-register\_\-pointer}!ds3231.h@{ds3231.h}}
\subsubsection[{set\_\-rtc\_\-register\_\-pointer}]{\setlength{\rightskip}{0pt plus 5cm}uint8\_\-t set\_\-rtc\_\-register\_\-pointer (
\begin{DoxyParamCaption}
\item[{uint8\_\-t}]{ val}
\end{DoxyParamCaption}
)}}
\label{ds3231_8h_a36dee10e230ff135f99efd3aa95914d3}


Set the register pointer in the RTC to the parameter supplied. 


\begin{DoxyParams}{Parameters}
\item[{\em val}]The address to be set\end{DoxyParams}
\begin{DoxyReturn}{Returns}
Returns the I2C error code from the transaction. 0=success. 
\end{DoxyReturn}
\hypertarget{ds3231_8h_a022ec8bc8e5fbaeb6ea91b5dbe3e854c}{
\index{ds3231.h@{ds3231.h}!write\_\-alarm@{write\_\-alarm}}
\index{write\_\-alarm@{write\_\-alarm}!ds3231.h@{ds3231.h}}
\subsubsection[{write\_\-alarm}]{\setlength{\rightskip}{0pt plus 5cm}uint8\_\-t write\_\-alarm (
\begin{DoxyParamCaption}
\item[{uint8\_\-t $\ast$}]{ alarm\_\-data}
\end{DoxyParamCaption}
)}}
\label{ds3231_8h_a022ec8bc8e5fbaeb6ea91b5dbe3e854c}


Write a set of data from memory to the alarm registers on the DS3231 Real time clock. 


\begin{DoxyParams}{Parameters}
\item[{\em $\ast$alarm\_\-data}]Pointer to location of 9 bytes (first byte padding 0x07) from which to get values to send to alarm See datasheet for order of RTC values for alarm1,alarm2, control Note that the alarm control bits are the top bits of the alarm values.\end{DoxyParams}
\begin{DoxyReturn}{Returns}
Returns the I2C error code from the transaction. 0=success. 
\end{DoxyReturn}
\hypertarget{ds3231_8h_a7f5203272b8222199211bd51bd75166f}{
\index{ds3231.h@{ds3231.h}!write\_\-to\_\-rtc@{write\_\-to\_\-rtc}}
\index{write\_\-to\_\-rtc@{write\_\-to\_\-rtc}!ds3231.h@{ds3231.h}}
\subsubsection[{write\_\-to\_\-rtc}]{\setlength{\rightskip}{0pt plus 5cm}uint8\_\-t write\_\-to\_\-rtc (
\begin{DoxyParamCaption}
\item[{uint8\_\-t $\ast$}]{ store\_\-data}
\end{DoxyParamCaption}
)}}
\label{ds3231_8h_a7f5203272b8222199211bd51bd75166f}


Write a set of data from memory to the DS3231 Real time clock. 


\begin{DoxyParams}{Parameters}
\item[{\em $\ast$store\_\-data}]Pointer to location of 8 bytes (first byte must be 0) from which to write RTC values Order of RTC values for setting time is 0,ss,mm,hh,dow,dd,mm,yy valid dow is 1-\/7\end{DoxyParams}
\begin{DoxyReturn}{Returns}
Returns the I2C error code from the transaction. 0=success. 
\end{DoxyReturn}
