Skip to content

Commit

Permalink
[Keyboard] Add support for Southpaw Extended 65% (qmk#8465)
Browse files Browse the repository at this point in the history
* Add support for Southpaw Extended 65%

* Update keyboards/switchplate/southpaw_65/readme.md

* Update keyboards/switchplate/southpaw_65/readme.md

* Update keyboards/switchplate/southpaw_65/readme.md

* Update keyboards/switchplate/southpaw_65/southpaw_65.c

* Update keyboards/switchplate/southpaw_65/rules.mk

* Cleaned up keymaps
-Removed default2 keymap
-Removed default_iso2 keymap
-Rename default keymap directory to default_ansi to reflect correct keymap name

* Update readme.md for default_ansi keymap directory change

* Add layout_all for configurator and correct maximum number of keys supported in readme.md

* Update keyboards/switchplate/southpaw_65/info.json

Forgot to change name to LAYOUT_all

* Update keyboards/switchplate/southpaw_65/info.json

* Update keyboards/switchplate/southpaw_65/readme.md

* Update keyboards/switchplate/southpaw_65/rules.mk

* Add LAYOUT_all keymap

* Update keyboards/switchplate/southpaw_65/keymaps/default/keymap.c

* Update keyboards/switchplate/southpaw_65/info.json
  • Loading branch information
horza21 authored and jakobaa committed Jul 7, 2020
1 parent 7548515 commit c3afc55
Show file tree
Hide file tree
Showing 11 changed files with 753 additions and 0 deletions.
239 changes: 239 additions & 0 deletions keyboards/switchplate/southpaw_65/config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,239 @@
/* Copyright 2019
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

#pragma once

#include "config_common.h"

/* USB Device descriptor parameter */
#define VENDOR_ID 0xFEED
#define PRODUCT_ID 0x4084
#define DEVICE_VER 0x0001
#define MANUFACTURER Switchplate Peripherals
#define PRODUCT Southpaw Extended 65%
#define DESCRIPTION A Left Hand Number Pad 65% Keyboard

/* key matrix size */
#define MATRIX_ROWS 5
#define MATRIX_COLS 19

/*
* Keyboard Matrix Assignments
*
* Change this to how you wired your keyboard
* COLS: AVR pins used for columns, left to right
* ROWS: AVR pins used for rows, top to bottom
* DIODE_DIRECTION: COL2ROW = COL = Anode (+), ROW = Cathode (-, marked on diode)
* ROW2COL = ROW = Anode (+), COL = Cathode (-, marked on diode)
*
*/
//#define MATRIX_ROW_PINS { D0, D5 }
//#define MATRIX_COL_PINS { F1, F0, B0 }
//#define UNUSED_PINS

/* COL2ROW, ROW2COL */
//#define DIODE_DIRECTION COL2ROW

#define BACKLIGHT_PIN B5
#define BACKLIGHT_LEVELS 10
// #define BACKLIGHT_BREATHING

#define RGB_DI_PIN C7
#define RGBLED_NUM 9
#define RGBLIGHT_ANIMATIONS
// #ifdef RGB_DI_PIN
// #define RGBLIGHT_HUE_STEP 8
// #define RGBLIGHT_SAT_STEP 8
// #define RGBLIGHT_VAL_STEP 8
// #define RGBLIGHT_LIMIT_VAL 255 /* The maximum brightness level */
// #define RGBLIGHT_SLEEP /* If defined, the RGB lighting will be switched off when the host goes to sleep */
// /*== all animations enable ==*/
// #define RGBLIGHT_ANIMATIONS
// /*== or choose animations ==*/
// #define RGBLIGHT_EFFECT_BREATHING
// #define RGBLIGHT_EFFECT_RAINBOW_MOOD
// #define RGBLIGHT_EFFECT_RAINBOW_SWIRL
// #define RGBLIGHT_EFFECT_SNAKE
// #define RGBLIGHT_EFFECT_KNIGHT
// #define RGBLIGHT_EFFECT_CHRISTMAS
// #define RGBLIGHT_EFFECT_STATIC_GRADIENT
// #define RGBLIGHT_EFFECT_RGB_TEST
// #define RGBLIGHT_EFFECT_ALTERNATING
// #endif

/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
#define DEBOUNCE 5

/* define if matrix has ghost (lacks anti-ghosting diodes) */
//#define MATRIX_HAS_GHOST

/* number of backlight levels */

/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
#define LOCKING_SUPPORT_ENABLE
/* Locking resynchronize hack */
#define LOCKING_RESYNC_ENABLE

/* If defined, GRAVE_ESC will always act as ESC when CTRL is held.
* This is userful for the Windows task manager shortcut (ctrl+shift+esc).
*/
// #define GRAVE_ESC_CTRL_OVERRIDE

/*
* Force NKRO
*
* Force NKRO (nKey Rollover) to be enabled by default, regardless of the saved
* state in the bootmagic EEPROM settings. (Note that NKRO must be enabled in the
* makefile for this to work.)
*
* If forced on, NKRO can be disabled via magic key (default = LShift+RShift+N)
* until the next keyboard reset.
*
* NKRO may prevent your keystrokes from being detected in the BIOS, but it is
* fully operational during normal computer usage.
*
* For a less heavy-handed approach, enable NKRO via magic key (LShift+RShift+N)
* or via bootmagic (hold SPACE+N while plugging in the keyboard). Once set by
* bootmagic, NKRO mode will always be enabled until it is toggled again during a
* power-up.
*
*/
//#define FORCE_NKRO

/*
* Magic Key Options
*
* Magic keys are hotkey commands that allow control over firmware functions of
* the keyboard. They are best used in combination with the HID Listen program,
* found here: https://www.pjrc.com/teensy/hid_listen.html
*
* The options below allow the magic key functionality to be changed. This is
* useful if your keyboard/keypad is missing keys and you want magic key support.
*
*/

/* key combination for magic key command */
/* defined by default; to change, uncomment and set to the combination you want */
// #define IS_COMMAND() (get_mods() == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)))

/* control how magic key switches layers */
//#define MAGIC_KEY_SWITCH_LAYER_WITH_FKEYS true
//#define MAGIC_KEY_SWITCH_LAYER_WITH_NKEYS true
//#define MAGIC_KEY_SWITCH_LAYER_WITH_CUSTOM false

/* override magic key keymap */
//#define MAGIC_KEY_SWITCH_LAYER_WITH_FKEYS
//#define MAGIC_KEY_SWITCH_LAYER_WITH_NKEYS
//#define MAGIC_KEY_SWITCH_LAYER_WITH_CUSTOM
//#define MAGIC_KEY_HELP1 H
//#define MAGIC_KEY_HELP2 SLASH
//#define MAGIC_KEY_DEBUG D
//#define MAGIC_KEY_DEBUG_MATRIX X
//#define MAGIC_KEY_DEBUG_KBD K
//#define MAGIC_KEY_DEBUG_MOUSE M
//#define MAGIC_KEY_VERSION V
//#define MAGIC_KEY_STATUS S
//#define MAGIC_KEY_CONSOLE C
//#define MAGIC_KEY_LAYER0_ALT1 ESC
//#define MAGIC_KEY_LAYER0_ALT2 GRAVE
//#define MAGIC_KEY_LAYER0 0
//#define MAGIC_KEY_LAYER1 1
//#define MAGIC_KEY_LAYER2 2
//#define MAGIC_KEY_LAYER3 3
//#define MAGIC_KEY_LAYER4 4
//#define MAGIC_KEY_LAYER5 5
//#define MAGIC_KEY_LAYER6 6
//#define MAGIC_KEY_LAYER7 7
//#define MAGIC_KEY_LAYER8 8
//#define MAGIC_KEY_LAYER9 9
//#define MAGIC_KEY_BOOTLOADER PAUSE
//#define MAGIC_KEY_LOCK CAPS
//#define MAGIC_KEY_EEPROM E
//#define MAGIC_KEY_NKRO N
//#define MAGIC_KEY_SLEEP_LED Z

/*
* Feature disable options
* These options are also useful to firmware size reduction.
*/

/* disable debug print */
//#define NO_DEBUG

/* disable print */
//#define NO_PRINT

/* disable action features */
//#define NO_ACTION_LAYER
//#define NO_ACTION_TAPPING
//#define NO_ACTION_ONESHOT
//#define NO_ACTION_MACRO
//#define NO_ACTION_FUNCTION

/*
* MIDI options
*/

/* Prevent use of disabled MIDI features in the keymap */
//#define MIDI_ENABLE_STRICT 1

/* enable basic MIDI features:
- MIDI notes can be sent when in Music mode is on
*/
//#define MIDI_BASIC

/* enable advanced MIDI features:
- MIDI notes can be added to the keymap
- Octave shift and transpose
- Virtual sustain, portamento, and modulation wheel
- etc.
*/
//#define MIDI_ADVANCED

/* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */
//#define MIDI_TONE_KEYCODE_OCTAVES 1

/*
* HD44780 LCD Display Configuration
*/
/*
#define LCD_LINES 2 //< number of visible lines of the display
#define LCD_DISP_LENGTH 16 //< visibles characters per line of the display
#define LCD_IO_MODE 1 //< 0: memory mapped mode, 1: IO port mode
#if LCD_IO_MODE
#define LCD_PORT PORTB //< port for the LCD lines
#define LCD_DATA0_PORT LCD_PORT //< port for 4bit data bit 0
#define LCD_DATA1_PORT LCD_PORT //< port for 4bit data bit 1
#define LCD_DATA2_PORT LCD_PORT //< port for 4bit data bit 2
#define LCD_DATA3_PORT LCD_PORT //< port for 4bit data bit 3
#define LCD_DATA0_PIN 4 //< pin for 4bit data bit 0
#define LCD_DATA1_PIN 5 //< pin for 4bit data bit 1
#define LCD_DATA2_PIN 6 //< pin for 4bit data bit 2
#define LCD_DATA3_PIN 7 //< pin for 4bit data bit 3
#define LCD_RS_PORT LCD_PORT //< port for RS line
#define LCD_RS_PIN 3 //< pin for RS line
#define LCD_RW_PORT LCD_PORT //< port for RW line
#define LCD_RW_PIN 2 //< pin for RW line
#define LCD_E_PORT LCD_PORT //< port for Enable line
#define LCD_E_PIN 1 //< pin for Enable line
#endif
*/

/* Bootmagic Lite key configuration */
// #define BOOTMAGIC_LITE_ROW 0
// #define BOOTMAGIC_LITE_COLUMN 0
141 changes: 141 additions & 0 deletions keyboards/switchplate/southpaw_65/dev.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
# Southpaw Extended 65%

Development docs covering the following:
- Kimera core
- RGB
- Backlight

## Kimera core
![Kimera core](https://gd2.alicdn.com/imgextra/i4/159916802/TB2qsIgdrJkpuFjy1zcXXa5FFXa_!!159916802.jpg)

What little available info that was available for the qmk port
- atmega32u4 16Mhz
- board seems to have a 6Mhz crystal
- 2x PCA9555 I2C IO expander

Links:
- [Schematic, BOM, Gerbers](/kairyu/kimera/blob/master/kimera_core)
- [Original firmware](https://github.com/kairyu/tmk_keyboard_custom/tree/master/keyboard/kimera)

```c
/*
Kimera_core_v1.0 Components
U1 (atmega32u4)
,----------------.
TX --| TX0(PD3) RAW |--
RX --| RX1(PD2) GND |--
--| GND RESET |-- RST
--| GND VCC |--
SDA --| 2(PD1) (PF4)A3 |--
SCL --| 3(PD0) (PF5)A2 |--
(INT) --| 4(PD4) (PF6)A1 |--
--| 5(PC6) (PF7)A0 |--
--| 6(PD7) (PB1)15 |-- SCK
LED2 --| 7(PE6) (PB3)14 |-- MISO
LED1 --| 8(PB4) (PB2)16 |-- MOSI
LED3 --| 9(PB5) (PB6)10 |-- LED4
`----------------'
IC1 (PCA9555) IC2 (PCA9555)
,----------. ,----------.
SDA --| SDA P00 |-- P1 SDA --| SDA P00 |-- P17
SCL --| SCL P01 |-- P2 SCL --| SCL P01 |-- P18
INT --| INT P02 |-- P3 INT --| INT P02 |-- P19
| P03 |-- P4 | P03 |-- P20
GND --| A0 P04 |-- P5 VCC --| A0 P04 |-- P21
SJ1 --| A1 P05 |-- P6 SJ1 --| A1 P05 |-- P22
SJ2 --| A2 P06 |-- P7 SJ2 --| A2 P06 |-- P23
| P07 |-- P8 | P07 |-- P24
| | | |
| P10 |-- P9 | P10 |-- P25
| P11 |-- P10 | P11 |-- P26
| P12 |-- P11 | P12 |-- P27
| P13 |-- P12 | P13 |-- P28
| P14 |-- P13 | P14 |-- P29
| P15 |-- P14 | P15 |-- P30
| P16 |-- P15 | P16 |-- P31
| P17 |-- P16 | P17 |-- P32
`----------' `----------'
*/

```

### Bootloader
Default bootloader is `atmel-dfu`.
Reboot to bootloader via magnetic switch next to icsp header.
Flash using regular dfu methods.

### Southpaw Extended 65 pin mappings
Taken from [kimera-config.json](https://github.com/kairyu/tkg/blob/master/keyboard/config/kimera-config.json)

"row_mapping": [ 2, 3, 4, 5, 6 ],
"col_mapping": [ 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31 ],

# RGB
- PIN C7
- Number of RGB LED 7

# Backlight
- PIN B5

# Capslock
- PIN B6

# Numlock
- PIN C6

## Assumptions
### Pin/Port mappings
- All cols are on the same IC
- All rows are on the same IC and port
- Pins mapped sequentially
- Each port only does row or column not a mixture of both
- No need to have complex port config
-

| ROW index | Kimera Pin | PCA9555 |
| ----------|------------|-------------------|
| 0 | 2 | IC1 Port 0 pin 1 |
| 1 | 3 | IC1 Port 0 pin 2 |
| 2 | 4 | IC1 Port 0 pin 3 |
| 3 | 5 | IC1 Port 0 pin 4 |
| 4 | 6 | IC1 Port 0 pin 5 |

- Safe enough to assume `row_index == pin`


| COL index | Kimera Pin | PCA9555 |
| ----------|------------|-------------------|
| 0 | 13 | IC1 Port 1 pin 4 |
| 1 | 14 | IC1 Port 1 pin 5 |
| 2 | 15 | IC1 Port 1 pin 6 |
| 3 | 16 | IC1 Port 1 pin 7 |
| 4 | 17 | IC2 Port 0 pin 0 |
| 5 | 18 | IC2 Port 0 pin 1 |
| 6 | 19 | IC2 Port 0 pin 2 |
| 7 | 20 | IC2 Port 0 pin 3 |
| 8 | 21 | IC2 Port 0 pin 4 |
| 9 | 22 | IC2 Port 0 pin 5 |
| 10 | 23 | IC2 Port 0 pin 6 |
| 11 | 24 | IC2 Port 0 pin 7 |
| 12 | 25 | IC2 Port 1 pin 0 |
| 13 | 26 | IC2 Port 1 pin 1 |
| 14 | 27 | IC2 Port 1 pin 2 |
| 15 | 28 | IC2 Port 1 pin 3 |
| 16 | 29 | IC2 Port 1 pin 4 |
| 17 | 30 | IC2 Port 1 pin 5 |
| 18 | 31 | IC2 Port 1 pin 6 |

- Need to read both ICs and corresponding port to compile the correct column data
- All pins are mapped sequentially
- maps to the usual practice of reading matrix columns
- Needs uint32_t to read 19 columns of data

## Notes
[pca9555 datasheet](https://www.ti.com/lit/ds/symlink/pca9555.pdf)

- Other Kimera based boards with non sequential pin mappings, pins mapped across ICs, or mixed row/col configs will need more complicated `pin -> i2c_addr,port,pin` logic as well as rather more complex pin functions.

## Return to stock firmware
To return back to stock TMK firmware, use [programming guide provided by Reconsiderit](https://geekhack.org/index.php?topic=92344.msg2625784#msg2625784)
Loading

0 comments on commit c3afc55

Please sign in to comment.