summaryrefslogtreecommitdiff
path: root/keyboards/handwired/dactyl
diff options
context:
space:
mode:
authorDrashna Jaelre <drashna@live.com>2019-04-09 08:58:11 -0700
committerDrashna Jaelre <drashna@live.com>2019-04-09 08:58:11 -0700
commitb6850bc043b1d129042f47501f0a1dc1e196f962 (patch)
treea0a772f278c3c494db3bc69103955af5561e1cae /keyboards/handwired/dactyl
parent19ed62114a1f5d20aacb9cbe83105e977b9a2971 (diff)
remove all keyboards but ergodox and planck
Diffstat (limited to 'keyboards/handwired/dactyl')
-rw-r--r--keyboards/handwired/dactyl/config.h68
-rw-r--r--keyboards/handwired/dactyl/dactyl.c15
-rw-r--r--keyboards/handwired/dactyl/dactyl.h67
-rw-r--r--keyboards/handwired/dactyl/i2cmaster.h178
-rw-r--r--keyboards/handwired/dactyl/info.json13
-rw-r--r--keyboards/handwired/dactyl/keymaps/default/keymap.c177
-rw-r--r--keyboards/handwired/dactyl/keymaps/default/readme.md10
-rw-r--r--keyboards/handwired/dactyl/keymaps/dvorak/keymap.c177
-rw-r--r--keyboards/handwired/dactyl/keymaps/dvorak/readme.md9
-rw-r--r--keyboards/handwired/dactyl/keymaps/erincalling/keymap.c160
-rw-r--r--keyboards/handwired/dactyl/keymaps/erincalling/readme.md6
-rw-r--r--keyboards/handwired/dactyl/matrix.c542
-rw-r--r--keyboards/handwired/dactyl/readme.md39
-rw-r--r--keyboards/handwired/dactyl/rules.mk86
-rw-r--r--keyboards/handwired/dactyl/twimaster.c207
15 files changed, 0 insertions, 1754 deletions
diff --git a/keyboards/handwired/dactyl/config.h b/keyboards/handwired/dactyl/config.h
deleted file mode 100644
index 8d42c0ae47..0000000000
--- a/keyboards/handwired/dactyl/config.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
-Copyright 2012 Jun Wako <wakojun@gmail.com>
-Copyright 2013 Oleg Kostyuk <cub.uanic@gmail.com>
-Copyright 2017 Erin Call <hello@erincall.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 DACTYL_CONFIG_H
-#define DACTYL_CONFIG_H
-
-#include "config_common.h"
-
-/* USB Device descriptor parameter */
-#define VENDOR_ID 0xFEED
-#define PRODUCT_ID 0x1308
-#define DEVICE_VER 0x0001
-#define MANUFACTURER Adereth
-#define PRODUCT Dactyl
-#define DESCRIPTION An ortholinear, split, 3D-curved keyboard with thumb clusters.
-
-#define DIODE_DIRECTION ROW2COL
-#define MATRIX_ROWS 6
-#define MATRIX_COLS 12
-#define COL_EXPANDED { true, true, true, true, true, true, false, false, false, false, false, false}
-#define MATRIX_ONBOARD_ROW_PINS { F0, F1, F4, F5, F6, F7 }
-#define MATRIX_ONBOARD_COL_PINS { 0, 0, 0, 0, 0, 0, B1, B2, B3, D2, D3, C6 }
-#define EXPANDER_COL_REGISTER 0
-#define MATRIX_EXPANDER_COL_PINS {0, 1, 2, 3, 4, 5}
-#define MATRIX_EXPANDER_ROW_PINS {0, 1, 2, 3, 4, 5}
-
-#define MOUSEKEY_INTERVAL 20
-#define MOUSEKEY_DELAY 0
-#define MOUSEKEY_TIME_TO_MAX 60
-#define MOUSEKEY_MAX_SPEED 7
-#define MOUSEKEY_WHEEL_DELAY 0
-
-#define TAPPING_TOGGLE 1
-
-#define TAPPING_TERM 200
-#define IGNORE_MOD_TAP_INTERRUPT // this makes it possible to do rolling combos (zx) with keys that convert to other keys on hold (z becomes ctrl when you hold it, and when this option isn't enabled, z rapidly followed by x actually sends Ctrl-x. That's bad.)
-
-/* key combination for command */
-#define IS_COMMAND() ( \
- get_mods() == (MOD_BIT(KC_LCTL) | MOD_BIT(KC_RCTL)) || \
- get_mods() == (MOD_BIT(KC_LSFT) | MOD_BIT(KC_RSFT)) \
-)
-
-/* fix space cadet rollover issue */
-#define DISABLE_SPACE_CADET_ROLLOVER
-
-/* Set 0 if debouncing isn't needed */
-#define DEBOUNCE 15
-
-#define USB_MAX_POWER_CONSUMPTION 500
-
-#endif
diff --git a/keyboards/handwired/dactyl/dactyl.c b/keyboards/handwired/dactyl/dactyl.c
deleted file mode 100644
index 81b9dce0f9..0000000000
--- a/keyboards/handwired/dactyl/dactyl.c
+++ /dev/null
@@ -1,15 +0,0 @@
-#include "dactyl.h"
-#include "i2cmaster.h"
-
-#ifdef SWAP_HANDS_ENABLE
-__attribute__ ((weak))
-// swap-hands action needs a matrix to define the swap
-const keypos_t hand_swap_config[MATRIX_ROWS][MATRIX_COLS] = {
- {{0,11}, {0,10}, {0,9}, {0,8}, {0,7}, {0,6}, {0,5}, {0,4}, {0,3}, {0,2}, {0,1}, {0,0}},
- {{1,11}, {1,11}, {1,9}, {1,8}, {1,7}, {1,6}, {1,5}, {1,4}, {1,3}, {1,2}, {1,1}, {1,0}},
- {{2,11}, {2,12}, {2,9}, {2,8}, {2,7}, {2,6}, {2,5}, {2,4}, {2,3}, {2,2}, {2,1}, {2,0}},
- {{3,11}, {3,13}, {3,9}, {3,8}, {3,7}, {3,6}, {3,5}, {3,4}, {3,3}, {3,2}, {3,1}, {3,0}},
- {{4,11}, {4,14}, {4,9}, {4,8}, {4,7}, {4,6}, {4,5}, {4,4}, {4,3}, {4,2}, {4,1}, {4,0}},
- {{5,11}, {5,15}, {5,9}, {5,8}, {5,7}, {5,6}, {5,5}, {5,4}, {5,3}, {5,2}, {5,1}, {5,0}},
-};
-#endif
diff --git a/keyboards/handwired/dactyl/dactyl.h b/keyboards/handwired/dactyl/dactyl.h
deleted file mode 100644
index d4c38dcfb6..0000000000
--- a/keyboards/handwired/dactyl/dactyl.h
+++ /dev/null
@@ -1,67 +0,0 @@
-#ifndef DACTYL_H
-#define DACTYL_H
-
-#include "quantum.h"
-#include <stdint.h>
-#include <stdbool.h>
-#include "i2cmaster.h"
-#include <util/delay.h>
-
-#define CPU_PRESCALE(n) (CLKPR = 0x80, CLKPR = (n))
-#define CPU_16MHz 0x00
-
-#define I2C_ADDR 0b0100000
-#define I2C_ADDR_WRITE ( (I2C_ADDR<<1) | I2C_WRITE )
-#define I2C_ADDR_READ ( (I2C_ADDR<<1) | I2C_READ )
-#define IODIRA 0x00 // i/o direction register
-#define IODIRB 0x01
-#define GPPUA 0x0C // GPIO pull-up resistor register
-#define GPPUB 0x0D
-#define GPIOA 0x12 // general purpose i/o port register (write modifies OLAT)
-#define GPIOB 0x13
-#define OLATA 0x14 // output latch register
-#define OLATB 0x15
-
-extern uint8_t expander_status;
-extern uint8_t expander_input_pin_mask;
-extern bool i2c_initialized;
-
-void init_dactyl(void);
-void init_expander(void);
-
-/*
- * LEFT HAND: LINES 38-45
- * RIGHT HAND: LINES 47-54
- */
-#define LAYOUT_dactyl( \
- \
- k00,k01,k02,k03,k04,k05, \
- k10,k11,k12,k13,k14,k15, \
- k20,k21,k22,k23,k24,k25, \
- k30,k31,k32,k33,k34,k35, \
- k40,k41,k42,k43,k44, \
- k55,k50, \
- k54, \
- k53,k52,k51, \
- \
- k06,k07,k08,k09,k0A,k0B, \
- k16,k17,k18,k19,k1A,k1B, \
- k26,k27,k28,k29,k2A,k2B, \
- k36,k37,k38,k39,k3A,k3B, \
- k47,k48,k49,k4A,k4B, \
- k5B,k56, \
- k57, \
- k5A,k59,k58 ) \
- \
- /* matrix positions */ \
- { \
- { k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0A, k0B }, \
- { k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1A, k1B }, \
- { k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2A, k2B }, \
- { k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3A, k3B }, \
- { k40, k41, k42, k43, k44, KC_NO, KC_NO, k47, k48, k49, k4A, k4B }, \
- { k50, k51, k52, k53, k54, k55, k56, k57, k58, k59, k5A, k5B }, \
- }
-
-
-#endif
diff --git a/keyboards/handwired/dactyl/i2cmaster.h b/keyboards/handwired/dactyl/i2cmaster.h
deleted file mode 100644
index 3917b9e6c0..0000000000
--- a/keyboards/handwired/dactyl/i2cmaster.h
+++ /dev/null
@@ -1,178 +0,0 @@
-#ifndef _I2CMASTER_H
-#define _I2CMASTER_H 1
-/*************************************************************************
-* Title: C include file for the I2C master interface
-* (i2cmaster.S or twimaster.c)
-* Author: Peter Fleury <pfleury@gmx.ch> http://jump.to/fleury
-* File: $Id: i2cmaster.h,v 1.10 2005/03/06 22:39:57 Peter Exp $
-* Software: AVR-GCC 3.4.3 / avr-libc 1.2.3
-* Target: any AVR device
-* Usage: see Doxygen manual
-**************************************************************************/
-
-#ifdef DOXYGEN
-/**
- @defgroup pfleury_ic2master I2C Master library
- @code #include <i2cmaster.h> @endcode
-
- @brief I2C (TWI) Master Software Library
-
- Basic routines for communicating with I2C slave devices. This single master
- implementation is limited to one bus master on the I2C bus.
-
- This I2c library is implemented as a compact assembler software implementation of the I2C protocol
- which runs on any AVR (i2cmaster.S) and as a TWI hardware interface for all AVR with built-in TWI hardware (twimaster.c).
- Since the API for these two implementations is exactly the same, an application can be linked either against the
- software I2C implementation or the hardware I2C implementation.
-
- Use 4.7k pull-up resistor on the SDA and SCL pin.
-
- Adapt the SCL and SDA port and pin definitions and eventually the delay routine in the module
- i2cmaster.S to your target when using the software I2C implementation !
-
- Adjust the CPU clock frequence F_CPU in twimaster.c or in the Makfile when using the TWI hardware implementaion.
-
- @note
- The module i2cmaster.S is based on the Atmel Application Note AVR300, corrected and adapted
- to GNU assembler and AVR-GCC C call interface.
- Replaced the incorrect quarter period delays found in AVR300 with
- half period delays.
-
- @author Peter Fleury pfleury@gmx.ch http://jump.to/fleury
-
- @par API Usage Example
- The following code shows typical usage of this library, see example test_i2cmaster.c
-
- @code
-
- #include <i2cmaster.h>
-
-
- #define Dev24C02 0xA2 // device address of EEPROM 24C02, see datasheet
-
- int main(void)
- {
- unsigned char ret;
-
- i2c_init(); // initialize I2C library
-
- // write 0x75 to EEPROM address 5 (Byte Write)
- i2c_start_wait(Dev24C02+I2C_WRITE); // set device address and write mode
- i2c_write(0x05); // write address = 5
- i2c_write(0x75); // write value 0x75 to EEPROM
- i2c_stop(); // set stop conditon = release bus
-
-
- // read previously written value back from EEPROM address 5
- i2c_start_wait(Dev24C02+I2C_WRITE); // set device address and write mode
-
- i2c_write(0x05); // write address = 5
- i2c_rep_start(Dev24C02+I2C_READ); // set device address and read mode
-
- ret = i2c_readNak(); // read one byte from EEPROM
- i2c_stop();
-
- for(;;);
- }
- @endcode
-
-*/
-#endif /* DOXYGEN */
-
-/**@{*/
-
-#if (__GNUC__ * 100 + __GNUC_MINOR__) < 304
-#error "This library requires AVR-GCC 3.4 or later, update to newer AVR-GCC compiler !"
-#endif
-
-#include <avr/io.h>
-
-/** defines the data direction (reading from I2C device) in i2c_start(),i2c_rep_start() */
-#define I2C_READ 1
-
-/** defines the data direction (writing to I2C device) in i2c_start(),i2c_rep_start() */
-#define I2C_WRITE 0
-
-
-/**
- @brief initialize the I2C master interace. Need to be called only once
- @param void
- @return none
- */
-extern void i2c_init(void);
-
-
-/**
- @brief Terminates the data transfer and releases the I2C bus
- @param void
- @return none
- */
-extern void i2c_stop(void);
-
-
-/**
- @brief Issues a start condition and sends address and transfer direction
-
- @param addr address and transfer direction of I2C device
- @retval 0 device accessible
- @retval 1 failed to access device
- */
-extern unsigned char i2c_start(unsigned char addr);
-
-
-/**
- @brief Issues a repeated start condition and sends address and transfer direction
-
- @param addr address and transfer direction of I2C device
- @retval 0 device accessible
- @retval 1 failed to access device
- */
-extern unsigned char i2c_rep_start(unsigned char addr);
-
-
-/**
- @brief Issues a start condition and sends address and transfer direction
-
- If device is busy, use ack polling to wait until device ready
- @param addr address and transfer direction of I2C device
- @return none
- */
-extern void i2c_start_wait(unsigned char addr);
-
-
-/**
- @brief Send one byte to I2C device
- @param data byte to be transfered
- @retval 0 write successful
- @retval 1 write failed
- */
-extern unsigned char i2c_write(unsigned char data);
-
-
-/**
- @brief read one byte from the I2C device, request more data from device
- @return byte read from I2C device
- */
-extern unsigned char i2c_readAck(void);
-
-/**
- @brief read one byte from the I2C device, read is followed by a stop condition
- @return byte read from I2C device
- */
-extern unsigned char i2c_readNak(void);
-
-/**
- @brief read one byte from the I2C device
-
- Implemented as a macro, which calls either i2c_readAck or i2c_readNak
-
- @param ack 1 send ack, request more data from device<br>
- 0 send nak, read is followed by a stop condition
- @return byte read from I2C device
- */
-extern unsigned char i2c_read(unsigned char ack);
-#define i2c_read(ack) (ack) ? i2c_readAck() : i2c_readNak();
-
-
-/**@}*/
-#endif
diff --git a/keyboards/handwired/dactyl/info.json b/keyboards/handwired/dactyl/info.json
deleted file mode 100644
index 37d2e025e2..0000000000
--- a/keyboards/handwired/dactyl/info.json
+++ /dev/null
@@ -1,13 +0,0 @@
-{
- "keyboard_name": "Dactyl",
- "url": "",
- "maintainer": "qmk",
- "width": 17,
- "height": 8,
- "layouts": {
- "LAYOUT_dactyl": {
- "key_count": 70,
- "layout": [{"label":"k00", "x":0, "y":0}, {"label":"k01", "x":1, "y":0}, {"label":"k02", "x":2, "y":0}, {"label":"k03", "x":3, "y":0}, {"label":"k04", "x":4, "y":0}, {"label":"k05", "x":5, "y":0}, {"label":"k10", "x":0, "y":1}, {"label":"k11", "x":1, "y":1}, {"label":"k12", "x":2, "y":1}, {"label":"k13", "x":3, "y":1}, {"label":"k14", "x":4, "y":1}, {"label":"k15", "x":5, "y":1}, {"label":"k20", "x":0, "y":2}, {"label":"k21", "x":1, "y":2}, {"label":"k22", "x":2, "y":2}, {"label":"k23", "x":3, "y":2}, {"label":"k24", "x":4, "y":2}, {"label":"k25", "x":5, "y":2}, {"label":"k30", "x":0, "y":3}, {"label":"k31", "x":1, "y":3}, {"label":"k32", "x":2, "y":3}, {"label":"k33", "x":3, "y":3}, {"label":"k34", "x":4, "y":3}, {"label":"k35", "x":5, "y":3}, {"label":"k40", "x":0, "y":4}, {"label":"k41", "x":1, "y":4}, {"label":"k42", "x":2, "y":4}, {"label":"k43", "x":3, "y":4}, {"label":"k44", "x":4, "y":4}, {"label":"k55", "x":6, "y":5}, {"label":"k50", "x":7, "y":5}, {"label":"k54", "x":7, "y":6}, {"label":"k53", "x":5, "y":6, "h":2}, {"label":"k52", "x":6, "y":6, "h":2}, {"label":"k51", "x":7, "y":7}, {"label":"k06", "x":11, "y":0}, {"label":"k07", "x":12, "y":0}, {"label":"k08", "x":13, "y":0}, {"label":"k09", "x":14, "y":0}, {"label":"k0A", "x":15, "y":0}, {"label":"k0B", "x":16, "y":0}, {"label":"k16", "x":11, "y":1}, {"label":"k17", "x":12, "y":1}, {"label":"k18", "x":13, "y":1}, {"label":"k19", "x":14, "y":1}, {"label":"k1A", "x":15, "y":1}, {"label":"k1B", "x":16, "y":1}, {"label":"k26", "x":11, "y":2}, {"label":"k27", "x":12, "y":2}, {"label":"k28", "x":13, "y":2}, {"label":"k29", "x":14, "y":2}, {"label":"k2A", "x":15, "y":2}, {"label":"k2B", "x":16, "y":2}, {"label":"k36", "x":11, "y":3}, {"label":"k37", "x":12, "y":3}, {"label":"k38", "x":13, "y":3}, {"label":"k39", "x":14, "y":3}, {"label":"k3A", "x":15, "y":3}, {"label":"k3B", "x":16, "y":3}, {"label":"k47", "x":12, "y":4}, {"label":"k48", "x":13, "y":4}, {"label":"k49", "x":14, "y":4}, {"label":"k4A", "x":15, "y":4}, {"label":"k4B", "x":16, "y":4}, {"label":"k5B", "x":9, "y":5}, {"label":"k56", "x":10, "y":5}, {"label":"k57", "x":9, "y":6}, {"label":"k5A", "x":9, "y":7}, {"label":"k59", "x":10, "y":6, "h":2}, {"label":"k58", "x":11, "y":6, "h":2}]
- }
- }
-}
diff --git a/keyboards/handwired/dactyl/keymaps/default/keymap.c b/keyboards/handwired/dactyl/keymaps/default/keymap.c
deleted file mode 100644
index db666f43fe..0000000000
--- a/keyboards/handwired/dactyl/keymaps/default/keymap.c
+++ /dev/null
@@ -1,177 +0,0 @@
-#include QMK_KEYBOARD_H
-#include "version.h"
-
-#define BASE 0 // default layer
-#define SYMB 1 // symbols
-#define MDIA 2 // media keys
-
-enum custom_keycodes {
- PLACEHOLDER = SAFE_RANGE, // ensure these codes start after the highest keycode defined in Quantum
- VRSN,
-};
-
-const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
-/* Keymap 0: Basic layer
- *
- * ,-----------------------------------------. ,-----------------------------------------.
- * | = | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | - |
- * |------+------+------+------+------+------| |------+------+------+------+------+------|
- * | Del | Q | W | E | R | T | | Y | U | I | O | P | \ |
- * |------+------+------+------+------+------| |------+------+------+------+------+------|
- * | BkSp | A | S | D | F | G | | H | J | K | L |; / L2|'/Cmd |
- * |------+------+------+------+------+------| |------+------+------+------+------+------|
- * |LShift|Z/Ctrl| X | C | V | B | | N | M | , | . |//Ctrl|RShift|
- * |------+------+------+------+------+------' `------+------+------+------+------+------|
- * |Grv/L1| '" |AltShf| Left | Right| | Up | Down | [ | ] | ~L1 |
- * `----------------------------------' `----------------------------------'
- * ,-------------. ,-------------.
- * | App | LGui | | Alt | ^/Esc|
- * ,------|------|------| |------+------+------.
- * | | | Home | | PgUp | | |
- * | Space|Backsp|------| |------| Tab |Enter |
- * | |ace | End | | PgDn | | |
- * `--------------------' `--------------------'
- */
-[BASE] = LAYOUT_dactyl( // layer 0 : default
- // left hand
- KC_EQL, KC_1, KC_2, KC_3, KC_4, KC_5,
- KC_DELT, KC_Q, KC_W, KC_E, KC_R, KC_T,
- KC_BSPC, KC_A, KC_S, KC_D, KC_F, KC_G,
- KC_LSFT, CTL_T(KC_Z), KC_X, KC_C, KC_V, KC_B,
- LT(SYMB,KC_GRV), KC_QUOT, LALT(KC_LSFT), KC_LEFT, KC_RGHT,
- ALT_T(KC_APP), KC_LGUI,
- KC_HOME,
- KC_SPC, KC_BSPC, KC_END,
- // right hand
- KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS,
- KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLS,
- KC_H, KC_J, KC_K, KC_L, LT(MDIA, KC_SCLN), GUI_T(KC_QUOT),
- KC_N, KC_M, KC_COMM, KC_DOT, CTL_T(KC_SLSH), KC_RSFT,
- KC_UP, KC_DOWN, KC_LBRC, KC_RBRC, TT(SYMB),
- KC_RALT, CTL_T(KC_ESC),
- KC_PGUP,
- KC_PGDN, KC_TAB, KC_ENT
- ),
-/* Keymap 1: Symbol Layer
- *
- * ,-----------------------------------------. ,-----------------------------------------.
- * |Versn | F1 | F2 | F3 | F4 | F5 | | F6 | F7 | F8 | F9 | F10 | F11 |
- * |------+------+------+------+------+------| |------+------+------+------+------+------|
- * | | ! | @ | { | } | | | | Up | 7 | 8 | 9 | * | F12 |
- * |------+------+------+------+------+------| |------+------+------+------+------+------|
- * | | # | $ | ( | ) | ` | | Down | 4 | 5 | 6 | + | |
- * |------+------+------+------+------+------| |------+------+------+------+------+------|
- * | | % | ^ | [ | ] | ~ | | & | 1 | 2 | 3 | \ | |
- * |------+------+------+------+------+------' `------+------+------+------+------+------|
- * |RESET | | | | | | | . | 0 | = | |
- * `----------------------------------' `----------------------------------'
- * ,-------------. ,-------------.
- * | | | | | |
- * ,------|------|------| |------+------+------.
- * | | | | | | | |
- * | | |------| |------| | |
- * | | | | | | | |
- * `--------------------' `--------------------'
- */
-// SYMBOLS
-[SYMB] = LAYOUT_dactyl(
- // left hand
- VRSN, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5,
- KC_TRNS, KC_EXLM, KC_AT, KC_LCBR, KC_RCBR, KC_PIPE,
- KC_TRNS, KC_HASH, KC_DLR, KC_LPRN, KC_RPRN, KC_GRV,
- KC_TRNS, KC_PERC, KC_CIRC, KC_LBRC, KC_RBRC, KC_TILD,
- RESET, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
- KC_TRNS, KC_TRNS,
- KC_TRNS,
- KC_TRNS, KC_TRNS, KC_TRNS,
- // right hand
- KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11,
- KC_UP, KC_7, KC_8, KC_9, KC_ASTR, KC_F12,
- KC_DOWN, KC_4, KC_5, KC_6, KC_PLUS, KC_TRNS,
- KC_AMPR, KC_1, KC_2, KC_3, KC_BSLS, KC_TRNS,
- KC_TRNS, KC_DOT, KC_0, KC_EQL, KC_TRNS,
- KC_TRNS, KC_TRNS,
- KC_TRNS,
- KC_TRNS, KC_TRNS, KC_TRNS
-),
-/* Keymap 2: Media and mouse keys
- * ,-----------------------------------------. ,-----------------------------------------.
- * | | | | | | | | | | | | | |
- * |------+------+------+------+------+------| |------+------+------+------+------+------|
- * | | | | MsUp | | | | | | | | | |
- * |------+------+------+------+------+------| |------+------+------+------+------+------|
- * | | |MsLeft|MsDown|MsRght| | | | | | | | Play |
- * |------+------+------+------+------+------| |------+------+------+------+------+------|
- * | | | | | | | | | | Prev | Next | | |
- * |------+------+------+------+------+------' `------+------+------+------+------+------|
- * | | | | Lclk | Rclk | | VolUp| VolDn| Mute | | |
- * `----------------------------------' `----------------------------------'
- * ,-------------. ,-------------.
- * | | | | | |
- * ,------|------|------| |------+------+------.
- * | | | | | | |Brwser|
- * | | |------| |------| |Back |
- * | | | | | | | |
- * `--------------------' `--------------------'
- *
- */
-// MEDIA AND MOUSE
-[MDIA] = LAYOUT_dactyl(
- KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
- KC_TRNS, KC_TRNS, KC_TRNS, KC_MS_U, KC_TRNS, KC_TRNS,
- KC_TRNS, KC_TRNS, KC_MS_L, KC_MS_D, KC_MS_R, KC_TRNS,
- KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
- KC_TRNS, KC_TRNS, KC_TRNS, KC_BTN1, KC_BTN2,
- KC_TRNS, KC_TRNS,
- KC_TRNS,
- KC_TRNS, KC_TRNS, KC_TRNS,
- // right hand
- 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_MPLY,
- KC_TRNS, KC_TRNS, KC_MPRV, KC_MNXT, KC_TRNS, KC_TRNS,
- KC_VOLU, KC_VOLD, KC_MUTE, KC_TRNS, KC_TRNS,
- KC_TRNS, KC_TRNS,
- KC_TRNS,
- KC_TRNS, KC_TRNS, KC_WBAK
-),
-};
-
-const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
-{
- // MACRODOWN only works in this function
- switch(id) {
- case 0:
- if (record->event.pressed) {
- SEND_STRING (QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION);
- }
- break;
- case 1:
- if (record->event.pressed) { // For resetting EEPROM
- eeconfig_init();
- }
- break;
- }
- return MACRO_NONE;
-};
-
-bool process_record_user(uint16_t keycode, keyrecord_t *record) {
- switch (keycode) {
- case VRSN:
- if (record->event.pressed) {
- SEND_STRING (QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION);
- }
- return false;
- break;
- }
- return true;
-}
-
-// Runs just one time when the keyboard initializes.
-void matrix_init_user(void) {
-
-};
-
-
-// Runs constantly in the background, in a loop.
-void matrix_scan_user(void) {};
diff --git a/keyboards/handwired/dactyl/keymaps/default/readme.md b/keyboards/handwired/dactyl/keymaps/default/readme.md
deleted file mode 100644
index e393e396e3..0000000000
--- a/keyboards/handwired/dactyl/keymaps/default/readme.md
+++ /dev/null
@@ -1,10 +0,0 @@
-# Dactyl Default Configuration
-
-## Changelog
-
-* Nov 2017:
- * Copied and adapted from the Ergodox EZ equivalent
- * Notable differences:
- - Don't try to have the columns that don't exist, naturally
- - Removed RGB keys, since there are no RGB LEDs in the Dactyl (as designed, at least)
-
diff --git a/keyboards/handwired/dactyl/keymaps/dvorak/keymap.c b/keyboards/handwired/dactyl/keymaps/dvorak/keymap.c
deleted file mode 100644
index 7c44f78a65..0000000000
--- a/keyboards/handwired/dactyl/keymaps/dvorak/keymap.c
+++ /dev/null
@@ -1,177 +0,0 @@
-#include QMK_KEYBOARD_H
-#include "version.h"
-
-#define BASE 0 // default layer
-#define SYMB 1 // symbols
-#define MDIA 2 // media keys
-
-enum custom_keycodes {
- PLACEHOLDER = SAFE_RANGE, // ensure these codes start after the highest keycode defined in Quantum
- VRSN,
-};
-
-const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
-/* Keymap 0: Basic layer
- *
- * ,-----------------------------------------. ,-----------------------------------------.
- * | = | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | - |
- * |------+------+------+------+------+------| |------+------+------+------+------+------|
- * | Del | '" | , | . | P | Y | | F | G | C | R | L | \ |
- * |------+------+------+------+------+------| |------+------+------+------+------+------|
- * | BkSp | A | O | E | U | I | | D | H | T | N | S/L2 |//Cmd |
- * |------+------+------+------+------+------| |------+------+------+------+------+------|
- * |LShift|;/Ctrl| Q | J | K | X | | B | M | W | V |Z/Ctrl|RShift|
- * |------+------+------+------+------+------' `------+------+------+------+------+------|
- * |Grv/L1| = |AltShf| Left | Right| | Up | Down | [ | ] | ~L1 |
- * `----------------------------------' `----------------------------------'
- * ,-------------. ,-------------.
- * | App | LGui | | Alt | ^/Esc|
- * ,------|------|------| |------+------+------.
- * | | | Home | | PgUp | | |
- * | Space|Backsp|------| |------| Tab |Enter |
- * | |ace | End | | PgDn | | |
- * `--------------------' `--------------------'
- */
-[BASE] = LAYOUT_dactyl( // layer 0 : default
- // left hand
- KC_EQL, KC_1, KC_2, KC_3, KC_4, KC_5,
- KC_DELT, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y,
- KC_BSPC, KC_A, KC_O, KC_E, KC_U, KC_I,
- KC_LSFT, CTL_T(KC_SCLN), KC_Q, KC_J, KC_K, KC_X,
- LT(SYMB,KC_GRV), KC_EQL, LALT(KC_LSFT), KC_LEFT, KC_RGHT,
- ALT_T(KC_APP), KC_LGUI,
- KC_HOME,
- KC_SPC, KC_BSPC, KC_END,
- // right hand
- KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS,
- KC_F, KC_G, KC_C, KC_R, KC_L, KC_BSLS,
- KC_D, KC_H, KC_T, KC_N, LT(MDIA, KC_S), GUI_T(KC_SLSH),
- KC_B, KC_M, KC_W, KC_V, CTL_T(KC_Z), KC_RSFT,
- KC_UP, KC_DOWN, KC_LBRC, KC_RBRC, TT(SYMB),
- KC_RALT, CTL_T(KC_ESC),
- KC_PGUP,
- KC_PGDN, KC_TAB, KC_ENT
- ),
-/* Keymap 1: Symbol Layer
- *
- * ,-----------------------------------------. ,-----------------------------------------.
- * |Versn | F1 | F2 | F3 | F4 | F5 | | F6 | F7 | F8 | F9 | F10 | F11 |
- * |------+------+------+------+------+------| |------+------+------+------+------+------|
- * | | ! | @ | { | } | | | | Up | 7 | 8 | 9 | * | F12 |
- * |------+------+------+------+------+------| |------+------+------+------+------+------|
- * | | # | $ | ( | ) | ` | | Down | 4 | 5 | 6 | + | |
- * |------+------+------+------+------+------| |------+------+------+------+------+------|
- * | | % | ^ | [ | ] | ~ | | & | 1 | 2 | 3 | \ | |
- * |------+------+------+------+------+------' `------+------+------+------+------+------|
- * |RESET | | | | | | | . | 0 | = | |
- * `----------------------------------' `----------------------------------'
- * ,-------------. ,-------------.
- * | | | | | |
- * ,------|------|------| |------+------+------.
- * | | | | | | | |
- * | | |------| |------| | |
- * | | | | | | | |
- * `--------------------' `--------------------'
- */
-// SYMBOLS
-[SYMB] = LAYOUT_dactyl(
- // left hand
- VRSN, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5,
- KC_TRNS, KC_EXLM, KC_AT, KC_LCBR, KC_RCBR, KC_PIPE,
- KC_TRNS, KC_HASH, KC_DLR, KC_LPRN, KC_RPRN, KC_GRV,
- KC_TRNS, KC_PERC, KC_CIRC, KC_LBRC, KC_RBRC, KC_TILD,
- RESET, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
- KC_TRNS, KC_TRNS,
- KC_TRNS,
- KC_TRNS, KC_TRNS, KC_TRNS,
- // right hand
- KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11,
- KC_UP, KC_7, KC_8, KC_9, KC_ASTR, KC_F12,
- KC_DOWN, KC_4, KC_5, KC_6, KC_PLUS, KC_TRNS,
- KC_AMPR, KC_1, KC_2, KC_3, KC_BSLS, KC_TRNS,
- KC_TRNS, KC_DOT, KC_0, KC_EQL, KC_TRNS,
- KC_TRNS, KC_TRNS,
- KC_TRNS,
- KC_TRNS, KC_TRNS, KC_TRNS
-),
-/* Keymap 2: Media and mouse keys
- * ,-----------------------------------------. ,-----------------------------------------.
- * | | | | | | | | | | | | | |
- * |------+------+------+------+------+------| |------+------+------+------+------+------|
- * | | | | MsUp | | | | | | | | | |
- * |------+------+------+------+------+------| |------+------+------+------+------+------|
- * | | |MsLeft|MsDown|MsRght| | | | | | | | Play |
- * |------+------+------+------+------+------| |------+------+------+------+------+------|
- * | | | | | | | | | | Prev | Next | | |
- * |------+------+------+------+------+------' `------+------+------+------+------+------|
- * | | | | Lclk | Rclk | | VolUp| VolDn| Mute | | |
- * `----------------------------------' `----------------------------------'
- * ,-------------. ,-------------.
- * | | | | | |
- * ,------|------|------| |------+------+------.
- * | | | | | | |Brwser|
- * | | |------| |------| |Back |
- * | | | | | | | |
- * `--------------------' `--------------------'
- *
- */
-// MEDIA AND MOUSE
-[MDIA] = LAYOUT_dactyl(
- KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
- KC_TRNS, KC_TRNS, KC_TRNS, KC_MS_U, KC_TRNS, KC_TRNS,
- KC_TRNS, KC_TRNS, KC_MS_L, KC_MS_D, KC_MS_R, KC_TRNS,
- KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
- KC_TRNS, KC_TRNS, KC_TRNS, KC_BTN1, KC_BTN2,
- KC_TRNS, KC_TRNS,
- KC_TRNS,
- KC_TRNS, KC_TRNS, KC_TRNS,
- // right hand
- 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_MPLY,
- KC_TRNS, KC_TRNS, KC_MPRV, KC_MNXT, KC_TRNS, KC_TRNS,
- KC_VOLU, KC_VOLD, KC_MUTE, KC_TRNS, KC_TRNS,
- KC_TRNS, KC_TRNS,
- KC_TRNS,
- KC_TRNS, KC_TRNS, KC_WBAK
-),
-};
-
-const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
-{
- // MACRODOWN only works in this function
- switch(id) {
- case 0:
- if (record->event.pressed) {
- SEND_STRING (QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION);
- }
- break;
- case 1:
- if (record->event.pressed) { // For resetting EEPROM
- eeconfig_init();
- }
- break;
- }
- return MACRO_NONE;
-};
-
-bool process_record_user(uint16_t keycode, keyrecord_t *record) {
- switch (keycode) {
- case VRSN:
- if (record->event.pressed) {
- SEND_STRING (QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION);
- }
- return false;
- break;
- }
- return true;
-}
-
-// Runs just one time when the keyboard initializes.
-void matrix_init_user(void) {
-
-};
-
-
-// Runs constantly in the background, in a loop.
-void matrix_scan_user(void) {};
diff --git a/keyboards/handwired/dactyl/keymaps/dvorak/readme.md b/keyboards/handwired/dactyl/keymaps/dvorak/readme.md
deleted file mode 100644
index 42ec3cd4f6..0000000000
--- a/keyboards/handwired/dactyl/keymaps/dvorak/readme.md
+++ /dev/null
@@ -1,9 +0,0 @@
-# Dactyl Dvorak keymap
-
-Modifiers and layers 1+ are the same as in the default layout.
-Only the layer-0 dvorak-relevant keys are different.
-
-## Changelog
-
-* Nov 2017:
- * Copied and adapted from the default keymap.
diff --git a/keyboards/handwired/dactyl/keymaps/erincalling/keymap.c b/keyboards/handwired/dactyl/keymaps/erincalling/keymap.c
deleted file mode 100644
index e439af3e54..0000000000
--- a/keyboards/handwired/dactyl/keymaps/erincalling/keymap.c
+++ /dev/null
@@ -1,160 +0,0 @@
-#include QMK_KEYBOARD_H
-#include "version.h"
-
-#define BASE 0 // default layer
-#define CONT 1 // control layer
-#define QWER 2 // qwerty layer
-
-enum custom_keycodes {
- PLACEHOLDER = SAFE_RANGE, // ensure these codes start after the highest keycode defined in Quantum
- COLON_EQ,
-};
-
-const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
-/* Keymap 0: Basic layer
- *
- * ,-----------------------------------------. ,-----------------------------------------.
- * | Esc | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | \ |
- * |------+------+------+------+------+------| |------+------+------+------+------+------|
- * | Tab | '" | , | . | P | Y | | F | G | C | R | L | / |
- * |------+------+------+------+------+------| |------+------+------+------+------+------|
- * | := | A | O | E | U | I | | D | H | T | N | S | - |
- * |------+------+------+------+------+------| |------+------+------+------+------+------|
- * |LShift| ; | Q | J | K | X | | B | M | W | V | Z |RShift|
- * |------+------+------+------+------+------' `------+------+------+------+------+------|
- * | Home | ` | = | Left | Right| | Up | Down | [ | ] | End |
- * `----------------------------------' `----------------------------------'
- * ,-------------. ,-------------.
- * | LCtl | LAlt | | RCtl | Ralt |
- * ,------|------|------| |------+------+------.
- * | | | L1 | | L1 | | |
- * | Back |Delete|------| |------|Enter |Space |
- * |Space | | LGui | | RGui | | |
- * `--------------------' `--------------------'
- */
-[BASE] = LAYOUT_dactyl( // layer 0 : default
- // left hand
- KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5,
- KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y,
- COLON_EQ, KC_A, KC_O, KC_E, KC_U, KC_I,
- KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X,
- KC_HOME, KC_GRV, KC_EQL, KC_LEFT, KC_RGHT,
- KC_LCTRL, KC_LALT,
- MO(CONT),
- KC_BSPC, KC_DEL, KC_LGUI,
- // right hand
- KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSLS,
- KC_F, KC_G, KC_C, KC_R, KC_L, KC_SLSH,
- KC_D, KC_H, KC_T, KC_N, KC_S, KC_MINS,
- KC_B, KC_M, KC_W, KC_V, KC_Z, KC_RSFT,
- KC_UP, KC_DOWN, KC_LBRC, KC_RBRC, KC_END,
- KC_RALT, KC_RCTL,
- MO(CONT),
- KC_RGUI, KC_ENT, KC_SPACE
- ),
-/* Keymap 1: Control layer (media keys, Fkeys, numpad)
- *
- * ,-----------------------------------------. ,-----------------------------------------.
- * | | F1 | F2 | F3 | F4 | F5 | | F6 | F7 | F8 | F9 | F10 | RESET|
- * |------+------+------+------+------+------| |------+------+------+------+------+------|
- * | | | Mute | VolD | VolU | | | | 7 | 8 | 9 | + | |
- * |------+------+------+------+------+------| |------+------+------+------+------+------|
- * | | | Prev |PPause| Next | | | | 4 | 5 | 6 | = | |
- * |------+------+------+------+------+------| |------+------+------+------+------+------|
- * | | | | | | | | | 1 | 2 | 3 | , | |
- * |------+------+------+------+------+------' `------+------+------+------+------+------|
- * |PageUp| | | | | | 0 | 0 | . | |PageDn|
- * `----------------------------------' `----------------------------------'
- * ,-------------. ,-------------.
- * | | | | | |
- * ,------|------|------| |------+------+------.
- * | | | | | | | |
- * | | |------| |------| | |
- * | | | | | | | |
- * `--------------------' `--------------------'
- */
-// SYMBOLS
-[CONT] = LAYOUT_dactyl(
- // left hand
- KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5,
- KC_TRNS, KC_TRNS, KC_MUTE, KC_VOLD, KC_VOLU, KC_TRNS,
- TG(QWER), KC_TRNS, KC_MPRV, KC_MPLY, KC_MNXT, KC_TRNS,
- KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
- KC_PGUP, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
- KC_TRNS, KC_TRNS,
- KC_TRNS,
- KC_TRNS, KC_TRNS, KC_TRNS,
- // right hand
- KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, RESET,
- KC_TRNS, KC_7, KC_8, KC_9, KC_KP_PLUS, KC_TRNS,
- KC_TRNS, KC_4, KC_5, KC_6, KC_EQL, KC_TRNS,
- KC_TRNS, KC_1, KC_2, KC_3, KC_COMM, KC_TRNS,
- KC_0, KC_0, KC_DOT, KC_TRNS, KC_PGDN,
- KC_TRNS, KC_TRNS,
- KC_TRNS,
- KC_TRNS, KC_TRNS, KC_TRNS
-),
-/* Keymap 2: QWERTY overlay
- * ,-----------------------------------------. ,-----------------------------------------.
- * | | | | | | | | | | | | | [ |
- * |------+------+------+------+------+------| |------+------+------+------+------+------|
- * | | Q | W | E | R | T | | Y | U | I | O | P | ] |
- * |------+------+------+------+------+------| |------+------+------+------+------+------|
- * | | A | S | D | F | G | | H | J | K | L | ; | '" |
- * |------+------+------+------+------+------| |------+------+------+------+------+------|
- * | | Z | X | C | V | B | | N | M | , | . | / | |
- * |------+------+------+------+------+------' `------+------+------+------+------+------|
- * | | | | | | | | | - | \ | |
- * `----------------------------------' `----------------------------------'
- * ,-------------. ,-------------.
- * | | | | | |
- * ,------|------|------| |------+------+------.
- * | | | | | | | |
- * | | |------| |------| | |
- * | | | | | | | |
- * `--------------------' `--------------------'
- *
- */
-// QWERTY
-[QWER] = LAYOUT_dactyl(
- KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
- KC_TRNS, KC_Q, KC_W, KC_E, KC_R, KC_T,
- KC_TRNS, KC_A, KC_S, KC_D, KC_F, KC_G,
- KC_TRNS, KC_Z, KC_X, KC_C, KC_V, KC_B,
- KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
- KC_TRNS, KC_TRNS,
- KC_TRNS,
- KC_TRNS, KC_TRNS, KC_TRNS,
- // right hand
- KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_LBRC,
- KC_Y, KC_U, KC_I, KC_O, KC_P, KC_RBRC,
- KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT,
- KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_TRNS,
- KC_TRNS, KC_TRNS, KC_MINS, KC_BSLS, KC_TRNS,
- KC_TRNS, KC_TRNS,
- KC_TRNS,
- KC_TRNS, KC_TRNS, KC_TRNS
-),
-};
-
-bool process_record_user(uint16_t keycode, keyrecord_t *record) {
- if (record->event.pressed) {
- switch(keycode) {
- case COLON_EQ:
- SEND_STRING(":=");
- return false;
- break;
- }
- }
-
- return true;
-}
-
-// Runs just one time when the keyboard initializes.
-void matrix_init_user(void) {
-
-};
-
-
-// Runs constantly in the background, in a loop.
-void matrix_scan_user(void) {};
diff --git a/keyboards/handwired/dactyl/keymaps/erincalling/readme.md b/keyboards/handwired/dactyl/keymaps/erincalling/readme.md
deleted file mode 100644
index 7528ed07eb..0000000000
--- a/keyboards/handwired/dactyl/keymaps/erincalling/readme.md
+++ /dev/null
@@ -1,6 +0,0 @@
-# Erincalling Dactyl keymap
-
-## Changelog
-
-* Nov 2017:
- * Ported and adapted from the ergodox-firmware layout I'd been using
diff --git a/keyboards/handwired/dactyl/matrix.c b/keyboards/handwired/dactyl/matrix.c
deleted file mode 100644
index f63cf1188f..0000000000
--- a/keyboards/handwired/dactyl/matrix.c
+++ /dev/null
@@ -1,542 +0,0 @@
-/*
-Copyright 2013 Oleg Kostyuk <cub.uanic@gmail.com>
-Copyright 2017 Erin Call <hello@erincall.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 "wait.h"
-#include "action_layer.h"
-#include "print.h"
-#include "debug.h"
-#include "util.h"
-#include "matrix.h"
-#include "dactyl.h"
-#include "i2cmaster.h"
-#include "timer.h"
-
-
-/* Set 0 if debouncing isn't needed */
-
-#ifndef DEBOUNCING_DELAY
-# define DEBOUNCING_DELAY 5
-#endif
-
-#if (DEBOUNCING_DELAY > 0)
- static uint16_t debouncing_time;
- static bool debouncing = false;
-#endif
-
-#ifdef MATRIX_MASKED
- extern const matrix_row_t matrix_mask[];
-#endif
-
-#if (DIODE_DIRECTION == ROW2COL) || (DIODE_DIRECTION == COL2ROW)
-static const uint8_t onboard_row_pins[MATRIX_ROWS] = MATRIX_ONBOARD_ROW_PINS;
-static const uint8_t onboard_col_pins[MATRIX_COLS] = MATRIX_ONBOARD_COL_PINS;
-static const bool col_expanded[MATRIX_COLS] = COL_EXPANDED;
-#endif
-
-/* matrix state(1:on, 0:off) */
-static matrix_row_t matrix[MATRIX_ROWS];
-
-static matrix_row_t matrix_debouncing[MATRIX_ROWS];
-
-#if (DIODE_DIRECTION == COL2ROW)
- static const uint8_t expander_col_pins[MATRIX_COLS] = MATRIX_EXPANDER_COL_PINS;
- static void init_cols(void);
- static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row);
- static void unselect_rows(void);
- static void select_row(uint8_t row);
- static void unselect_row(uint8_t row);
-#elif (DIODE_DIRECTION == ROW2COL)
- static const uint8_t expander_row_pins[MATRIX_ROWS] = MATRIX_EXPANDER_ROW_PINS;
- static void init_rows(void);
- static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col);
- static void unselect_cols(void);
- static void select_col(uint8_t col);
- static void unselect_col(uint8_t col);
-#endif
-
-static uint8_t expander_reset_loop;
-uint8_t expander_status;
-uint8_t expander_input_pin_mask;
-bool i2c_initialized = false;
-
-#ifdef DEBUG_MATRIX_SCAN_RATE
-uint32_t matrix_timer;
-uint32_t matrix_scan_count;
-#endif
-
-#define ROW_SHIFTER ((matrix_row_t)1)
-#if (DIODE_DIRECTION == COL2ROW)
-// bitmask to ensure the row state from the expander only applies to its columns
-#define EXPANDER_MASK ((matrix_row_t)0b00111111)
-#endif
-
-__attribute__ ((weak))
-void matrix_init_user(void) {}
-
-__attribute__ ((weak))
-void matrix_scan_user(void) {}
-
-__attribute__ ((weak))
-void matrix_init_kb(void) {
- matrix_init_user();
-}
-
-__attribute__ ((weak))
-void matrix_scan_kb(void) {
- matrix_scan_user();
-}
-
-inline
-uint8_t matrix_rows(void)
-{
- return MATRIX_ROWS;
-}
-
-inline
-uint8_t matrix_cols(void)
-{
- return MATRIX_COLS;
-}
-
-void matrix_init(void)
-{
- init_expander();
-
-#if (DIODE_DIRECTION == COL2ROW)
- unselect_rows();
- init_cols();
-#elif (DIODE_DIRECTION == ROW2COL)
- unselect_cols();
- init_rows();
-#endif
-
- // initialize matrix state: all keys off
- for (uint8_t i=0; i < MATRIX_ROWS; i++) {
- matrix[i] = 0;
- matrix_debouncing[i] = 0;
- }
-
-#ifdef DEBUG_MATRIX_SCAN_RATE
- matrix_timer = timer_read32();
- matrix_scan_count = 0;
-#endif
-
- matrix_init_quantum();
-}
-
-void init_expander(void) {
- if (! i2c_initialized) {
- i2c_init();
- wait_us(1000000);
- }
-
- if (! expander_input_pin_mask) {
-#if (DIODE_DIRECTION == COL2ROW)
- for (int col = 0; col < MATRIX_COLS; col++) {
- if (col_expanded[col]) {
- expander_input_pin_mask |= (1 << expander_col_pins[col]);
- }
- }
-#elif (DIODE_DIRECTION == ROW2COL)
- for (int row = 0; row < MATRIX_ROWS; row++) {
- expander_input_pin_mask |= (1 << expander_row_pins[row]);
- }
-#endif
- }
-
- expander_status = i2c_start(I2C_ADDR_WRITE); if (expander_status) goto out;
- expander_status = i2c_write(IODIRA); if (expander_status) goto out;
-
- /*
- Pin direction and pull-up depends on both the diode direction
- and on whether the column register is 0 ("A") or 1 ("B"):
- +-------+---------------+---------------+
- | | ROW2COL | COL2ROW |
- +-------+---------------+---------------+
- | Reg 0 | input, output | output, input |
- +-------+---------------+---------------+
- | Reg 1 | output, input | input, output |
- +-------+---------------+---------------+
- */
-
-#if (EXPANDER_COLUMN_REGISTER == 0)
-# if (DIODE_DIRECTION == COL2ROW)
- expander_status = i2c_write(expander_input_pin_mask); if (expander_status) goto out;
- expander_status = i2c_write(0); if (expander_status) goto out;
-# elif (DIODE_DIRECTION == ROW2COL)
- expander_status = i2c_write(0); if (expander_status) goto out;
- expander_status = i2c_write(expander_input_pin_mask); if (expander_status) goto out;
-# endif
-#elif (EXPANDER_COLUMN_REGISTER == 1)
-# if (DIODE_DIRECTION == COL2ROW)
- expander_status = i2c_write(0); if (expander_status) goto out;
- expander_status = i2c_write(expander_input_pin_mask); if (expander_status) goto out;
-# elif (DIODE_DIRECTION == ROW2COL)
- expander_status = i2c_write(expander_input_pin_mask); if (expander_status) goto out;
- expander_status = i2c_write(0); if (expander_status) goto out;
-# endif
-#endif
-
- i2c_stop();
-
- // set pull-up
- // - unused : off : 0
- // - input : on : 1
- // - driving : off : 0
- expander_status = i2c_start(I2C_ADDR_WRITE); if (expander_status) goto out;
- expander_status = i2c_write(GPPUA); if (expander_status) goto out;
-#if (EXPANDER_COLUMN_REGISTER == 0)
-# if (DIODE_DIRECTION == COL2ROW)
- expander_status = i2c_write(expander_input_pin_mask); if (expander_status) goto out;
- expander_status = i2c_write(0); if (expander_status) goto out;
-# elif (DIODE_DIRECTION == ROW2COL)
- expander_status = i2c_write(0); if (expander_status) goto out;
- expander_status = i2c_write(expander_input_pin_mask); if (expander_status) goto out;
-# endif
-#elif (EXPANDER_COLUMN_REGISTER == 1)
-# if (DIODE_DIRECTION == COL2ROW)
- expander_status = i2c_write(0); if (expander_status) goto out;
- expander_status = i2c_write(expander_input_pin_mask); if (expander_status) goto out;
-# elif (DIODE_DIRECTION == ROW2COL)
- expander_status = i2c_write(expander_input_pin_mask); if (expander_status) goto out;
- expander_status = i2c_write(0); if (expander_status) goto out;
-# endif
-#endif
-
-out:
- i2c_stop();
-}
-
-uint8_t matrix_scan(void)
-{
- if (expander_status) { // if there was an error
- if (++expander_reset_loop == 0) {
- // since expander_reset_loop is 8 bit - we'll try to reset once in 255 matrix scans
- // this will be approx bit more frequent than once per second
- print("trying to reset expander\n");
- init_expander();
- if (expander_status) {
- print("left side not responding\n");
- } else {
- print("left side attached\n");
- }
- }
- }
-
-#ifdef DEBUG_MATRIX_SCAN_RATE
- matrix_scan_count++;
-
- uint32_t timer_now = timer_read32();
- if (TIMER_DIFF_32(timer_now, matrix_timer)>1000) {
- print("matrix scan frequency: ");
- pdec(matrix_scan_count);
- print("\n");
-
- matrix_timer = timer_now;
- matrix_scan_count = 0;
- }
-#endif
-
-#if (DIODE_DIRECTION == COL2ROW)
- for (uint8_t current_row = 0; current_row < MATRIX_ROWS; current_row++) {
-# if (DEBOUNCING_DELAY > 0)
- bool matrix_changed = read_cols_on_row(matrix_debouncing, current_row);
-
- if (matrix_changed) {
- debouncing = true;
- debouncing_time = timer_read();
- }
-# else
- read_cols_on_row(matrix, current_row);
-# endif
- }
-
-#elif (DIODE_DIRECTION == ROW2COL)
- for (uint8_t current_col = 0; current_col < MATRIX_COLS; current_col++) {
-# if (DEBOUNCING_DELAY > 0)
- bool matrix_changed = read_rows_on_col(matrix_debouncing, current_col);
-
- if (matrix_changed) {
- debouncing = true;
- debouncing_time = timer_read();
- }
-# else
- read_rows_on_col(matrix, current_col);
-# endif
-
- }
-#endif
-
-# if (DEBOUNCING_DELAY > 0)
- if (debouncing && (timer_elapsed(debouncing_time) > DEBOUNCING_DELAY)) {
- for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
- matrix[i] = matrix_debouncing[i];
- }
- debouncing = false;
- }
-# endif
-
- matrix_scan_quantum();
- return 1;
-}
-
-bool matrix_is_modified(void) // deprecated and evidently not called.
-{
-#if (DEBOUNCING_DELAY > 0)
- if (debouncing) return false;
-#endif
- return true;
-}
-
-inline
-bool matrix_is_on(uint8_t row, uint8_t col)
-{
- return (matrix[row] & (ROW_SHIFTER << col));
-}
-
-inline
-matrix_row_t matrix_get_row(uint8_t row)
-{
-#ifdef MATRIX_MASKED
- return matrix[row] & matrix_mask[row];
-#else
- return matrix[row];
-#endif
-}
-
-void matrix_print(void)
-{
- print("\nr/c 0123456789ABCDEF\n");
- for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
- phex(row); print(": ");
- pbin_reverse16(matrix_get_row(row));
- print("\n");
- }
-}
-
-uint8_t matrix_key_count(void)
-{
- uint8_t count = 0;
- for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
- count += bitpop16(matrix[i]);
- }
- return count;
-}
-
-#if (DIODE_DIRECTION == COL2ROW)
-
-static void init_cols(void) {
- for (uint8_t x = 0; x < MATRIX_COLS; x++) {
- if (! col_expanded[x]) {
- uint8_t pin = onboard_col_pins[x];
- _SFR_IO8((pin >> 4) + 1) &= ~_BV(pin & 0xF); // IN
- _SFR_IO8((pin >> 4) + 2) |= _BV(pin & 0xF); // HI
- }
- }
-}
-
-static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) {
- // Store last value of row prior to reading
- matrix_row_t last_row_value = current_matrix[current_row];
-
- // Clear data in matrix row
- current_matrix[current_row] = 0;
-
- // Select row and wait for row selection to stabilize
- select_row(current_row);
- wait_us(30);
-
- // Read columns from expander, unless it's in an error state
- if (! expander_status) {
- expander_status = i2c_start(I2C_ADDR_WRITE); if (expander_status) goto out;
- expander_status = i2c_write(GPIOA); if (expander_status) goto out;
- expander_status = i2c_start(I2C_ADDR_READ); if (expander_status) goto out;
-
- current_matrix[current_row] |= (~i2c_readNak()) & EXPANDER_MASK;
-
- out:
- i2c_stop();
- }
-
- // Read columns from onboard pins
- for (uint8_t col_index = 0; col_index < MATRIX_COLS; col_index++) {
- if (! col_expanded[col_index]) {
- uint8_t pin = onboard_col_pins[col_index];
- uint8_t pin_state = (_SFR_IO8(pin >> 4) & _BV(pin & 0xF));
- current_matrix[current_row] |= pin_state ? 0 : (ROW_SHIFTER << col_index);
- }
- }
-
- unselect_row(current_row);
-
- return (last_row_value != current_matrix[current_row]);
-}
-
-static void select_row(uint8_t row) {
- // select on expander, unless it's in an error state
- if (! expander_status) {
- // set active row low : 0
- // set other rows hi-Z : 1
- expander_status = i2c_start(I2C_ADDR_WRITE); if (expander_status) goto out;
- expander_status = i2c_write(GPIOB); if (expander_status) goto out;
- expander_status = i2c_write(0xFF & ~(1<<row)); if (expander_status) goto out;
- out:
- i2c_stop();
- }
-
- // select on teensy
- uint8_t pin = onboard_row_pins[row];
- _SFR_IO8((pin >> 4) + 1) |= _BV(pin & 0xF); // OUT
- _SFR_IO8((pin >> 4) + 2) &= ~_BV(pin & 0xF); // LOW
-}
-
-static void unselect_row(uint8_t row)
-{
- // No need to explicitly unselect expander pins--their I/O state is
- // set simultaneously, with a single bitmask sent to i2c_write. When
- // select_row selects a single pin, it implicitly unselects all the
- // other ones.
-
- // unselect on teensy
- uint8_t pin = onboard_row_pins[row];
- _SFR_IO8((pin >> 4) + 1) &= ~_BV(pin & 0xF); // OUT
- _SFR_IO8((pin >> 4) + 2) |= _BV(pin & 0xF); // LOW
-}
-
-static void unselect_rows(void) {
- for (uint8_t x = 0; x < MATRIX_ROWS; x++) {
- unselect_row(x);
- }
-}
-
-#elif (DIODE_DIRECTION == ROW2COL)
-
-static void init_rows(void)
-{
- for (uint8_t x = 0; x < MATRIX_ROWS; x++) {
- uint8_t pin = onboard_row_pins[x];
- _SFR_IO8((pin >> 4) + 1) &= ~_BV(pin & 0xF); // IN
- _SFR_IO8((pin >> 4) + 2) |= _BV(pin & 0xF); // HI
- }
-}
-
-static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col)
-{
- bool matrix_changed = false;
-
- uint8_t column_state = 0;
-
- //select col and wait for selection to stabilize
- select_col(current_col);
- wait_us(30);
-
- if (current_col < 6) {
- // read rows from expander
- if (expander_status) {
- // it's already in an error state; nothing we can do
- return false;
- }
-
- expander_status = i2c_start(I2C_ADDR_WRITE); if (expander_status) goto out;
- expander_status = i2c_write(GPIOB); if (expander_status) goto out;
- expander_status = i2c_start(I2C_ADDR_READ); if (expander_status) goto out;
- column_state = i2c_readNak();
-
- out:
- i2c_stop();
-
- column_state = ~column_state;
- } else {
- for (uint8_t current_row = 0; current_row < MATRIX_ROWS; current_row++) {
- if ((_SFR_IO8(onboard_row_pins[current_row] >> 4) & _BV(onboard_row_pins[current_row] & 0xF)) == 0) {
- column_state |= (1 << current_row);
- }
- }
- }
-
- for (uint8_t current_row = 0; current_row < MATRIX_ROWS; current_row++) {
- // Store last value of row prior to reading
- matrix_row_t last_row_value = current_matrix[current_row];
-
- if (column_state & (1 << current_row)) {
- // key closed; set state bit in matrix
- current_matrix[current_row] |= (ROW_SHIFTER << current_col);
- } else {
- // key open; clear state bit in matrix
- current_matrix[current_row] &= ~(ROW_SHIFTER << current_col);
- }
-
- // Determine whether the matrix changed state
- if ((last_row_value != current_matrix[current_row]) && !(matrix_changed))
- {
- matrix_changed = true;
- }
- }
-
- unselect_col(current_col);
-
- return matrix_changed;
-}
-
-static void select_col(uint8_t col)
-{
- if (col_expanded[col]) {
- // select on expander
- if (expander_status) { // if there was an error
- // do nothing
- } else {
- // set active col low : 0
- // set other cols hi-Z : 1
- expander_status = i2c_start(I2C_ADDR_WRITE); if (expander_status) goto out;
- expander_status = i2c_write(GPIOA); if (expander_status) goto out;
- expander_status = i2c_write(0xFF & ~(1<<col)); if (expander_status) goto out;
- out:
- i2c_stop();
- }
- } else {
- // select on teensy
- uint8_t pin = onboard_col_pins[col];
- _SFR_IO8((pin >> 4) + 1) |= _BV(pin & 0xF); // OUT
- _SFR_IO8((pin >> 4) + 2) &= ~_BV(pin & 0xF); // LOW
- }
-}
-
-static void unselect_col(uint8_t col)
-{
- if (col_expanded[col]) {
- // No need to explicitly unselect expander pins--their I/O state is
- // set simultaneously, with a single bitmask sent to i2c_write. When
- // select_col selects a single pin, it implicitly unselects all the
- // other ones.
- } else {
- // unselect on teensy
- uint8_t pin = onboard_col_pins[col];
- _SFR_IO8((pin >> 4) + 1) &= ~_BV(pin & 0xF); // IN
- _SFR_IO8((pin >> 4) + 2) |= _BV(pin & 0xF); // HI
- }
-}
-
-static void unselect_cols(void)
-{
- for(uint8_t x = 0; x < MATRIX_COLS; x++) {
- unselect_col(x);
- }
-}
-#endif
diff --git a/keyboards/handwired/dactyl/readme.md b/keyboards/handwired/dactyl/readme.md
deleted file mode 100644
index 698ef29e01..0000000000
--- a/keyboards/handwired/dactyl/readme.md
+++ /dev/null
@@ -1,39 +0,0 @@
-# Dactyl
-
-See https://github.com/adereth/dactyl-keyboard
-
-The Dactyl uses the [Teensy Loader](https://www.pjrc.com/teensy/loader.html).
-
-Linux users need to modify udev rules as described on the [Teensy
-Linux page]. Some distributions provide a binary, maybe called
-`teensy-loader-cli`.
-
-[Teensy Linux page]: https://www.pjrc.com/teensy/loader_linux.html
-
-To flash the firmware:
-
- - Build the firmware with `make handwired/dactyl:<keymapname>`, for example `make handwired/dactyl:default`
- - This will result in a hex file called `handwired_dactyl_<keymapname>.hex`, e.g.
- `handwired_dactyl_default.hex`
-
- - Start the teensy loader.
-
- - Load the .hex file into it.
-
- - Put the Teensy in firmware-loading mode:
- * If your current layout has a RESET key, press it.
- * If you lack a RESET key, press the reset button on the Teensy board itself.
-
- - Click the button in the Teensy app to download the firmware.
-
-To flash with ´teensy-loader-cli´:
-
- - Build the firmware as above
-
- - Run `<path/to/>teensy_loader_cli -mmcu=atmega32u4 -w handwired_dactyl_<keymapname>.hex`
-
- - If you like, you can do both at once: `make handwired/dactyl:<keymapname>:teensy`
-
- - Put the Teensy in firmware-loading mode:
- * If your current layout has a RESET key, press it.
- * If you lack a RESET key, press the reset button on the Teensy board itself.
diff --git a/keyboards/handwired/dactyl/rules.mk b/keyboards/handwired/dactyl/rules.mk
deleted file mode 100644
index dc25f9c3fb..0000000000
--- a/keyboards/handwired/dactyl/rules.mk
+++ /dev/null
@@ -1,86 +0,0 @@
-#----------------------------------------------------------------------------
-# On command line:
-#
-# make = Make software.
-#
-# make clean = Clean out built project files.
-#
-# That's pretty much all you need. To compile, always go make clean,
-# followed by make.
-#
-# For advanced users only:
-# make teensy = Download the hex file to the device, using teensy_loader_cli.
-# (must have teensy_loader_cli installed).
-#
-#----------------------------------------------------------------------------
-
-# # project specific files
-SRC = twimaster.c \
- matrix.c
-
-# 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*
-# Teensy halfKay 512
-# Teensy++ halfKay 1024
-# Atmel DFU loader 4096
-# LUFA bootloader 4096
-# USBaspLoader 2048
-OPT_DEFS += -DBOOTLOADER_SIZE=512
-
-
-# Build Options
-# comment out to disable the options.
-#
-BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000)
-MIDI_ENABLE = no # MIDI support (+2400 to 4200)
-POINTING_DEVICE_ENABLE = no
-MOUSEKEY_ENABLE = no # Mouse keys(+4700)
-EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
-CONSOLE_ENABLE = no # Console for debug(+8000)
-COMMAND_ENABLE = no # Commands for debug and configuration
-CUSTOM_MATRIX = yes # Custom matrix file for the Dactyl
-NKRO_ENABLE = yes # USB Nkey Rollover
-UNICODE_ENABLE = yes # Unicode
-SWAP_HANDS_ENABLE = yes # Allow swapping hands of keyboard
-SLEEP_LED_ENABLE = no
-API_SYSEX_ENABLE = no
-RGBLIGHT_ENABLE = no
diff --git a/keyboards/handwired/dactyl/twimaster.c b/keyboards/handwired/dactyl/twimaster.c
deleted file mode 100644
index 2557f7e227..0000000000
--- a/keyboards/handwired/dactyl/twimaster.c
+++ /dev/null
@@ -1,207 +0,0 @@
-/*************************************************************************
-* Title: I2C master library using hardware TWI interface
-* Author: Peter Fleury <pfleury@gmx.ch> http://jump.to/fleury
-* File: $Id: twimaster.c,v 1.3 2005/07/02 11:14:21 Peter Exp $
-* Software: AVR-GCC 3.4.3 / avr-libc 1.2.3
-* Target: any AVR device with hardware TWI
-* Usage: API compatible with I2C Software Library i2cmaster.h
-**************************************************************************/
-#include <inttypes.h>
-#include <compat/twi.h>
-
-#include <i2cmaster.h>
-
-/* define CPU frequency in Hz here if not defined in Makefile */
-#ifndef F_CPU
-#define F_CPU 16000000UL
-#endif
-
-/* I2C clock in Hz */
-#define SCL_CLOCK 400000L
-
-
-/*************************************************************************
- Initialization of the I2C bus interface. Need to be called only once
-*************************************************************************/
-void i2c_init(void)
-{
- /* initialize TWI clock
- * minimal values in Bit Rate Register (TWBR) and minimal Prescaler
- * bits in the TWI Status Register should give us maximal possible
- * I2C bus speed - about 444 kHz
- *
- * for more details, see 20.5.2 in ATmega16/32 secification
- */
-
- TWSR = 0; /* no prescaler */
- TWBR = 10; /* must be >= 10 for stable operation */
-
-}/* i2c_init */
-
-
-/*************************************************************************
- Issues a start condition and sends address and transfer direction.
- return 0 = device accessible, 1= failed to access device
-*************************************************************************/
-unsigned char i2c_start(unsigned char address)
-{
- uint8_t twst;
-
- // send START condition
- TWCR = (1<<TWINT) | (1<<TWSTA) | (1<<TWEN);
-
- // wait until transmission completed
- while(!(TWCR & (1<<TWINT)));
-
- // check value of TWI Status Register. Mask prescaler bits.
- twst = TW_STATUS & 0xF8;
- if ( (twst != TW_START) && (twst != TW_REP_START)) return 1;
-
- // send device address
- TWDR = address;
- TWCR = (1<<TWINT) | (1<<TWEN);
-
- // wail until transmission completed and ACK/NACK has been received
- while(!(TWCR & (1<<TWINT)));
-
- // check value of TWI Status Register. Mask prescaler bits.
- twst = TW_STATUS & 0xF8;
- if ( (twst != TW_MT_SLA_ACK) && (twst != TW_MR_SLA_ACK) ) return 1;
-
- return 0;
-
-}/* i2c_start */
-
-
-/*************************************************************************
- Issues a start condition and sends address and transfer direction.
- If device is busy, use ack polling to wait until device is ready
-
- Input: address and transfer direction of I2C device
-*************************************************************************/
-void i2c_start_wait(unsigned char address)
-{
- uint8_t twst;
-
-
- while ( 1 )
- {
- // send START condition
- TWCR = (1<<TWINT) | (1<<TWSTA) | (1<<TWEN);
-
- // wait until transmission completed
- while(!(TWCR & (1<<TWINT)));
-
- // check value of TWI Status Register. Mask prescaler bits.
- twst = TW_STATUS & 0xF8;
- if ( (twst != TW_START) && (twst != TW_REP_START)) continue;
-
- // send device address
- TWDR = address;
- TWCR = (1<<TWINT) | (1<<TWEN);
-
- // wail until transmission completed
- while(!(TWCR & (1<<TWINT)));
-
- // check value of TWI Status Register. Mask prescaler bits.
- twst = TW_STATUS & 0xF8;
- if ( (twst == TW_MT_SLA_NACK )||(twst ==TW_MR_DATA_NACK) )
- {
- /* device busy, send stop condition to terminate write operation */
- TWCR = (1<<TWINT) | (1<<TWEN) | (1<<TWSTO);
-
- // wait until stop condition is executed and bus released
- while(TWCR & (1<<TWSTO));
-
- continue;
- }
- //if( twst != TW_MT_SLA_ACK) return 1;
- break;
- }
-
-}/* i2c_start_wait */
-
-
-/*************************************************************************
- Issues a repeated start condition and sends address and transfer direction
-
- Input: address and transfer direction of I2C device
-
- Return: 0 device accessible
- 1 failed to access device
-*************************************************************************/
-unsigned char i2c_rep_start(unsigned char address)
-{
- return i2c_start( address );
-
-}/* i2c_rep_start */
-
-
-/*************************************************************************
- Terminates the data transfer and releases the I2C bus
-*************************************************************************/
-void i2c_stop(void)
-{
- /* send stop condition */
- TWCR = (1<<TWINT) | (1<<TWEN) | (1<<TWSTO);
-
- // wait until stop condition is executed and bus released
- while(TWCR & (1<<TWSTO));
-
-}/* i2c_stop */
-
-
-/*************************************************************************
- Send one byte to I2C device
-
- Input: byte to be transfered
- Return: 0 write successful
- 1 write failed
-*************************************************************************/
-unsigned char i2c_write( unsigned char data )
-{
- uint8_t twst;
-
- // send data to the previously addressed device
- TWDR = data;
- TWCR = (1<<TWINT) | (1<<TWEN);
-
- // wait until transmission completed
- while(!(TWCR & (1<<TWINT)));
-
- // check value of TWI Status Register. Mask prescaler bits
- twst = TW_STATUS & 0xF8;
- if( twst != TW_MT_DATA_ACK) return 1;
- return 0;
-
-}/* i2c_write */
-
-
-/*************************************************************************
- Read one byte from the I2C device, request more data from device
-
- Return: byte read from I2C device
-*************************************************************************/
-unsigned char i2c_readAck(void)
-{
- TWCR = (1<<TWINT) | (1<<TWEN) | (1<<TWEA);
- while(!(TWCR & (1<<TWINT)));
-
- return TWDR;
-
-}/* i2c_readAck */
-
-
-/*************************************************************************
- Read one byte from the I2C device, read is followed by a stop condition
-
- Return: byte read from I2C device
-*************************************************************************/
-unsigned char i2c_readNak(void)
-{
- TWCR = (1<<TWINT) | (1<<TWEN);
- while(!(TWCR & (1<<TWINT)));
-
- return TWDR;
-
-}/* i2c_readNak */