diff options
| -rw-r--r-- | keyboards/minidox/i2c.h | 20 | ||||
| -rw-r--r-- | keyboards/minidox/keymaps/that_canadian/config.h | 2 | ||||
| -rw-r--r-- | keyboards/minidox/keymaps/that_canadian/keymap.c | 6 | ||||
| -rw-r--r-- | keyboards/minidox/matrix.c | 2 | ||||
| -rw-r--r-- | keyboards/minidox/readme.md | 64 | ||||
| -rw-r--r-- | keyboards/minidox/rev1/config.h | 2 | ||||
| -rw-r--r-- | keyboards/minidox/split_util.c | 6 | ||||
| -rw-r--r-- | keyboards/minidox/split_util.h | 2 |
8 files changed, 96 insertions, 8 deletions
diff --git a/keyboards/minidox/i2c.h b/keyboards/minidox/i2c.h index 08ce4b009..c15b6bc50 100644 --- a/keyboards/minidox/i2c.h +++ b/keyboards/minidox/i2c.h | |||
| @@ -16,7 +16,7 @@ | |||
| 16 | #define SLAVE_BUFFER_SIZE 0x10 | 16 | #define SLAVE_BUFFER_SIZE 0x10 |
| 17 | 17 | ||
| 18 | // i2c SCL clock frequency | 18 | // i2c SCL clock frequency |
| 19 | #define SCL_CLOCK 100000L | 19 | #define SCL_CLOCK 400000L |
| 20 | 20 | ||
| 21 | extern volatile uint8_t i2c_slave_buffer[SLAVE_BUFFER_SIZE]; | 21 | extern volatile uint8_t i2c_slave_buffer[SLAVE_BUFFER_SIZE]; |
| 22 | 22 | ||
| @@ -28,4 +28,22 @@ uint8_t i2c_master_read(int); | |||
| 28 | void i2c_reset_state(void); | 28 | void i2c_reset_state(void); |
| 29 | void i2c_slave_init(uint8_t address); | 29 | void i2c_slave_init(uint8_t address); |
| 30 | 30 | ||
| 31 | |||
| 32 | static inline unsigned char i2c_start_read(unsigned char addr) { | ||
| 33 | return i2c_master_start((addr << 1) | I2C_READ); | ||
| 34 | } | ||
| 35 | |||
| 36 | static inline unsigned char i2c_start_write(unsigned char addr) { | ||
| 37 | return i2c_master_start((addr << 1) | I2C_WRITE); | ||
| 38 | } | ||
| 39 | |||
| 40 | // from SSD1306 scrips | ||
| 41 | extern unsigned char i2c_rep_start(unsigned char addr); | ||
| 42 | extern void i2c_start_wait(unsigned char addr); | ||
| 43 | extern unsigned char i2c_readAck(void); | ||
| 44 | extern unsigned char i2c_readNak(void); | ||
| 45 | extern unsigned char i2c_read(unsigned char ack); | ||
| 46 | |||
| 47 | #define i2c_read(ack) (ack) ? i2c_readAck() : i2c_readNak(); | ||
| 48 | |||
| 31 | #endif | 49 | #endif |
diff --git a/keyboards/minidox/keymaps/that_canadian/config.h b/keyboards/minidox/keymaps/that_canadian/config.h index 7a8193e08..aad7ed1e6 100644 --- a/keyboards/minidox/keymaps/that_canadian/config.h +++ b/keyboards/minidox/keymaps/that_canadian/config.h | |||
| @@ -25,6 +25,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 25 | 25 | ||
| 26 | #define USE_SERIAL | 26 | #define USE_SERIAL |
| 27 | 27 | ||
| 28 | #define EE_HANDS | ||
| 29 | |||
| 28 | /* ws2812 RGB LED */ | 30 | /* ws2812 RGB LED */ |
| 29 | #define RGB_DI_PIN D7 | 31 | #define RGB_DI_PIN D7 |
| 30 | #define RGBLIGHT_TIMER | 32 | #define RGBLIGHT_TIMER |
diff --git a/keyboards/minidox/keymaps/that_canadian/keymap.c b/keyboards/minidox/keymaps/that_canadian/keymap.c index da9905346..5d55d1825 100644 --- a/keyboards/minidox/keymaps/that_canadian/keymap.c +++ b/keyboards/minidox/keymaps/that_canadian/keymap.c | |||
| @@ -40,7 +40,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
| 40 | * | Z | X | C | V | B | | N | M | , | . | / | | 40 | * | Z | X | C | V | B | | N | M | , | . | / | |
| 41 | * `----------------------------------' `----------------------------------' | 41 | * `----------------------------------' `----------------------------------' |
| 42 | * ,--------------------. ,------,-------------. | 42 | * ,--------------------. ,------,-------------. |
| 43 | <<<<<<< HEAD | ||
| 44 | * | Shift| LOWER| | | | RAISE| Ctrl | | ||
| 45 | ======= | ||
| 43 | * | Ctrl | LOWER| | | | RAISE| Shift| | 46 | * | Ctrl | LOWER| | | | RAISE| Shift| |
| 47 | >>>>>>> a4958a532da154b9dd6f6144836a73f9de641f74 | ||
| 44 | * `-------------| Space| |BckSpc|------+------. | 48 | * `-------------| Space| |BckSpc|------+------. |
| 45 | * | | | | | 49 | * | | | | |
| 46 | * `------' `------' | 50 | * `------' `------' |
| @@ -49,7 +53,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
| 49 | KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, \ | 53 | KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, \ |
| 50 | KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, \ | 54 | KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, \ |
| 51 | KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, \ | 55 | KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, \ |
| 52 | KC_LCTL, LOWER, KC_SPC, KC_BSPC, RAISE, OSM(MOD_LSFT) \ | 56 | OSM(MOD_LSFT), LOWER, KC_SPC, KC_BSPC, RAISE, KC_LCTL \ |
| 53 | ), | 57 | ), |
| 54 | 58 | ||
| 55 | /* Raise | 59 | /* Raise |
diff --git a/keyboards/minidox/matrix.c b/keyboards/minidox/matrix.c index 138969004..81dfb1445 100644 --- a/keyboards/minidox/matrix.c +++ b/keyboards/minidox/matrix.c | |||
| @@ -226,9 +226,7 @@ uint8_t matrix_scan(void) | |||
| 226 | TXLED0; | 226 | TXLED0; |
| 227 | error_count = 0; | 227 | error_count = 0; |
| 228 | } | 228 | } |
| 229 | |||
| 230 | matrix_scan_quantum(); | 229 | matrix_scan_quantum(); |
| 231 | |||
| 232 | return ret; | 230 | return ret; |
| 233 | } | 231 | } |
| 234 | 232 | ||
diff --git a/keyboards/minidox/readme.md b/keyboards/minidox/readme.md index f6227386d..da8971486 100644 --- a/keyboards/minidox/readme.md +++ b/keyboards/minidox/readme.md | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | ECO | 1 | MiniDox |
| 2 | === | 2 | ===== |
| 3 | 3 | ||
| 4 |  | 4 |  |
| 5 | 5 | ||
| @@ -13,3 +13,63 @@ Make example for this keyboard (after setting up your build environment): | |||
| 13 | make minidox-rev1-default | 13 | make minidox-rev1-default |
| 14 | 14 | ||
| 15 | See [build environment setup](https://docs.qmk.fm/build_environment_setup.html) then the [make instructions](https://docs.qmk.fm/make_instructions.html) for more information. | 15 | See [build environment setup](https://docs.qmk.fm/build_environment_setup.html) then the [make instructions](https://docs.qmk.fm/make_instructions.html) for more information. |
| 16 | |||
| 17 | ## Build Guide | ||
| 18 | |||
| 19 | A build guide for putting together the MiniDox v1 can be found here: [MiniDox Build Log / Guide](http://imgur.com/a/vImo6) | ||
| 20 | |||
| 21 | Flashing | ||
| 22 | ------- | ||
| 23 | Note: Most of this is copied from the Let's Split readme, because it is awesome | ||
| 24 | |||
| 25 | From the keymap directory run `make SUBPROJECT-KEYMAP-avrdude` for automatic serial port resolution and flashing. | ||
| 26 | Example: `make rev1-default-avrdude` | ||
| 27 | |||
| 28 | Choosing which board to plug the USB cable into (choosing Master) | ||
| 29 | -------- | ||
| 30 | Because the two boards are identical, the firmware has logic to differentiate the left and right board. | ||
| 31 | |||
| 32 | It uses two strategies to figure things out: look at the EEPROM (memory on the chip) or looks if the current board has the usb cable. | ||
| 33 | |||
| 34 | The EEPROM approach requires additional setup (flashing the eeeprom) but allows you to swap the usb cable to either side. | ||
| 35 | |||
| 36 | The USB cable approach is easier to setup and if you just want the usb cable on the left board, you do not need to do anything extra. | ||
| 37 | |||
| 38 | ### Setting the left hand as master | ||
| 39 | If you always plug the usb cable into the left board, nothing extra is needed as this is the default. Comment out `EE_HANDS` and comment out `I2C_MASTER_RIGHT` or `MASTER_RIGHT` if for some reason it was set. | ||
| 40 | |||
| 41 | ### Setting the right hand as master | ||
| 42 | If you always plug the usb cable into the right board, add an extra flag to your `config.h` | ||
| 43 | ``` | ||
| 44 | #define MASTER_RIGHT | ||
| 45 | ``` | ||
| 46 | |||
| 47 | ### Setting EE_hands to use either hands as master | ||
| 48 | If you define `EE_HANDS` in your `config.h`, you will need to set the | ||
| 49 | EEPROM for the left and right halves. | ||
| 50 | |||
| 51 | The EEPROM is used to store whether the | ||
| 52 | half is left handed or right handed. This makes it so that the same firmware | ||
| 53 | file will run on both hands instead of having to flash left and right handed | ||
| 54 | versions of the firmware to each half. To flash the EEPROM file for the left | ||
| 55 | half run: | ||
| 56 | ``` | ||
| 57 | avrdude -p atmega32u4 -P $(COM_PORT) -c avr109 -U eeprom:w:eeprom-lefthand.eep | ||
| 58 | // or the equivalent in dfu-programmer | ||
| 59 | |||
| 60 | ``` | ||
| 61 | and similarly for right half | ||
| 62 | ``` | ||
| 63 | avrdude -p atmega32u4 -P $(COM_PORT) -c avr109 -U eeprom:w:eeprom-righhand.eep | ||
| 64 | // or the equivalent in dfu-programmer | ||
| 65 | ``` | ||
| 66 | |||
| 67 | NOTE: replace `$(COM_PORT)` with the port of your device (e.g. `/dev/ttyACM0`) | ||
| 68 | |||
| 69 | After you have flashed the EEPROM, you then need to set `EE_HANDS` in your config.h, rebuild the hex files and reflash. | ||
| 70 | |||
| 71 | Note that you need to program both halves, but you have the option of using | ||
| 72 | different keymaps for each half. You could program the left half with a QWERTY | ||
| 73 | layout and the right half with a Colemak layout using bootmagic's default layout option. | ||
| 74 | Then if you connect the left half to a computer by USB the keyboard will use QWERTY and Colemak when the | ||
| 75 | right half is connected. | ||
diff --git a/keyboards/minidox/rev1/config.h b/keyboards/minidox/rev1/config.h index a858a5b90..9799c4199 100644 --- a/keyboards/minidox/rev1/config.h +++ b/keyboards/minidox/rev1/config.h | |||
| @@ -30,7 +30,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 30 | 30 | ||
| 31 | #define USE_SERIAL | 31 | #define USE_SERIAL |
| 32 | 32 | ||
| 33 | // #define EE_HANDS | 33 | //#define EE_HANDS |
| 34 | 34 | ||
| 35 | #define I2C_MASTER_LEFT | 35 | #define I2C_MASTER_LEFT |
| 36 | //#define I2C_MASTER_RIGHT | 36 | //#define I2C_MASTER_RIGHT |
diff --git a/keyboards/minidox/split_util.c b/keyboards/minidox/split_util.c index 461921798..39639c3b4 100644 --- a/keyboards/minidox/split_util.c +++ b/keyboards/minidox/split_util.c | |||
| @@ -21,7 +21,8 @@ static void setup_handedness(void) { | |||
| 21 | #ifdef EE_HANDS | 21 | #ifdef EE_HANDS |
| 22 | isLeftHand = eeprom_read_byte(EECONFIG_HANDEDNESS); | 22 | isLeftHand = eeprom_read_byte(EECONFIG_HANDEDNESS); |
| 23 | #else | 23 | #else |
| 24 | #ifdef I2C_MASTER_RIGHT | 24 | // I2C_MASTER_RIGHT is deprecated, use MASTER_RIGHT instead, since this works for both serial and i2c |
| 25 | #if defined(I2C_MASTER_RIGHT) || defined(MASTER_RIGHT) | ||
| 25 | isLeftHand = !has_usb(); | 26 | isLeftHand = !has_usb(); |
| 26 | #else | 27 | #else |
| 27 | isLeftHand = has_usb(); | 28 | isLeftHand = has_usb(); |
| @@ -32,6 +33,9 @@ static void setup_handedness(void) { | |||
| 32 | static void keyboard_master_setup(void) { | 33 | static void keyboard_master_setup(void) { |
| 33 | #ifdef USE_I2C | 34 | #ifdef USE_I2C |
| 34 | i2c_master_init(); | 35 | i2c_master_init(); |
| 36 | #ifdef SSD1306OLED | ||
| 37 | matrix_master_OLED_init (); | ||
| 38 | #endif | ||
| 35 | #else | 39 | #else |
| 36 | serial_master_init(); | 40 | serial_master_init(); |
| 37 | #endif | 41 | #endif |
diff --git a/keyboards/minidox/split_util.h b/keyboards/minidox/split_util.h index 6b896679c..3ae76c209 100644 --- a/keyboards/minidox/split_util.h +++ b/keyboards/minidox/split_util.h | |||
| @@ -19,4 +19,6 @@ void split_keyboard_setup(void); | |||
| 19 | bool has_usb(void); | 19 | bool has_usb(void); |
| 20 | void keyboard_slave_loop(void); | 20 | void keyboard_slave_loop(void); |
| 21 | 21 | ||
| 22 | void matrix_master_OLED_init (void); | ||
| 23 | |||
| 22 | #endif | 24 | #endif |
