Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Arm ps2 mouse interrupt #6490

Merged
merged 16 commits into from
Aug 5, 2021
Merged

Conversation

JohSchneider
Copy link
Contributor

Description

these patches add an PS2 mouse driver for ChibiOS based boards; The AVR ps2-interrupt-code is reused as much as possible, and parts that are platform specific are either split off or switched with defines.

Tested&Verified on a STM32F103 board with an Cherry-ML-4400 PS2-trackball :-)

Types of Changes

  • Core
  • Bugfix
  • New feature
  • Enhancement/optimization
  • Keyboard (addition or update)
  • Keymap/layout/userspace (addition or update)
  • Documentation

@JohSchneider JohSchneider force-pushed the arm_ps2-mouse_interrupt branch 2 times, most recently from 0966d98 to 294f017 Compare August 6, 2019 13:37
Copy link
Member

@drashna drashna left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You shouldn't need to add defines for the delay.

In fact, all of them should be changed to wait_**, as this is hardware agnostic, and should be defined for us.

tmk_core/protocol/ps2_interrupt.c Outdated Show resolved Hide resolved
tmk_core/protocol/ps2_interrupt.c Outdated Show resolved Hide resolved
tmk_core/protocol/ps2_interrupt.c Outdated Show resolved Hide resolved
tmk_core/protocol/ps2_interrupt.c Outdated Show resolved Hide resolved
tmk_core/protocol/ps2_interrupt.c Outdated Show resolved Hide resolved
tmk_core/protocol/ps2_interrupt.c Outdated Show resolved Hide resolved
tmk_core/protocol/ps2_interrupt.c Outdated Show resolved Hide resolved
tmk_core/protocol/ps2_interrupt.c Outdated Show resolved Hide resolved
tmk_core/protocol/ps2_interrupt.c Outdated Show resolved Hide resolved
tmk_core/protocol/ps2_interrupt.c Outdated Show resolved Hide resolved
@JohSchneider
Copy link
Contributor Author

good find! 34175dc fixes that

docs/feature_ps2_mouse.md Outdated Show resolved Hide resolved
docs/feature_ps2_mouse.md Outdated Show resolved Hide resolved
tmk_core/protocol/ps2_interrupt.c Outdated Show resolved Hide resolved

void clock_lo(void)
{
palSetLineMode(PS2_LINE_CLOCK, PAL_MODE_OUTPUT_OPENDRAIN);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does EXT require use of PAL_MODE_ALTERNATE on non GPIOv1 boards (for example f303 which is GPIOv2)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good question - dunno :-)
here on GPIOv1/stm32f1 the pins are in no special/alternate mode - probably applies to other stms as well...

Copy link
Member

@zvecr zvecr Aug 8, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My understanding is very few boards run GPIOv1, and the majority of QMK supported boards are GPIOv2. I would personally like to see this answered before merging, given the current state of the repo. That way it can either be documented, or protected with compile time errors.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, from what i can tell - grepping through the sources and docs - the EXT driver only uses the pins as they are configured for example with PAL_MODE_OUTPUT_? - no special/alternate mode anywhere. and the EXT driver is available on other STM32F? as well. so i see no problems there

but do note, that the EXT driver is considered legacy - newer chibios versions use per line/pad events that can have a callback function assigned (palEnableLineEvent and palSetLineCallback) - see the comments in my code
yes this adds a minor hurdle when QMK decides to move to a newer chibios version - but i did my best to document that :-)

This comment was marked as off-topic.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ChibiOS has been updated since, so this PR may need some TLC before it's ready to merge.

@drashna drashna requested review from drashna and a team August 8, 2019 20:34
@JohSchneider JohSchneider force-pushed the arm_ps2-mouse_interrupt branch 2 times, most recently from 082af25 to 5e50864 Compare August 9, 2019 12:55
@jackhumbert jackhumbert added the hacktoberfest-accepted All the good issues to tackle during Hacktoberfest! label Sep 30, 2019
Copy link

@hugovk hugovk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some suggestions for the docs, otherwise looks good.

docs/feature_ps2_mouse.md Outdated Show resolved Hide resolved
docs/feature_ps2_mouse.md Outdated Show resolved Hide resolved
docs/feature_ps2_mouse.md Outdated Show resolved Hide resolved
Copy link

@samagragupta samagragupta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

docs/feature_ps2_mouse.md Outdated Show resolved Hide resolved
tmk_core/protocol/ps2_interrupt.c Outdated Show resolved Hide resolved
@drashna drashna requested a review from zvecr October 22, 2019 03:44
@qmk qmk deleted a comment from Ratna04priya Oct 22, 2019
tmk_core/protocol/ps2_mouse.c Show resolved Hide resolved
tmk_core/protocol/ps2_interrupt.c Outdated Show resolved Hide resolved
docs/feature_ps2_mouse.md Outdated Show resolved Hide resolved
docs/feature_ps2_mouse.md Outdated Show resolved Hide resolved
tmk_core/protocol/ps2_interrupt.c Outdated Show resolved Hide resolved
tmk_core/protocol/ps2_interrupt.c Show resolved Hide resolved
tmk_core/protocol/ps2_mouse.c Outdated Show resolved Hide resolved
tmk_core/protocol/ps2_mouse.c Show resolved Hide resolved
@qmk qmk deleted a comment from PrathamGoyal Oct 22, 2019
@JohSchneider JohSchneider requested a review from zvecr October 22, 2019 18:16
@qmk qmk deleted a comment from raghavdhingra Oct 23, 2019
@qmk qmk deleted a comment from raghavdhingra Oct 23, 2019
Copy link

