aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--keyboard/retro_refit/Makefile139
-rw-r--r--keyboard/retro_refit/README.md24
-rw-r--r--keyboard/retro_refit/config.h79
-rw-r--r--keyboard/retro_refit/keymaps/default.c33
-rw-r--r--keyboard/retro_refit/retro_refit.c80
-rw-r--r--keyboard/retro_refit/retro_refit.h45
-rw-r--r--quantum/led.c12
-rw-r--r--quantum/template/template.c32
-rw-r--r--quantum/template/template.h1
m---------teensy-sdk0
-rw-r--r--tmk_core/common/led.h2
11 files changed, 438 insertions, 9 deletions
diff --git a/keyboard/retro_refit/Makefile b/keyboard/retro_refit/Makefile
new file mode 100644
index 000000000..ec51227ff
--- /dev/null
+++ b/keyboard/retro_refit/Makefile
@@ -0,0 +1,139 @@
1#----------------------------------------------------------------------------
2# On command line:
3#
4# make all = Make software.
5#
6# make clean = Clean out built project files.
7#
8# make coff = Convert ELF to AVR COFF.
9#
10# make extcoff = Convert ELF to AVR Extended COFF.
11#
12# make program = Download the hex file to the device.
13# Please customize your programmer settings(PROGRAM_CMD)
14#
15# make teensy = Download the hex file to the device, using teensy_loader_cli.
16# (must have teensy_loader_cli installed).
17#
18# make dfu = Download the hex file to the device, using dfu-programmer (must
19# have dfu-programmer installed).
20#
21# make flip = Download the hex file to the device, using Atmel FLIP (must
22# have Atmel FLIP installed).
23#
24# make dfu-ee = Download the eeprom file to the device, using dfu-programmer
25# (must have dfu-programmer installed).
26#
27# make flip-ee = Download the eeprom file to the device, using Atmel FLIP
28# (must have Atmel FLIP installed).
29#
30# make debug = Start either simulavr or avarice as specified for debugging,
31# with avr-gdb or avr-insight as the front end for debugging.
32#
33# make filename.s = Just compile filename.c into the assembler code only.
34#
35# make filename.i = Create a preprocessed source file for use in submitting
36# bug reports to the GCC project.
37#
38# To rebuild project do "make clean" then "make all".
39#----------------------------------------------------------------------------
40
41# Target file name (without extension).
42TARGET = retro_refit
43
44
45# Directory common source filess exist
46TOP_DIR = ../..
47TMK_DIR = ../../tmk_core
48
49# Directory keyboard dependent files exist
50TARGET_DIR = .
51
52# # project specific files
53SRC = retro_refit.c
54
55ifdef KEYMAP
56 SRC := keymaps/$(KEYMAP).c $(SRC)
57else
58 SRC := keymaps/default.c $(SRC)
59endif
60
61CONFIG_H = config.h
62
63# MCU name
64#MCU = at90usb1287
65MCU = atmega32u4
66
67# Processor frequency.
68# This will define a symbol, F_CPU, in all source code files equal to the
69# processor frequency in Hz. You can then use this symbol in your source code to
70# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
71# automatically to create a 32-bit value in your source code.
72#
73# This will be an integer division of F_USB below, as it is sourced by
74# F_USB after it has run through any CPU prescalers. Note that this value
75# does not *change* the processor frequency - it should merely be updated to
76# reflect the processor speed set externally so that the code can use accurate
77# software delays.
78F_CPU = 16000000
79
80
81#
82# LUFA specific
83#
84# Target architecture (see library "Board Types" documentation).
85ARCH = AVR8
86
87# Input clock frequency.
88# This will define a symbol, F_USB, in all source code files equal to the
89# input clock frequency (before any prescaling is performed) in Hz. This value may
90# differ from F_CPU if prescaling is used on the latter, and is required as the
91# raw input clock is fed directly to the PLL sections of the AVR for high speed
92# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'
93# at the end, this will be done automatically to create a 32-bit value in your
94# source code.
95#
96# If no clock division is performed on the input clock inside the AVR (via the
97# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
98F_USB = $(F_CPU)
99
100# Interrupt driven control endpoint task(+60)
101OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
102
103
104# Boot Section Size in *bytes*
105# Teensy halfKay 512
106# Teensy++ halfKay 1024
107# Atmel DFU loader 4096
108# LUFA bootloader 4096
109# USBaspLoader 2048
110OPT_DEFS += -DBOOTLOADER_SIZE=512
111
112
113# Build Options
114# comment out to disable the options.
115#
116BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000)
117MOUSEKEY_ENABLE = yes # Mouse keys(+4700)
118EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
119CONSOLE_ENABLE = yes # Console for debug(+400)
120COMMAND_ENABLE = yes # Commands for debug and configuration
121# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
122# SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend
123# NKRO_ENABLE = yes # USB Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
124# BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
125# MIDI_ENABLE = YES # MIDI controls
126# UNICODE_ENABLE = YES # Unicode
127# BLUETOOTH_ENABLE = yes # Enable Bluetooth with the Adafruit EZ-Key HID
128
129
130# Optimize size but this may cause error "relocation truncated to fit"
131#EXTRALDFLAGS = -Wl,--relax
132
133# Search Path
134VPATH += $(TARGET_DIR)
135VPATH += $(TOP_DIR)
136VPATH += $(TMK_DIR)
137
138include $(TOP_DIR)/quantum/quantum.mk
139
diff --git a/keyboard/retro_refit/README.md b/keyboard/retro_refit/README.md
new file mode 100644
index 000000000..d3c9d4197
--- /dev/null
+++ b/keyboard/retro_refit/README.md
@@ -0,0 +1,24 @@
1retro_refit keyboard firmware
2======================
3
4## Quantum MK Firmware
5
6For the full Quantum feature list, see [the parent README.md](/README.md).
7
8## Building
9
10Download or clone the whole firmware and navigate to the keyboard/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.
11
12Depending on which keymap you would like to use, you will have to compile slightly differently.
13
14### Default
15To build with the default keymap, simply run `make`.
16
17### Other Keymaps
18Several 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.
19
20To build the firmware binary hex file with a keymap just do `make` with `KEYMAP` option like:
21```
22$ make KEYMAP=[default|jack|<name>]
23```
24Keymaps follow the format **__\<name\>.c__** and are stored in the `keymaps` folder. \ No newline at end of file
diff --git a/keyboard/retro_refit/config.h b/keyboard/retro_refit/config.h
new file mode 100644
index 000000000..ba9a861ed
--- /dev/null
+++ b/keyboard/retro_refit/config.h
@@ -0,0 +1,79 @@
1/*
2Copyright 2012 Jun Wako <wakojun@gmail.com>
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18#ifndef CONFIG_H
19#define CONFIG_H
20
21#include "config_common.h"
22
23/* USB Device descriptor parameter */
24#define VENDOR_ID 0xFEED
25#define PRODUCT_ID 0x6060
26#define DEVICE_VER 0x0001
27#define MANUFACTURER Nobody
28#define PRODUCT retro_refit
29#define DESCRIPTION Retro Refit
30
31/* key matrix size */
32#define MATRIX_ROWS 11
33#define MATRIX_COLS 8
34
35// See note in retro_refit.h for an explanation of how this matrix is wired up
36#define COLS (int []){ B0, B1, B2, B3, D2, D3, C7, D5 }
37#define ROWS (int []){ D4, D7, B4, B5, B6, F7, F6, F5, F4, F1, F0 }
38
39/* COL2ROW or ROW2COL */
40#define DIODE_DIRECTION COL2ROW
41
42/* define if matrix has ghost */
43//#define MATRIX_HAS_GHOST
44
45/* number of backlight levels */
46#define BACKLIGHT_LEVELS 0
47
48/* Set 0 if debouncing isn't needed */
49#define DEBOUNCE 5
50
51/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
52#define LOCKING_SUPPORT_ENABLE
53/* Locking resynchronize hack */
54#define LOCKING_RESYNC_ENABLE
55
56/* key combination for command */
57#define IS_COMMAND() ( \
58 keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \
59)
60
61/*
62 * Feature disable options
63 * These options are also useful to firmware size reduction.
64 */
65
66/* disable debug print */
67//#define NO_DEBUG
68
69/* disable print */
70//#define NO_PRINT
71
72/* disable action features */
73//#define NO_ACTION_LAYER
74//#define NO_ACTION_TAPPING
75//#define NO_ACTION_ONESHOT
76//#define NO_ACTION_MACRO
77//#define NO_ACTION_FUNCTION
78
79#endif
diff --git a/keyboard/retro_refit/keymaps/default.c b/keyboard/retro_refit/keymaps/default.c
new file mode 100644
index 000000000..405402d5e
--- /dev/null
+++ b/keyboard/retro_refit/keymaps/default.c
@@ -0,0 +1,33 @@
1// This is the canonical layout file for the Quantum project. If you want to add another keyboard,
2// this is the style you want to emulate.
3
4#include "retro_refit.h"
5
6const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
7[0] =
8 KEYMAP( ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, NLCK, SLCK, PSCR, PAUS, \
9 GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS, EQL, BSPC, HOME, \
10 TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC, RBRC, PGUP, \
11 BSLS, A, S, D, F, G, H, J, K, L, SCLN, QUOT, ENT, PGDN, \
12 LSFT, Z, X, C, V, B, N, M, COMM, DOT, SLSH, RSFT, UP, END, \
13 LCTL, LGUI, LALT, SPC, INS, DEL, LEFT, DOWN, RGHT),
14};
15
16const uint16_t PROGMEM fn_actions[] = {
17
18};
19
20const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
21{
22 // MACRODOWN only works in this function
23 switch(id) {
24 case 0:
25 if (record->event.pressed) {
26 register_code(KC_RSFT);
27 } else {
28 unregister_code(KC_RSFT);
29 }
30 break;
31 }
32 return MACRO_NONE;
33};
diff --git a/keyboard/retro_refit/retro_refit.c b/keyboard/retro_refit/retro_refit.c
new file mode 100644
index 000000000..e01b8956a
--- /dev/null
+++ b/keyboard/retro_refit/retro_refit.c
@@ -0,0 +1,80 @@
1#include "retro_refit.h"
2
3__attribute__ ((weak))
4void * matrix_init_user(void) {
5 // leave this function blank - it can be defined in a keymap file
6 return NULL;
7};
8
9__attribute__ ((weak))
10void * matrix_scan_user(void) {
11 // leave this function blank - it can be defined in a keymap file
12 return NULL;
13};
14
15__attribute__ ((weak))
16void * led_set_user(uint8_t usb_led) {
17 // leave this function blank - it can be defined in a keymap file
18 return NULL;
19};
20
21void * matrix_init_kb(void) {
22 // put your keyboard start-up code here
23 // runs once when the firmware starts up
24
25 // Disable status LED on KB, enable status LED on Teensy (KB_STATUS = !TEENSY_STATUS)
26 DDRD |= (1<<6);
27 PORTD |= (1<<6);
28
29 if (matrix_init_user) {
30 (*matrix_init_user)();
31 }
32 return NULL;
33};
34
35void * matrix_scan_kb(void) {
36 // put your looping keyboard code here
37 // runs every cycle (a lot)
38
39 if (matrix_scan_user) {
40 (*matrix_scan_user)();
41 }
42 return NULL;
43};
44
45void * led_set_kb(uint8_t usb_led) {
46 // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here
47
48 if (usb_led & (1<<USB_LED_CAPS_LOCK)) {
49 // output low
50 DDRD |= (1<<0);
51 PORTD &= ~(1<<0);
52 } else {
53 // Hi-Z
54 DDRD &= ~(1<<0);
55 PORTD &= ~(1<<0);
56 }
57 if (usb_led & (1<<USB_LED_NUM_LOCK)) {
58 // output low
59 DDRD |= (1<<1);
60 PORTD &= ~(1<<1);
61 } else {
62 // Hi-Z
63 DDRD &= ~(1<<1);
64 PORTD &= ~(1<<1);
65 }
66 if (usb_led & (1<<USB_LED_SCROLL_LOCK)) {
67 // output low
68 DDRC |= (1<<6);
69 PORTC &= ~(1<<6);
70 } else {
71 // Hi-Z
72 DDRC &= ~(1<<6);
73 PORTC &= ~(1<<6);
74 }
75
76 if (led_set_user) {
77 (*led_set_user)(usb_led);
78 }
79 return NULL;
80}; \ No newline at end of file
diff --git a/keyboard/retro_refit/retro_refit.h b/keyboard/retro_refit/retro_refit.h
new file mode 100644
index 000000000..87f44e8de
--- /dev/null
+++ b/keyboard/retro_refit/retro_refit.h
@@ -0,0 +1,45 @@
1#ifndef RETRO_REFIT_H
2#define RETRO_REFIT_H
3
4#include "matrix.h"
5#include "keymap_common.h"
6#include "led.h"
7#include <stddef.h>
8
9// This macro is an example of using a non-standard row-column matrix. The
10// keyboard in question had 11 rows and 8 columns, but the rows were not all
11// horizontal, and the columns were not all vertical. For example, row 2
12// contained "Print Screen", "N", "M", ",", ".", "/", "Right Shift", and
13// "Left Alt". Column 0 contained "F6", "7", "O", "'", "Q", "D", "B",
14// "Left Alt", "Up Arrow", and "Down Arrow".
15//
16// The macro makes programming the keys easier and in a more straight-forward
17// manner because it realigns the keys into a 6x15 sensible keyboard layout
18// instead of the obtuse 11x8 matrix.
19
20#define KEYMAP( \
21 K77, K05, K04, K03, K02, K01, K00, KA7, KA6, KA5, KA4, KA3, KA2, K11, K94, \
22 K27, K76, K75, K74, K73, K72, K71, K70, K67, K66, K65, K64, K63, K62, KA1, \
23 K61, K60, K57, K56, K55, K54, K53, K52, K51, K50, K47, K46, K45, K97, \
24 K43, K42, K41, K40, K37, K36, K35, K34, K33, K32, K31, K30, K44, K87, \
25 K26, K24, K23, K22, K21, K20, K17, K16, K15, K14, K13, K12, KA0, K91, \
26 K10, K06, K25, K07, K86, K85, K95, K90, K93 \
27) { \
28{ KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07, }, \
29{ KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_##K17, }, \
30{ KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_##K27, }, \
31{ KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_##K34, KC_##K35, KC_##K36, KC_##K37, }, \
32{ KC_##K40, KC_##K41, KC_##K42, KC_##K43, KC_##K44, KC_##K45, KC_##K46, KC_##K47, }, \
33{ KC_##K50, KC_##K51, KC_##K52, KC_##K53, KC_##K54, KC_##K55, KC_##K56, KC_##K57, }, \
34{ KC_##K60, KC_##K61, KC_##K62, KC_##K63, KC_##K64, KC_##K65, KC_##K66, KC_##K67, }, \
35{ KC_##K70, KC_##K71, KC_##K72, KC_##K73, KC_##K74, KC_##K75, KC_##K76, KC_##K77, }, \
36{ KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_##K85, KC_##K86, KC_##K87, }, \
37{ KC_##K90, KC_##K91, KC_NO, KC_##K93, KC_##K94, KC_##K95, KC_NO, KC_##K97, }, \
38{ KC_##KA0, KC_##KA1, KC_##KA2, KC_##KA3, KC_##KA4, KC_##KA5, KC_##KA6, KC_##KA7, } \
39}
40
41void * matrix_init_user(void);
42void * matrix_scan_user(void);
43void * led_set_user(uint8_t usb_led);
44
45#endif \ No newline at end of file
diff --git a/quantum/led.c b/quantum/led.c
index 2c0574660..a53e94043 100644
--- a/quantum/led.c
+++ b/quantum/led.c
@@ -16,9 +16,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/ 16*/
17 17
18#include <avr/io.h> 18#include <avr/io.h>
19#include "stdint.h" 19#include <stddef.h>
20#include "led.h" 20#include "led.h"
21 21
22__attribute__ ((weak))
23void * led_set_kb(uint8_t usb_led) {
24 return NULL;
25};
22 26
23void led_set(uint8_t usb_led) 27void led_set(uint8_t usb_led)
24{ 28{
@@ -35,4 +39,10 @@ void led_set(uint8_t usb_led)
35 // DDRE &= ~(1<<6); 39 // DDRE &= ~(1<<6);
36 // PORTE &= ~(1<<6); 40 // PORTE &= ~(1<<6);
37 // } 41 // }
42
43 if (led_set_kb) {
44 (*led_set_kb)(usb_led);
45 }
46
47 return;
38} 48}
diff --git a/quantum/template/template.c b/quantum/template/template.c
index 7dcd67cfc..828afb18c 100644
--- a/quantum/template/template.c
+++ b/quantum/template/template.c
@@ -2,22 +2,38 @@
2 2
3__attribute__ ((weak)) 3__attribute__ ((weak))
4void matrix_init_user(void) { 4void matrix_init_user(void) {
5 // leave these blank 5 // leave this function blank - it can be defined in a keymap file
6} 6 return NULL;
7};
7 8
8__attribute__ ((weak)) 9__attribute__ ((weak))
9void matrix_scan_user(void) { 10void matrix_scan_user(void) {
10 // leave these blank 11 // leave this function blank - it can be defined in a keymap file
11} 12 return NULL;
13};
14
15__attribute__ ((weak))
16void led_set_user(uint8_t usb_led) {
17 // leave this function blank - it can be defined in a keymap file
18 return NULL;
19};
12 20
13void matrix_init_kb(void) { 21void matrix_init_kb(void) {
14 // put your keyboard start-up code here 22 // put your keyboard start-up code here
15 // runs once when the firmware starts up 23 // runs once when the firmware starts up
24
16 matrix_init_user(); 25 matrix_init_user();
17} 26};
18 27
19void matrix_scan_kb(void) { 28void matrix_scan_kb(void) {
20 // put your looping keyboard code here 29 // put your looping keyboard code here
21 // runs every cycle (a lot) 30 // runs every cycle (a lot)
31
22 matrix_scan_user(); 32 matrix_scan_user();
23} \ No newline at end of file 33};
34
35void led_set_kb(uint8_t usb_led) {
36 // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here
37
38 led_set_user(usb_led);
39}; \ No newline at end of file
diff --git a/quantum/template/template.h b/quantum/template/template.h
index 1171dc8e0..ba91abac3 100644
--- a/quantum/template/template.h
+++ b/quantum/template/template.h
@@ -21,5 +21,6 @@
21 21
22void matrix_init_user(void); 22void matrix_init_user(void);
23void matrix_scan_user(void); 23void matrix_scan_user(void);
24void led_set_user(uint8_t usb_led);
24 25
25#endif \ No newline at end of file 26#endif \ No newline at end of file
diff --git a/teensy-sdk b/teensy-sdk
deleted file mode 160000
Subproject 19892c196894e6676fa69c732e05a03a68d5cb0
diff --git a/tmk_core/common/led.h b/tmk_core/common/led.h
index d5fc051bf..4b9632d3a 100644
--- a/tmk_core/common/led.h
+++ b/tmk_core/common/led.h
@@ -33,6 +33,8 @@ extern "C" {
33#endif 33#endif
34 34
35void led_set(uint8_t usb_led); 35void led_set(uint8_t usb_led);
36void * led_set_kb(uint8_t usb_led);
37
36 38
37#ifdef __cplusplus 39#ifdef __cplusplus
38} 40}