Hello, I'm adding owfs support for a new device and am a bit confused regarding conventions/best practices and what to do in the FS_xxxx() and OW_yyyy() functions.
Using ow_1820.c as an example, to read a temperature from a DS18x20 sensor, we have: FS_10temp() is the read function used for the "temperature" entry in the struct filetype DS18S20[] array. FS_10temp() in turn calls OW_10temp(),which ends up performing the necessary bus transactions or calling other OW_yyyy() functions that perform more bus transactions (in the ow_1820.c case, OW_10temp() sends the "start conversion" command doing a direct bus transaction, and then calls OW_r_scratchpad() to read the scratchpad). An important thing done in OW_10temp() is that it converts the DS18x20 representation of a temperature to a float. One difference that I can see between the FS_xxxx() and the OW_yyyy() functions is that the FS_xxxx() functions have the following declaration: ZERO_OR_ERROR FS_xxxx(struct one_wire_query *owq) and the OW_yyyy() functions are basically free-form. I have also noticed that the FS_xxxx() functions do not do bus transactions directly. Instead, they seem to call OW_yyyy() functions. I have not looked much, though, so I don't know if there are any exceptions. Now, my device also provides different values that require conversion from a device internal representation to a more common representation (like a floating point number). Should I be doing these conversions in FS_xxxx() or in OW_yyyy() functions? If I follow the "convention" in, for example, ow_1820.c, then it would have to be OW_yyyy(), but I wanted to confirm. And more in general, are there any guidelines on the use of FS_xxxx() and OW_yyyy() functions, like what should be/should not be done in each "class" of function? Thanks in advance for any insight. Cheers, Eloy Paris.- ------------------------------------------------------------------------------ Keep Your Developer Skills Current with LearnDevNow! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now! http://p.sf.net/sfu/learndevnow-d2d _______________________________________________ Owfs-developers mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/owfs-developers
