~ruther/qmk_firmware

4822ad6be194f416f6c95c468e26197dd442ac52 — noroadsleft 6 years ago 37b042a
handwired/retro_refit: refactor, Configurator support and readme update (#4899)

* handwired/retro_refit: refactor

- retro_refit.h
  - updated to use #pragma once include guard
  - refactored layout macro to not auto-prepend KC_ to keycodes
  - renamed to LAYOUT (from KEYMAP)
  - aligned for readability
- default keymap.c
  - now uses #include QMK_KEYBOARD_H
  - removed unused fn_actions and action_get_macro blocks

* handwired/retro_refit: Configurator support

* handwired/retro_refit: readme update

Updated readme to format of current QMK template.
A keyboards/handwired/retro_refit/info.json => keyboards/handwired/retro_refit/info.json +95 -0
@@ 0,0 1,95 @@
{
  "keyboard_name": "handwired/retro_refit",
  "url": "",
  "maintainer": "qmk",
  "width": 15.5,
  "height": 6.5,
  "layouts": {
    "LAYOUT": {
      "key_count": 81,
      "layout": [
        {"label":"Esc", "x":0, "y":0},
        {"label":"F1", "x":1, "y":0},
        {"label":"F2", "x":2, "y":0},
        {"label":"F3", "x":3, "y":0},
        {"label":"F4", "x":4, "y":0},
        {"label":"F5", "x":5, "y":0},
        {"label":"F6", "x":6, "y":0},
        {"label":"F7", "x":7, "y":0},
        {"label":"F8", "x":8, "y":0},
        {"label":"F9", "x":9, "y":0},
        {"label":"F10", "x":10, "y":0},
        {"label":"Num Lock", "x":11.5, "y":0},
        {"label":"Scroll Lock", "x":12.5, "y":0},
        {"label":"Print Screen", "x":13.5, "y":0},
        {"label":"Pause", "x":14.5, "y":0},
        {"label":"`", "x":0, "y":1.5},
        {"label":"1", "x":1, "y":1.5},
        {"label":"2", "x":2, "y":1.5},
        {"label":"3", "x":3, "y":1.5},
        {"label":"4", "x":4, "y":1.5},
        {"label":"5", "x":5, "y":1.5},
        {"label":"6", "x":6, "y":1.5},
        {"label":"7", "x":7, "y":1.5},
        {"label":"8", "x":8, "y":1.5},
        {"label":"9", "x":9, "y":1.5},
        {"label":"0", "x":10, "y":1.5},
        {"label":"-", "x":11, "y":1.5},
        {"label":"=", "x":12, "y":1.5},
        {"label":"Backspace", "x":13, "y":1.5, "w":1.5},
        {"label":"Home", "x":14.5, "y":1.5},
        {"label":"Tab", "x":0, "y":2.5, "w":1.5},
        {"label":"Q", "x":1.5, "y":2.5},
        {"label":"W", "x":2.5, "y":2.5},
        {"label":"E", "x":3.5, "y":2.5},
        {"label":"R", "x":4.5, "y":2.5},
        {"label":"T", "x":5.5, "y":2.5},
        {"label":"Y", "x":6.5, "y":2.5},
        {"label":"U", "x":7.5, "y":2.5},
        {"label":"I", "x":8.5, "y":2.5},
        {"label":"O", "x":9.5, "y":2.5},
        {"label":"P", "x":10.5, "y":2.5},
        {"label":"[", "x":11.5, "y":2.5},
        {"label":"]", "x":12.5, "y":2.5},
        {"label":"Page Up", "x":14.5, "y":2.5},
        {"label":"Ctrl", "x":0, "y":3.5, "w":1.75},
        {"label":"A", "x":1.75, "y":3.5},
        {"label":"S", "x":2.75, "y":3.5},
        {"label":"D", "x":3.75, "y":3.5},
        {"label":"F", "x":4.75, "y":3.5},
        {"label":"G", "x":5.75, "y":3.5},
        {"label":"H", "x":6.75, "y":3.5},
        {"label":"J", "x":7.75, "y":3.5},
        {"label":"K", "x":8.75, "y":3.5},
        {"label":"L", "x":9.75, "y":3.5},
        {"label":";", "x":10.75, "y":3.5},
        {"label":"'", "x":11.75, "y":3.5},
        {"label":"Enter", "x":12.75, "y":3.5, "w":1.75},
        {"label":"Page Down", "x":14.5, "y":3.5},
        {"label":"Shift", "x":0, "y":4.5, "w":2.25},
        {"label":"Z", "x":2.25, "y":4.5},
        {"label":"X", "x":3.25, "y":4.5},
        {"label":"C", "x":4.25, "y":4.5},
        {"label":"V", "x":5.25, "y":4.5},
        {"label":"B", "x":6.25, "y":4.5},
        {"label":"N", "x":7.25, "y":4.5},
        {"label":"M", "x":8.25, "y":4.5},
        {"label":",", "x":9.25, "y":4.5},
        {"label":".", "x":10.25, "y":4.5},
        {"label":"/", "x":11.25, "y":4.5},
        {"label":"Shift", "x":12.25, "y":4.5, "w":1.25},
        {"label":"Up", "x":13.5, "y":4.5},
        {"label":"End", "x":14.5, "y":4.5},
        {"label":"Alt", "x":0, "y":5.5, "w":1.25},
        {"label":"Caps Lock", "x":1.25, "y":5.5, "w":1.25},
        {"label":"\\", "x":2.5, "y":5.5},
        {"label":"Space", "x":3.5, "y":5.5, "w":7},
        {"label":"Insert", "x":10.5, "y":5.5},
        {"label":"Delete", "x":11.5, "y":5.5},
        {"label":"Left", "x":12.5, "y":5.5},
        {"label":"Down", "x":13.5, "y":5.5},
        {"label":"Right", "x":14.5, "y":5.5}
      ]
    }
  }
}

M keyboards/handwired/retro_refit/keymaps/default/keymap.c => keyboards/handwired/retro_refit/keymaps/default/keymap.c +9 -24
@@ 1,27 1,12 @@

#include "retro_refit.h"
#include QMK_KEYBOARD_H

const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[0] =
	KEYMAP( ESC,    F1,   F2,   F3,   F4,   F5,   F6,   F7,   F8,  F9,  F10, NLCK, SLCK, PSCR, PAUS, \
			GRV,     1,    2,    3,    4,    5,    6,    7,    8,   9,    0, MINS,  EQL, BSPC, HOME, \
			TAB,     Q,    W,    E,    R,    T,    Y,    U,    I,   O,    P, LBRC, RBRC,       PGUP, \
			BSLS,    A,    S,    D,    F,    G,    H,    J,    K,   L, SCLN, QUOT,        ENT, PGDN, \
			LSFT,          Z,    X,    C,    V,    B,    N,    M, COMM, DOT, SLSH, RSFT,   UP,  END, \
			LCTL, LGUI, LALT,        SPC,                               INS,  DEL, LEFT, DOWN, RGHT),
};

