Merge remote-tracking branch 'origin/develop' into xap

This commit is contained in:
QMK Bot 2023-09-25 02:55:31 +00:00
commit fe6eb752a7
4 changed files with 377 additions and 18 deletions

View File

@ -49,6 +49,11 @@ Configuration-wise, you'll need to set up the peripheral as per your MCU's datas
As per the AVR configuration, you may choose any other standard GPIO as a slave select pin, which should be supplied to `spi_start()`. As per the AVR configuration, you may choose any other standard GPIO as a slave select pin, which should be supplied to `spi_start()`.
If a complete SPI interface is not required, then the following can be done to disable certain SPI pins, so they don't occupy a GPIO unnecessarily:
- in `config.h`: `#define SPI_MISO_PIN NO_PIN`
- in `config.h`: `#define SPI_MOSI_PIN NO_PIN`
- in `mcuconf.h`: `#define SPI_SELECT_MODE SPI_SELECT_MODE_NONE`, in this case the `slavePin` argument passed to `spi_start()` may be `NO_PIN` if the slave select pin is not used.
## API :id=api ## API :id=api
### `void spi_init(void)` :id=api-spi-init ### `void spi_init(void)` :id=api-spi-init

View File

@ -25,7 +25,16 @@
"pid": "0x6071", "pid": "0x6071",
"vid": "0x4B42" "vid": "0x4B42"
}, },
"community_layouts": ["60_ansi", "60_hhkb", "60_iso", "60_ansi_tsangan", "60_tsangan_hhkb"], "community_layouts": [
"60_ansi",
"60_ansi_split_bs_rshift",
"60_ansi_tsangan",
"60_hhkb",
"60_iso",
"60_iso_split_bs_rshift",
"60_iso_tsangan",
"60_tsangan_hhkb"
],
"layouts": { "layouts": {
"LAYOUT_60_ansi": { "LAYOUT_60_ansi": {
"layout": [ "layout": [
@ -96,6 +105,77 @@
{ "label": "Ctrl", "matrix": [4, 13], "x": 13.75, "y": 4, "w": 1.25 } { "label": "Ctrl", "matrix": [4, 13], "x": 13.75, "y": 4, "w": 1.25 }
] ]
}, },
"LAYOUT_60_ansi_split_bs_rshift": {
"layout": [
{"label": "~", "matrix": [0, 0], "x": 0, "y": 0},
{"label": "!", "matrix": [0, 1], "x": 1, "y": 0},
{"label": "@", "matrix": [0, 2], "x": 2, "y": 0},
{"label": "#", "matrix": [0, 3], "x": 3, "y": 0},
{"label": "$", "matrix": [0, 4], "x": 4, "y": 0},
{"label": "%", "matrix": [0, 5], "x": 5, "y": 0},
{"label": "^", "matrix": [0, 6], "x": 6, "y": 0},
{"label": "&", "matrix": [0, 7], "x": 7, "y": 0},
{"label": "*", "matrix": [0, 8], "x": 8, "y": 0},
{"label": "(", "matrix": [0, 9], "x": 9, "y": 0},
{"label": ")", "matrix": [0, 10], "x": 10, "y": 0},
{"label": "_", "matrix": [0, 11], "x": 11, "y": 0},
{"label": "+", "matrix": [0, 12], "x": 12, "y": 0},
{"label": "Del", "matrix": [0, 13], "x": 13, "y": 0},
{"label": "Backspace", "matrix": [2, 12], "x": 14, "y": 0},
{"label": "Tab", "matrix": [1, 0], "x": 0, "y": 1, "w": 1.5},
{"label": "Q", "matrix": [1, 1], "x": 1.5, "y": 1},
{"label": "W", "matrix": [1, 2], "x": 2.5, "y": 1},
{"label": "E", "matrix": [1, 3], "x": 3.5, "y": 1},
{"label": "R", "matrix": [1, 4], "x": 4.5, "y": 1},
{"label": "T", "matrix": [1, 5], "x": 5.5, "y": 1},
{"label": "Y", "matrix": [1, 6], "x": 6.5, "y": 1},
{"label": "U", "matrix": [1, 7], "x": 7.5, "y": 1},
{"label": "I", "matrix": [1, 8], "x": 8.5, "y": 1},
{"label": "O", "matrix": [1, 9], "x": 9.5, "y": 1},
{"label": "P", "matrix": [1, 10], "x": 10.5, "y": 1},
{"label": "{", "matrix": [1, 11], "x": 11.5, "y": 1},
{"label": "}", "matrix": [1, 12], "x": 12.5, "y": 1},
{"label": "|", "matrix": [1, 13], "x": 13.5, "y": 1, "w": 1.5},
{"label": "Caps Lock", "matrix": [2, 0], "x": 0, "y": 2, "w": 1.75},
{"label": "A", "matrix": [2, 1], "x": 1.75, "y": 2},
{"label": "S", "matrix": [2, 2], "x": 2.75, "y": 2},
{"label": "D", "matrix": [2, 3], "x": 3.75, "y": 2},
{"label": "F", "matrix": [2, 4], "x": 4.75, "y": 2},
{"label": "G", "matrix": [2, 5], "x": 5.75, "y": 2},
{"label": "H", "matrix": [2, 6], "x": 6.75, "y": 2},
{"label": "J", "matrix": [2, 7], "x": 7.75, "y": 2},
{"label": "K", "matrix": [2, 8], "x": 8.75, "y": 2},
{"label": "L", "matrix": [2, 9], "x": 9.75, "y": 2},
{"label": ":", "matrix": [2, 10], "x": 10.75, "y": 2},
{"label": "\"", "matrix": [2, 11], "x": 11.75, "y": 2},
{"label": "Enter", "matrix": [2, 13], "x": 12.75, "y": 2, "w": 2.25},
{"label": "Shift", "matrix": [3, 0], "x": 0, "y": 3, "w": 2.25},
{"label": "Z", "matrix": [3, 2], "x": 2.25, "y": 3},
{"label": "X", "matrix": [3, 3], "x": 3.25, "y": 3},
{"label": "C", "matrix": [3, 4], "x": 4.25, "y": 3},
{"label": "V", "matrix": [3, 5], "x": 5.25, "y": 3},
{"label": "B", "matrix": [3, 6], "x": 6.25, "y": 3},
{"label": "N", "matrix": [3, 7], "x": 7.25, "y": 3},
{"label": "M", "matrix": [3, 8], "x": 8.25, "y": 3},
{"label": "<", "matrix": [3, 9], "x": 9.25, "y": 3},
{"label": ">", "matrix": [3, 10], "x": 10.25, "y": 3},
{"label": "?", "matrix": [3, 11], "x": 11.25, "y": 3},
{"label": "Shift", "matrix": [3, 12], "x": 12.25, "y": 3, "w": 1.75},
{"label": "Fn", "matrix": [3, 13], "x": 14, "y": 3},
{"label": "Ctrl", "matrix": [4, 0], "x": 0, "y": 4, "w": 1.25},
{"label": "Win", "matrix": [4, 1], "x": 1.25, "y": 4, "w": 1.25},
{"label": "Alt", "matrix": [4, 2], "x": 2.5, "y": 4, "w": 1.25},
{"label": "K47", "matrix": [4, 7], "x": 3.75, "y": 4, "w": 6.25},
{"label": "Alt", "matrix": [4, 10], "x": 10, "y": 4, "w": 1.25},
{"label": "Win", "matrix": [4, 11], "x": 11.25, "y": 4, "w": 1.25},
{"label": "Menu", "matrix": [4, 12], "x": 12.5, "y": 4, "w": 1.25},
{"label": "Ctrl", "matrix": [4, 13], "x": 13.75, "y": 4, "w": 1.25}
]
},
"LAYOUT_60_hhkb": { "LAYOUT_60_hhkb": {
"layout": [ "layout": [
{ "label": "~", "matrix": [0, 0], "x": 0, "y": 0 }, { "label": "~", "matrix": [0, 0], "x": 0, "y": 0 },
@ -371,6 +451,218 @@
{ "label": "Ctrl", "matrix": [4, 13], "x": 13.5, "y": 4, "w": 1.5 } { "label": "Ctrl", "matrix": [4, 13], "x": 13.5, "y": 4, "w": 1.5 }
] ]
}, },
"LAYOUT_60_iso_split_bs_rshift": {
"layout": [
{"label": "~", "matrix": [0, 0], "x": 0, "y": 0},
{"label": "!", "matrix": [0, 1], "x": 1, "y": 0},
{"label": "@", "matrix": [0, 2], "x": 2, "y": 0},
{"label": "#", "matrix": [0, 3], "x": 3, "y": 0},
{"label": "$", "matrix": [0, 4], "x": 4, "y": 0},
{"label": "%", "matrix": [0, 5], "x": 5, "y": 0},
{"label": "^", "matrix": [0, 6], "x": 6, "y": 0},
{"label": "&", "matrix": [0, 7], "x": 7, "y": 0},
{"label": "*", "matrix": [0, 8], "x": 8, "y": 0},
{"label": "(", "matrix": [0, 9], "x": 9, "y": 0},
{"label": ")", "matrix": [0, 10], "x": 10, "y": 0},
{"label": "_", "matrix": [0, 11], "x": 11, "y": 0},
{"label": "+", "matrix": [0, 12], "x": 12, "y": 0},
{"label": "Del", "matrix": [0, 13], "x": 13, "y": 0},
{"label": "Backspace", "matrix": [2, 12], "x": 14, "y": 0},
{"label": "Tab", "matrix": [1, 0], "x": 0, "y": 1, "w": 1.5},
{"label": "Q", "matrix": [1, 1], "x": 1.5, "y": 1},
{"label": "W", "matrix": [1, 2], "x": 2.5, "y": 1},
{"label": "E", "matrix": [1, 3], "x": 3.5, "y": 1},
{"label": "R", "matrix": [1, 4], "x": 4.5, "y": 1},
{"label": "T", "matrix": [1, 5], "x": 5.5, "y": 1},
{"label": "Y", "matrix": [1, 6], "x": 6.5, "y": 1},
{"label": "U", "matrix": [1, 7], "x": 7.5, "y": 1},
{"label": "I", "matrix": [1, 8], "x": 8.5, "y": 1},
{"label": "O", "matrix": [1, 9], "x": 9.5, "y": 1},
{"label": "P", "matrix": [1, 10], "x": 10.5, "y": 1},
{"label": "{", "matrix": [1, 11], "x": 11.5, "y": 1},
{"label": "}", "matrix": [1, 12], "x": 12.5, "y": 1},
{"label": "Caps Lock", "matrix": [2, 0], "x": 0, "y": 2, "w": 1.75},
{"label": "A", "matrix": [2, 1], "x": 1.75, "y": 2},
{"label": "S", "matrix": [2, 2], "x": 2.75, "y": 2},
{"label": "D", "matrix": [2, 3], "x": 3.75, "y": 2},
{"label": "F", "matrix": [2, 4], "x": 4.75, "y": 2},
{"label": "G", "matrix": [2, 5], "x": 5.75, "y": 2},
{"label": "H", "matrix": [2, 6], "x": 6.75, "y": 2},
{"label": "J", "matrix": [2, 7], "x": 7.75, "y": 2},
{"label": "K", "matrix": [2, 8], "x": 8.75, "y": 2},
{"label": "L", "matrix": [2, 9], "x": 9.75, "y": 2},
{"label": ":", "matrix": [2, 10], "x": 10.75, "y": 2},
{"label": "@", "matrix": [2, 11], "x": 11.75, "y": 2},
{"label": "~", "matrix": [1, 13], "x": 12.75, "y": 2},
{"label": "Enter", "matrix": [2, 13], "x": 13.75, "y": 1, "w": 1.25, "h": 2},
{"label": "Shift", "matrix": [3, 0], "x": 0, "y": 3, "w": 1.25},
{"label": "|", "matrix": [3, 1], "x": 1.25, "y": 3},
{"label": "Z", "matrix": [3, 2], "x": 2.25, "y": 3},
{"label": "X", "matrix": [3, 3], "x": 3.25, "y": 3},
{"label": "C", "matrix": [3, 4], "x": 4.25, "y": 3},
{"label": "V", "matrix": [3, 5], "x": 5.25, "y": 3},
{"label": "B", "matrix": [3, 6], "x": 6.25, "y": 3},
{"label": "N", "matrix": [3, 7], "x": 7.25, "y": 3},
{"label": "M", "matrix": [3, 8], "x": 8.25, "y": 3},
{"label": "<", "matrix": [3, 9], "x": 9.25, "y": 3},
{"label": ">", "matrix": [3, 10], "x": 10.25, "y": 3},
{"label": "?", "matrix": [3, 11], "x": 11.25, "y": 3},
{"label": "Shift", "matrix": [3, 12], "x": 12.25, "y": 3, "w": 1.75},
{"label": "Fn", "matrix": [3, 13], "x": 14, "y": 3},
{"label": "Ctrl", "matrix": [4, 0], "x": 0, "y": 4, "w": 1.25},
{"label": "Win", "matrix": [4, 1], "x": 1.25, "y": 4, "w": 1.25},
{"label": "Alt", "matrix": [4, 2], "x": 2.5, "y": 4, "w": 1.25},
{"label": "K47", "matrix": [4, 7], "x": 3.75, "y": 4, "w": 6.25},
{"label": "AltGr", "matrix": [4, 10], "x": 10, "y": 4, "w": 1.25},
{"label": "Win", "matrix": [4, 11], "x": 11.25, "y": 4, "w": 1.25},
{"label": "Menu", "matrix": [4, 12], "x": 12.5, "y": 4, "w": 1.25},
{"label": "Ctrl", "matrix": [4, 13], "x": 13.75, "y": 4, "w": 1.25}
]
},
"LAYOUT_60_iso_tsangan": {
"layout": [
{"label": "~", "matrix": [0, 0], "x": 0, "y": 0},
{"label": "!", "matrix": [0, 1], "x": 1, "y": 0},
{"label": "@", "matrix": [0, 2], "x": 2, "y": 0},
{"label": "#", "matrix": [0, 3], "x": 3, "y": 0},
{"label": "$", "matrix": [0, 4], "x": 4, "y": 0},
{"label": "%", "matrix": [0, 5], "x": 5, "y": 0},
{"label": "^", "matrix": [0, 6], "x": 6, "y": 0},
{"label": "&", "matrix": [0, 7], "x": 7, "y": 0},
{"label": "*", "matrix": [0, 8], "x": 8, "y": 0},
{"label": "(", "matrix": [0, 9], "x": 9, "y": 0},
{"label": ")", "matrix": [0, 10], "x": 10, "y": 0},
{"label": "_", "matrix": [0, 11], "x": 11, "y": 0},
{"label": "+", "matrix": [0, 12], "x": 12, "y": 0},
{"label": "Backspace", "matrix": [0, 13], "x": 13, "y": 0, "w": 2},
{"label": "Tab", "matrix": [1, 0], "x": 0, "y": 1, "w": 1.5},
{"label": "Q", "matrix": [1, 1], "x": 1.5, "y": 1},
{"label": "W", "matrix": [1, 2], "x": 2.5, "y": 1},
{"label": "E", "matrix": [1, 3], "x": 3.5, "y": 1},
{"label": "R", "matrix": [1, 4], "x": 4.5, "y": 1},
{"label": "T", "matrix": [1, 5], "x": 5.5, "y": 1},
{"label": "Y", "matrix": [1, 6], "x": 6.5, "y": 1},
{"label": "U", "matrix": [1, 7], "x": 7.5, "y": 1},
{"label": "I", "matrix": [1, 8], "x": 8.5, "y": 1},
{"label": "O", "matrix": [1, 9], "x": 9.5, "y": 1},
{"label": "P", "matrix": [1, 10], "x": 10.5, "y": 1},
{"label": "{", "matrix": [1, 11], "x": 11.5, "y": 1},
{"label": "}", "matrix": [1, 12], "x": 12.5, "y": 1},
{"label": "Caps Lock", "matrix": [2, 0], "x": 0, "y": 2, "w": 1.75},
{"label": "A", "matrix": [2, 1], "x": 1.75, "y": 2},
{"label": "S", "matrix": [2, 2], "x": 2.75, "y": 2},
{"label": "D", "matrix": [2, 3], "x": 3.75, "y": 2},
{"label": "F", "matrix": [2, 4], "x": 4.75, "y": 2},
{"label": "G", "matrix": [2, 5], "x": 5.75, "y": 2},
{"label": "H", "matrix": [2, 6], "x": 6.75, "y": 2},
{"label": "J", "matrix": [2, 7], "x": 7.75, "y": 2},
{"label": "K", "matrix": [2, 8], "x": 8.75, "y": 2},
{"label": "L", "matrix": [2, 9], "x": 9.75, "y": 2},
{"label": ":", "matrix": [2, 10], "x": 10.75, "y": 2},
{"label": "@", "matrix": [2, 11], "x": 11.75, "y": 2},
{"label": "~", "matrix": [1, 13], "x": 12.75, "y": 2},
{"label": "Enter", "matrix": [2, 13], "x": 13.75, "y": 1, "w": 1.25, "h": 2},
{"label": "Shift", "matrix": [3, 0], "x": 0, "y": 3, "w": 1.25},
{"label": "|", "matrix": [3, 1], "x": 1.25, "y": 3},
{"label": "Z", "matrix": [3, 2], "x": 2.25, "y": 3},
{"label": "X", "matrix": [3, 3], "x": 3.25, "y": 3},
{"label": "C", "matrix": [3, 4], "x": 4.25, "y": 3},
{"label": "V", "matrix": [3, 5], "x": 5.25, "y": 3},
{"label": "B", "matrix": [3, 6], "x": 6.25, "y": 3},
{"label": "N", "matrix": [3, 7], "x": 7.25, "y": 3},
{"label": "M", "matrix": [3, 8], "x": 8.25, "y": 3},
{"label": "<", "matrix": [3, 9], "x": 9.25, "y": 3},
{"label": ">", "matrix": [3, 10], "x": 10.25, "y": 3},
{"label": "?", "matrix": [3, 11], "x": 11.25, "y": 3},
{"label": "Shift", "matrix": [3, 12], "x": 12.25, "y": 3, "w": 2.75},
{"label": "Ctrl", "matrix": [4, 0], "x": 0, "y": 4, "w": 1.5},
{"label": "Win", "matrix": [4, 1], "x": 1.5, "y": 4},
{"label": "Alt", "matrix": [4, 2], "x": 2.5, "y": 4, "w": 1.5},
{"label": "K47", "matrix": [4, 7], "x": 4, "y": 4, "w": 7},
{"label": "Alt", "matrix": [4, 11], "x": 11, "y": 4, "w": 1.5},
{"label": "Win", "matrix": [4, 12], "x": 12.5, "y": 4},
{"label": "Ctrl", "matrix": [4, 13], "x": 13.5, "y": 4, "w": 1.5}
]
},
"LAYOUT_60_iso_tsangan_split_bs_rshift": {
"layout": [
{"label": "~", "matrix": [0, 0], "x": 0, "y": 0},
{"label": "!", "matrix": [0, 1], "x": 1, "y": 0},
{"label": "@", "matrix": [0, 2], "x": 2, "y": 0},
{"label": "#", "matrix": [0, 3], "x": 3, "y": 0},
{"label": "$", "matrix": [0, 4], "x": 4, "y": 0},
{"label": "%", "matrix": [0, 5], "x": 5, "y": 0},
{"label": "^", "matrix": [0, 6], "x": 6, "y": 0},
{"label": "&", "matrix": [0, 7], "x": 7, "y": 0},
{"label": "*", "matrix": [0, 8], "x": 8, "y": 0},
{"label": "(", "matrix": [0, 9], "x": 9, "y": 0},
{"label": ")", "matrix": [0, 10], "x": 10, "y": 0},
{"label": "_", "matrix": [0, 11], "x": 11, "y": 0},
{"label": "+", "matrix": [0, 12], "x": 12, "y": 0},
{"label": "Del", "matrix": [0, 13], "x": 13, "y": 0},
{"label": "Backspace", "matrix": [2, 12], "x": 14, "y": 0},
{"label": "Tab", "matrix": [1, 0], "x": 0, "y": 1, "w": 1.5},
{"label": "Q", "matrix": [1, 1], "x": 1.5, "y": 1},
{"label": "W", "matrix": [1, 2], "x": 2.5, "y": 1},
{"label": "E", "matrix": [1, 3], "x": 3.5, "y": 1},
{"label": "R", "matrix": [1, 4], "x": 4.5, "y": 1},
{"label": "T", "matrix": [1, 5], "x": 5.5, "y": 1},
{"label": "Y", "matrix": [1, 6], "x": 6.5, "y": 1},
{"label": "U", "matrix": [1, 7], "x": 7.5, "y": 1},
{"label": "I", "matrix": [1, 8], "x": 8.5, "y": 1},
{"label": "O", "matrix": [1, 9], "x": 9.5, "y": 1},
{"label": "P", "matrix": [1, 10], "x": 10.5, "y": 1},
{"label": "{", "matrix": [1, 11], "x": 11.5, "y": 1},
{"label": "}", "matrix": [1, 12], "x": 12.5, "y": 1},
{"label": "Caps Lock", "matrix": [2, 0], "x": 0, "y": 2, "w": 1.75},
{"label": "A", "matrix": [2, 1], "x": 1.75, "y": 2},
{"label": "S", "matrix": [2, 2], "x": 2.75, "y": 2},
{"label": "D", "matrix": [2, 3], "x": 3.75, "y": 2},
{"label": "F", "matrix": [2, 4], "x": 4.75, "y": 2},
{"label": "G", "matrix": [2, 5], "x": 5.75, "y": 2},
{"label": "H", "matrix": [2, 6], "x": 6.75, "y": 2},
{"label": "J", "matrix": [2, 7], "x": 7.75, "y": 2},
{"label": "K", "matrix": [2, 8], "x": 8.75, "y": 2},
{"label": "L", "matrix": [2, 9], "x": 9.75, "y": 2},
{"label": ":", "matrix": [2, 10], "x": 10.75, "y": 2},
{"label": "@", "matrix": [2, 11], "x": 11.75, "y": 2},
{"label": "~", "matrix": [1, 13], "x": 12.75, "y": 2},
{"label": "Enter", "matrix": [2, 13], "x": 13.75, "y": 1, "w": 1.25, "h": 2},
{"label": "Shift", "matrix": [3, 0], "x": 0, "y": 3, "w": 1.25},
{"label": "|", "matrix": [3, 1], "x": 1.25, "y": 3},
{"label": "Z", "matrix": [3, 2], "x": 2.25, "y": 3},
{"label": "X", "matrix": [3, 3], "x": 3.25, "y": 3},
{"label": "C", "matrix": [3, 4], "x": 4.25, "y": 3},
{"label": "V", "matrix": [3, 5], "x": 5.25, "y": 3},
{"label": "B", "matrix": [3, 6], "x": 6.25, "y": 3},
{"label": "N", "matrix": [3, 7], "x": 7.25, "y": 3},
{"label": "M", "matrix": [3, 8], "x": 8.25, "y": 3},
{"label": "<", "matrix": [3, 9], "x": 9.25, "y": 3},
{"label": ">", "matrix": [3, 10], "x": 10.25, "y": 3},
{"label": "?", "matrix": [3, 11], "x": 11.25, "y": 3},
{"label": "Shift", "matrix": [3, 12], "x": 12.25, "y": 3, "w": 1.75},
{"label": "Fn", "matrix": [3, 13], "x": 14, "y": 3},
{"label": "Ctrl", "matrix": [4, 0], "x": 0, "y": 4, "w": 1.5},
{"label": "Win", "matrix": [4, 1], "x": 1.5, "y": 4},
{"label": "Alt", "matrix": [4, 2], "x": 2.5, "y": 4, "w": 1.5},
{"label": "K47", "matrix": [4, 7], "x": 4, "y": 4, "w": 7},
{"label": "Alt", "matrix": [4, 11], "x": 11, "y": 4, "w": 1.5},
{"label": "Win", "matrix": [4, 12], "x": 12.5, "y": 4},
{"label": "Ctrl", "matrix": [4, 13], "x": 13.5, "y": 4, "w": 1.5}
]
},
"LAYOUT_all": { "LAYOUT_all": {
"layout": [ "layout": [
{ "label": "~", "matrix": [0, 0], "x": 0, "y": 0 }, { "label": "~", "matrix": [0, 0], "x": 0, "y": 0 },

View File

@ -0,0 +1,24 @@
# Matrix Diagram for Dztech Tofu60
```
┌───────┐
2u Backspace │0D │
└───────┘
┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┐
│00 │01 │02 │03 │04 │05 │06 │07 │08 │09 │0A │0B │0C │0D │2C │
├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┤ ┌─────┐
│10 │11 │12 │13 │14 │15 │16 │17 │18 │19 │1A │1B │1C │1D │ │ │
├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┤ ┌──┴┐2D │ ISO Enter
│20 │21 │22 │23 │24 │25 │26 │27 │28 │29 │2A │2B │2D │ │1D │ │
├────┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────┬───┤ └───┴────┘
│30 │31 │32 │33 │34 │35 │36 │37 │38 │39 │3A │3B │3C │3D │
├────┼───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬┴───┤
│40 │41 │42 │47 │4A │4B │4C │4D │
└────┴────┴────┴────────────────────────┴────┴────┴────┴────┘
┌────────┐ ┌──────────┐
│31 │ 2.25u LShift 2.75u RShift │3C │
└────────┘ └──────────┘
┌─────┬───┬─────┬───────────────────────────┬─────┬───┬─────┐
│40 │41 │42 │47 │4B │4C │4D │ Tsangan/WKL/HHKB
└─────┴───┴─────┴───────────────────────────┴─────┴───┴─────┘
```

View File

@ -18,14 +18,14 @@
#include "timer.h" #include "timer.h"
static pin_t currentSlavePin = NO_PIN; static bool spiStarted = false;
#if defined(K20x) || defined(KL2x) || defined(RP2040) #if SPI_SELECT_MODE == SPI_SELECT_MODE_NONE
static SPIConfig spiConfig = {NULL, 0, 0, 0}; static pin_t currentSlavePin;
#else
static SPIConfig spiConfig = {false, NULL, 0, 0, 0, 0};
#endif #endif
static SPIConfig spiConfig;
__attribute__((weak)) void spi_init(void) { __attribute__((weak)) void spi_init(void) {
static bool is_initialised = false; static bool is_initialised = false;
if (!is_initialised) { if (!is_initialised) {
@ -33,28 +33,45 @@ __attribute__((weak)) void spi_init(void) {
// Try releasing special pins for a short time // Try releasing special pins for a short time
setPinInput(SPI_SCK_PIN); setPinInput(SPI_SCK_PIN);
setPinInput(SPI_MOSI_PIN); if (SPI_MOSI_PIN != NO_PIN) {
setPinInput(SPI_MISO_PIN); setPinInput(SPI_MOSI_PIN);
}
if (SPI_MISO_PIN != NO_PIN) {
setPinInput(SPI_MISO_PIN);
}
chThdSleepMilliseconds(10); chThdSleepMilliseconds(10);
#if defined(USE_GPIOV1) #if defined(USE_GPIOV1)
palSetPadMode(PAL_PORT(SPI_SCK_PIN), PAL_PAD(SPI_SCK_PIN), SPI_SCK_PAL_MODE); palSetPadMode(PAL_PORT(SPI_SCK_PIN), PAL_PAD(SPI_SCK_PIN), SPI_SCK_PAL_MODE);
palSetPadMode(PAL_PORT(SPI_MOSI_PIN), PAL_PAD(SPI_MOSI_PIN), SPI_MOSI_PAL_MODE); if (SPI_MOSI_PIN != NO_PIN) {
palSetPadMode(PAL_PORT(SPI_MISO_PIN), PAL_PAD(SPI_MISO_PIN), SPI_MISO_PAL_MODE); palSetPadMode(PAL_PORT(SPI_MOSI_PIN), PAL_PAD(SPI_MOSI_PIN), SPI_MOSI_PAL_MODE);
}
if (SPI_MISO_PIN != NO_PIN) {
palSetPadMode(PAL_PORT(SPI_MISO_PIN), PAL_PAD(SPI_MISO_PIN), SPI_MISO_PAL_MODE);
}
#else #else
palSetPadMode(PAL_PORT(SPI_SCK_PIN), PAL_PAD(SPI_SCK_PIN), SPI_SCK_FLAGS); palSetPadMode(PAL_PORT(SPI_SCK_PIN), PAL_PAD(SPI_SCK_PIN), SPI_SCK_FLAGS);
palSetPadMode(PAL_PORT(SPI_MOSI_PIN), PAL_PAD(SPI_MOSI_PIN), SPI_MOSI_FLAGS); if (SPI_MOSI_PIN != NO_PIN) {
palSetPadMode(PAL_PORT(SPI_MISO_PIN), PAL_PAD(SPI_MISO_PIN), SPI_MISO_FLAGS); palSetPadMode(PAL_PORT(SPI_MOSI_PIN), PAL_PAD(SPI_MOSI_PIN), SPI_MOSI_FLAGS);
}
if (SPI_MISO_PIN != NO_PIN) {
palSetPadMode(PAL_PORT(SPI_MISO_PIN), PAL_PAD(SPI_MISO_PIN), SPI_MISO_FLAGS);
}
#endif #endif
spiStop(&SPI_DRIVER); spiStop(&SPI_DRIVER);
currentSlavePin = NO_PIN; spiStarted = false;
} }
} }
bool spi_start(pin_t slavePin, bool lsbFirst, uint8_t mode, uint16_t divisor) { bool spi_start(pin_t slavePin, bool lsbFirst, uint8_t mode, uint16_t divisor) {
if (currentSlavePin != NO_PIN || slavePin == NO_PIN) { if (spiStarted) {
return false; return false;
} }
#if SPI_SELECT_MODE != SPI_SELECT_MODE_NONE
if (slavePin == NO_PIN) {
return false;
}
#endif
#if !(defined(WB32F3G71xx) || defined(WB32FQ95xx)) #if !(defined(WB32F3G71xx) || defined(WB32FQ95xx))
uint16_t roundedDivisor = 2; uint16_t roundedDivisor = 2;
@ -247,13 +264,29 @@ bool spi_start(pin_t slavePin, bool lsbFirst, uint8_t mode, uint16_t divisor) {
} }
#endif #endif
currentSlavePin = slavePin; spiStarted = true;
#if SPI_SELECT_MODE == SPI_SELECT_MODE_NONE
currentSlavePin = slavePin;
#endif
#if SPI_SELECT_MODE == SPI_SELECT_MODE_PAD
spiConfig.ssport = PAL_PORT(slavePin); spiConfig.ssport = PAL_PORT(slavePin);
spiConfig.sspad = PAL_PAD(slavePin); spiConfig.sspad = PAL_PAD(slavePin);
setPinOutput(slavePin); setPinOutput(slavePin);
#elif SPI_SELECT_MODE == SPI_SELECT_MODE_NONE
if (slavePin != NO_PIN) {
setPinOutput(slavePin);
}
#else
# error "Unsupported SPI_SELECT_MODE"
#endif
spiStart(&SPI_DRIVER, &spiConfig); spiStart(&SPI_DRIVER, &spiConfig);
spiSelect(&SPI_DRIVER); spiSelect(&SPI_DRIVER);
#if SPI_SELECT_MODE == SPI_SELECT_MODE_NONE
if (slavePin != NO_PIN) {
writePinLow(slavePin);
}
#endif
return true; return true;
} }
@ -283,9 +316,14 @@ spi_status_t spi_receive(uint8_t *data, uint16_t length) {
} }
void spi_stop(void) { void spi_stop(void) {
if (currentSlavePin != NO_PIN) { if (spiStarted) {
#if SPI_SELECT_MODE == SPI_SELECT_MODE_NONE
if (currentSlavePin != NO_PIN) {
writePinHigh(currentSlavePin);
}
#endif
spiUnselect(&SPI_DRIVER); spiUnselect(&SPI_DRIVER);
spiStop(&SPI_DRIVER); spiStop(&SPI_DRIVER);
currentSlavePin = NO_PIN; spiStarted = false;
} }
} }