|
View:
New views
4 Messages
—
Rating Filter:
Alert me
|
|
|
Request for clarification: FS_xxxx() versus OW_yyyy() functionsHello,
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 Owfs-developers@... https://lists.sourceforge.net/lists/listinfo/owfs-developers |
|
|
Re: Request for clarification: FS_xxxx() versus OW_yyyy() functionsi think FS is for fusefs not?
2012/1/20 Eloy Paris <peloy@...>: > 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 > Owfs-developers@... > https://lists.sourceforge.net/lists/listinfo/owfs-developers > -- Roberto Spadim Spadim Technology / SPAEmpresarial ------------------------------------------------------------------------------ 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 Owfs-developers@... https://lists.sourceforge.net/lists/listinfo/owfs-developers |
|
|
Re: Request for clarification: FS_xxxx() versus OW_yyyy() functionsHi Roberto,
On 01/20/2012 01:32 PM, Roberto Spadim wrote: > i think FS is for fusefs not? Yes, it seems like the FS_xxxx() functions are intended to interface with the filesystem side of things, but I am wondering if there are do's and dont's/guidelines/recommendations regarding what type of code to put in each "class" of functions. The example I provided, i.e. where to do internal representation conversions, is one that comes to mind as something I'd like clarification on. Cheers, Eloy Paris.- > > 2012/1/20 Eloy Paris<peloy@...>: >> 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 Owfs-developers@... https://lists.sourceforge.net/lists/listinfo/owfs-developers |
|
|
Re: Request for clarification: FS_xxxx() versus OW_yyyy() functionsGood question. The general idea was that the FS functions work with the higher level logic and the full owq structure. The OW_ function deal with the actual byte sequences sent to and from the slave.
The distinction isn't alway clear, or followed perfectly (it is a 10 year-old project). I'd be happy to offer style suggestions on your code.
On Fri, Jan 20, 2012 at 1:37 PM, Eloy Paris <peloy@...> wrote: Hi Roberto, ------------------------------------------------------------------------------ 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 Owfs-developers@... https://lists.sourceforge.net/lists/listinfo/owfs-developers |
| Free embeddable forum powered by Nabble | Forum Help |