From: Lars-Peter Clausen <lars@metafoo.de>
To: Guillaume Ballet <gballetwork@gmail.com>
Cc: Jonathan Cameron <jic23@jic23.retrosnub.co.uk>,
linux-iio@vger.kernel.org
Subject: Re: Why is only one int returned in iio_read_channel_processed?
Date: Wed, 22 May 2013 15:39:46 +0200 [thread overview]
Message-ID: <519CCAA2.2070408@metafoo.de> (raw)
In-Reply-To: <CAGi_vrir0uQd4u9WgixQ5an+jE8WFTyVmBiFnmxa-y=DfeW61g@mail.gmail.com>
On 05/22/2013 03:29 PM, Guillaume Ballet wrote:
> On Wed, May 22, 2013 at 1:43 PM, Lars-Peter Clausen <lars@metafoo.de> wrote:
>> On 05/22/2013 11:37 AM, Guillaume Ballet wrote:
>>>>>
>>>>>>
>>>>>>> functions' signature only has one integer
>>>>>>> in/out parameter. That makes sense in the context of _raw because the
>>>>>>> value isn't yet processed.
>>>>>>>
>>>>>>> However, as the scale is a number encoded over two ints, the
>>>>>>> _processed value should also span two ints. Is there a reason why it's
>>>>>>> still only one int?
>>>>>>
>>>>>> No it certainly should not be one int for exactly the reasons you have
>>>>>> stated.
>>>>>>>
>>>>>>>
>>>>>
>>>>> I'm not to sure about that. I'd rather add a scale parameter to the
>>>>> iio_read_channel_processed, just in the same way the
>>>>> convert_raw_to_processed function takes a scale parameter.
>>>>
>>>> That may be tricky to do given we often have nasty non linear functions
>>>> that are the reason we are using processed in the first place. Hmm.
>>>> Not sure which way works better.
>>>
>>> I agree, this is the whole point of using processed. Lars, is there a
>>> specific reason why you want to keep reading the value and the scale
>>> in different function calls?
>>
>> I don't want to keep reading scale and value in different function calls.
>>
>> What's you use case and how do you want to split the data between the two
>> integers?
>
> Since the scale's format can be IIO_VAL_INT_PLUS_MICRO and
> IIO_VAL_INT_PLUS_NANO, etc... and since iio_read_channel_processed
> returns a value that is homogeneous to (value * scale), it seems to me
> the same format should be used as when calling iio_read_channel_raw
> with IIO_CHAN_INFO_SCALE. My use case is not more complicated than
> making sure I keep the same precision when getting processed values.
That doesn't really help me understand what you are trying to do. What is
your application, where do you call iio_read_channel_processed and how do
you process the returned value.
- Lars
next prev parent reply other threads:[~2013-05-22 13:39 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-22 7:49 Why is only one int returned in iio_read_channel_processed? Guillaume Ballet
2013-05-22 8:04 ` Jonathan Cameron
2013-05-22 8:19 ` Lars-Peter Clausen
2013-05-22 9:00 ` Jonathan Cameron
2013-05-22 9:37 ` Guillaume Ballet
2013-05-22 11:43 ` Lars-Peter Clausen
2013-05-22 13:29 ` Guillaume Ballet
2013-05-22 13:39 ` Lars-Peter Clausen [this message]
2013-05-22 14:00 ` Guillaume Ballet
2013-05-22 14:15 ` Lars-Peter Clausen
2013-05-22 15:24 ` Guillaume Ballet
2013-05-22 17:14 ` Lars-Peter Clausen
2013-05-23 9:52 ` Guillaume Ballet
2013-05-23 10:39 ` Lars-Peter Clausen
2013-05-23 13:18 ` Guillaume Ballet
2013-05-23 13:28 ` Lars-Peter Clausen
2013-06-02 16:00 ` Jonathan Cameron
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=519CCAA2.2070408@metafoo.de \
--to=lars@metafoo.de \
--cc=gballetwork@gmail.com \
--cc=jic23@jic23.retrosnub.co.uk \
--cc=linux-iio@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).