diff -u -r orig/dalweathdb-1.0b/mlan_lib/MLan.h dalweathdb-1.0b/mlan_lib/MLan.h --- orig/dalweathdb-1.0b/mlan_lib/MLan.h Sun Mar 28 11:49:07 1999 +++ dalweathdb-1.0b/mlan_lib/MLan.h Wed Jul 12 07:52:11 2000 @@ -76,6 +76,7 @@ int MLanTouchReset(void); int MLanTouchBit(int sendbit); int MLanTouchByte(int sendbyte); +int MLanTouchBytePullup(int sendbyte, int pullup); int MLanWriteByte(int sendbyte); int MLanReadByte(void); int MLanSpeed(int); diff -u -r orig/dalweathdb-1.0b/mlan_lib/mlanllu.c dalweathdb-1.0b/mlan_lib/mlanllu.c --- orig/dalweathdb-1.0b/mlan_lib/mlanllu.c Sun Mar 28 11:37:45 1999 +++ dalweathdb-1.0b/mlan_lib/mlanllu.c Wed Jul 12 08:03:38 2000 @@ -485,3 +485,112 @@ return FALSE; } +//-------------------------------------------------------------------------- +// Send 8 bits of communication to the MicroLAN and return the +// result 8 bits read from the MicroLAN. The parameter 'sendbyte' +// least significant 8 bits are used and the least significant 8 bits +// of the result is the return byte. +// +// 'sendbyte' - 8 bits to send (least significant byte) +// 'pullup' is the SPUD setting +// +// Returns: 8 bytes read from sendbyte -- after completeion of pullup +// +int MLanTouchBytePullup(int sendbyte, int pullup) +{ + uchar readbuffer[10],sendpacket[10]; + int sendlen=0; + + // make sure normal level + MLanLevel(MODE_NORMAL); + + // check if correct mode + if (UMode != MODSEL_COMMAND) + { + UMode = MODSEL_COMMAND; + sendpacket[sendlen++] = MODE_COMMAND; + } + + // set the SPUD time value + sendpacket[sendlen++] = CMD_CONFIG | PARMSEL_5VPULSE | pullup; + + // pulse command + sendpacket[sendlen++] = CMD_COMM | FUNCTSEL_CHMOD | PRIME5V_TRUE | SPEEDSEL_PULSE; + + // Terminate the initial pulse + sendpacket[sendlen++] = MODE_STOP_PULSE; + + // check if correct mode + if (UMode != MODSEL_DATA) + { + UMode = MODSEL_DATA; + sendpacket[sendlen++] = MODE_DATA; + } + + // add the byte to send + sendpacket[sendlen++] = (uchar)sendbyte; + + // check for duplication of data that looks like COMMAND mode + if (sendbyte == MODE_COMMAND) + sendpacket[sendlen++] = (uchar)sendbyte; + + // flush the buffers + FlushCOM(); + + // send the packet + if (WriteCOM(sendlen,sendpacket)) + { + // read back the 3 byte response + if (ReadCOM(3,readbuffer) == 3) + { + if ((readbuffer[0] | CMD_CONFIG) == (CMD_CONFIG | PARMSEL_5VPULSE | pullup) + && (readbuffer[1] & 0xfc) == + ((CMD_COMM | FUNCTSEL_CHMOD | PRIME5V_TRUE | SPEEDSEL_PULSE) & 0xfc)) { + usleep(32000 << (pullup / 2)); + // Now we wait for 1 second + if (ReadCOM(1, readbuffer) == 1) { + if ((readbuffer[0] & 0x7f) == 0x76) { + // Disarm pullup + + sendlen = 0; + // check if correct mode + if (UMode != MODSEL_COMMAND) + { + UMode = MODSEL_COMMAND; + sendpacket[sendlen++] = MODE_COMMAND; + } + + // pulse command + sendpacket[sendlen++] = CMD_COMM | FUNCTSEL_CHMOD | PRIME5V_FALSE | SPEEDSEL_PULSE; + + // Terminate the initial pulse + sendpacket[sendlen++] = MODE_STOP_PULSE; + + // flush the buffers + FlushCOM(); + + // send the packet + if (WriteCOM(sendlen,sendpacket)) + { + // read back the 1 byte response + if (ReadCOM(1,readbuffer) == 1) + { + if ((readbuffer[0] & 0xfc) == + ((CMD_COMM | FUNCTSEL_CHMOD | PRIME5V_FALSE | SPEEDSEL_PULSE) & 0xfc)) { + // return the response + return (int)readbuffer[2]; + } + } + } + } + } + } + } + } + + // an error occured so re-sync with DS2480 + DS2480Detect(); + + return 0; +} + Only in dalweathdb-1.0b/mlan_lib: mlanllu.o Only in dalweathdb-1.0b/mlan_lib: mlannetu.o Only in dalweathdb-1.0b/mlan_lib: mlantrnu.o Only in dalweathdb-1.0b/sensa: find_all_devices Only in dalweathdb-1.0b/sensa: find_all_devices.o diff -u -r orig/dalweathdb-1.0b/sensa/ngp_weath_lib.c dalweathdb-1.0b/sensa/ngp_weath_lib.c --- orig/dalweathdb-1.0b/sensa/ngp_weath_lib.c Tue Jun 29 12:23:29 1999 +++ dalweathdb-1.0b/sensa/ngp_weath_lib.c Wed Jul 12 07:53:09 2000 @@ -196,8 +204,9 @@ return 0; // send the convert temperature command - MLanTouchByte(0x44); + MLanTouchBytePullup(0x44, PARMSET_1p05s); +#if 0 // set the MicroLAN to strong pull-up if (MLanLevel(MODE_STRONG5) != MODE_STRONG5) return FALSE; @@ -208,6 +217,7 @@ // turn off the MicroLAN strong pull-up if (MLanLevel(MODE_NORMAL) != MODE_NORMAL) return FALSE; +#endif // access the device if (!MLanAccess()) @@ -245,6 +266,10 @@ tmp = tmp - (float)0.25 + (cpc - cr)/cpc; *Temp = tmp*9/5 + 32; // Farenhiet + + if (*Temp > 184) + return 0; + // success return 1; diff -u -r orig/dalweathdb-1.0b/sensa/sample_devices.c dalweathdb-1.0b/sensa/sample_devices.c --- orig/dalweathdb-1.0b/sensa/sample_devices.c Wed Sep 15 15:56:05 1999 +++ dalweathdb-1.0b/sensa/sample_devices.c Tue May 9 22:30:32 2000 @@ -62,6 +62,7 @@ //fflush(stdout); } +fflush(stdout); sleep(1); // Slow things down a bit } Only in dalweathdb-1.0b/sensa: sample_devices.o