Mercurial > templog
diff simple_ds18b20.c @ 381:83c83014e5e3
report raw ds18b20 values instead
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Tue, 03 Jul 2012 22:44:21 +0800 |
parents | f6b5941b4c34 |
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) {