~ruther/qmk_firmware

dcc363390f47ec23fdbc04bb56bb03a3cbf310e6 — Max 7 years ago 62eed0e
Added Daisy port (#2016)

* Add files via upload

* Update readme.md

* Update readme.md

* Update readme.md

* Add files via upload

* Delete config.h

* Delete rules.mk

* Add files via upload

* Update config.h

* revised config files

* revised readme

* Update readme.md

* Update readme.md
A keyboards/daisy/config.h => keyboards/daisy/config.h +175 -0
@@ 0,0 1,175 @@
#ifndef CONFIG_H
#define CONFIG_H

#include "config_common.h"

/* USB Device descriptor parameter */
#define VENDOR_ID       0x1209
#define PRODUCT_ID      0x2328
#define DEVICE_VER      0x501
#define MANUFACTURER    K.T.E.C.
#define PRODUCT         Daisy
#define DESCRIPTION     qmk port for Daisy

/* key matrix size */
#define MATRIX_ROWS 4
#define MATRIX_COLS 11

/*
 * 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 { D2, D3, D5, B7 }
#define MATRIX_COL_PINS { F0, F1, F4, F5, F6, F7, B6, B5, B4, D7, D6 }
#define UNUSED_PINS

/* COL2ROW, ROW2COL, or CUSTOM_MATRIX */
#define DIODE_DIRECTION COL2ROW
 
#define BACKLIGHT_PIN D0
#define BACKLIGHT_LEVELS 6


/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
#define DEBOUNCING_DELAY 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

/*
 * 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 */
#define IS_COMMAND() ( \
    keyboard_report->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

// ws2812 options
#define RGB_DI_PIN C7 // pin the DI on the ws2812 is hooked-up to
#define RGBLIGHT_ANIMATIONS // run RGB animations
#define RGBLED_NUM 8 // number of LEDs
#define RGBLIGHT_HUE_STEP 12 // units to step when in/decreasing hue
#define RGBLIGHT_SAT_STEP 25 // units to step when in/decresing saturation
#define RGBLIGHT_VAL_STEP 12 // units to step when in/decreasing value (brightness)

/*
 * 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

#endif

A keyboards/daisy/daisy.c => keyboards/daisy/daisy.c +15 -0
@@ 0,0 1,15 @@
#include "daisy.h"

void led_set_kb(uint8_t usb_led) {
	// put your keyboard LED indicator (ex: Caps Lock LED) toggling code here
  if (usb_led & (1<<USB_LED_CAPS_LOCK)) {
        // output low
        DDRC  |=  (1<<PC6);
        PORTC &= ~(1<<PC6);
    } else {
        // Hi-Z
        DDRC  &= ~(1<<PC6);
        PORTC &= ~(1<<PC6);
  }
	led_set_user(usb_led);
}
\ No newline at end of file

A keyboards/daisy/daisy.h => keyboards/daisy/daisy.h +19 -0
@@ 0,0 1,19 @@
#ifndef DAISY_H
#define DAISY_H

#include "quantum.h"

#define KEYMAP( \
	K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K3A, \
	K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, \
	K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, \
	K30, K31, K32, K34, K35, K37, K38, K39 \
) \
{ \
	{ K00, K01, K02, K03,   K04, K05, K06,   K07, K08, K09, K0A }, \
	{ K10, K11, K12, K13,   K14, K15, K16,   K17, K18, K19, K1A }, \
	{ K20, K21, K22, K23,   K24, K25, K26,   K27, K28, K29, K2A }, \
	{ K30, K31, K32, KC_NO, K34, K35, KC_NO, K37, K38, K39, K3A }  \
}

#endif
\ No newline at end of file

A keyboards/daisy/keymaps/default/keymap.c => keyboards/daisy/keymaps/default/keymap.c +99 -0
@@ 0,0 1,99 @@
	#include "daisy.h"
#include "action_layer.h"

extern keymap_config_t keymap_config;

// Layer shorthand
#define _BL 0
#define _LW 1
#define _RS 2

enum layer_keycodes {
	QWERTY = SAFE_RANGE, LOWER, RAISE
};

const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {

/* Base Layer
 * .-----------------------------------------------------------------------.
 * | ESC | Q   | W   | E   | R   | T   | Y   | U   | I   | O   | P   | \|  |
 * |-----------------------------------------------------------------------|
 * | TAB   | A   | S   | D   | F   | G   | H   | J   | K   | L   | ENTER   |
 * |-----------------------------------------------------------------------|
 * | LSHIFT | Z   | X    | C   | V   | B   | N   | M   | ,<  | .>  | /?    |
 * |-----------------------------------------------------------------------|
 * | LCTRL | LGUI | LALT | SPACE   | BACKSPACE      | LW     | RS  | RALT  |
 * '-----------------------------------------------------------------------'
 */

	[_BL] = KEYMAP(
  GRAVE_ESC,  KC_Q,    KC_W,    KC_E,    KC_R,    KC_T,     KC_Y,     KC_U,   KC_I,    KC_O,    KC_P,    KC_BSLS,
  KC_TAB,  KC_A,    KC_S,    KC_D,    KC_F,    KC_G,     KC_H,     KC_J,   KC_K,    KC_L,    KC_ENT,
  KC_LSFT, KC_Z,    KC_X,    KC_C,    KC_V,    KC_B,     KC_N,     KC_M,   KC_COMM, KC_DOT,  KC_SLSH,
  KC_LCTL, KC_LGUI, KC_LALT, KC_SPC,  KC_BSPC, LOWER, RAISE, KC_RALT ),
 

/* Function Layer
 * .-----------------------------------------------------------------------.
 * | GRV | 1   | 2   | 3   | 4   | 5   | 6   | 7   | 8   | 9   | 0   | -_  |
 * |-----------------------------------------------------------------------|
 * |       | =+  | UP  |     |     |     | [{  | ]}  | ;:  | '"  |         |
 * |-----------------------------------------------------------------------|
 * |        | LEFT| DOWN |RIGHT|     |     |     |     |     |     |       |
 * |-----------------------------------------------------------------------|
 * |       |      |      |         | DELETE         |        |     |       |
 * '-----------------------------------------------------------------------'
 */
 
	[_LW] = KEYMAP(
  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_TRNS, KC_EQL,  KC_UP,   KC_TRNS, KC_TRNS, KC_TRNS, KC_LBRC, KC_RBRC, KC_SCLN, KC_QUOT, KC_TRNS,
  KC_TRNS, KC_LEFT, KC_DOWN, KC_RGHT, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
  KC_LCTL, KC_LGUI, KC_LALT, KC_TRNS, KC_DEL,  KC_TRNS, KC_TRNS, KC_TRNS ),
 
 
 /* Second Function Layer
 * .-----------------------------------------------------------------------.
 * | RST | F1  | F2  | F3  | F4  | F5  | F6  |     | HOME| PGUP|     |     |
 * |-----------------------------------------------------------------------|
 * |      | F7  | F8  | F9  | F10 | F11 | F12 |     | END | PGDN|          |
 * |-----------------------------------------------------------------------|
 * |       |RGBtog|RGBmod|RGBhud|RGBhui|RGBvad|RGBvai|RGBsad|RGBsai|BL|    |
 * |-----------------------------------------------------------------------|
 * |       |      |      |         |                |        |     |       |
 * '-----------------------------------------------------------------------'
 */
 
	[_RS] = KEYMAP(
  RESET,   KC_F1,   KC_F2,    KC_F3,   KC_F4,   KC_F5,   KC_F6,   KC_TRNS, KC_HOME, KC_PGUP,  KC_TRNS,  KC_TRNS,
  KC_TRNS, KC_F7,   KC_F8,    KC_F9,   KC_F10,  KC_F11,  KC_F12,  KC_TRNS, KC_END,  KC_PGDN,  KC_TRNS,
  KC_TRNS, RGB_TOG, RGB_SMOD, RGB_HUD, RGB_HUI, RGB_VAD, RGB_VAI, RGB_SAD, RGB_SAI, BL_STEP,  KC_TRNS,
  KC_TRNS, KC_TRNS, KC_TRNS,  KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS ),
 
};

