The previous implementation already reported a key-press event after
reading an ADC value close to the threshold for the first time.
This may lead to false events if the ADC takes a reading just during
the transition from one button state to another (especially if a
somewhat large capacitor is used to avoid noise).
A key-press state must be same for at least two samples in order to
avoid such issues, which is what this commit implements.
Signed-off-by: Martin Jäger <martin@libre.solar>
The Microchip CAP12xx series has a configurable sensitivity and
can drive an optional guard signal to reduce noise sensitivity.
Signed-off-by: Jeremy Dick <jdick@pivotint.com>
The VS1838B is one of the most found infrared receiver
found in electronic kits and is easy to setup with only
a single GPIO used for signal transmission (apart from
VCC and GND).
This new driver let applications use the VS1838B as an
input with events relayed as 0x0000<address><command>.
Only the NEC protocol is supported in this version but
more can be added later.
Link: https://github-wiki-see.page/m/CoreELEC/remotes/wiki/08.-NEC-IR-Protocol-Datasheet
This has been tested using the input_dump sample.
Signed-off-by: Bastien JAUNY <bastien.jauny@smile.fr>
Under certain conditions report_lock could already be used by the irq
before it was initialized, now we ensure we enable irq after report_lock
is initialized.
Furthermore in some conditions data->xfer_bytes could be equal
SBUS_FRAME_LEN resulting in a infinite loop doing zero reads when
fifo is still holding new bytes
Signed-off-by: Peter van der Perk <peter.vanderperk@nxp.com>
Make the zephyr,input-sdl-touch driver be multi instance and add the
possibility to associate it with a display. The input events are only
emitted if the events occured on this display.
Signed-off-by: Fabian Blatz <fabianblatz@gmail.com>
SBUS parser discards portion of the received data, this is a result
of SBUS parser intermediate variable overflow. Fix by changing said
variable type to uint32_t.
Signed-off-by: Nikola Petrovic <nikolaptr6@gmail.com>
Enabling `CONFIG_INPUT_FT5336_INTERRUPT` if the ft5336 node in DT
has `int-gpios` property.
As a result of this change, some boards can eliminate lines that
explicitly configure `CONFIG_INPUT_FT5336_INTERRUPT`.
Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
The Microchip CAP12xx series are available in 3, 6 or 8 channel versions.
Co-authored-by: Benjamin Cabé <kartben@gmail.com>
Signed-off-by: Lothar Felten <lothar.felten@gmail.com>
Add a driver for the Nintendo Nunchuk, accessed through the I2C bus.
This driver only supports the joystick and the buttons, not the
accelerometer.
Signed-off-by: Miguel Gazquez <miguel.gazquez@bootlin.com>
Instead of depending on GPIO. This allows to just enable
CONFIG_INPUT=y + DT node in the application layer. The same
pattern is nowadays followed by most drivers.
Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
allows use of touch_sensor, rtc_counter, and wdt simultaneously by enabling
ESP_INTR_FLAG_SHARED when calling esp_intr_alloc()
Signed-off-by: Marcio Ribeiro <marcio.ribeiro@espressif.com>
Implement a new stable-poll-period-ms property to specify a new (slower)
polling rate for when the matrix is stable.
The keyboard thread can eat up a surprisingly high amount of cpu cycles in
busy waiting if the specific hardware implementation happen to have a
particularly slow settle time, but high frequency polling is really only
needed when debouncing.
The new property allow slowing down the polling rate when the matrix is
stable (either key pressed but none to be debounced or idle in the case
of the gpio implementation with no interrupts), this allows reducing the
overall cpu time taken by the keyboard scanning thread when keys are
persistently pressed.
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
The it8xxx2_kbd KSO pins can be used as both keyboard scan and GPIO. By
default the keyboard scanning driver controls the output level of all
the KSO signals from 0 to (col-size - 1), meaning that any line in
between used as GPIO is going to have its output value overridden.
Add a kso-ignore-mask property to the keyboard scan driver to allow
specifiying extra pins that should not be controlled by the driver.
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
The CONFIG_PINCTRL is removed from the board's defconfig files.
Drivers which use pin control function should add "select PINCTRL"
in their Kconfig files.
Fixes#78619
Signed-off-by: Jun Lin <CHLin56@nuvoton.com>
Even in cases where the alt-addr is set, we can still use the INT pin
during probe. Some boards require this, as if a reset GPIO is not
defined the INT pin may still need to be toggled in order to initialize
the GT911 IC correctly.
Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
Add a no-disconnect property that skips the call to disconnect the pin
during suspend, this is useful as not all gpio controllers supports pin
disconnection, and right now using the gpio-keys driver on one of those
results in a failed initialization if PM runtime is enabled.
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
The argument of INPUT_SBUS_INIT is named `n,` but there are some places
where it references `id.` Correcting these.
Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
GT911 driver was reading an additional touch point into the stack
defined touch point array, causing an out-of-bounds write on the stack.
Fix this issue by adjusting the limit on the for loop, and add a note
to the driver as to why we don't need to validate the number of points
reported for future developers
Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
Adds the use of generic touch reporting method for stmpe811 driver.
Signed-off-by: Dominik Lau <dlau@internships.antmicro.com>
Signed-off-by: Filip Kokosinski <fkokosinski@antmicro.com>
Adds the use of generic touch reporting method for ft5336 driver.
Signed-off-by: Dominik Lau <dlau@internships.antmicro.com>
Signed-off-by: Filip Kokosinski <fkokosinski@antmicro.com>
Adds a way of reporting touchscreen events
taking common properties into account.
Signed-off-by: Dominik Lau <dlau@internships.antmicro.com>
Signed-off-by: Filip Kokosinski <fkokosinski@antmicro.com>
Add power management support to various drivers:
- gpio-kbd-matrix
- ite,it8xxx2-kbd
- nuvoton,npcx-kbd
- microchip,xec-kbd
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
Add power management support to the keyboard matrix library. This
provides a generic pm_action function that changes the keyboard matrix
scan in two places when suspended:
- reset the state to 0 for all columns
- do not enable key press detection
This ensures that any key that was pressed when the device is suspended
is released, and no other scan happens until the device is resumed.
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
The reset pin on the chip is optional, add a soft reset call when the
reset pin is not specified for the device.
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
The gt911 can recognize up to 5 touch points at a time.
Add code to support these multi-touch events.
Signed-off-by: Farah Fliss <farah.fliss@nxp.com>
Signed-off-by: Phi Bang Nguyen <phibang.nguyen@nxp.com>
Some kind of race condition caused the gpio_keys input module to
occasionally miss an event after boot. This is fixed by initializing the
pin state variable in the input_gpio_keys module.
Related to https://github.com/starcopter/bms-firmware/issues/6
Signed-off-by: Lasse Fröhner <lasse@starcopter.com>
The CST816D touch chip is similar to the CST816S, with the primary
difference being the chip ID. This commit extends the existing
CST816S driver to support the CST816D by adding its chip ID. There
are no other modifications.
Signed-off-by: Shang Xiangyao <shxyke@gmail.com>
During driver init make sure that the IRQ_CTL field is set before enabling
the interrupts. Fixes the i2c read error on startup.
Signed-off-by: Fabian Blatz <fabianblatz@gmail.com>
The driver right now only allows inverting the input value, which can be
useful for differential channels but is quite confusing for single ended
ones. Implement a simple output inversion flag instead to make up for
that.
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
The motion event handler is currently setup to always retrigger until
there's no more motion data from the sensor. Change that to only
retrigger if the motion pin is asserted when the handler has finished
running, this saves a bunch of unnecessary spi transactions.
Ideally this driver would use a level interrupt, but I'd rather avoid
that as that is unsupported by many gpio controllers.
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
The KBS_KSOH1 register contains both keyboard and GPIO output settings.
Not all bits are for the keyboard will be driven, so a critical section
is needed to prevent race conditions.
Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>