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:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user