~ruther/qmk_firmware

b5d85ddc90e248317fb12832f7072dfbcccd48e5 — Adam Newbold 6 years ago 6aba3ce
[Keyboard] Adding Numeric Keypad //e converter (#5294)

* Adding Numeric Keypad //e to conversions

* Update keyboards/converter/numeric_keypad_IIe/config.h

//e -> IIe

Co-Authored-By: newbold <adam@neatnik.net>

* Update keyboards/converter/numeric_keypad_IIe/config.h

//e -> IIe and wrapped description in quotes for comma inclusion

Co-Authored-By: newbold <adam@neatnik.net>

* Updating info.json for Configurator

* Corrected legend

* Update keyboards/converter/numeric_keypad_IIe/info.json

Corrected layout

Co-Authored-By: newbold <adam@neatnik.net>
A keyboards/converter/numeric_keypad_IIe/config.h => keyboards/converter/numeric_keypad_IIe/config.h +101 -0
@@ 0,0 1,101 @@
/*
Copyright 2019 Adam Newbold <adam@neatnik.net>

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      0x0000
#define DEVICE_VER      0x0001
#define MANUFACTURER    Apple Inc.
#define PRODUCT         Numeric Keypad IIe
#define DESCRIPTION     "Numeric Keypad IIe, A2M2003"

/*

Pin Mappings
============

Dsub-15 Connection
------------------

          Dsub-15 (female)
    ,-------------------------.
    \ 08 07 06 05 04 03 02 01 /
     \ 15 14 13 12 11 10 09  /
      `---------------------'

Header Pins
-----------
 _____________________________________
|                                     |
|  11  10  9  8  7  6  5  4  3  2  1  |
|_____________________________________|


Header / Matrix
---------------

Pin             Name        Description                                
--------------------------------------------------------------
1,2,5,3,4,6     Y0-Y5       Y-direction key-matrix connections
7               NC                                          
9,11,10,8       X4-X7       X-direction key-matrix connections


Microcontroller Configuration
-----------------------------

(Pins are for an Arduino Micro)

+-----------------------------------+
| Dsub-15 | Header | Matrix | Micro |
|---------+--------+--------+-------|
|   12    |   11   |   X5   |   B0  |
|   11    |   10   |   X6   |   D3  |
|   10    |    9   |   X4   |   B2  |
|    9    |    8   |   X7   |   D2  |
|   NC    |    7   |   NC   |   --  |
|    7    |    6   |   Y5   |   E6  |
|    6    |    5   |   Y2   |   D4  |
|    5    |    4   |   Y4   |   D7  |
|    3    |    3   |   Y3   |   C6  |
|    2    |    2   |   Y1   |   D0  |
|    1    |    1   |   Y0   |   D1  |
+-----------------------------------+

Note: Dsub-15 pins 4, 8, 13, 14, and 15 are unused

Reference
---------

https://deskthority.net/wiki/Apple_Numeric_Keypad_IIe
https://geekhack.org/index.php?topic=78048.0
http://wiki.apple2.org/index.php?title=Pinouts#Apple_.2F.2Fe_Numeric_Keypad_connector

*/

#define MATRIX_ROWS 4
#define MATRIX_COLS 6
#define MATRIX_ROW_PINS { B0, B2, D2, D3 }
#define MATRIX_COL_PINS { D1, D0, D4, C6, D7, E6 }
#define UNUSED_PINS
#define DIODE_DIRECTION COL2ROW
#define SOFT_SERIAL_PIN D0
#define DEBOUNCING_DELAY 5

A keyboards/converter/numeric_keypad_IIe/info.json => keyboards/converter/numeric_keypad_IIe/info.json +12 -0
@@ 0,0 1,12 @@
{
    "keyboard_name": "Numeric Keypad IIe", 
    "url": "", 
    "maintainer": "qmk", 
    "width": 7.5, 
    "height": 4, 
    "layouts": {
        "LAYOUT": {
            "layout": [{"label":"Esc", "x":0, "y":0}, {"label":"7", "x":2, "y":0}, {"label":"8", "x":3, "y":0}, {"label":"9", "x":4, "y":0}, {"label":"(", "x":5.5, "y":0}, {"label":")", "x":6.5, "y":0}, {"label":"\u2190", "x":0, "y":1}, {"label":"4", "x":2, "y":1}, {"label":"5", "x":3, "y":1}, {"label":"6", "x":4, "y":1}, {"label":"\u2212", "x":5.5, "y":1}, {"label":"\u00f7", "x":6.5, "y":1}, {"label":"\u2192", "x":0, "y":2}, {"label":"1", "x":2, "y":2}, {"label":"2", "x":3, "y":2}, {"label":"3", "x":4, "y":2}, {"label":"+", "x":5.5, "y":2}, {"label":"\u00d7", "x":6.5, "y":2}, {"label":"Space", "x":0, "y":3}, {"label":"0", "x":1.5, "y":3, "w":1.5}, {"label":",", "x":3, "y":3}, {"label":".", "x":4, "y":3}, {"label":"Ret", "x":5.5, "y":3}, {"label":"Print", "x":6.5, "y":3}]
        }
    }
}

