\hypertarget{sht7x_8h}{
\section{sht7x.h File Reference}
\label{sht7x_8h}\index{sht7x.h@{sht7x.h}}
}
{\tt \#include $<$avr/io.h$>$}\par
{\tt \#include \char`\"{}config.h\char`\"{}}\par
{\tt \#include $<$util/delay\_\-basic.h$>$}\par
{\tt \#include $<$util/delay.h$>$}\par
\subsection*{Defines}
\begin{CompactItemize}
\item 
\#define \hyperlink{sht7x_8h_21216357a5661f199b188ed4a30ad15b}{shtcommand\_\-readtemp}~0x03 ;
\item 
\#define \hyperlink{sht7x_8h_f823c9d0978cb749395920e95f03692e}{shtcommand\_\-readhum}~0x05 ;
\item 
\#define \hyperlink{sht7x_8h_50292a7e6e9863da59195f5afe035472}{shtcommand\_\-reset}~0x1E ;
\end{CompactItemize}
\subsection*{Functions}
\begin{CompactItemize}
\item 
void \hyperlink{sht7x_8h_bbe9b6ed0ef3c370aa6f29b5591d8922}{init\_\-sht7x} (void)
\begin{CompactList}\small\item\em Initialise the SHT7x or SHT1x device. \item\end{CompactList}\item 
uint16\_\-t \hyperlink{sht7x_8h_b0d748a8dfaf94111a83234766f90529}{read\_\-temp} (void)
\begin{CompactList}\small\item\em Read the temperature value from a SHT7x or SHT1x device. \item\end{CompactList}\item 
uint16\_\-t \hyperlink{sht7x_8h_37d472c47735d90ee4d483c6445e2dcf}{read\_\-hum} (void)
\begin{CompactList}\small\item\em Read the humidity value from a SHT7x or SHT1x device. \item\end{CompactList}\item 
void \hyperlink{sht7x_8h_248406c48a412ca4663ea0cfb90f0ada}{sht7x\_\-reset\_\-device} (void) void sht7x\_\-reset\_\-connection(void) void sht7x\_\-send\_\-start(void)
\begin{CompactList}\small\item\em Issues an internal reset command for the SHT7x. \item\end{CompactList}\item 
void \hyperlink{sht7x_8h_6dd5e68176b296fda8ccbfef6ff1ad91}{sht7x\_\-send\_\-command} (uint8\_\-t command)
\begin{CompactList}\small\item\em Internal command used within the library when communicating with the SHT7x. \item\end{CompactList}\item 
uint16\_\-t \hyperlink{sht7x_8h_f63114972603209a98b7e8feff9b6dfd}{sht7x\_\-getdata} (void)
\begin{CompactList}\small\item\em Internal command used within the library to get a 16 bit value from the SHT7x. \item\end{CompactList}\end{CompactItemize}


\subsection{Define Documentation}
\hypertarget{sht7x_8h_f823c9d0978cb749395920e95f03692e}{
\index{sht7x.h@{sht7x.h}!shtcommand\_\-readhum@{shtcommand\_\-readhum}}
\index{shtcommand\_\-readhum@{shtcommand\_\-readhum}!sht7x.h@{sht7x.h}}
\subsubsection[{shtcommand\_\-readhum}]{\setlength{\rightskip}{0pt plus 5cm}\#define shtcommand\_\-readhum~0x05 ;}}
\label{sht7x_8h_f823c9d0978cb749395920e95f03692e}


\hypertarget{sht7x_8h_21216357a5661f199b188ed4a30ad15b}{
\index{sht7x.h@{sht7x.h}!shtcommand\_\-readtemp@{shtcommand\_\-readtemp}}
\index{shtcommand\_\-readtemp@{shtcommand\_\-readtemp}!sht7x.h@{sht7x.h}}
\subsubsection[{shtcommand\_\-readtemp}]{\setlength{\rightskip}{0pt plus 5cm}\#define shtcommand\_\-readtemp~0x03 ;}}
\label{sht7x_8h_21216357a5661f199b188ed4a30ad15b}


\hypertarget{sht7x_8h_50292a7e6e9863da59195f5afe035472}{
\index{sht7x.h@{sht7x.h}!shtcommand\_\-reset@{shtcommand\_\-reset}}
\index{shtcommand\_\-reset@{shtcommand\_\-reset}!sht7x.h@{sht7x.h}}
\subsubsection[{shtcommand\_\-reset}]{\setlength{\rightskip}{0pt plus 5cm}\#define shtcommand\_\-reset~0x1E ;}}
\label{sht7x_8h_50292a7e6e9863da59195f5afe035472}




\subsection{Function Documentation}
\hypertarget{sht7x_8h_bbe9b6ed0ef3c370aa6f29b5591d8922}{
\index{sht7x.h@{sht7x.h}!init\_\-sht7x@{init\_\-sht7x}}
\index{init\_\-sht7x@{init\_\-sht7x}!sht7x.h@{sht7x.h}}
\subsubsection[{init\_\-sht7x}]{\setlength{\rightskip}{0pt plus 5cm}void init\_\-sht7x (void)}}
\label{sht7x_8h_bbe9b6ed0ef3c370aa6f29b5591d8922}


Initialise the SHT7x or SHT1x device. 

The SHT7x device uses a bus similar to but not exactly I2C. It requires a clock input (output from the microcontroller) and a data line which is either an output from the microcontroller driven low, or an input to the microcontroller pulled up.

Hence various lines need to be defined in a config file: sht7x\_\-DATA sht7x\_\-CLK sht7x\_\-DDR sht7x\_\-PORT sht7x\_\-PIN

This function sets up the IO, waits for 11mS to allow the SHT7x to reset itself from a power up, and issues a reset command to clear the communication bus \hypertarget{sht7x_8h_37d472c47735d90ee4d483c6445e2dcf}{
\index{sht7x.h@{sht7x.h}!read\_\-hum@{read\_\-hum}}
\index{read\_\-hum@{read\_\-hum}!sht7x.h@{sht7x.h}}
\subsubsection[{read\_\-hum}]{\setlength{\rightskip}{0pt plus 5cm}uint16\_\-t read\_\-hum (void)}}
\label{sht7x_8h_37d472c47735d90ee4d483c6445e2dcf}


Read the humidity value from a SHT7x or SHT1x device. 

\begin{Desc}
\item[Returns:]16 bit value representing the temperature reading.\end{Desc}
Note that the returned temperature reading will be an 8/12 bit value right aligned in a 16 bit word depending on current configuration of the SHT7x device See the documentation for the function init\_\-sht7x for more detail on the sht7x communication and setup. This function polls the status of the SHT7x, so may wait 10s of milliseconds before returning. \hypertarget{sht7x_8h_b0d748a8dfaf94111a83234766f90529}{
\index{sht7x.h@{sht7x.h}!read\_\-temp@{read\_\-temp}}
\index{read\_\-temp@{read\_\-temp}!sht7x.h@{sht7x.h}}
\subsubsection[{read\_\-temp}]{\setlength{\rightskip}{0pt plus 5cm}uint16\_\-t read\_\-temp (void)}}
\label{sht7x_8h_b0d748a8dfaf94111a83234766f90529}


Read the temperature value from a SHT7x or SHT1x device. 

\begin{Desc}
\item[Returns:]16 bit value representing the temperature reading.\end{Desc}
Note that the returned temperature reading will be an 8/12/14 bit value right aligned in a 16 bit word depending on current configuration of the SHT7x device See the documentation for the function init\_\-sht7x for more detail on the sht7x communication and setup. This function polls the status of the SHT7x, so may wait 10s of milliseconds before returning. \hypertarget{sht7x_8h_f63114972603209a98b7e8feff9b6dfd}{
\index{sht7x.h@{sht7x.h}!sht7x\_\-getdata@{sht7x\_\-getdata}}
\index{sht7x\_\-getdata@{sht7x\_\-getdata}!sht7x.h@{sht7x.h}}
\subsubsection[{sht7x\_\-getdata}]{\setlength{\rightskip}{0pt plus 5cm}uint16\_\-t sht7x\_\-getdata (void)}}
\label{sht7x_8h_f63114972603209a98b7e8feff9b6dfd}


Internal command used within the library to get a 16 bit value from the SHT7x. 

\begin{Desc}
\item[Returns:]The 16 bit temperature or humidity value. \end{Desc}
\hypertarget{sht7x_8h_248406c48a412ca4663ea0cfb90f0ada}{
\index{sht7x.h@{sht7x.h}!sht7x\_\-reset\_\-device@{sht7x\_\-reset\_\-device}}
\index{sht7x\_\-reset\_\-device@{sht7x\_\-reset\_\-device}!sht7x.h@{sht7x.h}}
\subsubsection[{sht7x\_\-reset\_\-device}]{\setlength{\rightskip}{0pt plus 5cm}void sht7x\_\-reset\_\-device (void)}}
\label{sht7x_8h_248406c48a412ca4663ea0cfb90f0ada}


Issues an internal reset command for the SHT7x. 

This command only resets the SHT7x device itself, not the communications to the device. There is an 11mS delay while the device performs an internal reset. See the documentation for the function init\_\-sht7x for more detail on the sht7x communication and setup. Issues a reset of the clock and data lines to the SHT7x. This command only resets the communications, not the SHT7x device itself. There is avery small delay (typically ,20uS) while the sommunicatin bus is reset. See the documentation for the function init\_\-sht7x for more detail on the sht7x communication and setup. Internal command used within the library when communicating with the SHT7x. \hypertarget{sht7x_8h_6dd5e68176b296fda8ccbfef6ff1ad91}{
\index{sht7x.h@{sht7x.h}!sht7x\_\-send\_\-command@{sht7x\_\-send\_\-command}}
\index{sht7x\_\-send\_\-command@{sht7x\_\-send\_\-command}!sht7x.h@{sht7x.h}}
\subsubsection[{sht7x\_\-send\_\-command}]{\setlength{\rightskip}{0pt plus 5cm}void sht7x\_\-send\_\-command (uint8\_\-t {\em command})}}
\label{sht7x_8h_6dd5e68176b296fda8ccbfef6ff1ad91}


Internal command used within the library when communicating with the SHT7x. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em command}]8 bit command value. See the SHT7x datasheet for details of commands \end{description}
\end{Desc}
