aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--keyboards/handwired/space_oddity/config.h66
-rw-r--r--keyboards/handwired/space_oddity/keymaps/default/keymap.c156
-rw-r--r--keyboards/handwired/space_oddity/readme.md25
-rw-r--r--keyboards/handwired/space_oddity/rules.mk57
-rw-r--r--keyboards/handwired/space_oddity/space_oddity.c1
-rw-r--r--keyboards/handwired/space_oddity/space_oddity.h22
6 files changed, 327 insertions, 0 deletions
diff --git a/keyboards/handwired/space_oddity/config.h b/keyboards/handwired/space_oddity/config.h
new file mode 100644
index 000000000..88cc5ad00
--- /dev/null
+++ b/keyboards/handwired/space_oddity/config.h
@@ -0,0 +1,66 @@
+#ifndef CONFIG_H
+#define CONFIG_H
+
+#include "config_common.h"
+
+/* USB Device descriptor parameter */
+#define VENDOR_ID 0xFEED
+#define PRODUCT_ID 0x6060
+#define DEVICE_VER 0x0001
+#define MANUFACTURER James Taylor
+#define PRODUCT Space Odyssey
+#define DESCRIPTION Keyboard
+
+#define CATERINA_BOOTLOADER
+
+#define MOUSEKEY_INTERVAL 16
+#define MOUSEKEY_DELAY 0
+#define MOUSEKEY_TIME_TO_MAX 60
+#define MOUSEKEY_MAX_SPEED 7
+#define MOUSEKEY_WHEEL_DELAY 0
+
+/* key matrix size */
+#define MATRIX_ROWS 6
+#define MATRIX_COLS 12
+
+/* key matrix pins */
+#define MATRIX_ROW_PINS { F4, F5, F6, F7, B1, B3 }
+#define MATRIX_COL_PINS { B2, B6, B5, B4, E6, D7, C6, D4, D0, D1, D2, D3 }
+#define UNUSED_PINS
+
+/* COL2ROW or ROW2COL */
+#define DIODE_DIRECTION COL2ROW
+
+/* number of backlight levels */
+
+#ifdef BACKLIGHT_PIN
+#define BACKLIGHT_LEVELS 0
+#endif
+
+/* Set 0 if debouncing isn't needed */
+#define DEBOUNCING_DELAY 5
+
+/* 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
+
+/* key combination for command */
+#define IS_COMMAND() ( \
+ keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \
+)
+
+/* prevent stuck modifiers */
+#define PREVENT_STUCK_MODIFIERS
+
+
+#ifdef RGB_DI_PIN
+#define RGBLIGHT_ANIMATIONS
+#define RGBLED_NUM 0
+#define RGBLIGHT_HUE_STEP 8
+#define RGBLIGHT_SAT_STEP 8
+#define RGBLIGHT_VAL_STEP 8
+#endif
+
+#endif
diff --git a/keyboards/handwired/space_oddity/keymaps/default/keymap.c b/keyboards/handwired/space_oddity/keymaps/default/keymap.c
new file mode 100644
index 000000000..26be16fbd
--- /dev/null
+++ b/keyboards/handwired/space_oddity/keymaps/default/keymap.c
@@ -0,0 +1,156 @@
+/* Keymap for Space Oddity Keyboard
+ Copyright (C) 2017 James Taylor
+
+ 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 3 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 <https://www.gnu.org/licenses/>.
+*/
+
+#include "space_oddity.h"
+
+// Planck keycodes needed for dynamic macros
+enum planck_keycodes {
+
+ QWERTY = SAFE_RANGE,
+ DYNAMIC_MACRO_RANGE,
+
+};
+
+// Tap Dance
+enum {
+
+ SFT_CAPS = 0,
+
+};
+
+#include "dynamic_macro.h"
+
+#define MOUSE_LAYER 2
+
+const uint16_t PROGMEM fn_actions[] = {
+
+ [2] = ACTION_LAYER_TOGGLE(MOUSE_LAYER),
+
+};
+
+qk_tap_dance_action_t tap_dance_actions[] = {
+
+ [SFT_CAPS] = ACTION_TAP_DANCE_DOUBLE(KC_LSFT, KC_CAPS),
+
+};
+
+const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+
+ KEYMAP(
+ M(0), M(1), M(2), M(3), M(4), DYN_MACRO_PLAY1, DYN_MACRO_PLAY2,
+ KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC,
+ KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_MINS,
+ CTL_T(KC_ESC), KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT,
+ TD(SFT_CAPS), KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, SFT_T(KC_ENT),
+ MO(2), MO(1), KC_LGUI, KC_RALT, KC_LCTRL, KC_SPC, ALT_T(KC_LEFT), ALL_T(KC_RGHT), LT(1, KC_UP), LT(2, KC_DOWN)),
+
+ KEYMAP(
+ M(7), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, DYN_REC_START1, DYN_REC_START2,
+ DYN_REC_STOP, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_LBRC, KC_P7, KC_P8, KC_P9, KC_ASTR, KC_DEL,
+ KC_TRNS, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_RBRC, KC_P4, KC_P5, KC_P6, KC_PLUS, KC_EQL,
+ KC_BSLS, KC_F11, KC_F12, KC_F13, KC_F14, KC_F15, KC_LCBR, KC_P1, KC_P2, KC_P3, KC_MINS, KC_PIPE,
+ KC_TRNS, KC_F16, KC_F17, KC_F18, KC_F19, KC_F20, KC_RCBR, KC_P0, KC_COMM, KC_DOT, KC_SLSH, KC_TRNS,
+ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
+
+ KEYMAP(
+ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
+ KC_TRNS, KC_TRNS, KC_TRNS, KC_MS_UP, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
+ KC_TRNS, KC_TRNS, KC_MS_LEFT, KC_MS_DOWN, KC_MS_RIGHT, KC_TRNS, KC_TRNS, KC_MS_BTN1, KC_MS_BTN3, KC_MS_BTN2, KC_TRNS, KC_TRNS,
+ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
+ KC_TRNS, RESET, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
+ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, F(2))
+};
+
+const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) {
+
+ switch (id) {
+ case 0:
+ if (record->event.pressed) {
+ SEND_STRING("()"SS_TAP(X_LEFT));
+ }
+ break;
+
+ case 1:
+ if (record->event.pressed) {
+ SEND_STRING("[]"SS_TAP(X_LEFT));
+ }
+ break;
+
+ case 2:
+ if (record->event.pressed) {
+ SEND_STRING("{}"SS_TAP(X_LEFT));
+ }
+ break;
+
+ case 7:
+ if (record->event.pressed) {
+ SEND_STRING("(lambda ())"SS_TAP(X_LEFT)SS_TAP(X_LEFT));
+ }
+ break;
+ }
+
+ return MACRO_NONE;
+
+}
+
+void matrix_init_user(void) {
+}
+
+void matrix_scan_user(void) {
+}
+
+bool process_record_user(uint16_t keycode, keyrecord_t *record) {
+
+ if (!process_record_dynamic_macro(keycode, record)) {
+ return false;
+ }
+ return true;
+}
+
+void led_set_user(uint8_t usb_led) {
+
+ if (usb_led & (1 << USB_LED_NUM_LOCK)) {
+
+ } else {
+
+ }
+
+ if (usb_led & (1 << USB_LED_CAPS_LOCK)) {
+
+ } else {
+
+ }
+
+ if (usb_led & (1 << USB_LED_SCROLL_LOCK)) {
+
+ } else {
+
+ }
+
+ if (usb_led & (1 << USB_LED_COMPOSE)) {
+
+ } else {
+
+ }
+
+ if (usb_led & (1 << USB_LED_KANA)) {
+
+ } else {
+
+ }
+
+}
diff --git a/keyboards/handwired/space_oddity/readme.md b/keyboards/handwired/space_oddity/readme.md
new file mode 100644
index 000000000..1dadcb8a9
--- /dev/null
+++ b/keyboards/handwired/space_oddity/readme.md
@@ -0,0 +1,25 @@
+Space Oddity Keyboard
+=====================
+
+This firmware is for an Emacs-focused handwired custom keyboard using an Arduino Pro Micro.
+
+As originally designed, the top row consists of 2u keys which are used for user-defined macros. The keys for Shift and Enter are 1.75u.
+
+Some simple example macros are included. To add your own, simply add the number of the macro you want in the appropriate section.
+
+A picture of the finished product can be found here: https://imgur.com/dE9Y4XK
+
+## Pinout
+
+The following pins are used:
+- Columns 1-12: B2, B6, B5, B4, E6, D7, C6, D4, D0, D1, D2, D3
+- Rows 1-6: F4, F5, F6, F7, B1, B3
+
+## Compiling and loading the firmware
+
+To build the firmware, run `make handwired/space-oddity` from the toplevel directory.
+
+On GNU/Linux, you can flash the default layout onto the microcontroller by using `avrdude -p atmega32u4 -P /dev/ttyACM0 -c avr109 -U flash:w:handwired_space_oddity_default.hex`. Note that the device name under `/dev` may be different.
+
+
+This design was conceived by James Taylor. Any requests for further information and/or tips for building your own are welcome! \ No newline at end of file
diff --git a/keyboards/handwired/space_oddity/rules.mk b/keyboards/handwired/space_oddity/rules.mk
new file mode 100644
index 000000000..170c64a30
--- /dev/null
+++ b/keyboards/handwired/space_oddity/rules.mk
@@ -0,0 +1,57 @@
+# 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
+
+
+# Boot Section Size in *bytes*
+OPT_DEFS += -DBOOTLOADER_SIZE=4096
+
+
+# Build Options
+# comment out to disable the options.
+#
+BOOTMAGIC_ENABLE ?= yes # Virtual DIP switch configuration(+1000)
+MOUSEKEY_ENABLE ?= yes # 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
+SLEEP_LED_ENABLE ?= no # Breathing sleep LED during USB suspend
+NKRO_ENABLE ?= yes # USB Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
+BACKLIGHT_ENABLE ?= no # Enable keyboard backlight functionality
+AUDIO_ENABLE ?= no
+RGBLIGHT_ENABLE ?= no
+TAP_DANCE_ENABLE = yes
diff --git a/keyboards/handwired/space_oddity/space_oddity.c b/keyboards/handwired/space_oddity/space_oddity.c
new file mode 100644
index 000000000..9a9a270a4
--- /dev/null
+++ b/keyboards/handwired/space_oddity/space_oddity.c
@@ -0,0 +1 @@
+#include "space_oddity.h"
diff --git a/keyboards/handwired/space_oddity/space_oddity.h b/keyboards/handwired/space_oddity/space_oddity.h
new file mode 100644
index 000000000..e9270d044
--- /dev/null
+++ b/keyboards/handwired/space_oddity/space_oddity.h
@@ -0,0 +1,22 @@
+#ifndef KB_H
+#define KB_H
+
+#include "quantum.h"
+
+#define KEYMAP( \
+ K000, K002, K004, K006, K008, K010, K011, \
+ K100, K101, K102, K103, K104, K105, K106, K107, K108, K109, K110, K111, \
+ K200, K201, K202, K203, K204, K205, K206, K207, K208, K209, K210, K211, \
+ K300, K301, K302, K303, K304, K305, K306, K307, K308, K309, K310, K311, \
+ K400, K401, K402, K403, K404, K405, K406, K407, K408, K409, K410, K411, \
+ K500, K501, K502, K503, K505, K507, K508, K509, K510, K511 \
+) { \
+ { K000, KC_NO, K002, KC_NO, K004, KC_NO, K006, KC_NO, K008, KC_NO, K010, K011 }, \
+ { K100, K101, K102, K103, K104, K105, K106, K107, K108, K109, K110, K111 }, \
+ { K200, K201, K202, K203, K204, K205, K206, K207, K208, K209, K210, K211 }, \
+ { K300, K301, K302, K303, K304, K305, K306, K307, K308, K309, K310, K311 }, \
+ { K400, K401, K402, K403, K404, K405, K406, K407, K408, K409, K410, K411 }, \
+ { K500, K501, K502, K503, KC_NO, K505, KC_NO, K507, K508, K509, K510, K511 } \
+}
+
+#endif \ No newline at end of file
728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930
/******************************************************************************
 * Arch-specific domctl.c
 * 
 * Copyright (c) 2002-2006, K A Fraser
 */

