diff options
author | Jack Humbert <jack.humb@gmail.com> | 2016-06-04 00:10:47 -0400 |
---|---|---|
committer | Jack Humbert <jack.humb@gmail.com> | 2016-06-04 00:10:47 -0400 |
commit | b36e532b5e0eef219f33075e6e60b68d104484ee (patch) | |
tree | 6979225bc1c87f339b358945ec2558c396da4530 /converter/ascii_usb | |
parent | 189a3b02fb7b43c6bc28271ee0c0bf9eb16810bf (diff) |
cleans up folder structure
* consolidates docs
* deletes converter/
* updates .md references (most)
Diffstat (limited to 'converter/ascii_usb')
-rw-r--r-- | converter/ascii_usb/Makefile | 82 | ||||
-rw-r--r-- | converter/ascii_usb/README | 38 | ||||
-rw-r--r-- | converter/ascii_usb/config.h | 70 | ||||
-rw-r--r-- | converter/ascii_usb/keymap.c | 42 | ||||
-rw-r--r-- | converter/ascii_usb/led.c | 25 | ||||
-rw-r--r-- | converter/ascii_usb/matrix.c | 195 |
6 files changed, 0 insertions, 452 deletions
diff --git a/converter/ascii_usb/Makefile b/converter/ascii_usb/Makefile deleted file mode 100644 index 6d977afc05..0000000000 --- a/converter/ascii_usb/Makefile +++ /dev/null @@ -1,82 +0,0 @@ -# Target file name (without extension). -TARGET = ascii_usb - -# Directory common source filess exist -TMK_DIR = ../../tmk_core - -# Directory keyboard dependent files exist -TARGET_DIR = . - -# keyboard dependent files -SRC = keymap.c \ - matrix.c \ - led.c \ - protocol/serial_uart.c - -CONFIG_H = config.h - - -# MCU name, you MUST set this to match the board you are using -# type "make clean" after changing this, so all files will be rebuilt -#MCU = at90usb162 # Teensy 1.0 -MCU = atmega32u4 # Teensy 2.0 -#MCU = at90usb646 # Teensy++ 1.0 -#MCU = at90usb1286 # Teensy++ 2.0 - - -# Processor frequency. -# Normally the first thing your program should do is set the clock prescaler, -# so your program will run at the correct speed. You should also set this -# variable to same clock speed. The _delay_ms() macro uses this, and many -# examples use this variable to calculate timings. Do not add a "UL" here. -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 -OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT - - -# Build Options -# *Comment out* to disable the options. -# -#MOUSEKEY_ENABLE = yes # Mouse keys -#EXTRAKEY_ENABLE = yes # Audio control and System control -CONSOLE_ENABLE = yes # Console for debug -#NKRO_ENABLE = yes # USB Nkey Rollover - - -# Boot Section Size in bytes -# Teensy halfKay 512 -# Atmel DFU loader 4096 -# LUFA bootloader 4096 -OPT_DEFS += -DBOOTLOADER_SIZE=4096 - - -# Search Path -VPATH += $(TARGET_DIR) -VPATH += $(TMK_DIR) - - -include $(TMK_DIR)/protocol/lufa.mk -include $(TMK_DIR)/protocol.mk -include $(TMK_DIR)/common.mk -include $(TMK_DIR)/rules.mk diff --git a/converter/ascii_usb/README b/converter/ascii_usb/README deleted file mode 100644 index 02fa064ed4..0000000000 --- a/converter/ascii_usb/README +++ /dev/null @@ -1,38 +0,0 @@ -ASCII to USB keyboard protocol converter -======================================== -This converts serial console terminal into USB keyboard, tested with TRS-80 model 100 TELCOM application. -Target MCU is ATMega32u4 but other USB capable AVR will also work. - - -Hardware --------- -Connect RX, TX and GND to UART pin of AVR. Note that you may need line driver/level shifter like MAX232 to interface high voltage of RS-232C. - - - -Build Firmware --------------- -Configure UART setting and Just use 'make' - - $ cd ascii_usb - $ make - -Then, load the binary to MCU with your favorite programmer. - - - -Limitation ----------- -- This cannot see key up event, you cannot hold a key. -- Alt, Gui(Win/Mac) modifier key are not available. - - - -TRS-80 model 100 ----------------- -Use TELCOM program with setting: 19200bps/8bit/odd parity/1stop bit -To set this configuration push Stat(F3) and input '9801D,10'. Then push Term(F4) to connect. - - - - diff --git a/converter/ascii_usb/config.h b/converter/ascii_usb/config.h deleted file mode 100644 index 0908997a53..0000000000 --- a/converter/ascii_usb/config.h +++ /dev/null @@ -1,70 +0,0 @@ -/* -Copyright 2014 Jun Wako <wakojun@gmail.com> - -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 - -#define VENDOR_ID 0xFEED -#define PRODUCT_ID 0x5C01 -#define DEVICE_VER 0x0100 -#define MANUFACTURER t.m.k. -#define PRODUCT ASCII keyboard converter -#define DESCRIPTION converts Serial Console Terminal into USB keyboard - - -/* matrix size */ -#define MATRIX_ROWS 16 -#define MATRIX_COLS 16 - -/* key combination for command */ -#define IS_COMMAND() ( \ - host_get_first_key() == KC_BRK \ -) - - -/* - * Serial(USART) configuration - * asynchronous, positive logic, 19200baud, bit order: LSB first - * 1-start bit, 8-data bit, odd parity, 1-stop bit - */ -#ifdef __AVR_ATmega32U4__ - #define SERIAL_UART_BAUD 19200 - #define SERIAL_UART_DATA UDR1 - #define SERIAL_UART_UBRR ((F_CPU/(16UL*SERIAL_UART_BAUD))-1) - #define SERIAL_UART_RXD_VECT USART1_RX_vect - #define SERIAL_UART_TXD_READY (UCSR1A&(1<<UDRE1)) - #define SERIAL_UART_INIT() do { \ - UBRR1L = (uint8_t) SERIAL_UART_UBRR; /* baud rate */ \ - UBRR1H = (uint8_t) (SERIAL_UART_UBRR>>8); /* baud rate */ \ - UCSR1B |= (1<<RXCIE1) | (1<<RXEN1); /* RX interrupt, RX: enable */ \ - UCSR1B |= (0<<TXCIE1) | (1<<TXEN1); /* TX interrupt, TX: enable */ \ - UCSR1C |= (1<<UPM11) | (1<<UPM10); /* parity: none(00), even(01), odd(11) */ \ - sei(); \ - } while(0) -#else - #error "USART configuration is needed." -#endif - -/* disable action features */ -#define NO_ACTION_LAYER -#define NO_ACTION_TAPPING -#define NO_ACTION_ONESHOT -#define NO_ACTION_MACRO -#define NO_ACTION_FUNCTION - - -#endif diff --git a/converter/ascii_usb/keymap.c b/converter/ascii_usb/keymap.c deleted file mode 100644 index a0c61ce8de..0000000000 --- a/converter/ascii_usb/keymap.c +++ /dev/null @@ -1,42 +0,0 @@ -/* -Copyright 2012 Jun Wako <wakojun@gmail.com> - -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 <stdint.h> -#include <stdbool.h> -#include <avr/pgmspace.h> -#include "keycode.h" -#include "action.h" -#include "action_macro.h" -#include "action_util.h" -#include "util.h" -#include "print.h" -#include "keymap.h" - - -// Keymap is not used. See matrix.c. - -/* translates key to keycode */ -uint8_t keymap_key_to_keycode(uint8_t layer, keypos_t key) -{ - return KC_NO; -} - -/* translates Fn keycode to action */ -action_t keymap_fn_to_action(uint8_t keycode) -{ - return (action_t) { .code = ACTION_NO }; -} diff --git a/converter/ascii_usb/led.c b/converter/ascii_usb/led.c deleted file mode 100644 index d1c39bc653..0000000000 --- a/converter/ascii_usb/led.c +++ /dev/null @@ -1,25 +0,0 @@ -/* -Copyright 2012 Jun Wako <wakojun@gmail.com> - -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 "stdint.h" -#include "serial.h" -#include "led.h" - - -void led_set(uint8_t usb_led) -{ -} diff --git a/converter/ascii_usb/matrix.c b/converter/ascii_usb/matrix.c deleted file mode 100644 index e1ea8e0ab8..0000000000 --- a/converter/ascii_usb/matrix.c +++ /dev/null @@ -1,195 +0,0 @@ -/* -Copyright 2014 Jun Wako <wakojun@gmail.com> - -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 <stdint.h> -#include <stdbool.h> -#include <avr/io.h> -#include <util/delay.h> -#include "print.h" -#include "util.h" -#include "matrix.h" -#include "debug.h" -#include "action_util.h" -#include "protocol/serial.h" - - -/* - * Not use Matrix. - * - * ROW: 16(4bits) - * COL: 16(4bits) - * - * 8bit wide - * +---------+ - * 0|00 ... 0F| - * 1|08 ... 1F| - * :| ... | - * :| ... | - * E|E0 ... EF| - * F|F0 ... FF| - * +---------+ - */ - - -inline -uint8_t matrix_rows(void) -{ - return MATRIX_ROWS; -} - -inline -uint8_t matrix_cols(void) -{ - return MATRIX_COLS; -} - -void matrix_init(void) -{ - debug_matrix = true; - serial_init(); - - debug("init\n"); - return; -} - -static void type_key(uint16_t keycode) -{ - if (keycode == 0) return; - - uint8_t mods = keycode>>8; - uint8_t key = keycode&0xFF; - if (mods) { - add_mods(mods); - send_keyboard_report(); - } - - add_key(key); - send_keyboard_report(); - - del_key(key); - send_keyboard_report(); - - if (mods) { - del_mods(mods); - send_keyboard_report(); - } -} -static uint16_t code2key(uint8_t code) -{ - // ASCII to key combination in US laout - switch (code) { - case 0x01 ... 0x08: // Ctrl-[a-z] - return MOD_BIT(KC_LCTRL)<<8 | (KC_A + (code-0x01)); - case 0x09: return KC_TAB; // TAB(Ctrl-i) - case 0x0A ... 0x0C: // Ctrl-[a-z] - return MOD_BIT(KC_LCTRL)<<8 | (KC_A + (code-0x01)); - case 0x0D: return KC_ENTER; // Enter(Ctrl-m) - case 0x0E ... 0x1A: // Ctrl-[a-z] - return MOD_BIT(KC_LCTRL)<<8 | (KC_A + (code-0x01)); - case 0x1B: return KC_ESC; - case 0x1C: return KC_RIGHT; - case 0x1D: return KC_LEFT; - case 0x1E: return KC_UP; - case 0x1F: return KC_DOWN; - case 0x20: return KC_SPACE; - case 0x21: return MOD_BIT(KC_LSHIFT)<<8 | KC_1; // ! - case 0x22: return MOD_BIT(KC_LSHIFT)<<8 | KC_QUOTE; // " - case 0x23: return MOD_BIT(KC_LSHIFT)<<8 | KC_3; // # - case 0x24: return MOD_BIT(KC_LSHIFT)<<8 | KC_4; // $ - case 0x25: return MOD_BIT(KC_LSHIFT)<<8 | KC_5; // % - case 0x26: return MOD_BIT(KC_LSHIFT)<<8 | KC_7; // & - case 0x27: return KC_QUOTE; // ' - case 0x28: return MOD_BIT(KC_LSHIFT)<<8 | KC_9; // ( - case 0x29: return MOD_BIT(KC_LSHIFT)<<8 | KC_0; // ) - case 0x2A: return MOD_BIT(KC_LSHIFT)<<8 | KC_8; // * - case 0x2B: return MOD_BIT(KC_LSHIFT)<<8 | KC_EQUAL; // + - case 0x2C: return KC_COMMA; // , - case 0x2D: return KC_MINUS; // - - case 0x2E: return KC_DOT; // . - case 0x2F: return KC_SLASH; // / - case 0x30: return KC_0; - case 0x31 ... 0x39: // 1-9 - return KC_1 + (code-0x31); - case 0x3A: return MOD_BIT(KC_LSHIFT)<<8 | KC_SCLN; // : - case 0x3B: return KC_SCLN; // ; - case 0x3C: return MOD_BIT(KC_LSHIFT)<<8 | KC_COMMA; // < - case 0x3D: return KC_EQUAL; // = - case 0x3E: return MOD_BIT(KC_LSHIFT)<<8 | KC_DOT; // > - case 0x3F: return MOD_BIT(KC_LSHIFT)<<8 | KC_SLASH; // ? - case 0x40: return MOD_BIT(KC_LSHIFT)<<8 | KC_2; // @ - case 0x41 ... 0x5A: // A-Z - return MOD_BIT(KC_LSHIFT)<<8 | (KC_A + (code-0x41)); - case 0x5B: return KC_LBRACKET; // [ - case 0x5C: return KC_BSLASH; // - case 0x5D: return KC_RBRACKET; // ] - case 0x5E: return MOD_BIT(KC_LSHIFT)<<8 | KC_6; // ^ - case 0x5F: return MOD_BIT(KC_LSHIFT)<<8 | KC_MINUS; // _ - case 0x61 ... 0x7A: // a-z - return KC_A + (code-0x61); - case 0x7B: return MOD_BIT(KC_LSHIFT)<<8 | KC_LBRACKET; // { - case 0x7C: return MOD_BIT(KC_LSHIFT)<<8 | KC_BSLASH; // | - case 0x7D: return MOD_BIT(KC_LSHIFT)<<8 | KC_RBRACKET; // } - case 0x7E: return MOD_BIT(KC_LSHIFT)<<8 | KC_GRAVE; // } - case 0x7F: return KC_DELETE; // - } - return 0; -} - -uint8_t matrix_scan(void) -{ - uint16_t code = serial_recv2(); - if (code == -1) { - return 0; - } - - print_hex8(code); print(" "); - - // echo back - serial_send(code); - type_key(code2key(code)); - - - return code; -} - -inline -bool matrix_has_ghost(void) -{ - return false; -} - -inline -bool matrix_is_on(uint8_t row, uint8_t col) -{ - return false; -} - -inline -matrix_row_t matrix_get_row(uint8_t row) -{ - return 0; -} - -void matrix_print(void) -{ - print("\nr/c 0123456789ABCDEF\n"); - for (uint8_t row = 0; row < matrix_rows(); row++) { - phex(row); print(": "); - pbin_reverse(matrix_get_row(row)); - print("\n"); - } -} |