Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Microsoft Sculpt Ergonomic Desktop keyboard support #330

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
129 changes: 129 additions & 0 deletions keyboard/sculpt/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
#----------------------------------------------------------------------------
# On command line:
#
# make all = Make software.
#
# make clean = Clean out built project files.
#
# make coff = Convert ELF to AVR COFF.
#
# make extcoff = Convert ELF to AVR Extended COFF.
#
# make program = Download the hex file to the device.
# Please customize your programmer settings(PROGRAM_CMD)
#
# make teensy = Download the hex file to the device, using teensy_loader_cli.
# (must have teensy_loader_cli installed).
#
# make dfu = Download the hex file to the device, using dfu-programmer (must
# have dfu-programmer installed).
#
# make flip = Download the hex file to the device, using Atmel FLIP (must
# have Atmel FLIP installed).
#
# make dfu-ee = Download the eeprom file to the device, using dfu-programmer
# (must have dfu-programmer installed).
#
# make flip-ee = Download the eeprom file to the device, using Atmel FLIP
# (must have Atmel FLIP installed).
#
# make debug = Start either simulavr or avarice as specified for debugging,
# with avr-gdb or avr-insight as the front end for debugging.
#
# make filename.s = Just compile filename.c into the assembler code only.
#
# make filename.i = Create a preprocessed source file for use in submitting
# bug reports to the GCC project.
#
# To rebuild project do "make clean" then "make all".
#----------------------------------------------------------------------------

# Target file name (without extension).
TARGET = sculpt_lufa

# Directory common source filess exist
TMK_DIR = ../../tmk_core

# Directory keyboard dependent files exist
TARGET_DIR = .

# project specific files
SRC = keymap.c \
keymap_common.c \
matrix.c \
led.c

CONFIG_H = config.h

# MCU name
#MCU = at90usb1287
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
# 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 = yes # Console for debug(+400)
COMMAND_ENABLE = yes # Commands for debug and configuration
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
NKRO_ENABLE = no # USB Nkey Rollover - not yet supported in LUFA


# Optimize size but this may cause error "relocation truncated to fit"
#EXTRALDFLAGS = -Wl,--relax

# Search Path
VPATH += $(TARGET_DIR)
VPATH += $(TMK_DIR)

include $(TMK_DIR)/protocol/lufa.mk
include $(TMK_DIR)/common.mk
include $(TMK_DIR)/rules.mk
101 changes: 101 additions & 0 deletions keyboard/sculpt/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
Microsoft Sculpt Ergonomic Desktop keyboard firmware
======================
Ergonomic keyboard by Microsoft modified to work with Teensy 2.0.

- TODO: put original controller PCB version

