added RTC functions

git-svn-id: https://svn.salfter.gotdns.org/svn/a2bfc/trunk@89 1b90f75b-8b96-4784-87c0-14078182fce6
This commit is contained in:
(no author)
2007-09-24 05:41:06 +00:00
parent 973382c13c
commit d8a3fd2194
6 changed files with 92 additions and 8 deletions

View File

@@ -1,4 +1,5 @@
#include "ow-temp.h"
#include <errno.h>
short ow_temp_read(unsigned char* devid, unsigned char format)
{
@@ -7,7 +8,10 @@ short ow_temp_read(unsigned char* devid, unsigned char format)
unsigned char i;
if (!ow_temp_idcheck(devid))
return OW_ERR_INVALIDDEVICE;
{
errno=EINVAL;
return -1;
}
ow_selectdevice(devid);
ow_writebyte(68); // ask for a temperature reading
ow_wait(); // wait for operation to complete
@@ -17,6 +21,7 @@ short ow_temp_read(unsigned char* devid, unsigned char format)
data[i]=ow_readbyte();
rawtemp=(short)(data[0]+((int)data[1]<<8));
errno=0;
switch (format)
{
case OW_TEMP_FAHRENHEIT: