You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

72 lines
2.5 KiB

[Keyboard] Update Symmetric70 keyboard prototype (#12707) * update handwired/symmetric70_proto/matrix.c * make keyboards/handwired/symmetric70_proto/promicro/ * add symmetric70_proto/debug_config.h, update symmetric70_proto/local_features.mk etc. set MATRIX_IO_DELAY macro make MTEST=mdelay0 symmetric70_proto/promicro:default:flash make MTEST=mdelay1 symmetric70_proto/promicro:default:flash make MTEST=mdelay10 symmetric70_proto/promicro:default:flash make MTEST=mdelay30 symmetric70_proto/promicro:default:flash set DEBUG_MATRIX_SCAN_RATE_ENABLE yes make MTEST=scan symmetric70_proto/promicro:default:flash set MATRIX_DEBUG_DELAY and MATRIX_IO_DELAY macro make MTEST=matrix_debug_delay,mdelay0 symmetric70_proto/promicro:default:flash set MATRIX_DEBUG_SCAN make MTEST=matrix_debug_scan symmetric70_proto/promicro:default:flash * add symmetric70_proto/matrix_debug/readme.md * update symmetric70_proto/matrix_debug/readme.md * update handwired/symmetric70_proto/readme.md * update handwired/symmetric70_proto/readme.md * update handwired/symmetric70_proto/*/readme.md * add handwired/symmetric70_proto/matrix_fast/ * update handwired/symmetric70_proto/matrix_fast/readme.md * fix typo in handwired/symmetric70_proto/matrix_fast/readme.md * update config.h under handwired/symmetric70_proto/promicro * add Proton C support to handwired/symmetric70_proto * add handwired/symmetric70_proto/proton_c/readme.md * add promicro/*/readme.md proton_c/*/readme.md * update handwired/symmetric70_proto/proton_c/proton_c.c support MATRIX_IO_DELAY_DEFAULT for testing. * Added another implementation of 'adaptive_delay'. * update symmetric70_proto/local_features.mk * update symmetric70_proto/matrix_fast/gpio_extr.h * add matrix_output_unselect_delay_ports() * add MTEST=adaptive_delay_fast option * update symmetric70_proto/matrix_debug/readme.md * update symmetric70_proto/matrix_fast/readme.md * update symmetric70_proto/matrix_debug/readme.md * Erase garbage * fix symmetric70_proto/proton_c/proton_c.c * improve adaptive_delay_fast in symmetric70_proto/matrix_debug/matrix.c * update symmetric70_proto/matrix_debug/readme.md * fix symmetric70_proto/matrix_debug/readme.md * Update keyboards/handwired/symmetric70_proto/proton_c/rules.mk Co-authored-by: Ryan <fauxpark@gmail.com> * Update keyboards/handwired/symmetric70_proto/proton_c/rules.mk Co-authored-by: Ryan <fauxpark@gmail.com> * Update keyboards/handwired/symmetric70_proto/local_features.mk Co-authored-by: Nick Brassel <nick@tzarc.org> * Update keyboards/handwired/symmetric70_proto/local_features.mk Co-authored-by: Nick Brassel <nick@tzarc.org> * Update keyboards/handwired/symmetric70_proto/matrix_debug/matrix.c Co-authored-by: Nick Brassel <nick@tzarc.org> * Update keyboards/handwired/symmetric70_proto/matrix_debug/matrix.c Co-authored-by: Nick Brassel <nick@tzarc.org> * Update keyboards/handwired/symmetric70_proto/local_features.mk Co-authored-by: Nick Brassel <nick@tzarc.org> * Update keyboards/handwired/symmetric70_proto/matrix_debug/matrix.c Co-authored-by: Nick Brassel <nick@tzarc.org> * Update keyboards/handwired/symmetric70_proto/matrix_debug/readme.md Co-authored-by: Nick Brassel <nick@tzarc.org> * Update keyboards/handwired/symmetric70_proto/matrix_debug/readme.md Co-authored-by: Nick Brassel <nick@tzarc.org> * Update keyboards/handwired/symmetric70_proto/matrix_debug/readme.md Co-authored-by: Nick Brassel <nick@tzarc.org> * Update keyboards/handwired/symmetric70_proto/matrix_fast/matrix_config_expand.c Co-authored-by: Nick Brassel <nick@tzarc.org> Co-authored-by: Ryan <fauxpark@gmail.com> Co-authored-by: Nick Brassel <nick@tzarc.org>
2 years ago
  1. /*
  2. Copyright 2021 mtei
  3. This program is free software: you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation, either version 2 of the License, or
  6. (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program. If not, see <http://www.gnu.org/licenses/>.
  13. */
  14. // clang-format off
  15. #if defined(MATRIX_EXTENSION_74HC157)
  16. # define MATRIX_DEVICES MCU_GPIOa, MCU_GPIOb
  17. # define IS_74HC15x(dev) ((dev)==MCU_GPIOa || (dev)==MCU_GPIOb)
  18. # define MATRIX_EXT_74HC15x MATRIX_EXTENSION_74HC157
  19. #elif defined(MATRIX_EXTENSION_74HC153)
  20. # define MATRIX_DEVICES MCU_GPIOa, MCU_GPIOb, MCU_GPIOc, MCU_GPIOd
  21. # define IS_74HC15x(dev) ((dev)==MCU_GPIOa || (dev)==MCU_GPIOb || (dev)==MCU_GPIOc || (dev)==MCU_GPIOd)
  22. # define MATRIX_EXT_74HC15x MATRIX_EXTENSION_74HC153
  23. #endif
  24. static const pin_t sel_pins[] = { MATRIX_EXT_74HC15x };
  25. #ifdef MATRIX_GPIO_NEED_SEPARATE_ATOMIC
  26. # define setMatrixInputHigh(dev, port, bit) \
  27. do { \
  28. if ((dev) == MCU_GPIO || IS_74HC15x(dev)) { \
  29. setPortBitInputHigh_atomic(port, bit); \
  30. }
  31. } while(0)
  32. #else
  33. # define setMatrixInputHigh(dev, port, bit) \
  34. do { \
  35. if ((dev) == MCU_GPIO || IS_74HC15x(dev)) { \
  36. setPortBitInputHigh(port, bit); \
  37. } \
  38. } while(0)
  39. #endif
  40. LOCAL_FUNC ALWAYS_INLINE void select74HC15x(uint8_t devid);
  41. LOCAL_FUNC
  42. void select74HC15x(uint8_t devid) {
  43. writePin(sel_pins[0], devid&1);
  44. #if defined(MATRIX_EXTENSION_74HC153)
  45. writePin(sel_pins[1], devid&2);
  46. #endif
  47. }
  48. LOCAL_FUNC ALWAYS_INLINE port_width_t readPortMultiplexer(uint8_t devid, pin_t port);
  49. LOCAL_FUNC port_width_t readPortMultiplexer(uint8_t devid, pin_t port) {
  50. select74HC15x(devid);
  51. waitInputPinDelay();
  52. return readPort(port);
  53. }
  54. #define readMatrixPort(dev, port) \
  55. ((dev) == MCU_GPIO)? readPort(port): (IS_74HC15x(dev))? readPortMultiplexer((dev)-MCU_GPIOa, port):0
  56. #define INIT_74HC15X(x) setPinOutput(x); writePinLow(x);
  57. LOCAL_FUNC
  58. void init_74hc15x(void) {
  59. MAP(INIT_74HC15X, MATRIX_EXT_74HC15x)
  60. }
  61. #define init_extension() init_74hc15x()