#include <xen/config.h>
#include <xen/types.h>
#include <xen/lib.h>
#include <xen/mm.h>
#include <xen/guest_access.h>
#include <xen/compat.h>
#include <public/domctl.h>
#include <xen/sched.h>
#include <xen/domain.h>
#include <xen/event.h>
#include <xen/domain_page.h>
#include <asm/msr.h>
#include <xen/trace.h>
#include <xen/console.h>
#include <xen/iocap.h>
#include <asm/paging.h>
#include <asm/irq.h>
#include <asm/hvm/hvm.h>
#include <asm/hvm/support.h>
#include <asm/hvm/cacheattr.h>
#include <asm/processor.h>
#include <xsm/xsm.h>
#include <xen/iommu.h>

long arch_do_domctl(
    struct xen_domctl *domctl,
    XEN_GUEST_HANDLE(xen_domctl_t) u_domctl)
{
    long ret = 0;

    switch ( domctl->cmd )
    {

    case XEN_DOMCTL_shadow_op:
    {
        struct domain *d;
        ret = -ESRCH;
        d = rcu_lock_domain_by_id(domctl->domain);
        if ( d != NULL )
        {
            ret = paging_domctl(d,
                                &domctl->u.shadow_op,
                                guest_handle_cast(u_domctl, void));
            rcu_unlock_domain(d);
            copy_to_guest(u_domctl, domctl, 1);
        } 
    }
    break;

    case XEN_DOMCTL_ioport_permission:
    {
        struct domain *d;
        unsigned int fp = domctl->u.ioport_permission.first_port;
        unsigned int np = domctl->u.ioport_permission.nr_ports;

        ret = -EINVAL;
        if ( (fp + np) > 65536 )
            break;

        ret = -ESRCH;
        if ( unlikely((d = rcu_lock_domain_by_id(domctl->domain)) == NULL) )
            break;

        ret = xsm_ioport_permission(d, fp, 
                                    domctl->u.ioport_permission.allow_access);
        if ( ret )
        {
            rcu_unlock_domain(d);
            break;
        }

        if ( np == 0 )
            ret = 0;
        else if ( domctl->u.ioport_permission.allow_access )
            ret = ioports_permit_access(d, fp, fp + np - 1);
        else
            ret = ioports_deny_access(d, fp, fp + np - 1);

        rcu_unlock_domain(d);
    }
    break;

    case XEN_DOMCTL_getpageframeinfo:
    {
        struct page_info *page;
        unsigned long mfn = domctl->u.getpageframeinfo.gmfn;
        domid_t dom = domctl->domain;
        struct domain *d;

        ret = -EINVAL;

        if ( unlikely(!mfn_valid(mfn)) ||