-
Notifications
You must be signed in to change notification settings - Fork 102
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
iio: counter: Add support for STM32 LPTimer
Add support for STM32 Low-Power Timer, that can be used as counter or quadrature encoder. Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
- Loading branch information
Fabrice Gasnier
authored and
Lee Jones
committed
Sep 4, 2017
1 parent
717e692
commit d895882
Showing
4 changed files
with
450 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
What: /sys/bus/iio/devices/iio:deviceX/in_count0_preset | ||
KernelVersion: 4.13 | ||
Contact: fabrice.gasnier@st.com | ||
Description: | ||
Reading returns the current preset value. Writing sets the | ||
preset value. Encoder counts continuously from 0 to preset | ||
value, depending on direction (up/down). | ||
|
||
What: /sys/bus/iio/devices/iio:deviceX/in_count_quadrature_mode_available | ||
KernelVersion: 4.13 | ||
Contact: fabrice.gasnier@st.com | ||
Description: | ||
Reading returns the list possible quadrature modes. | ||
|
||
What: /sys/bus/iio/devices/iio:deviceX/in_count0_quadrature_mode | ||
KernelVersion: 4.13 | ||
Contact: fabrice.gasnier@st.com | ||
Description: | ||
Configure the device counter quadrature modes: | ||
- non-quadrature: | ||
Encoder IN1 input servers as the count input (up | ||
direction). | ||
- quadrature: | ||
Encoder IN1 and IN2 inputs are mixed to get direction | ||
and count. | ||
|
||
What: /sys/bus/iio/devices/iio:deviceX/in_count_polarity_available | ||
KernelVersion: 4.13 | ||
Contact: fabrice.gasnier@st.com | ||
Description: | ||
Reading returns the list possible active edges. | ||
|
||
What: /sys/bus/iio/devices/iio:deviceX/in_count0_polarity | ||
KernelVersion: 4.13 | ||
Contact: fabrice.gasnier@st.com | ||
Description: | ||
Configure the device encoder/counter active edge: | ||
- rising-edge | ||
- falling-edge | ||
- both-edges | ||
|
||
In non-quadrature mode, device counts up on active edge. | ||
In quadrature mode, encoder counting scenarios are as follows: | ||
---------------------------------------------------------------- | ||
| Active | Level on | IN1 signal | IN2 signal | | ||
| edge | opposite |------------------------------------------ | ||
| | signal | Rising | Falling | Rising | Falling | | ||
---------------------------------------------------------------- | ||
| Rising | High -> | Down | - | Up | - | | ||
| edge | Low -> | Up | - | Down | - | | ||
---------------------------------------------------------------- | ||
| Falling | High -> | - | Up | - | Down | | ||
| edge | Low -> | - | Down | - | Up | | ||
---------------------------------------------------------------- | ||
| Both | High -> | Down | Up | Up | Down | | ||
| edges | Low -> | Up | Down | Down | Up | | ||
---------------------------------------------------------------- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.