diff options
Diffstat (limited to 'keyboards/ymdk/sp64/sp64.h')
| -rw-r--r-- | keyboards/ymdk/sp64/sp64.h | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/keyboards/ymdk/sp64/sp64.h b/keyboards/ymdk/sp64/sp64.h new file mode 100644 index 000000000..63620f0c3 --- /dev/null +++ b/keyboards/ymdk/sp64/sp64.h | |||
| @@ -0,0 +1,84 @@ | |||
| 1 | /* Copyright 2019 Neil Kettle | ||
| 2 | * | ||
| 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 | * | ||
| 8 | * This program is distributed in the hope that it will be useful, | ||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | * GNU General Public License for more details. | ||
| 12 | * | ||
| 13 | * You should have received a copy of the GNU General Public License | ||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 15 | */ | ||
| 16 | |||
| 17 | #pragma once | ||
| 18 | |||
| 19 | #include "quantum.h" | ||
| 20 | |||
| 21 | #ifdef RIGHT_HALF | ||
| 22 | # include <stdint.h> | ||
| 23 | # include "i2c_master.h" | ||
| 24 | |||
| 25 | // I2C aliases and register addresses (see "mcp23018.md") | ||
| 26 | # define I2C_ADDR 0b0100000 | ||
| 27 | # define I2C_ADDR_WRITE ( (I2C_ADDR<<1) | I2C_WRITE ) | ||
| 28 | # define I2C_ADDR_READ ( (I2C_ADDR<<1) | I2C_READ ) | ||
| 29 | # define IODIRA 0x00 // i/o direction register | ||
| 30 | # define IODIRB 0x01 | ||
| 31 | # define GPPUA 0x0C // GPIO pull-up resistor register | ||
| 32 | # define GPPUB 0x0D | ||
| 33 | # define GPIOA 0x12 // general purpose i/o port register (write modifies OLAT) | ||
| 34 | # define GPIOB 0x13 | ||
| 35 | # define OLATA 0x14 // output latch register | ||
| 36 | # define OLATB 0x15 | ||
| 37 | |||
| 38 | extern i2c_status_t mcp23018_status; | ||
| 39 | # define MCP23018_I2C_TIMEOUT 100 | ||
| 40 | |||
| 41 | uint8_t init_mcp23018(void); | ||
| 42 | #endif | ||
| 43 | |||
| 44 | #define ___ KC_NO | ||
| 45 | #define XXX KC_NO | ||
| 46 | |||
| 47 | /* This is a shortcut to help you visually see your layout. | ||
| 48 | * | ||
| 49 | * The first section contains all of the arguments representing the physical | ||
| 50 | * layout of the board and position of the keys. | ||
| 51 | * | ||
| 52 | * The second converts the arguments into a two-dimensional array which | ||
| 53 | * represents the switch matrix. | ||
| 54 | * | ||
| 55 | * LEFT HAND RIGHT HAND | ||
| 56 | * ┌-----┬-----┬-----┬-----┬-----┬-----┬-----┐ ┌-----┬-----┬-----┬-----┬-----┬-----┬----------┐ | ||
| 57 | * │ L00 │ L01 │ L02 │ L03 │ L04 │ L05 │ L06 │ │ R07 │ R08 │ R09 │ R0A │ R0B │ R0C │ R0D │ | ||
| 58 | * ├-----┴--┬--┴--┬--┴--┬--┴--┬--┴--┬--┴--┬--┘ ┌--┴--┬--┴--┬--┴--┬--┴--┬--┴--┬--┴--┬--┴--┬-------┤ | ||
| 59 | * │ L10 │ L11 │ L12 │ L13 │ L14 │ L15 │ │ R16 │ R17 │ R18 │ R19 │ R1A │ R1B │ R1C │ R1D │ | ||
| 60 | * ├--------┴┬----┴┬----┴┬----┴┬----┴┬----┴┐ └┬----┴┬----┴┬----┴┬----┴┬----┴┬----┴┬----┴-------┤ | ||
| 61 | * │ L20 │ L21 │ L22 │ L23 │ L24 │ L25 │ │ R26 │ R27 │ R28 │ R29 │ R2A │ R2B │ R2C │ | ||
| 62 | * ├---------┴┬----┴┬----┴┬----┴┬----┴┬----┴┐ └┬----┴┬----┴┬----┴┬----┴┬----┴┬----┴┬-----┬-----┤ | ||
| 63 | * │ L30 │ L31 │ L32 │ L33 │ L34 │ L35 │ │ R36 │ R37 │ R38 │ R39 │ R3A │ R3B │ R3C │ R3D │ | ||
| 64 | * ├------┬---┴-┬---┴--┬--┴-----┴----┬┴----┬┘ ┌┴-----┴-----┴--┬--┴----┬┴-----┼-----┼-----┼-----┤ | ||
| 65 | * │ L40 │ L41 │ L42 │ L43 │ L45 │ │ R46 │ R48 │ R4A │ R4B │ R4C │ R4D │ | ||
| 66 | * └------┴-----┴------┴-------------┴-----┘ └---------------┴-------┴------┴-----┴-----┴-----┘ | ||
| 67 | */ | ||
| 68 | #define LAYOUT( \ | ||
| 69 | L00, L01, L02, L03, L04, L05, L06, R07, R08, R09, R0A, R0B, R0C, R0D, \ | ||
| 70 | L10, L11, L12, L13, L14, L15, R16, R17, R18, R19, R1A, R1B, R1C, R1D, \ | ||
| 71 | L20, L21, L22, L23, L24, L25, R26, R27, R28, R29, R2A, R2B, R2C, \ | ||
| 72 | L30, L31, L32, L33, L34, L35, R36, R37, R38, R39, R3A, R3B, R3C, R3D, \ | ||
| 73 | L40, L41, L42, L43, L45, R46, R48, R4A, R4B, R4C, R4D \ | ||
| 74 | ) \ | ||
| 75 | /* matrix positions */ \ | ||
| 76 | { \ | ||
| 77 | { ___, ___, ___, ___, ___, ___, ___, R46, R48, R4A, R4B, R4C, R4D, R3D }, \ | ||
| 78 | { L40, L41, L42, L43, L45, L06, ___, R36, R37, R38, R39, R3A, R3B, R3C }, \ | ||
| 79 | { L30, L31, L32, L33, L34, L35, ___, R26, R27, R28, R29, R2A, R2B, R2C }, \ | ||
| 80 | { L20, L21, L22, L23, L24, L25, ___, R17, R18, R19, R1A, R1B, R1C, R1D }, \ | ||
| 81 | { L10, L11, L12, L13, L14, L15, ___, R07, R08, R09, R0A, R0B, R0C, R0D }, \ | ||
| 82 | { L00, L01, L02, L03, L04, L05, ___, R16, ___, ___, ___, ___, ___, ___ } \ | ||
| 83 | } | ||
| 84 | |||
