-
-
Notifications
You must be signed in to change notification settings - Fork 39.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 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>
- Loading branch information
1 parent
5bbc527
commit bcb6e23
Showing
5 changed files
with
172 additions
and
20 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
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
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,55 @@ | ||
#include <stdbool.h> | ||
#include "ps2_io.h" | ||
|
||
// chibiOS headers | ||
#include "ch.h" | ||
#include "hal.h" | ||
|
||
/* Check port settings for clock and data line */ | ||
#if !(defined(PS2_CLOCK)) | ||
# error "PS/2 clock setting is required in config.h" | ||
#endif | ||
|
||
#if !(defined(PS2_DATA)) | ||
# error "PS/2 data setting is required in config.h" | ||
#endif | ||
|
||
/* | ||
* Clock | ||
*/ | ||
void clock_init(void) {} | ||
|
||
void clock_lo(void) { | ||
palSetLineMode(PS2_CLOCK, PAL_MODE_OUTPUT_OPENDRAIN); | ||
palWriteLine(PS2_CLOCK, PAL_LOW); | ||
} | ||
|
||
void clock_hi(void) { | ||
palSetLineMode(PS2_CLOCK, PAL_MODE_OUTPUT_OPENDRAIN); | ||
palWriteLine(PS2_CLOCK, PAL_HIGH); | ||
} | ||
|
||
bool clock_in(void) { | ||
palSetLineMode(PS2_CLOCK, PAL_MODE_INPUT); | ||
return palReadLine(PS2_CLOCK); | ||
} | ||
|
||
/* | ||
* Data | ||
*/ | ||
void data_init(void) {} | ||
|
||
void data_lo(void) { | ||
palSetLineMode(PS2_DATA, PAL_MODE_OUTPUT_OPENDRAIN); | ||
palWriteLine(PS2_DATA, PAL_LOW); | ||
} | ||
|
||
void data_hi(void) { | ||
palSetLineMode(PS2_DATA, PAL_MODE_OUTPUT_OPENDRAIN); | ||
palWriteLine(PS2_DATA, PAL_HIGH); | ||
} | ||
|
||
bool data_in(void) { | ||
palSetLineMode(PS2_DATA, PAL_MODE_INPUT); | ||
return palReadLine(PS2_DATA); | ||
} |
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