Input: rotary-encoder - convert documentation into to ReST format

This file require minimum adjustments to be a valid ReST file.
Do it, in order to be able to parse it with Sphinx.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
This commit is contained in:
Mauro Carvalho Chehab 2017-04-04 17:47:55 -07:00 committed by Dmitry Torokhov
parent 7b11fdc39f
commit 42f2309bba
1 changed files with 38 additions and 36 deletions

View File

@ -1,8 +1,11 @@
============================================================
rotary-encoder - a generic driver for GPIO connected devices
Daniel Mack <daniel@caiaq.de>, Feb 2009
============================================================
0. Function
-----------
:Author: Daniel Mack <daniel@caiaq.de>, Feb 2009
Function
--------
Rotary encoders are devices which are connected to the CPU or other
peripherals with two wires. The outputs are phase-shifted by 90 degrees
@ -13,7 +16,7 @@ Some encoders have both outputs low in stable states, others also have
a stable state with both outputs high (half-period mode) and some have
a stable state in all steps (quarter-period mode).
The phase diagram of these two outputs look like this:
The phase diagram of these two outputs look like this::
_____ _____ _____
| | | | | |
@ -40,8 +43,8 @@ For more information, please see
https://en.wikipedia.org/wiki/Rotary_encoder
1. Events / state machine
-------------------------
Events / state machine
----------------------
In half-period mode, state a) and c) above are used to determine the
rotational direction based on the last stable state. Events are reported in
@ -65,16 +68,16 @@ d) Falling edge on channel B, channel A in low state
should have happened, unless it flipped back on half the way. The
'armed' state tells us about that.
2. Platform requirements
------------------------
Platform requirements
---------------------
As there is no hardware dependent call in this driver, the platform it is
used with must support gpiolib. Another requirement is that IRQs must be
able to fire on both edges.
3. Board integration
--------------------
Board integration
-----------------
To use this driver in your system, register a platform_device with the
name 'rotary-encoder' and associate the IRQs and some specific platform
@ -93,17 +96,17 @@ the configuration.
Because GPIO to IRQ mapping is platform specific, this information must
be given in separately to the driver. See the example below.
---------<snip>---------
::
/* board support file example */
/* board support file example */
#include <linux/input.h>
#include <linux/rotary_encoder.h>
#include <linux/input.h>
#include <linux/rotary_encoder.h>
#define GPIO_ROTARY_A 1
#define GPIO_ROTARY_B 2
#define GPIO_ROTARY_A 1
#define GPIO_ROTARY_B 2
static struct rotary_encoder_platform_data my_rotary_encoder_info = {
static struct rotary_encoder_platform_data my_rotary_encoder_info = {
.steps = 24,
.axis = ABS_X,
.relative_axis = false,
@ -114,13 +117,12 @@ static struct rotary_encoder_platform_data my_rotary_encoder_info = {
.inverted_b = 0,
.half_period = false,
.wakeup_source = false,
};
};
static struct platform_device rotary_encoder_device = {
static struct platform_device rotary_encoder_device = {
.name = "rotary-encoder",
.id = 0,
.dev = {
.platform_data = &my_rotary_encoder_info,
}
};
};