const uint16_t PROGMEM fn_actions[] = {

};

bool process_record_user(uint16_t keycode, keyrecord_t *record) {
	switch (keycode) {
		case LOWER:
		  if(record->event.pressed){
			   layer_on(_LW);
		  } else {
			  layer_off(_LW);
		  }
		  return false;
		  break;
		  case RAISE:
		  if(record->event.pressed){
			   layer_on(_RS);
		  } else {
			  layer_off(_RS);
		  }
		  return false;
		  break;
	}
  return true;
};
\ No newline at end of file

A keyboards/daisy/keymaps/default/readme.md => keyboards/daisy/keymaps/default/readme.md +5 -0
@@ 0,0 1,5 @@
![Daisy Layout Image](https://imgur.com/9mSF0yf)

# Default Daisy Layout

This is the default layout as offered by KPRepublic's TMK firmware for the Daisy with a few minor tweaks for usability made by me.

A keyboards/daisy/readme.md => keyboards/daisy/readme.md +29 -0
@@ 0,0 1,29 @@
# Daisy

A 40% keyboard kit sold by KPRepublic.

Keyboard Maintainer: westfoxtrot (https://github.com/westfoxtrot)  
Hardware Supported: Daisy PCB Rev.1, Daisy PCB Rev.2  
Hardware Availability: http://tinyurl.com/yc26lq22

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

    make daisy:default

See [build environment setup](https://docs.qmk.fm/build_environment_setup.html) then the [make instructions](https://docs.qmk.fm/make_instructions.html) for more information.


# Other Keymaps

The "default" keymap included is the layout I personally use on the Daisy and the one I have found the most comfortable.

A printable picture showing this layout is available here: https://imgur.com/9mSF0yf


```
$ make daisy:[default|<name>]
```

# Bootloader

I personally had issues with the bootloader on my Daisy PCB and was unable to flash a firmware to the board after the first time. I replaced the bootloader with the one available in the repository at ../../util/bootloader_atmega32u4_1_0_0.hex

A keyboards/daisy/rules.mk => keyboards/daisy/rules.mk +66 -0
@@ 0,0 1,66 @@
# MCU name
#MCU = at90usb1286
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


# Boot Section Size in *bytes*
#   Teensy halfKay   512
#   Teensy++ halfKay 1024
#   Atmel DFU loader 4096
#   LUFA bootloader  4096
#   USBaspLoader     2048
OPT_DEFS += -DBOOTLOADER_SIZE=4996

# QMK Build Options
#   change to "no" to disable the options, or define them in the Makefile in 
#   the appropriate keymap folder that will get included automatically
#
BOOTMAGIC_ENABLE = no       # Virtual DIP switch configuration(+1000)
MOUSEKEY_ENABLE = no        # Mouse keys(+4700)
EXTRAKEY_ENABLE = yes       # Audio control and System control(+450)
CONSOLE_ENABLE = no         # Console for debug(+400)
COMMAND_ENABLE = no         # Commands for debug and configuration
NKRO_ENABLE = yes           # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
BACKLIGHT_ENABLE = yes      # Enable keyboard backlight functionality
MIDI_ENABLE = no            # MIDI support (+2400 to 4200, depending on config)
AUDIO_ENABLE = no           # Audio output on port C6
UNICODE_ENABLE = no         # Unicode
BLUETOOTH_ENABLE = no       # Enable Bluetooth with the Adafruit EZ-Key HID
RGBLIGHT_ENABLE = yes       # Enable WS2812 RGB underlight.  Do not enable this with audio at the same time.
SLEEP_LED_ENABLE = no       # Breathing sleep LED during USB suspend
\ No newline at end of file