@parammittal16 parammittal16 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@qmk qmk deleted a comment from rishav142k Oct 31, 2019
using the chibios equivalent to AVRs cli: chSys[Unl|L]ock
@JohSchneider
Copy link
Contributor Author

@twadleigh thanks!
since you seem to be using this code - mind testing it in your setup, and posting some feedback :)

Copy link
Member

@tzarc tzarc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems fine, but no hardware to test with... would be great to get some feedback from users.

@tzarc tzarc requested a review from a team July 16, 2020 12:24
@tzarc tzarc changed the base branch from master to develop July 25, 2020 03:10
@tzarc
Copy link
Member

tzarc commented Jul 25, 2020

Retargeted this to develop due to core changes.

@noroadsleft noroadsleft force-pushed the develop branch 2 times, most recently from 550bb6a to 9d827f9 Compare July 31, 2020 19:45
@noroadsleft noroadsleft force-pushed the develop branch 2 times, most recently from 1d4c0cd to 65c27a3 Compare August 29, 2020 21:42
@noroadsleft noroadsleft deleted the branch qmk:develop November 28, 2020 20:02
@tzarc tzarc reopened this Nov 28, 2020
@tzarc tzarc closed this Feb 27, 2021
@tzarc tzarc deleted the branch qmk:develop February 27, 2021 20:27
@noroadsleft noroadsleft reopened this Feb 27, 2021
@tzarc tzarc merged commit bcb6e23 into qmk:develop Aug 5, 2021
nhongooi pushed a commit to nhongooi/qmk_firmware that referenced this pull request Dec 5, 2021
* ps2_mouse on ARM: an interrupt-version of the ps2-mouse code ported to ARM/chibios

* ps2_mouse on ARM: link EXT callback-channel selection to the user defined PS2_LINE_CLOCK

* ps2_mouse on ARM: replace DELAY_X defines with hardware-agnostic wait_X

* ps2_mouse on ARM: replace chibios-specific defines for the pins/lines with defines from quantum/config_common.h

and drop the '_LINE' component from teh define name

* ps2_mouse on ARM: expose the software-intterupt port as a user editable define

* Update docs/feature_ps2_mouse.md

Co-Authored-By: Hugo van Kemenade <hugovk@users.noreply.github.com>

* Update feature_ps2_mouse.md

* use a define to deduce the PS_DATA_PORT instead

* reduce all-zero extcfg to oneliner

* ps2_mouse: use generic wait instead of avr-delay

* Update docs/feature_ps2_mouse.md

* ps2_mouse: changes for new chibios version

(17.6.0 -> 19.1.0)
replacing the legacy externa-interrupt driver with pal-callbacks

* ps2_mouse: use PLATFORM_KEY

Co-Authored-By: Joel Challis <git@zvecr.com>

* ps2_mouse: clang-format corrections

* ps2_mouse: add systemlocks

using the chibios equivalent to AVRs cli: chSys[Unl|L]ock

Co-authored-by: Johannes <you@example.com>
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
Co-authored-by: Joel Challis <git@zvecr.com>
BorisTestov pushed a commit to BorisTestov/qmk_firmware that referenced this pull request May 23, 2024
* ps2_mouse on ARM: an interrupt-version of the ps2-mouse code ported to ARM/chibios

* ps2_mouse on ARM: link EXT callback-channel selection to the user defined PS2_LINE_CLOCK

* ps2_mouse on ARM: replace DELAY_X defines with hardware-agnostic wait_X

* ps2_mouse on ARM: replace chibios-specific defines for the pins/lines with defines from quantum/config_common.h

and drop the '_LINE' component from teh define name

* ps2_mouse on ARM: expose the software-intterupt port as a user editable define

* Update docs/feature_ps2_mouse.md

Co-Authored-By: Hugo van Kemenade <hugovk@users.noreply.github.com>

* Update feature_ps2_mouse.md

* use a define to deduce the PS_DATA_PORT instead

* reduce all-zero extcfg to oneliner

* ps2_mouse: use generic wait instead of avr-delay

* Update docs/feature_ps2_mouse.md

* ps2_mouse: changes for new chibios version

(17.6.0 -> 19.1.0)
replacing the legacy externa-interrupt driver with pal-callbacks

* ps2_mouse: use PLATFORM_KEY

Co-Authored-By: Joel Challis <git@zvecr.com>

* ps2_mouse: clang-format corrections

* ps2_mouse: add systemlocks

using the chibios equivalent to AVRs cli: chSys[Unl|L]ock

Co-authored-by: Johannes <you@example.com>
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
Co-authored-by: Joel Challis <git@zvecr.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.