diff options
Diffstat (limited to 'tmk_core')
-rw-r--r-- | tmk_core/avr.mk | 33 | ||||
-rw-r--r-- | tmk_core/chibios.mk | 3 | ||||
-rw-r--r-- | tmk_core/common/action_layer.c | 2 | ||||
-rw-r--r-- | tmk_core/common/eeconfig.h | 2 | ||||
-rw-r--r-- | tmk_core/common/keycode.h | 8 | ||||
-rw-r--r-- | tmk_core/common/mousekey.c | 14 | ||||
-rw-r--r-- | tmk_core/protocol/lufa/descriptor.h | 3 | ||||
-rw-r--r-- | tmk_core/protocol/usb_hid.mk | 1 | ||||
-rw-r--r-- | tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/README.md (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/readme.md) | 0 | ||||
-rw-r--r-- | tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/testusbhostFAT/README.md (renamed from tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/testusbhostFAT/readme.md) | 0 | ||||
-rw-r--r-- | tmk_core/protocol/usb_hid/parser.cpp | 24 | ||||
-rw-r--r-- | tmk_core/protocol/usb_hid/parser.h | 5 | ||||
-rw-r--r-- | tmk_core/protocol/usb_hid/test/Makefile | 40 | ||||
-rw-r--r-- | tmk_core/rules.mk | 4 |
14 files changed, 96 insertions, 43 deletions
diff --git a/tmk_core/avr.mk b/tmk_core/avr.mk index 0d0eec3bf3..989180f3ca 100644 --- a/tmk_core/avr.mk +++ b/tmk_core/avr.mk @@ -145,23 +145,30 @@ dfu-ee: $(BUILD_DIR)/$(TARGET).hex $(BUILD_DIR)/$(TARGET).eep $(DFU_PROGRAMMER) $(MCU) reset avrdude: $(BUILD_DIR)/$(TARGET).hex - ls /dev/tty* > /tmp/1; \ - echo "Detecting Pro Micro port, reset your Pro Micro now.\c"; \ - while [ -z $$USB ]; do \ - sleep 1; \ - echo ".\c"; \ - ls /dev/tty* > /tmp/2; \ - USB=`diff /tmp/1 /tmp/2 | grep -o '/dev/tty.*'`; \ - done; \ - echo ""; \ - echo "Detected Pro Micro port at $$USB"; \ - sleep 1; \ - avrdude -p $(MCU) -c avr109 -P $$USB -U flash:w:$(BUILD_DIR)/$(TARGET).hex + if grep -q -s Microsoft /proc/version; then \ + echo 'ERROR: Pro Micros can not be flashed within the Windows Subsystem for Linux (WSL) currently. Instead, take the .hex file generated and flash it using AVRDUDE, AVRDUDESS, or XLoader.'; \ + else \ + ls /dev/tty* > /tmp/1; \ + echo "Detecting Pro Micro port, reset your Pro Micro now.\c"; \ + while [ -z $$USB ]; do \ + sleep 1; \ + echo ".\c"; \ + ls /dev/tty* > /tmp/2; \ + USB=`diff /tmp/1 /tmp/2 | grep -o '/dev/tty.*'`; \ + done; \ + echo ""; \ + echo "Detected Pro Micro port at $$USB"; \ + sleep 1; \ + avrdude -p $(MCU) -c avr109 -P $$USB -U flash:w:$(BUILD_DIR)/$(TARGET).hex; \ + fi # Convert hex to bin. -flashbin: $(BUILD_DIR)/$(TARGET).hex +bin: $(BUILD_DIR)/$(TARGET).hex $(OBJCOPY) -Iihex -Obinary $(BUILD_DIR)/$(TARGET).hex $(BUILD_DIR)/$(TARGET).bin $(COPY) $(BUILD_DIR)/$(TARGET).bin $(TARGET).bin; + +# copy bin to FLASH.bin +flashbin: bin $(COPY) $(BUILD_DIR)/$(TARGET).bin FLASH.bin; # Generate avr-gdb config/init file which does the following: diff --git a/tmk_core/chibios.mk b/tmk_core/chibios.mk index 2a8d32fb99..61e0a847d7 100644 --- a/tmk_core/chibios.mk +++ b/tmk_core/chibios.mk @@ -155,3 +155,6 @@ DFU_UTIL ?= dfu-util dfu-util: $(BUILD_DIR)/$(TARGET).bin sizeafter $(DFU_UTIL) $(DFU_ARGS) -D $(BUILD_DIR)/$(TARGET).bin + +bin: $(BUILD_DIR)/$(TARGET).bin sizeafter + $(COPY) $(BUILD_DIR)/$(TARGET).bin $(TARGET).bin;
\ No newline at end of file diff --git a/tmk_core/common/action_layer.c b/tmk_core/common/action_layer.c index 58d919a04d..c6a166a823 100644 --- a/tmk_core/common/action_layer.c +++ b/tmk_core/common/action_layer.c @@ -188,10 +188,10 @@ action_t store_or_get_action(bool pressed, keypos_t key) int8_t layer_switch_get_layer(keypos_t key) { +#ifndef NO_ACTION_LAYER action_t action; action.code = ACTION_TRANSPARENT; -#ifndef NO_ACTION_LAYER uint32_t layers = layer_state | default_layer_state; /* check top layer first */ for (int8_t i = 31; i >= 0; i--) { diff --git a/tmk_core/common/eeconfig.h b/tmk_core/common/eeconfig.h index ce60ca8661..1397a90c79 100644 --- a/tmk_core/common/eeconfig.h +++ b/tmk_core/common/eeconfig.h @@ -35,6 +35,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #define EECONFIG_RGBLIGHT (uint32_t *)8 #define EECONFIG_UNICODEMODE (uint8_t *)12 #define EECONFIG_STENOMODE (uint8_t *)13 +// EEHANDS for two handed boards +#define EECONFIG_HANDEDNESS (uint8_t *)14 /* debug bit */ diff --git a/tmk_core/common/keycode.h b/tmk_core/common/keycode.h index 54e9c322c1..a1e0bc9a47 100644 --- a/tmk_core/common/keycode.h +++ b/tmk_core/common/keycode.h @@ -94,6 +94,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #define KC_JYEN KC_INT3 #define KC_HENK KC_INT4 #define KC_MHEN KC_INT5 +/* Korean specific */ +#define KC_HAEN KC_LANG1 +#define KC_HANJ KC_LANG2 /* Keypad */ #define KC_P1 KC_KP_1 #define KC_P2 KC_KP_2 @@ -113,6 +116,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #define KC_PPLS KC_KP_PLUS #define KC_PEQL KC_KP_EQUAL #define KC_PENT KC_KP_ENTER +/* Unix function key */ +#define KC_EXEC KC_EXECUTE +#define KC_SLCT KC_SELECT +#define KC_AGIN KC_AGAIN +#define KC_PSTE KC_PASTE /* Mousekey */ #define KC_MS_U KC_MS_UP #define KC_MS_D KC_MS_DOWN diff --git a/tmk_core/common/mousekey.c b/tmk_core/common/mousekey.c index 23469476e2..aa128f0e87 100644 --- a/tmk_core/common/mousekey.c +++ b/tmk_core/common/mousekey.c @@ -55,6 +55,14 @@ uint8_t mk_wheel_time_to_max = MOUSEKEY_WHEEL_TIME_TO_MAX; static uint16_t last_timer = 0; +inline int8_t times_inv_sqrt2(int8_t x) +{ + // 181/256 is pretty close to 1/sqrt(2) + // 0.70703125 0.707106781 + // 1 too small for x=99 and x=198 + // This ends up being a mult and discard lower 8 bits + return (x * 181) >> 8; +} static uint8_t move_unit(void) { @@ -111,10 +119,10 @@ void mousekey_task(void) if (mouse_report.y > 0) mouse_report.y = move_unit(); if (mouse_report.y < 0) mouse_report.y = move_unit() * -1; - /* diagonal move [1/sqrt(2) = 0.7] */ + /* diagonal move [1/sqrt(2)] */ if (mouse_report.x && mouse_report.y) { - mouse_report.x *= 0.7; - mouse_report.y *= 0.7; + mouse_report.x = times_inv_sqrt2(mouse_report.x); + mouse_report.y = times_inv_sqrt2(mouse_report.y); } if (mouse_report.v > 0) mouse_report.v = wheel_unit(); diff --git a/tmk_core/protocol/lufa/descriptor.h b/tmk_core/protocol/lufa/descriptor.h index cde44abc9b..43001c9778 100644 --- a/tmk_core/protocol/lufa/descriptor.h +++ b/tmk_core/protocol/lufa/descriptor.h @@ -238,7 +238,8 @@ typedef struct # define CDC_OUT_EPNUM MIDI_STREAM_OUT_EPNUM #endif -#if defined(__AVR_ATmega32U2__) && CDC_OUT_EPNUM > 4 +#if (defined(__AVR_ATmega32U2__) && CDC_OUT_EPNUM > 4) || \ + (defined(__AVR_ATmega32U4__) && CDC_OUT_EPNUM > 6) # error "Endpoints are not available enough to support all functions. Remove some in Makefile.(MOUSEKEY, EXTRAKEY, CONSOLE, NKRO, MIDI, SERIAL)" #endif diff --git a/tmk_core/protocol/usb_hid.mk b/tmk_core/protocol/usb_hid.mk index 1f79bda3bd..e720080979 100644 --- a/tmk_core/protocol/usb_hid.mk +++ b/tmk_core/protocol/usb_hid.mk @@ -43,7 +43,6 @@ SRC += $(USB_HID_DIR)/override_Serial.cpp # replace arduino/wiring.c SRC += $(USB_HID_DIR)/override_wiring.c -SRC += common/avr/timer.c SRC += $(USB_HOST_SHIELD_SRC) SRC += $(ARDUINO_CORES_SRC) diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/readme.md b/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/README.md index 49cd83e0af..49cd83e0af 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/readme.md +++ b/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/README.md diff --git a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/testusbhostFAT/readme.md b/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/testusbhostFAT/README.md index d8b4296b1a..d8b4296b1a 100644 --- a/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/testusbhostFAT/readme.md +++ b/tmk_core/protocol/usb_hid/USB_Host_Shield_2.0/examples/testusbhostFAT/README.md diff --git a/tmk_core/protocol/usb_hid/parser.cpp b/tmk_core/protocol/usb_hid/parser.cpp index 1a152ff3f2..94e747ca4b 100644 --- a/tmk_core/protocol/usb_hid/parser.cpp +++ b/tmk_core/protocol/usb_hid/parser.cpp @@ -4,30 +4,14 @@ #include "debug.h" -report_keyboard_t usb_hid_keyboard_report; -uint16_t usb_hid_time_stamp; - - void KBDReportParser::Parse(HID *hid, bool is_rpt_id, uint8_t len, uint8_t *buf) { - bool is_error = false; - report_keyboard_t *report = (report_keyboard_t *)buf; + ::memcpy(&report, buf, sizeof(report_keyboard_t)); + time_stamp = millis(); - dprintf("KBDReport: %02X %02X", report->mods, report->reserved); + dprintf("input %d: %02X %02X", hid->GetAddress(), report.mods, report.reserved); for (uint8_t i = 0; i < KEYBOARD_REPORT_KEYS; i++) { - if (IS_ERROR(report->keys[i])) { - is_error = true; - } - dprintf(" %02X", report->keys[i]); + dprintf(" %02X", report.keys[i]); } dprint("\r\n"); - - // ignore error and not send report to computer - if (is_error) { - dprint("Error usage! \r\n"); - return; - } - - ::memcpy(&usb_hid_keyboard_report, buf, sizeof(report_keyboard_t)); - usb_hid_time_stamp = millis(); } diff --git a/tmk_core/protocol/usb_hid/parser.h b/tmk_core/protocol/usb_hid/parser.h index 703eb1ed4c..036281fa66 100644 --- a/tmk_core/protocol/usb_hid/parser.h +++ b/tmk_core/protocol/usb_hid/parser.h @@ -2,11 +2,14 @@ #define PARSER_H #include "hid.h" +#include "report.h" class KBDReportParser : public HIDReportParser { public: - virtual void Parse(HID *hid, bool is_rpt_id, uint8_t len, uint8_t *buf); + report_keyboard_t report; + uint16_t time_stamp; + virtual void Parse(HID *hid, bool is_rpt_id, uint8_t len, uint8_t *buf); }; #endif diff --git a/tmk_core/protocol/usb_hid/test/Makefile b/tmk_core/protocol/usb_hid/test/Makefile index c093bbd4c1..83bf2aed67 100644 --- a/tmk_core/protocol/usb_hid/test/Makefile +++ b/tmk_core/protocol/usb_hid/test/Makefile @@ -1,4 +1,42 @@ - +#---------------------------------------------------------------------------- +# 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 = usb_hid_test diff --git a/tmk_core/rules.mk b/tmk_core/rules.mk index be06d611b6..aef4d5e552 100644 --- a/tmk_core/rules.mk +++ b/tmk_core/rules.mk @@ -247,8 +247,8 @@ gccversion : $(eval CMD=$(HEX) $< $@) @$(BUILD_CMD) @if $(AUTOGEN); then \ - $(SILENT) || printf "Copying $(TARGET).hex to keymaps/$(KEYMAP)/$(KEYBOARD)_$(KEYMAP).hex\n"; \ - $(COPY) $@ $(KEYMAP_PATH)/$(KEYBOARD)_$(KEYMAP).hex; \ + $(SILENT) || printf "Copying $(TARGET).hex to keymaps/$(KEYMAP)/$(TARGET).hex\n"; \ + $(COPY) $@ $(KEYMAP_PATH)/$(TARGET).hex; \ else \ $(COPY) $@ $(TARGET).hex; \ fi |