From: Daniel Mack <zonque@gmail.com>
To: "Ezequiel García" <ezequiel@vanguardiasur.com.ar>
Cc: linux-input@vger.kernel.org, Dmitry Torokhov <dmitry.torokhov@gmail.com>
Subject: Re: [PATCH 1/1] Input: rotary-encoder: Add 'stepped' irq handler
Date: Sun, 29 Sep 2013 19:39:56 +0200 [thread overview]
Message-ID: <524865EC.3050100@gmail.com> (raw)
In-Reply-To: <CAAEAJfDSW5rgGYXnL2Z_YUKUCVQ82BOg_Q5HtOKKpFvJAs5Qvw@mail.gmail.com>
On 29.09.2013 19:29, Ezequiel García wrote:
> On 29 September 2013 07:40, Daniel Mack <zonque@gmail.com> wrote:
>> On 28.09.2013 20:26, Ezequiel Garcia wrote:
>>> + sum = (encoder->last_stable << 2) + state;
>>> + switch (sum) {
>>> + case 0b1101:
>>> + case 0b0100:
>>> + case 0b0010:
>>> + case 0b1011:
>>
>> Binary constants are frowned upon, please avoid them in the kernel.
>> checkpatch.pl should have warned you about them as well.
>>
>
> Well... despite any checkpatch.pl warnings, I think the above is much clear
> to the reader than any alternative.
The problem is that support for that notation is a proprietary gcc
extension that is AFAIK only supported from gcc 4.3 onwards or so.
However, the current minimum gcc version for building the kernel is 3.2.
> If binary values should be avoided by all means, then I would prefer to encode
> the previous and current in different nibbles:
>
> sum = (encoder->last_stable << 4) + state;
> switch (sum) {
> case 0x31:
> case 0x10:
> case 0x02:
> case 0x23:
>
> Maybe this is better?
Either that, or use
case BIT(3) | BIT(2) | BIT(0):
...
> I'm really curious about the rotary devices you originally used with
> this driver.
> I guess those have no detents, so there's no mechanical-click on each step?
Some models have detents, some don't. We've used one of this series
which does:
http://de.mouser.com/ProductDetail/Alpha-Taiwan/RE111F-20B3-20F-20P/?qs=yA6kp8fx8Y7KsyMOFz9p0A==
Best regards,
Daniel
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
prev parent reply other threads:[~2013-09-29 17:40 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-28 18:26 [RFC/PATCH 0/1] rotary-encoder: Add new interruption handler Ezequiel Garcia
2013-09-28 18:26 ` [PATCH 1/1] Input: rotary-encoder: Add 'stepped' irq handler Ezequiel Garcia
2013-09-29 10:40 ` Daniel Mack
2013-09-29 17:29 ` Ezequiel García
2013-09-29 17:39 ` Daniel Mack [this message]
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=524865EC.3050100@gmail.com \
--to=zonque@gmail.com \
--cc=dmitry.torokhov@gmail.com \
--cc=ezequiel@vanguardiasur.com.ar \
--cc=linux-input@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.