A keyboards/converter/numeric_keypad_IIe/keymaps/default/config.h => keyboards/converter/numeric_keypad_IIe/keymaps/default/config.h +19 -0
@@ 0,0 1,19 @@
/* Copyright 2019 Adam Newbold <adam@neatnik.net>
 *
 * 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

// place overrides here

A keyboards/converter/numeric_keypad_IIe/keymaps/default/keymap.c => keyboards/converter/numeric_keypad_IIe/keymaps/default/keymap.c +62 -0
@@ 0,0 1,62 @@
/* Copyright 2019 Adam Newbold <adam@neatnik.net>
 *
 * 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/>.
 */
#include QMK_KEYBOARD_H

// Defines the keycodes used by our macros in process_record_user
enum custom_keycodes {
  QMKBEST = SAFE_RANGE,
  QMKURL
};

const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/*
 +-------+     +-------+-------+-------+  +-------+-------+
 |  Esc  |     |  7    |  8    |  9    |  |  (    |  )    |
 +-------+     +-------+-------+-------+  +-------+-------+
 |  <--  |     |  4    |  5    |  6    |  |  -    |  /    |
 +-------+     +-------+-------+-------+  +-------+-------+
 |  -->  |     |  1    |  2    |  3    |  |  +    |  *    |
 +-------+  +--+-------+-------+-------+  +-------+-------+
 | Space |  |  0       |  ,    |  .    |  |  Ret  | Print |
 +-------+  +----------+-------+-------+  +-------+-------+
*/
  [0] = LAYOUT(
    KC_ESCAPE,  KC_KP_7,  KC_KP_8,      KC_KP_9,    KC_LEFT_PAREN,  KC_RIGHT_PAREN, \
    KC_LEFT,    KC_KP_4,  KC_KP_5,      KC_KP_6,    KC_KP_MINUS,    KC_KP_SLASH, \
    KC_RIGHT,   KC_KP_1,  KC_KP_2,      KC_KP_3,    KC_KP_PLUS,     KC_KP_ASTERISK, \
    KC_SPACE,   KC_KP_0,  KC_KP_COMMA,  KC_KP_DOT,  KC_RETURN,      KC_QUESTION  \
  ),
};

bool process_record_user(uint16_t keycode, keyrecord_t *record) {
  return true;
}

void keyboard_post_init_user(void) {

}

void matrix_init_user(void) {

}

void matrix_scan_user(void) {

}

void led_set_user(uint8_t usb_led) {

}

A keyboards/converter/numeric_keypad_IIe/keymaps/default/readme.md => keyboards/converter/numeric_keypad_IIe/keymaps/default/readme.md +3 -0
@@ 0,0 1,3 @@
# Numeric Keypad //e Default Keymap

All keys perform their default functions displayed on the stock keycaps. Note that the "Print" key presses a question mark (?), which was the default behavior on the Apple //e (with ? the shorthand for the AppleSoft BASIC PRINT command).

A keyboards/converter/numeric_keypad_IIe/keymaps/newbold/config.h => keyboards/converter/numeric_keypad_IIe/keymaps/newbold/config.h +19 -0
@@ 0,0 1,19 @@
/* Copyright 2019 Adam Newbold <adam@neatnik.net>
 *
 * 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

// place overrides here

A keyboards/converter/numeric_keypad_IIe/keymaps/newbold/keymap.c => keyboards/converter/numeric_keypad_IIe/keymaps/newbold/keymap.c +68 -0
@@ 0,0 1,68 @@
/* Copyright 2019 Adam Newbold <adam@neatnik.net>
 *
 * 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/>.
 */
#include QMK_KEYBOARD_H

// Defines the keycodes used by our macros in process_record_user
enum custom_keycodes {
  QMKBEST = SAFE_RANGE,
  QMKURL
};