const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
{
  // MACRODOWN only works in this function
      switch(id) {
        case 0:
          if (record->event.pressed) {
            register_code(KC_RSFT);
          } else {
            unregister_code(KC_RSFT);
          }
        break;
      }
    return MACRO_NONE;
  [0] = LAYOUT( \
    KC_ESC,    KC_F1,   KC_F2,   KC_F3,   KC_F4,   KC_F5,   KC_F6,   KC_F7,   KC_F8,   KC_F9,  KC_F10, KC_NLCK, KC_SLCK, KC_PSCR, KC_PAUS, \
    KC_GRV,     KC_1,    KC_2,    KC_3,    KC_4,    KC_5,    KC_6,    KC_7,    KC_8,    KC_9,    KC_0, KC_MINS,  KC_EQL, KC_BSPC, KC_HOME, \
    KC_TAB,     KC_Q,    KC_W,    KC_E,    KC_R,    KC_T,    KC_Y,    KC_U,    KC_I,    KC_O,    KC_P, KC_LBRC, KC_RBRC,          KC_PGUP, \
    KC_BSLS,    KC_A,    KC_S,    KC_D,    KC_F,    KC_G,    KC_H,    KC_J,    KC_K,    KC_L, KC_SCLN, KC_QUOT,           KC_ENT, KC_PGDN, \
    KC_LSFT,             KC_Z,    KC_X,    KC_C,    KC_V,    KC_B,    KC_N,    KC_M, KC_COMM,  KC_DOT, KC_SLSH, KC_RSFT,   KC_UP,  KC_END, \
    KC_LCTL, KC_LGUI, KC_LALT,           KC_SPC,                                               KC_INS,  KC_DEL, KC_LEFT, KC_DOWN, KC_RGHT  \
  ),
};

