Mercurial > templog
diff simple_ds18b20.c @ 75:ca08442635ca
report raw ds18b20 values instead
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Tue, 03 Jul 2012 22:44:21 +0800 |
parents | 878be5e353a0 |
children | 90d1ebb941ab |
line wrap: on
line diff
--- a/simple_ds18b20.c Tue Jul 03 21:55:50 2012 +0800 +++ b/simple_ds18b20.c Tue Jul 03 22:44:21 2012 +0800 @@ -125,6 +125,23 @@ return ret; } +uint8_t +simple_ds18b20_read_raw( uint8_t id[], uint16_t *reading ) +{ + uint8_t sp[DS18X20_SP_SIZE]; + uint8_t ret; + + if (id) + { + ow_reset(); + } + ret = read_scratchpad( id, sp, DS18X20_SP_SIZE ); + if ( ret == DS18X20_OK ) { + *reading = sp[0] | (sp[1] << 8); + } + return ret; +} + static void printhex_nibble(const unsigned char b, FILE *stream) {