## Microsoft Sculpt Ergonomic Desktop keyboard resources
- [Microsoft Sculpt Ergonomic Desktop support page]
(https://www.microsoft.com/hardware/en-us/d/sculpt-ergonomic-desktop)

## Build
Move to this directory and run `make`:

$ make

## Matrix
Only keyboard with US layout was traced.

### Original US layout keyboard matrix
Original US layout keboard matrix is 8 rows and 18 columns:

A B C D E F G H I
----------------------------------------------------
1 PAUS DEL 0 9 8 BSPC -->
2 PGUP F12 LBRC MINS RBRC INS -->
3 HOME CALC P O I -->
4 SLCK ENT SCLN L K BSLS -->
5 APP SLSH QUOT RALT LEFT -->
6 END RSFT PGDN DOT COMM -->
7 LCTL RGHT UP DOWN SPC -->
8 PSCR F11 EQL F9 F8 F10 -->

J K L M N O P Q R
-------------------------------------------------
--> 7 TAB Q 2 1 1
--> Y F5 F3 W 4 F6 2
--> U R E CAPS 3 T 3
--> J F D A LGUI 4
--> H G F4 S ESC LALT 5
--> M V C X Z LSFT 6
--> N B SPC RCTL 7
--> F7 5 F2 F1 GRV 6 8

Note that original matrix requires 8+18=26 pins on micro-controller and will
not work verbatim on Teensy 2.0 because it only has 25 pins.

### Modified US layout keyboard matrix

To make all keys work on Teensy 2.0 it is best to merge keys on column C and G
of orininal matrix (see above). To achieve that simply connect colums C and G
to the same pin on Teensy.

Modified matrix will have 8 rows and 17 columns and will require 25 pins:

A B C D E F G H
----------------------------------------------
1 PAUS DEL 0 9 8 BSPC -->
2 PGUP F12 LBRC MINS RBRC INS -->
3 HOME CALC P O I -->
4 SLCK ENT SCLN L K BSLS -->
5 RALT APP SLSH QUOT LEFT -->
6 END RSFT PGDN DOT COMM -->
7 LCTL RGHT UP DOWN SPC -->
8 PSCR F11 EQL F9 F8 F10 -->

I J K L M N O P Q
-------------------------------------------------
--> 7 TAB Q 2 1 1
--> Y F5 F3 W 4 F6 2
--> U R E CAPS 3 T 3
--> J F D A LGUI 4
--> H G F4 S ESC LALT 5
--> M V C X Z LSFT 6
--> N B SPC RCTL 7
--> F7 5 F2 F1 GRV 6 8

Note that RALT and RSFT are now sitting on the same column (C).


## Keymap

### 1 Original Scultp keymap
[keymap.c](keymap.c) represents original Sculpt layout

Fn + {F1, F2, F3} = {play/pause, mute, volume down, volume up}
Fn + {left, down, up, right} = {home, pgdown, pgup, end}

#### 1.0 Default layer
,---------------------------. ,-----------------------------------------------.
|Esc| F1| F2| F3| F4| F5| F6| | F7| F8| F9|F10|F11|F12|PrSc|ScLk|Pau|Calc| |
|---------------------------| |-----------------------------------------------|
| `| 1| 2| 3| 4| 5| 6| | 7| 8| 9| 0| -| =| Bcksp| Del|Home|
|---------------------------| |-------------------------------------| |----|
| Tab| Q| W| E| R| T| | Y| U| I| O| P| [| ]| \| | End|
|---------------------------| |-----------------------------------------------|
| Caps| A| S| D| F| G| | H| J| K| L| ;| '| Enter| Ins|PgUp|
|---------------------------| |-----------------------------------------------|
| Shift| Z| X| C| V| B| | N| M| ,| .| /| Shift| Up|PgDn|
|---------------------------`----'-----------------------------------------------|
| Ctrl| Gui| Alt| | | Alt| Fn| Ctrl|Left|Down|Righ|
`--------------------------------------------------------------------------------'
68 changes: 68 additions & 0 deletions keyboard/sculpt/config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
/*
Copyright 2012 Jun Wako <[email protected]>

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


/* USB Device descriptor parameter */
#define VENDOR_ID 0xFEED
#define PRODUCT_ID 0x6060
#define DEVICE_VER 0x0001
#define MANUFACTURER t.m.k.
#define PRODUCT Microsoft Sculpt mod
#define DESCRIPTION t.m.k. keyboard firmware for Microsoft Sculpt

/* key matrix size */
#define MATRIX_ROWS 8
#define MATRIX_COLS 17

/* define if matrix has ghost */
#define MATRIX_HAS_GHOST

/* Set 0 if debouncing isn't needed */
#define DEBOUNCE 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)) \
)

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

#endif
30 changes: 30 additions & 0 deletions keyboard/sculpt/keymap.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#include "keymap_common.h"

const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* 0: qwerty */
KEYMAP(
PAUS, DEL, 0, 9, 8, BSPC, 7, TAB, Q, 2, 1, \
PGUP, F12,LBRC,MINS,RBRC, INS, Y, F5, F3, W, 4, F6, \
HOME, CALC, P, O, I, U, R, E, CAPS, 3, T, \
SLCK, ENT, SCLN, L, K, BSLS, J, F, D, A, LGUI, \
RALT, FN1, SLSH, QUOT, LEFT, H, G, F4, S, ESC, LALT, \
END, RSFT, PGDN, DOT, COMM, M, V, C, X, Z, LSFT, \
RCTL, RGHT, UP, DOWN, SPC, N, B, SPC, LCTL, \
PSCR, F11, EQL, F9, F8, F10, F7, 5, F2, F1, GRV, 6),
/* 1: FN1 (Replaces arrows with pagination, home and end and activates
multimedia keys on top row).
*/
KEYMAP(
TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, \
TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, VOLD, TRNS, TRNS, TRNS, \
TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, \
TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, \
TRNS, TRNS, TRNS, TRNS, HOME, TRNS, TRNS, VOLU, TRNS, TRNS, TRNS, \
TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, \
TRNS, END, PGUP, PGDN, TRNS, TRNS, TRNS, TRNS, TRNS, \
TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, MUTE, MPLY, TRNS, TRNS ),
};
const uint16_t PROGMEM fn_actions[] = {
ACTION_DEFAULT_LAYER_SET(0), // Default layer. Not used.
ACTION_LAYER_TAP_KEY(1, KC_APP), // FN1
};
30 changes: 30 additions & 0 deletions keyboard/sculpt/keymap_common.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
Copyright 2012,2013 Jun Wako <[email protected]>

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 "keymap_common.h"


/* translates key to keycode */
uint8_t keymap_key_to_keycode(uint8_t layer, keypos_t key)
{
return pgm_read_byte(&keymaps[(layer)][(key.row)][(key.col)]);
}

/* translates Fn keycode to action */
action_t keymap_fn_to_action(uint8_t keycode)
{
return (action_t){ .code = pgm_read_word(&fn_actions[FN_INDEX(keycode)]) };
}
Loading