Commit graph

72 commits

Author SHA1 Message Date
zhiayang
cc3d5529fd
feat(drivers): Driver for MAX7318 GPIO expander (#1295)
Add driver for max7318 i2c gpio expander

Co-authored-by: Pete Johanson <peter@peterjohanson.com>
2022-09-29 21:22:01 -04:00
Peter Johanson
6a86cd0547 feat(gpio): Add 595 shift register driver.
* Use SPI for sending serial data.
* Supports 1-4 shift registers chained together by
  setting `ngios` property appropriately.
2022-06-03 22:45:04 -04:00
Kurtis Lew
f369f2cc46 feat(kscan): Add toggle-mode to updated direct-wire kscan 2022-05-19 11:24:01 -04:00
Joel Spadin
0738b4b2b0 refactor(kscan): Match direct GPIO driver to matrix driver
Rewrote the direct GPIO kscan driver to match the improvements made to
the matrix driver in 82cb762698 and
f946dc6893. It now uses the same
debouncing system as the matrix driver.
2022-05-17 01:20:20 -04:00
Joel Spadin
f946dc6893 feat(kscan): Improve matrix debouncing
Switched the GPIO matrix driver to debouncing using a simple integrator
algorithm. Whenever a key is pressed, we now scan at a rate controlled
by debounce-scan-period-ms (default 1 ms) until all keys are released,
then return to either waiting for an interrupt or polling more slowly.

The timers for key press and release can now be controlled separately,
so debounce-period is deprecated in favor of debounce-press-ms and
debounce-release-ms. Global Kconfig options
ZMK_KSCAN_DEBOUNCE_PRESS_MS and ZMK_KSCAN_DEBOUNCE_RELEASE_MS are also
added to make these easier to set.

Added documentation for debouncing options.
2021-10-26 23:52:13 -04:00
Pete Johanson
647110e5e5 feat(drivers): Add mcp23017 driver based on upstream mcp23s17 one.
* Upstream Zephyr has in progress driver, so doing this locally here,
  until we can move over to that driver.
2021-09-14 20:48:28 -04:00
Joel Spadin
82cb762698 refactor(kscan): Demacroify GPIO matrix driver
Refactored the GPIO matrix kscan driver so that only the data and config
structures are defined in the foreach macro. Functionality is unchanged
except for the addition of DT properties to adjust polling speed.

This should make it easier to add other enhancements later, like
improved and customizable debounce behavior.
2021-09-08 14:34:28 -04:00
Joel Spadin
a6de43e665 feat: Add nrf VDDH battery driver
Added a driver which uses the nRF52's ADC channel on the VDDH pin to
read the battery voltage when using high voltage mode.
2021-07-24 23:39:13 -05:00
innovaker
61893e453b
refactor(app): format with prettier (#563)
prettier --write .

PR: #563
2021-01-01 22:55:52 -05:00
innovaker
8d9ae1fdf3 refactor: Align drivers with Zephyr file system conventions
PR: #400
2020-12-03 21:06:01 -05:00
Pete Johanson
e0fede4aa5 refactor(kscan): Use PORT events for direct driver
* Switch interrupt configuration so nRF52 uses
  PORT events for lower power use, and wake
  from deep sleep.
* Closes #272
2020-12-02 16:46:05 -05:00
4pplet
924a598920 Updated function calls with missing reference. GPIO missing.
Updated function calls with missing reference. GPIO missing.

To my understanding:
DT_INST_GPIO_PIN() should be called instead if DT_INST_PIN()
DT_INST_GPIO_FLAGS() should be called instead if DT_INST_GPIO_FLAGS()

Current implementation does not compile when using control pin.
2020-11-29 21:12:26 -05:00
innovaker
67a6646cd7 chore: add copyright to core Kconfig 2020-11-20 22:25:28 -05:00
innovaker
1c8321566a fix(drivers): rename module.yaml to module.yml
module.yaml is not a valid module filename.

See Zephyr `scripts/zephyr_module.py`
2020-11-20 22:23:20 -05:00
Nick
8779563896 fix(bvd): Add SENSOR_CHAN_ALL support 2020-11-01 23:00:54 -05:00
Jay Greco
8a98212a02 Update demux kscan driver as per PR feedback
- Remove kscan_gpio_irq_callback
- Remove kscan_gpio_irq_callback_handler
- Remove irq_callbacks
+ Add TODO noting timer and sleep state interactions
2020-10-27 12:44:59 -07:00
Jay Greco
1522c91d73 Add new kscan_gpio_demux driver
+ zmk,kscan_gpio_demux is now a compatible kscan option
+ kscan_gpio_demux is based heavily off of the implementation of
kscan_gpio_matrix, modified to address cols using an n-to-1
demultiplexer chip instead of discrete IO
+ Added zmk,kscan_gpio_demux.yaml file
* modified CMakeLists to include new source files
2020-10-27 18:58:58 +00:00
Nick
a008731103 Implement Kconfig and enhance error checks 2020-10-26 16:01:57 -05:00
Nick
63007fb6c1 fix: clang-format 2020-10-24 18:54:56 -05:00
Nick
adb07926b1 Remove newlib dep 2020-10-24 18:52:34 -05:00
Nick
a67a8cd3b8 Check if fetch channel is supported 2020-10-23 22:37:44 -05:00
Nick
6047415b1c Fix build for boards without voltage divider 2020-10-23 01:19:47 -05:00
Nick Winans
70ffcca3b4
Merge branch 'main' into bluetooth/battery-reporting 2020-10-23 00:55:50 -05:00
Nick
162c6b77db clang-format and add missing defconfig values 2020-10-23 00:50:39 -05:00
Nick
3082455aec Refactor driver to use Sensor API 2020-10-23 00:45:59 -05:00
Nuxiom
1c0c02e097
Reformatted according to clang-format lint 2020-10-11 17:51:06 +11:00
Nuxiom
78cb6c8b21
Fix kscan_gpio_irq_callback_handler_##n conditional macro 2020-10-11 17:33:07 +11:00
Pete Johanson
12b9a37005
Merge pull request #211 from petejohanson/core/keymap-port-event-exploration
Use PORT events for kscan matrix interrupts, add option for deep sleep.
2020-10-06 17:32:35 -04:00
Pete Johanson
a7496ab064 feat(power): Initial deep sleep work.
* New ZMK_SLEEP Kconfig symbol to enable the functionality.
* Switch to PORT events that allows wake from deep sleep.
* Initial basic power management policy, with idle ms,
  and ignoring deep sleep if we detect a USB connection.
2020-10-06 17:24:36 -04:00
Pete Johanson
9be566603e feat(kscan): Use PORT events for kscan matrix interrupts
* Lower power usage compared to regular interrupts on nrf52.
2020-10-04 22:03:21 -04:00
Joel Spadin
4121b07f7f fix(kscan): fix direct GPIO when using interrupts
Fixed initializing interrupts for direct GPIO when
CONFIG_ZMK_KSCAN_DIRECT_POLLING is not enabled. IS_ENABLED() is needed to map
the possibly-undefined value to 0 or 1 so COND_CODE_0() and COND_CODE_1() work.
2020-10-04 14:07:20 -05:00
Joel Spadin
f6f8abe055 fix(ec11): allow more than one encoder
Fixes "device.h:101:11: error: redefinition of '__device_ec11'" in firmware that
has more than one encoder.
2020-10-03 14:05:05 -05:00
Pete Johanson
028dfae92e chore: Fix remaining formatting issues. 2020-10-01 11:43:00 -04:00
Pete Johanson
e993378b2a chore: Fix some accidental formatting issues. 2020-10-01 11:24:57 -04:00
Jason Chestnut
c2a861c0e6 Modify preprocessor directives to use basic #if !defined() rather than Zephyr macros where appropriate. 2020-09-28 08:24:51 -04:00
jason
9392c4f9ff Fix preprocessor flag issues for pull request. 2020-09-27 21:27:30 -04:00
Jason Chestnut
cfc75a118e Fix merge error. 2020-09-25 11:51:14 -04:00
Jason Chestnut
cca8337f05 Add support to GPIO matrix driver for matrix polling, rather than interrupt-based IO.
- Add ZMK_KSCAN_MATRIX_POLLING config flag to Kconfig
  - Update matrix driver code to use the above flag to conditionally add the handling code for polling operations.
2020-09-25 11:49:07 -04:00
Jason Chestnut
b1dce208f8 Add matrix polling logic to matrix GPIO driver. 2020-09-25 11:29:21 -04:00
Jason Chestnut
9668305621 Restore original matrix driver to correct implementation errors. 2020-09-24 17:35:51 -04:00
Jason Chestnut
5c4705d465 Add new matrix scan flag and implementation in the gpio matrix driver. 2020-09-24 14:30:47 -04:00
Jason Chestnut
53425aa3c4 Rename kscan direct wired driver polling kscan flag in preparationfor addition of new matrix driver flag that enables polling. 2020-09-24 07:55:32 -04:00
Jason Chestnut
31af9646e6 Adding kconfig flag for enabling matrix polling (vs interrupts) on the matrix gpio driver. 2020-09-23 16:05:29 -04:00
Nick
f5909f9c26 fix(clang-format) 2020-09-19 19:18:03 -05:00
Nick
da0fb965f6 Merge remote-tracking branch 'upstream/main' into bluetooth/battery-reporting 2020-09-19 19:15:05 -05:00
Nick
844f2c7674 Voltage divider driver initial implementation 2020-09-19 19:14:59 -05:00
Pete Johanson
191a2d755a chore: clang-format the codebase.
* Use the LLVM style
* Override indent width (8) and column limit (100)
* Fixes #142.
2020-09-14 00:10:34 -04:00
Pete Johanson
68e72f9275 fix: Switch to single AUTHORS file.* Closes #164 2020-09-10 10:24:23 -04:00
Pete Johanson
01db53b46a fix(kscan): Avoid sending duplicate kscan events. 2020-09-01 09:55:25 -04:00
Pete Johanson
4402e4fbc7 feeature(bt): Add "unpair combo" on startup.
* Especially for splits, we need the ability to
  unpair all paired devices as  sledgehammer
  if we need to "reset things", and doing so via
  keymaps isn't suitable.
* Allows shields to define a collection of key
  positions that if all held 2 seconds after
  startup, will unpair all existing pairs for the
  device.
2020-08-18 13:17:10 -04:00