Mercurial > templog
comparison 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 |
comparison
equal
deleted
inserted
replaced
74:cb5ea75ee599 | 75:ca08442635ca |
---|---|
123 *decicelsius = ds18b20_raw_to_decicelsius( sp ); | 123 *decicelsius = ds18b20_raw_to_decicelsius( sp ); |
124 } | 124 } |
125 return ret; | 125 return ret; |
126 } | 126 } |
127 | 127 |
128 uint8_t | |
129 simple_ds18b20_read_raw( uint8_t id[], uint16_t *reading ) | |
130 { | |
131 uint8_t sp[DS18X20_SP_SIZE]; | |
132 uint8_t ret; | |
133 | |
134 if (id) | |
135 { | |
136 ow_reset(); | |
137 } | |
138 ret = read_scratchpad( id, sp, DS18X20_SP_SIZE ); | |
139 if ( ret == DS18X20_OK ) { | |
140 *reading = sp[0] | (sp[1] << 8); | |
141 } | |
142 return ret; | |
143 } | |
144 | |
128 static void | 145 static void |
129 printhex_nibble(const unsigned char b, FILE *stream) | 146 printhex_nibble(const unsigned char b, FILE *stream) |
130 { | 147 { |
131 unsigned char c = b & 0x0f; | 148 unsigned char c = b & 0x0f; |
132 if ( c > 9 ) { | 149 if ( c > 9 ) { |