Mercurial > ~darius > hgwebdir.cgi > tempctrl
comparison 1wire.c @ 45:efd44dc40934
Add macros for number system used for temperatures.
Add error strings and improve comments for ROM programming.
author | darius@Inchoate |
---|---|
date | Mon, 20 Oct 2008 22:11:18 +1030 |
parents | 5898fba6593c |
children | 4abce5954d25 |
comparison
equal
deleted
inserted
replaced
44:f219538d6ea7 | 45:efd44dc40934 |
---|---|
45 #include "cons.h" | 45 #include "cons.h" |
46 | 46 |
47 static uint8_t OW_LastDevice = 0; | 47 static uint8_t OW_LastDevice = 0; |
48 static uint8_t OW_LastDiscrepancy = 0; | 48 static uint8_t OW_LastDiscrepancy = 0; |
49 static uint8_t OW_LastFamilyDiscrepancy = 0; | 49 static uint8_t OW_LastFamilyDiscrepancy = 0; |
50 | |
51 const PROGMEM char *OWProgROM_Status[] = { | |
52 "OK", | |
53 "not possible (no HW support)", | |
54 "Invalid parameters", | |
55 "module doesn't exist or didn't respond properly" | |
56 }; | |
50 | 57 |
51 /*----------------------------------------------------------------------------- | 58 /*----------------------------------------------------------------------------- |
52 * Configure the IO port as we need | 59 * Configure the IO port as we need |
53 */ | 60 */ |
54 void | 61 void |
412 * programmed [to 0] | 419 * programmed [to 0] |
413 * status - If true program status rather than memory | 420 * status - If true program status rather than memory |
414 * | 421 * |
415 * Returns.. | 422 * Returns.. |
416 * 0 if all is OK | 423 * 0 if all is OK |
417 * 1 if the programming was unsuccessful | 424 * 1 if the programming is not possible |
418 * 2 if the parameters were invalid | 425 * 2 if the parameters were invalid |
419 * 3 if the DS2502 didn't respond appropriately (also happens if the | 426 * 3 if the DS2502 didn't respond appropriately (also happens if the |
420 * module doesn't exist) | 427 * module doesn't exist) |
421 */ | 428 */ |
422 uint8_t | 429 uint8_t |
424 #if defined(OWSETVPPON) && defined(OWSETVPPOFF) | 431 #if defined(OWSETVPPON) && defined(OWSETVPPOFF) |
425 uint8_t crc, i, tmp; | 432 uint8_t crc, i, tmp; |
426 | 433 |
427 /* Stupid programmer detection */ | 434 /* Stupid programmer detection */ |
428 if (status) { | 435 if (status) { |
429 if (start + len > 3) | 436 if (start + len > 3) |
430 return(2); | 437 return(2); |
431 } else { | 438 } else { |
432 if (start + len > 127) | 439 if (start + len > 127) |
433 return(2); | 440 return(2); |
434 } | 441 } |