M keyboards/handwired/retro_refit/readme.md => keyboards/handwired/retro_refit/readme.md +27 -45
@@ 1,60 1,42 @@
retro_refit keyboard firmware
======================

## Keyboard Info
# retro_refit

The retro refit keyboard used a Teensy to replace the original controller on a 386 "laptop".

http://imgur.com/a/08Fyj
[Image Gallery](https://imgur.com/a/08Fyj)

This keyboard uses a KEYMAP macro that is a great example of using a non-standard row-column matrix. The keyboard in question had 11 rows and 8 columns, but the rows were not all horizontal, and the columns were not all vertical. For example, row 2 contained "Print Screen", "N", "M", ",", ".", "/", "Right Shift", and"Left Alt". Column 0 contained "F6", "7", "O", "'", "Q", "D", "B", "Left Alt", "Up Arrow", and "Down Arrow".
This keyboard uses a LAYOUT macro that is a great example of using a non-standard row-column matrix. The keyboard in question had 11 rows and 8 columns, but the rows were not all horizontal, and the columns were not all vertical. For example, row 2 contained "Print Screen", "N", "M", ",", ".", "/", "Right Shift", and"Left Alt". Column 0 contained "F6", "7", "O", "'", "Q", "D", "B", "Left Alt", "Up Arrow", and "Down Arrow".

The macro makes programming the keys easier and in a more straight-forward manner because it realigns the keys into a 6x15 sensible keyboard layout instead of the obtuse 11x8 matrix. Each Kxy corrisponds to a key in row x column y.
The macro makes programming the keys easier and in a more straight-forward manner because it realigns the keys into a 6x15 sensible keyboard layout instead of the obtuse 11x8 matrix. Each Kxy corresponds to a key in row x column y.

```
#define KEYMAP( \
	K77, K05, K04, K03, K02, K01, K00, KA7, KA6, KA5, KA4, KA3, KA2, K11, K94, \
	K27, K76, K75, K74, K73, K72, K71, K70, K67, K66, K65, K64, K63, K62, KA1, \
	K61, K60, K57, K56, K55, K54, K53, K52, K51, K50, K47, K46, K45,      K97, \
	K43, K42, K41, K40, K37, K36, K35, K34, K33, K32, K31, K30,      K44, K87, \
	K26,      K24, K23, K22, K21, K20, K17, K16, K15, K14, K13, K12, KA0, K91, \
	K10, K06, K25,                K07,                K86, K85, K95, K90, K93  \
#define LAYOUT( \
  K77, K05, K04, K03, K02, K01, K00, KA7, KA6, KA5, KA4, KA3, KA2, K11, K94, \
  K27, K76, K75, K74, K73, K72, K71, K70, K67, K66, K65, K64, K63, K62, KA1, \
  K61, K60, K57, K56, K55, K54, K53, K52, K51, K50, K47, K46, K45,      K97, \
  K43, K42, K41, K40, K37, K36, K35, K34, K33, K32, K31, K30,      K44, K87, \
  K26,      K24, K23, K22, K21, K20, K17, K16, K15, K14, K13, K12, KA0, K91, \
  K10, K06, K25,                K07,                K86, K85, K95, K90, K93  \
) { \
{	KC_##K00,	KC_##K01,	KC_##K02,	KC_##K03,	KC_##K04,	KC_##K05,	KC_##K06,	KC_##K07,	}, \
{	KC_##K10,	KC_##K11,	KC_##K12,	KC_##K13,	KC_##K14,	KC_##K15,	KC_##K16,	KC_##K17,	}, \
{	KC_##K20,	KC_##K21,	KC_##K22,	KC_##K23,	KC_##K24,	KC_##K25,	KC_##K26,	KC_##K27,	}, \
{	KC_##K30,	KC_##K31,	KC_##K32,	KC_##K33,	KC_##K34,	KC_##K35,	KC_##K36,	KC_##K37,	}, \
{	KC_##K40,	KC_##K41,	KC_##K42,	KC_##K43,	KC_##K44,	KC_##K45,	KC_##K46,	KC_##K47,	}, \
{	KC_##K50,	KC_##K51,	KC_##K52,	KC_##K53,	KC_##K54,	KC_##K55,	KC_##K56,	KC_##K57,	}, \
{	KC_##K60,	KC_##K61,	KC_##K62,	KC_##K63,	KC_##K64,	KC_##K65,	KC_##K66,	KC_##K67,	}, \
{	KC_##K70,	KC_##K71,	KC_##K72,	KC_##K73,	KC_##K74,	KC_##K75,	KC_##K76,	KC_##K77,	}, \
{	KC_NO,		KC_NO,		KC_NO,		KC_NO,		KC_NO,		KC_##K85,	KC_##K86,	KC_##K87,	}, \
{	KC_##K90,	KC_##K91,	KC_NO,		KC_##K93,	KC_##K94,	KC_##K95,	KC_NO,		KC_##K97,	}, \
{	KC_##KA0,	KC_##KA1,	KC_##KA2,	KC_##KA3,	KC_##KA4,	KC_##KA5,	KC_##KA6,	KC_##KA7,	}  \
  {  K00,    K01,    K02,    K03,    K04,    K05,  K06,    K07  }, \
  {  K10,    K11,    K12,    K13,    K14,    K15,  K16,    K17  }, \
  {  K20,    K21,    K22,    K23,    K24,    K25,  K26,    K27  }, \
  {  K30,    K31,    K32,    K33,    K34,    K35,  K36,    K37  }, \
  {  K40,    K41,    K42,    K43,    K44,    K45,  K46,    K47  }, \
  {  K50,    K51,    K52,    K53,    K54,    K55,  K56,    K57  }, \
  {  K60,    K61,    K62,    K63,    K64,    K65,  K66,    K67  }, \
  {  K70,    K71,    K72,    K73,    K74,    K75,  K76,    K77  }, \
  {  KC_NO,  KC_NO,  KC_NO,  KC_NO,  KC_NO,  K85,  K86,    K87  }, \
  {  K90,    K91,    KC_NO,  K93,    K94,    K95,  KC_NO,  K97  }, \
  {  KA0,    KA1,    KA2,    KA3,    KA4,    KA5,  KA6,    KA7  } \
}
```


## Quantum MK Firmware

For the full Quantum feature list, see [the parent readme.md](/readme.md).

## Building

Download or clone the whole firmware and navigate to the keyboards/retro_refit folder. Once your dev env is setup, you'll be able to type `make` to generate your .hex - you can then use the Teensy Loader to program your .hex file.

Depending on which keymap you would like to use, you will have to compile slightly differently.
Keyboard Maintainer: [The QMK Community](https://github.com/qmk)  
Hardware Supported: Leading Edge D3 386 keyboard, Teensy  

### Default
To build with the default keymap, simply run `make default`.
Make example for this keyboard (after setting up your build environment):

### Other Keymaps
Several version of keymap are available in advance but you are recommended to define your favorite layout yourself. To define your own keymap create file named `<name>.c` and see keymap document (you can find in top readme.md) and existent keymap files.

To build the firmware binary hex file with a keymap just do `make` with a keymap like this:

```
$ make [default|jack|<name>]
```
    make handwired/retro_refit:default

Keymaps follow the format **__\<name\>.c__** and are stored in the `keymaps` folder.
\ No newline at end of file
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).

M keyboards/handwired/retro_refit/retro_refit.h => keyboards/handwired/retro_refit/retro_refit.h +24 -27
@@ 1,38 1,35 @@
#ifndef RETRO_REFIT_H
#define RETRO_REFIT_H
#pragma once

#include "quantum.h"

// This macro is an example of using a non-standard row-column matrix. The 
// keyboard in question had 11 rows and 8 columns, but the rows were not all 
// horizontal, and the columns were not all vertical. For example, row 2 
// This macro is an example of using a non-standard row-column matrix. The
// keyboard in question had 11 rows and 8 columns, but the rows were not all
// horizontal, and the columns were not all vertical. For example, row 2
// contained "Print Screen", "N", "M", ",", ".", "/", "Right Shift", and
// "Left Alt". Column 0 contained "F6", "7", "O", "'", "Q", "D", "B", 
// "Left Alt". Column 0 contained "F6", "7", "O", "'", "Q", "D", "B",
// "Left Alt", "Up Arrow", and "Down Arrow".
//
// The macro makes programming the keys easier and in a more straight-forward
// manner because it realigns the keys into a 6x15 sensible keyboard layout 
// manner because it realigns the keys into a 6x15 sensible keyboard layout
// instead of the obtuse 11x8 matrix.

#define KEYMAP( \
	K77, K05, K04, K03, K02, K01, K00, KA7, KA6, KA5, KA4, KA3, KA2, K11, K94, \
	K27, K76, K75, K74, K73, K72, K71, K70, K67, K66, K65, K64, K63, K62, KA1, \
	K61, K60, K57, K56, K55, K54, K53, K52, K51, K50, K47, K46, K45,      K97, \
	K43, K42, K41, K40, K37, K36, K35, K34, K33, K32, K31, K30,      K44, K87, \
	K26,      K24, K23, K22, K21, K20, K17, K16, K15, K14, K13, K12, KA0, K91, \
	K10, K06, K25,                K07,                K86, K85, K95, K90, K93  \
#define LAYOUT( \
  K77, K05, K04, K03, K02, K01, K00, KA7, KA6, KA5, KA4, KA3, KA2, K11, K94, \
  K27, K76, K75, K74, K73, K72, K71, K70, K67, K66, K65, K64, K63, K62, KA1, \
  K61, K60, K57, K56, K55, K54, K53, K52, K51, K50, K47, K46, K45,      K97, \
  K43, K42, K41, K40, K37, K36, K35, K34, K33, K32, K31, K30,      K44, K87, \
  K26,      K24, K23, K22, K21, K20, K17, K16, K15, K14, K13, K12, KA0, K91, \
  K10, K06, K25,                K07,                K86, K85, K95, K90, K93  \
) { \
{	KC_##K00,	KC_##K01,	KC_##K02,	KC_##K03,	KC_##K04,	KC_##K05,	KC_##K06,	KC_##K07,	}, \
{	KC_##K10,	KC_##K11,	KC_##K12,	KC_##K13,	KC_##K14,	KC_##K15,	KC_##K16,	KC_##K17,	}, \
{	KC_##K20,	KC_##K21,	KC_##K22,	KC_##K23,	KC_##K24,	KC_##K25,	KC_##K26,	KC_##K27,	}, \
{	KC_##K30,	KC_##K31,	KC_##K32,	KC_##K33,	KC_##K34,	KC_##K35,	KC_##K36,	KC_##K37,	}, \
{	KC_##K40,	KC_##K41,	KC_##K42,	KC_##K43,	KC_##K44,	KC_##K45,	KC_##K46,	KC_##K47,	}, \
{	KC_##K50,	KC_##K51,	KC_##K52,	KC_##K53,	KC_##K54,	KC_##K55,	KC_##K56,	KC_##K57,	}, \
{	KC_##K60,	KC_##K61,	KC_##K62,	KC_##K63,	KC_##K64,	KC_##K65,	KC_##K66,	KC_##K67,	}, \
{	KC_##K70,	KC_##K71,	KC_##K72,	KC_##K73,	KC_##K74,	KC_##K75,	KC_##K76,	KC_##K77,	}, \
{	KC_NO,		KC_NO,		KC_NO,		KC_NO,		KC_NO,		KC_##K85,	KC_##K86,	KC_##K87,	}, \
{	KC_##K90,	KC_##K91,	KC_NO,		KC_##K93,	KC_##K94,	KC_##K95,	KC_NO,		KC_##K97,	}, \
{	KC_##KA0,	KC_##KA1,	KC_##KA2,	KC_##KA3,	KC_##KA4,	KC_##KA5,	KC_##KA6,	KC_##KA7,	} \
  {  K00,    K01,    K02,    K03,    K04,    K05,  K06,    K07  }, \
  {  K10,    K11,    K12,    K13,    K14,    K15,  K16,    K17  }, \
  {  K20,    K21,    K22,    K23,    K24,    K25,  K26,    K27  }, \
  {  K30,    K31,    K32,    K33,    K34,    K35,  K36,    K37  }, \
  {  K40,    K41,    K42,    K43,    K44,    K45,  K46,    K47  }, \
  {  K50,    K51,    K52,    K53,    K54,    K55,  K56,    K57  }, \
  {  K60,    K61,    K62,    K63,    K64,    K65,  K66,    K67  }, \
  {  K70,    K71,    K72,    K73,    K74,    K75,  K76,    K77  }, \
  {  KC_NO,  KC_NO,  KC_NO,  KC_NO,  KC_NO,  K85,  K86,    K87  }, \
  {  K90,    K91,    KC_NO,  K93,    K94,    K95,  KC_NO,  K97  }, \
  {  KA0,    KA1,    KA2,    KA3,    KA4,    KA5,  KA6,    KA7  } \
}

#endif
\ No newline at end of file