aboutsummaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorJames Young <xxiinophobia@yahoo.com>2020-02-26 22:53:47 -0800
committerskullydazed <skullydazed@users.noreply.github.com>2020-03-05 16:00:10 -0800
commita95a314f78fd96aca7cc496b10bd310e28b1b66e (patch)
tree39a79f0d4b99ad5a36f18635ba1a7e7a2a0d0411 /docs
parentbc31ebd0c479f8eb74dca8c22a09accbcc6fb02e (diff)
downloadqmk_firmware-a95a314f78fd96aca7cc496b10bd310e28b1b66e.tar.gz
qmk_firmware-a95a314f78fd96aca7cc496b10bd310e28b1b66e.zip
refactor How a Matrix Works doc
Diffstat (limited to 'docs')
-rw-r--r--docs/how_a_matrix_works.md18
1 files changed, 5 insertions, 13 deletions
diff --git a/docs/how_a_matrix_works.md b/docs/how_a_matrix_works.md
index bc31bb877..df7d164cb 100644
--- a/docs/how_a_matrix_works.md
+++ b/docs/how_a_matrix_works.md
@@ -1,16 +1,10 @@
1## Preamble: How a Keyboard Matrix Works (and why we need diodes) 1# How a Keyboard Matrix Works
2 2
3The collapsible section below covers why keyboards are wired the way they are, as outlined in this guide. It isn't required reading to make your own hand wired keyboard, but provides background information. 3Keyboard switch matrices are arranged in rows and columns. Without a matrix circuit, each switch would require its own wire directly to the controller.
4 4
5<details> 5When the circuit is arranged in rows and columns, if a key is pressed, a column wire makes contact with a row wire and completes a circuit. The keyboard controller detects this closed circuit and registers it as a key press.
6 6
7<summary>Click for details</summary> 7The microcontroller will be set up via the firmware to send a logical 1 to the columns, one at a time, and read from the rows, all at once - this process is called matrix scanning. The matrix is a bunch of open switches that, by default, don't allow any current to pass through - the firmware will read this as no keys being pressed. As soon as you press one key down, the logical 1 that was coming from the column the keyswitch is attached to gets passed through the switch and to the corresponding row - check out the following 2x2 example:
8
9Without a matrix circuit each switch would require its own wire directly to the controller.
10
11Simply put, when the circuit is arranged in rows and columns, if a key is pressed, a column wire makes contact with a row wire and completes a circuit. The keyboard controller detects this closed circuit and registers it as a key press.
12
13The microcontroller will be setup up via the firmware to send a logical 1 to the columns, one at a time, and read from the rows, all at once - this process is called matrix scanning. The matrix is a bunch of open switches that, by default, don't allow any current to pass through - the firmware will read this as no keys being pressed. As soon as you press one key down, the logical 1 that was coming from the column the keyswitch is attached to gets passed through the switch and to the corresponding row - check out the following 2x2 example:
14 8
15 Column 0 being scanned Column 1 being scanned 9 Column 0 being scanned Column 1 being scanned
16 x x 10 x x
@@ -32,7 +26,7 @@ When we press `key0`, `col0` gets connected to `row0`, so the values that the fi
32 | | | | 26 | | | |
33 row1 ---(key2)---(key3) row1 ---(key2)---(key3) 27 row1 ---(key2)---(key3) row1 ---(key2)---(key3)
34 28
35We can now see that `row0` has an `x`, so has the value of 1. As a whole, the data the firmware receives when `key0` is pressed is 29We can now see that `row0` has an `x`, so has the value of 1. As a whole, the data the firmware receives when `key0` is pressed is:
36 30
37 col0: 0b01 31 col0: 0b01
38 col1: 0b00 32 col1: 0b00
@@ -103,5 +97,3 @@ Further reading:
103- [Keyboard Matrix Help by Dave Dribin (2000)](https://www.dribin.org/dave/keyboard/one_html/) 97- [Keyboard Matrix Help by Dave Dribin (2000)](https://www.dribin.org/dave/keyboard/one_html/)
104- [How Key Matrices Works by PCBheaven](http://pcbheaven.com/wikipages/How_Key_Matrices_Works/) (animated examples) 98- [How Key Matrices Works by PCBheaven](http://pcbheaven.com/wikipages/How_Key_Matrices_Works/) (animated examples)
105- [How keyboards work - QMK documentation](how_keyboards_work.md) 99- [How keyboards work - QMK documentation](how_keyboards_work.md)
106
107</details>