const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/*
 +-------+     +-------+-------+-------+  +-------+-------+
 |  Esc  |     |  7    |  8    |  9    |  |  (    |  )    |
 +-------+     +-------+-------+-------+  +-------+-------+
 |  <--  |     |  4    |  5    |  6    |  |  -    |  /    |
 +-------+     +-------+-------+-------+  +-------+-------+
 |  -->  |     |  1    |  2    |  3    |  |  +    |  *    |
 +-------+  +--+-------+-------+-------+  +-------+-------+
 | Space |  |  0       |  ,    |  .    |  |  Ret  | Print |
 +-------+  +----------+-------+-------+  +-------+-------+
*/
  [0] = LAYOUT(
    KC__MUTE,     KC_KP_7,  KC_KP_8,      KC_KP_9,    KC_LEFT_PAREN,  KC_RIGHT_PAREN, \
    KC__VOLDOWN,  KC_KP_4,  KC_KP_5,      KC_KP_6,    KC_KP_MINUS,    KC_KP_SLASH, \
    KC__VOLUP,    KC_KP_1,  KC_KP_2,      KC_KP_3,    KC_KP_PLUS,     KC_KP_ASTERISK, \
    MO(1),        KC_KP_0,  KC_KP_COMMA,  KC_KP_DOT,  KC_RETURN,      KC_QUESTION  \
  ),
  [1] = LAYOUT(
    KC_TRNS,      KC_TRNS,  KC_TRNS,      KC_TRNS,    KC_TRNS,        KC_TRNS, \
    KC_BRMD,      KC_TRNS,  KC_TRNS,      KC_TRNS,    KC_TRNS,        KC_TRNS, \
    KC_BRMU,      KC_TRNS,  KC_TRNS,      KC_TRNS,    KC_TRNS,        KC_TRNS, \
    KC_TRNS,      KC_TRNS,  KC_TRNS,      KC_TRNS,    KC_TRNS,        RESET  \
  ),
};

bool process_record_user(uint16_t keycode, keyrecord_t *record) {
  return true;
}

void keyboard_post_init_user(void) {

}

void matrix_init_user(void) {

}

void matrix_scan_user(void) {

}

void led_set_user(uint8_t usb_led) {

}

A keyboards/converter/numeric_keypad_IIe/keymaps/newbold/readme.md => keyboards/converter/numeric_keypad_IIe/keymaps/newbold/readme.md +28 -0
@@ 0,0 1,28 @@
# @newbold's layout for the Numeric Keypad IIe

Includes the standard layout for all keys except for the left-most column, which is remapped to these keys:

 +-----------------+
 |       Mute      |
 +-----------------+
 |   Volume Down   |
 +-----------------+
 |    Volume Up    |
 +-----------------+
 |     Function    |
 +-----------------+
 
 With Function held down:
 
 +-----------------+
 |       Mute      |
 +-----------------+
 | Brightness Down |
 +-----------------+
 |  Brightness Up  |
 +-----------------+
 |     Function    |
 +-----------------+
 
 And also with Function held down, "Print" (the lower right key) will trigger RESET (putting the controller into bootloader mode so it can be flashed).
 
\ No newline at end of file

A keyboards/converter/numeric_keypad_IIe/numeric_keypad_IIe.c => keyboards/converter/numeric_keypad_IIe/numeric_keypad_IIe.c +43 -0
@@ 0,0 1,43 @@
/* Copyright 2019 Adam Newbold <adam@neatnik.net>
 *
 * 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/>.
 */
#include "numeric_keypad_IIe.h"

void matrix_init_kb(void) {
	// put your keyboard start-up code here
	// runs once when the firmware starts up

	matrix_init_user();
}

void matrix_scan_kb(void) {
	// put your looping keyboard code here
	// runs every cycle (a lot)

	matrix_scan_user();
}

bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
	// put your per-action keyboard code here
	// runs for every action, just before processing by the firmware

	return process_record_user(keycode, record);
}

void led_set_kb(uint8_t usb_led) {
	// put your keyboard LED indicator (ex: Caps Lock LED) toggling code here

	led_set_user(usb_led);
}

