adds avr example keyboard

This commit is contained in:
Jack Humbert 2017-07-07 23:26:00 -04:00
parent 03706de946
commit 23707efe4f
10 changed files with 362 additions and 0 deletions

View File

@ -0,0 +1,3 @@
ifndef MAKEFILE_INCLUDED
include ../../Makefile
endif

View File

@ -0,0 +1,50 @@
/*
Copyright 2012 Jun Wako <wakojun@gmail.com>
2017 Jack Humbert
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 "_example_avr.h"
void matrix_init_kb(void) {
// put your keyboard start-up code here
// runs once when the firmware starts up
// keep this line at the end of the function
matrix_init_user();
}
void matrix_scan_kb(void) {
// put your looping keyboard code here
// runs every cycle (a lot)
// keep this line at the end of the function
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
// keep this line at the end of the function
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
// keep this line at the end of the function
led_set_user(usb_led);
}

View File

@ -0,0 +1,35 @@
/*
Copyright 2012 Jun Wako <wakojun@gmail.com>
2017 Jack Humbert
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/>.
*/
#ifndef _EXAMPLE_AVR_H
#define _EXAMPLE_AVR_H
#include "quantum.h"
// This a shortcut to help you visually see your layout.
// The first section contains all of the arguements
// The second converts the arguments into a two-dimensional array
#define KEYMAP( \
k00, k01, \
k10, k11 \
) { \
{ k00, k01, }, \
{ k10, k11, } \
}
#endif

View File

@ -0,0 +1,101 @@
/*
Copyright 2012 Jun Wako <wakojun@gmail.com>
2017 Jack Humbert
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/>.
*/
#ifndef CONFIG_H
#define CONFIG_H
#include "config_common.h"
#define VENDOR_ID 0x1234
#define PRODUCT_ID 0x5678
#define DEVICE_VER 0x0001
#define MANUFACTURER Example Company
#define PRODUCT Example Keyboard
#define DESCRIPTION A short description
#define MATRIX_ROWS 2
#define MATRIX_COLS 2
#define MATRIX_ROW_PINS { F0, F5 }
#define MATRIX_COL_PINS { F1, F7 }
#define UNUSED_PINS
#define MATRIX_HAS_GHOST // define is matrix has ghost (unlikely)
#define DIODE_DIRECTION COL2ROW // COL2ROW or ROW2COL - how your matrix is configured
// COL2ROW means the black mark on your diode is facing to the rows, and between the switch and the rows
// #define AUDIO_VOICES // turns on the alternate audio voices (to cycle through)
// #define C6_AUDIO // enables audio on pin C6
// #define B5_AUDIO // enables audio on pin B5 (duophony is enable if both are enabled)
#define BACKLIGHT_PIN B7 // pin of the backlight - B5, B6, B7 use PWM, others use softPWM
#define BACKLIGHT_LEVELS 3 // number of levels your backlight will have (not including off)
#define DEBOUNCING_DELAY 5 // the delay when reading the value of the pin (5 is default)
// #define LOCKING_SUPPORT_ENABLE // mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap
// #define LOCKING_RESYNC_ENABLE // tries to keep switch state consistent with keyboard LED state
// key combination that allows the use of magic commands (useful for debugging)
#define IS_COMMAND() ( \
keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \
)
// the following options can save on file size at the expense of that feature
// #define NO_DEBUG // disable debuging (saves on file size)
// #define NO_PRINT // disable printing (saves of file size)
// #define NO_ACTION_LAYER // no layers
// #define NO_ACTION_TAPPING // no tapping for layers/mods
// #define NO_ACTION_ONESHOT // no oneshot for layers/mods
// #define NO_ACTION_MACRO // no macros
// #define NO_ACTION_FUNCTION // no functions
// #define FORCE_NKRO // NKRO by default requires to be turned on, this forces it to be on always
// #define PREVENT_STUCK_MODIFIERS // when switching layers, this will release all mods
// #define TAPPING_TERM 200 // how long before a tap becomes a hold
// #define TAPPING_TOGGLE 2 // how many taps before triggering the toggle
// #define PERMISSIVE_HOLD // makes tap and hold keys work better for fast typers who don't want tapping term set above 500
// #define LEADER_TIMEOUT 300 // how long before the leader key times out
// #define ONESHOT_TIMEOUT 300 // how long before oneshot times out
// #define ONESHOT_TAP_TOGGLE 2 // how many taps before oneshot toggle is triggered
// #define IGNORE_MOD_TAP_INTERRUPT // makes it possible to do rolling combos (zx) with keys that convert to other keys on hold
// ws2812 options
// #define RGB_DI_PIN D7 // pin the DI on the ws2812 is hooked-up to
// #define RGBLIGHT_ANIMATIONS // run RGB animations
// #define RGBLED_NUM 15 // 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)
// #define RGBW_BB_TWI // bit-bangs twi to EZ RGBW LEDs (only required for Ergodox EZ)
// mousekey options (self-describing)
// #define MOUSEKEY_INTERVAL 20
// #define MOUSEKEY_DELAY 0
// #define MOUSEKEY_TIME_TO_MAX 60
// #define MOUSEKEY_MAX_SPEED 7
// #define MOUSEKEY_WHEEL_DELAY 0
#endif

View File

@ -0,0 +1,3 @@
ifndef QUANTUM_DIR
include ../../../../Makefile
endif

View File

@ -0,0 +1,26 @@
/*
Copyright 2012 Jun Wako <wakojun@gmail.com>
2017 Jack Humbert
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/>.
*/
#ifndef CONFIG_USER_H
#define CONFIG_USER_H
#include "../../config.h"
// place overrides here
#endif

View File

@ -0,0 +1,44 @@
/*
Copyright 2012 Jun Wako <wakojun@gmail.com>
2017 Jack Humbert
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 "_example_avr.h"
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[0] = KEYMAP(
KC_A, KC_B, \
KC_C, KC_D \
)
};
void matrix_init_user(void) {
}
void matrix_scan_user(void) {
}
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
// this line is necessary to keep at the end of the function
return true;
}
void led_set_user(uint8_t usb_led) {
}

View File

@ -0,0 +1,3 @@
# The default keymap for the example
Feel free to provide an explanation on why certain things were chosen here.

View File

@ -0,0 +1,13 @@
# Example AVR
A short description explaining the keyboard/project. Extended info can go on qmk.fm/<keyboard>.
* Keyboard Maintainer: [Name/Handle](link to their github account)
* Hardware Supported: PCB/controller name, version
* Hardware Availability: Website for details
Make example for this keyboard (after setting up your build environment):
make _example_avr-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.

View File

@ -0,0 +1,84 @@
# Copyright 2012 Jun Wako <wakojun@gmail.com>
# 2017 Jack Humbert
# 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/>.
# 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=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
RGBLIGHT_ENABLE = no # Enable keyboard underlight functionality (+4870)
BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality by default
MIDI_ENABLE = no # MIDI controls
UNICODE_ENABLE = no # Unicode
BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
AUDIO_ENABLE = no # Audio output on port C6