A keyboards/converter/numeric_keypad_IIe/numeric_keypad_IIe.h => keyboards/converter/numeric_keypad_IIe/numeric_keypad_IIe.h +30 -0
@@ 0,0 1,30 @@
/* Copyright Adam Newbold <adam@neatnik.net>
 *
 * 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 "quantum.h"

#define LAYOUT( \
    K_ESC,   K_7, K_8,     K_9,   K_LEFT_PARENS, K_RIGHT_PARENS, \
    K_LEFT,  K_4, K_5,     K_6,   K_MINUS,       K_DIVIDE,       \
    K_RIGHT, K_1, K_2,     K_3,   K_PLUS,        K_MULTIPLY,     \
    K_SPACE, K_0, K_COMMA, K_DOT, K_RETURN,      K_PRINT         \
){ \
    { K_RIGHT_PARENS, K_ESC,   K_4,           K_5,     K_6,      K_7     },\
    { K_DIVIDE,       K_LEFT,  K_0,           K_1,     K_2,      K_3     },\
    { K_PRINT,        K_SPACE, K_LEFT_PARENS, K_MINUS, K_RETURN, K_COMMA },\
    { K_MULTIPLY,     K_RIGHT, K_8,           K_9,     K_DOT,    K_PLUS  },\
}

A keyboards/converter/numeric_keypad_IIe/readme.md => keyboards/converter/numeric_keypad_IIe/readme.md +16 -0
@@ 0,0 1,16 @@
# Numeric Keypad IIe

![Numeric Keypad IIe](https://upload.wikimedia.org/wikipedia/commons/3/3b/Apple_Numeric_Keypad_IIe.jpg)

This is a conversion project for the Numeric Keypad IIe, model A2M2003. This was an external keypad that connected to the Apple //e's motherboard (and as such, it lacked any kind of onboard controller).

The reference conversion setup uses the keyboard's DB15 (VGA) fixed cable connected to a DB15 wiring terminal with breakout board ([this one](https://www.amazon.com/gp/product/B07437293Y/ref=ppx_yo_dt_b_asin_title_o02_s00?ie=UTF8&psc=1), specifically) and wired to an [Arduino Micro](https://store.arduino.cc/usa/arduino-micro).

Keyboard Maintainer: [Adam Newbold](https://github.com/newbold)  
Hardware Supported: Internal Numeric Keypad IIe PCB (Apple part 820.0081.c), ATmega32U4 microcontroller

Make example for this keyboard (after setting up your build environment):

    make converter/numeric_keypad_IIe:default

See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs).

A keyboards/converter/numeric_keypad_IIe/rules.mk => keyboards/converter/numeric_keypad_IIe/rules.mk +76 -0
@@ 0,0 1,76 @@
# MCU name
MCU = atmega32u4

# Processor frequency.
#     This will define a symbol, F_CPU, in all source code files equal to the
#     processor frequency in Hz. You can then use this symbol in your source code to
#     calculate timings. Do NOT tack on a 'UL' at the end, this will be done
#     automatically to create a 32-bit value in your source code.
#
#     This will be an integer division of F_USB below, as it is sourced by
#     F_USB after it has run through any CPU prescalers. Note that this value
#     does not *change* the processor frequency - it should merely be updated to
#     reflect the processor speed set externally so that the code can use accurate
#     software delays.
F_CPU = 16000000

#
# LUFA specific
#
# Target architecture (see library "Board Types" documentation).
ARCH = AVR8

# Input clock frequency.
#     This will define a symbol, F_USB, in all source code files equal to the
#     input clock frequency (before any prescaling is performed) in Hz. This value may
#     differ from F_CPU if prescaling is used on the latter, and is required as the
#     raw input clock is fed directly to the PLL sections of the AVR for high speed
#     clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'
#     at the end, this will be done automatically to create a 32-bit value in your
#     source code.
#
#     If no clock division is performed on the input clock inside the AVR (via the
#     CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
F_USB = $(F_CPU)

# Interrupt driven control endpoint task(+60)
OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT

# Bootloader selection
#   Teensy       halfkay
#   Pro Micro    caterina
#   Atmel DFU    atmel-dfu
#   LUFA DFU     lufa-dfu
#   QMK DFU      qmk-dfu
#   atmega32a    bootloadHID
BOOTLOADER = caterina

# If you don't know the bootloader type, then you can specify the
# Boot Section Size in *bytes* by uncommenting out the OPT_DEFS line
#   Teensy halfKay      512
#   Teensy++ halfKay    1024
#   Atmel DFU loader    4096
#   LUFA bootloader     4096
#   USBaspLoader        2048
# OPT_DEFS += -DBOOTLOADER_SIZE=4096

# Build Options
#   change yes to no to disable
#
BOOTMAGIC_ENABLE = no      # Virtual DIP switch configuration(+1000)
MOUSEKEY_ENABLE = yes       # Mouse keys(+4700)
EXTRAKEY_ENABLE = yes       # Audio control and System control(+450)
CONSOLE_ENABLE = yes        # Console for debug(+400)
COMMAND_ENABLE = yes        # Commands for debug and configuration
# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
SLEEP_LED_ENABLE = no       # Breathing sleep LED during USB suspend
# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
NKRO_ENABLE = no            # USB Nkey Rollover
BACKLIGHT_ENABLE = no       # Enable keyboard backlight functionality on B7 by default
RGBLIGHT_ENABLE = no        # Enable keyboard RGB underglow
MIDI_ENABLE = no            # MIDI support (+2400 to 4200, depending on config)
UNICODE_ENABLE = no         # Unicode
BLUETOOTH_ENABLE = no       # Enable Bluetooth with the Adafruit EZ-Key HID
AUDIO_ENABLE = no           # Audio output on port C6
FAUXCLICKY_ENABLE = no      # Use buzzer to emulate clicky switches
HD44780_ENABLE = no 		# Enable support for HD44780 based LCDs (+400)