aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/breaking_changes.md4
-rw-r--r--docs/chibios_upgrade_instructions.md56
-rw-r--r--drivers/chibios/spi_master.c70
-rw-r--r--drivers/chibios/spi_master.h19
-rw-r--r--keyboards/sofle/keymaps/killmaster/config.h64
-rw-r--r--keyboards/sofle/keymaps/killmaster/keymap.c402
-rw-r--r--keyboards/sofle/keymaps/killmaster/readme.md19
-rw-r--r--keyboards/sofle/keymaps/killmaster/rules.mk4
-rw-r--r--keyboards/sofle/rev1/readme.md27
-rw-r--r--keyboards/sofle/rev1/rev1.c86
m---------lib/chibios0
m---------lib/chibios-contrib0
-rw-r--r--quantum/matrix.c18
-rw-r--r--quantum/split_common/matrix.c18
-rw-r--r--tmk_core/avr.mk2
-rw-r--r--tmk_core/common/avr/gpio.h15
-rw-r--r--tmk_core/common/chibios/gpio.h16
-rw-r--r--tmk_core/protocol/chibios/usb_main.c34
-rw-r--r--tmk_core/protocol/lufa/lufa.c34
-rw-r--r--tmk_core/protocol/usb_descriptor.c2
-rw-r--r--tmk_core/protocol/vusb/vusb.c3
-rw-r--r--tmk_core/rules.mk2
22 files changed, 828 insertions, 67 deletions
diff --git a/docs/breaking_changes.md b/docs/breaking_changes.md
index 3e85a7076..2ad8b5a14 100644
--- a/docs/breaking_changes.md
+++ b/docs/breaking_changes.md
@@ -96,3 +96,7 @@ This happens immediately after the previous `develop` branch is merged.
96 * [ ] Create a PR for `develop` 96 * [ ] Create a PR for `develop`
97 * [ ] Make sure travis comes back clean 97 * [ ] Make sure travis comes back clean
98 * [ ] Merge `develop` PR 98 * [ ] Merge `develop` PR
99
100## Post-merge operations
101
102* (Optional) [update ChibiOS + ChibiOS-Contrib on `develop`](chibios_upgrade_instructions.md) \ No newline at end of file
diff --git a/docs/chibios_upgrade_instructions.md b/docs/chibios_upgrade_instructions.md
new file mode 100644
index 000000000..40c2faafc
--- /dev/null
+++ b/docs/chibios_upgrade_instructions.md
@@ -0,0 +1,56 @@
1# ChibiOS Upgrade Procedure
2
3ChibiOS and ChibiOS-Contrib need to be updated in tandem -- the latter has a branch tied to the ChibiOS version in use and should not be mixed with different versions.
4
5## Getting ChibiOS
6
7* `svn` Initialisation:
8 * Only needed to be done once
9 * You might need to separately install `git-svn` package in your OS's package manager
10 * `git svn init --stdlayout --prefix='svn/' http://svn.osdn.net/svnroot/chibios/`
11 * `git remote add qmk git@github.com:qmk/ChibiOS.git`
12* Updating:
13 * `git svn fetch`
14 * First time around this will take several hours
15 * Subsequent updates will be incremental only
16* Tagging example (work out which version first!):
17 * `git tag -a ver20.3.3 -m ver20.3.3 svn/tags/ver20.3.3`
18 * `git push qmk ver20.3.3`
19 * `git tag -a breaking_YYYY_qN -m breaking_YYYY_qN svn/tags/ver20.3.3`
20 * `git push qmk breaking_YYYY_qN`
21
22## Getting ChibiOS-Contrib
23
24* `git` Initialisation:
25 * `git clone git@github.com:qmk/ChibiOS-Contrib`
26 * `git remote add upstream https://github.com/ChibiOS/ChibiOS-Contrib`
27 * `git checkout -b chibios-20.3.x upstream/chibios-20.3.x`
28* Updating:
29 * `git fetch --all --tags --prune`
30 * `git checkout chibios-20.3.x`
31 * `git pull --ff-only`
32 * `git push origin chibios-20.3.x`
33 * `git tag -a breaking_YYYY_qN -m breaking_YYYY_qN chibios-20.3.x`
34 * `git push origin breaking_YYYY_qN`
35
36## Updating submodules
37
38* Update the submodules
39 * `cd $QMK_FIRMWARE`
40 * `git checkout develop`
41 * `git pull --ff-only`
42 * `git checkout -b chibios-version-bump`
43 * `cd lib/chibios`
44 * `git fetch --all --tags --prune`
45 * `git checkout breaking_YYYY_qN`
46 * `cd ../chibios-contrib`
47 * `git fetch --all --tags --prune`
48 * `git checkout breaking_YYYY_qN`
49* Build everything
50 * `cd $QMK_FIRMWARE`
51 * `qmk multibuild -j4`
52 * Make sure there are no errors
53* Push to the repo
54 * `git commit -am 'Update ChibiOS to XXXXXXXXX'`
55 * `git push --set-upstream origin chibios-version-bump`
56* Make a PR to qmk_firmware with the new branch \ No newline at end of file
diff --git a/drivers/chibios/spi_master.c b/drivers/chibios/spi_master.c
index 4852a6eba..28ddcbb2b 100644
--- a/drivers/chibios/spi_master.c
+++ b/drivers/chibios/spi_master.c
@@ -18,8 +18,13 @@
18 18
19#include "timer.h" 19#include "timer.h"
20 20
21static pin_t currentSlavePin = NO_PIN; 21static pin_t currentSlavePin = NO_PIN;
22static SPIConfig spiConfig = {false, NULL, 0, 0, 0, 0}; 22
23#if defined(K20x) || defined(KL2x)
24static SPIConfig spiConfig = {NULL, 0, 0, 0};
25#else
26static SPIConfig spiConfig = {false, NULL, 0, 0, 0, 0};
27#endif
23 28
24__attribute__((weak)) void spi_init(void) { 29__attribute__((weak)) void spi_init(void) {
25 static bool is_initialised = false; 30 static bool is_initialised = false;
@@ -27,15 +32,15 @@ __attribute__((weak)) void spi_init(void) {
27 is_initialised = true; 32 is_initialised = true;
28 33
29 // Try releasing special pins for a short time 34 // Try releasing special pins for a short time
30 palSetPadMode(PAL_PORT(SPI_SCK_PIN), PAL_PAD(SPI_SCK_PIN), PAL_MODE_INPUT); 35 setPinInput(SPI_SCK_PIN);
31 palSetPadMode(PAL_PORT(SPI_MOSI_PIN), PAL_PAD(SPI_MOSI_PIN), PAL_MODE_INPUT); 36 setPinInput(SPI_MOSI_PIN);
32 palSetPadMode(PAL_PORT(SPI_MISO_PIN), PAL_PAD(SPI_MISO_PIN), PAL_MODE_INPUT); 37 setPinInput(SPI_MISO_PIN);
33 38
34 chThdSleepMilliseconds(10); 39 chThdSleepMilliseconds(10);
35#if defined(USE_GPIOV1) 40#if defined(USE_GPIOV1)
36 palSetPadMode(PAL_PORT(SPI_SCK_PIN), PAL_PAD(SPI_SCK_PIN), PAL_MODE_STM32_ALTERNATE_PUSHPULL); 41 palSetPadMode(PAL_PORT(SPI_SCK_PIN), PAL_PAD(SPI_SCK_PIN), SPI_SCK_PAL_MODE);
37 palSetPadMode(PAL_PORT(SPI_MOSI_PIN), PAL_PAD(SPI_MOSI_PIN), PAL_MODE_STM32_ALTERNATE_PUSHPULL); 42 palSetPadMode(PAL_PORT(SPI_MOSI_PIN), PAL_PAD(SPI_MOSI_PIN), SPI_MOSI_PAL_MODE);
38 palSetPadMode(PAL_PORT(SPI_MISO_PIN), PAL_PAD(SPI_MISO_PIN), PAL_MODE_STM32_ALTERNATE_PUSHPULL); 43 palSetPadMode(PAL_PORT(SPI_MISO_PIN), PAL_PAD(SPI_MISO_PIN), SPI_MISO_PAL_MODE);
39#else 44#else
40 palSetPadMode(PAL_PORT(SPI_SCK_PIN), PAL_PAD(SPI_SCK_PIN), PAL_MODE_ALTERNATE(SPI_SCK_PAL_MODE) | PAL_STM32_OTYPE_PUSHPULL | PAL_STM32_OSPEED_HIGHEST); 45 palSetPadMode(PAL_PORT(SPI_SCK_PIN), PAL_PAD(SPI_SCK_PIN), PAL_MODE_ALTERNATE(SPI_SCK_PAL_MODE) | PAL_STM32_OTYPE_PUSHPULL | PAL_STM32_OSPEED_HIGHEST);
41 palSetPadMode(PAL_PORT(SPI_MOSI_PIN), PAL_PAD(SPI_MOSI_PIN), PAL_MODE_ALTERNATE(SPI_MOSI_PAL_MODE) | PAL_STM32_OTYPE_PUSHPULL | PAL_STM32_OSPEED_HIGHEST); 46 palSetPadMode(PAL_PORT(SPI_MOSI_PIN), PAL_PAD(SPI_MOSI_PIN), PAL_MODE_ALTERNATE(SPI_MOSI_PAL_MODE) | PAL_STM32_OTYPE_PUSHPULL | PAL_STM32_OSPEED_HIGHEST);
@@ -58,6 +63,54 @@ bool spi_start(pin_t slavePin, bool lsbFirst, uint8_t mode, uint16_t divisor) {
58 return false; 63 return false;
59 } 64 }
60 65
66#if defined(K20x) || defined(KL2x)
67 spiConfig.tar0 = SPIx_CTARn_FMSZ(7) | SPIx_CTARn_ASC(1);
68
69 if (lsbFirst) {
70 spiConfig.tar0 |= SPIx_CTARn_LSBFE;
71 }
72
73 switch (mode) {
74 case 0:
75 break;
76 case 1:
77 spiConfig.tar0 |= SPIx_CTARn_CPHA;
78 break;
79 case 2:
80 spiConfig.tar0 |= SPIx_CTARn_CPOL;
81 break;
82 case 3:
83 spiConfig.tar0 |= SPIx_CTARn_CPHA | SPIx_CTARn_CPOL;
84 break;
85 }
86
87 switch (roundedDivisor) {
88 case 2:
89 spiConfig.tar0 |= SPIx_CTARn_BR(0);
90 break;
91 case 4:
92 spiConfig.tar0 |= SPIx_CTARn_BR(1);
93 break;
94 case 8:
95 spiConfig.tar0 |= SPIx_CTARn_BR(3);
96 break;
97 case 16:
98 spiConfig.tar0 |= SPIx_CTARn_BR(4);
99 break;
100 case 32:
101 spiConfig.tar0 |= SPIx_CTARn_BR(5);
102 break;
103 case 64:
104 spiConfig.tar0 |= SPIx_CTARn_BR(6);
105 break;
106 case 128:
107 spiConfig.tar0 |= SPIx_CTARn_BR(7);
108 break;
109 case 256:
110 spiConfig.tar0 |= SPIx_CTARn_BR(8);
111 break;
112 }
113#else
61 spiConfig.cr1 = 0; 114 spiConfig.cr1 = 0;
62 115
63 if (lsbFirst) { 116 if (lsbFirst) {
@@ -103,6 +156,7 @@ bool spi_start(pin_t slavePin, bool lsbFirst, uint8_t mode, uint16_t divisor) {
103 spiConfig.cr1 |= SPI_CR1_BR_2 | SPI_CR1_BR_1 | SPI_CR1_BR_0; 156 spiConfig.cr1 |= SPI_CR1_BR_2 | SPI_CR1_BR_1 | SPI_CR1_BR_0;
104 break; 157 break;
105 } 158 }
159#endif
106 160
107 currentSlavePin = slavePin; 161 currentSlavePin = slavePin;
108 spiConfig.ssport = PAL_PORT(slavePin); 162 spiConfig.ssport = PAL_PORT(slavePin);
diff --git a/drivers/chibios/spi_master.h b/drivers/chibios/spi_master.h
index e93580e31..b5a6ef143 100644
--- a/drivers/chibios/spi_master.h
+++ b/drivers/chibios/spi_master.h
@@ -21,6 +21,7 @@
21#include <stdbool.h> 21#include <stdbool.h>
22 22
23#include "gpio.h" 23#include "gpio.h"
24#include "chibios_config.h"
24 25
25#ifndef SPI_DRIVER 26#ifndef SPI_DRIVER
26# define SPI_DRIVER SPID2 27# define SPI_DRIVER SPID2
@@ -31,7 +32,11 @@
31#endif 32#endif
32 33
33#ifndef SPI_SCK_PAL_MODE 34#ifndef SPI_SCK_PAL_MODE
34# define SPI_SCK_PAL_MODE 5 35# if defined(USE_GPIOV1)
36# define SPI_SCK_PAL_MODE PAL_MODE_STM32_ALTERNATE_PUSHPULL
37# else
38# define SPI_SCK_PAL_MODE 5
39# endif
35#endif 40#endif
36 41
37#ifndef SPI_MOSI_PIN 42#ifndef SPI_MOSI_PIN
@@ -39,7 +44,11 @@
39#endif 44#endif
40 45
41#ifndef SPI_MOSI_PAL_MODE 46#ifndef SPI_MOSI_PAL_MODE
42# define SPI_MOSI_PAL_MODE 5 47# if defined(USE_GPIOV1)
48# define SPI_MOSI_PAL_MODE PAL_MODE_STM32_ALTERNATE_PUSHPULL
49# else
50# define SPI_MOSI_PAL_MODE 5
51# endif
43#endif 52#endif
44 53
45#ifndef SPI_MISO_PIN 54#ifndef SPI_MISO_PIN
@@ -47,7 +56,11 @@
47#endif 56#endif
48 57
49#ifndef SPI_MISO_PAL_MODE 58#ifndef SPI_MISO_PAL_MODE
50# define SPI_MISO_PAL_MODE 5 59# if defined(USE_GPIOV1)
60# define SPI_MISO_PAL_MODE PAL_MODE_STM32_ALTERNATE_PUSHPULL
61# else
62# define SPI_MISO_PAL_MODE 5
63# endif
51#endif 64#endif
52 65
53typedef int16_t spi_status_t; 66typedef int16_t spi_status_t;
diff --git a/keyboards/sofle/keymaps/killmaster/config.h b/keyboards/sofle/keymaps/killmaster/config.h
new file mode 100644
index 000000000..2e6abe84e
--- /dev/null
+++ b/keyboards/sofle/keymaps/killmaster/config.h
@@ -0,0 +1,64 @@
1/* Copyright 2021 Carlos Martins
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16#pragma once
17
18/* The way how "handedness" is decided (which half is which),
19see https://docs.qmk.fm/#/feature_split_keyboard?id=setting-handedness
20for more options.
21*/
22
23#define RGB_DI_PIN D3
24
25#ifdef RGB_MATRIX_ENABLE
26
27#define RGBLED_NUM 72
28#define DRIVER_LED_TOTAL RGBLED_NUM
29#define RGB_MATRIX_MAXIMUM_BRIGHTNESS 120 // limits maximum brightness of LEDs to 150 out of 255. Higher may cause the controller to crash.
30#define RGB_MATRIX_HUE_STEP 8
31#define RGB_MATRIX_SAT_STEP 8
32#define RGB_MATRIX_VAL_STEP 8
33#define RGB_MATRIX_SPD_STEP 10
34#define RGB_MATRIX_KEYPRESSES
35#define RGB_MATRIX_FRAMEBUFFER_EFFECTS
36#define RGB_MATRIX_SPLIT {36,36}
37#define SPLIT_TRANSPORT_MIRROR
38
39#endif
40
41#ifdef RGBLIGHT_ENABLE
42#define RGBLIGHT_SPLIT
43#define RGBLED_NUM 70
44#define RGB_SPLIT {36,36}
45#define RGBLIGHT_LIMIT_VAL 120
46// #define RGBLIGHT_SLEEP /* If defined, the RGB lighting will be switched off when the host goes to sleep */
47// /*== all animations enable ==*/
48// #define RGBLIGHT_ANIMATIONS
49// /*== or choose animations ==*/
50// #define RGBLIGHT_EFFECT_BREATHING
51 //#define RGBLIGHT_EFFECT_RAINBOW_MOOD
52 //#define RGBLIGHT_EFFECT_RAINBOW_SWIRL
53// #define RGBLIGHT_EFFECT_SNAKE
54// #define RGBLIGHT_EFFECT_KNIGHT
55// #define RGBLIGHT_EFFECT_CHRISTMAS
56 #define RGBLIGHT_EFFECT_STATIC_GRADIENT
57 #define RGBLIGHT_EFFECT_RGB_TEST
58// #define RGBLIGHT_EFFECT_ALTERNATING
59#endif
60
61#define MEDIA_KEY_DELAY 2
62
63#define USB_POLLING_INTERVAL_MS 1
64#define QMK_KEYS_PER_SCAN 12
diff --git a/keyboards/sofle/keymaps/killmaster/keymap.c b/keyboards/sofle/keymaps/killmaster/keymap.c
new file mode 100644
index 000000000..d292c64ab
--- /dev/null
+++ b/keyboards/sofle/keymaps/killmaster/keymap.c
@@ -0,0 +1,402 @@
1/* Copyright 2021 Carlos Martins
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#include QMK_KEYBOARD_H
18#include <stdio.h>
19
20enum sofle_layers {
21 /* _M_XYZ = Mac Os, _W_XYZ = Win/Linux */
22 _QWERTY,
23 _LOWER,
24 _RAISE,
25 _ADJUST,
26};
27
28enum custom_keycodes {
29 KC_QWERTY = SAFE_RANGE,
30 KC_LOWER,
31 KC_RAISE,
32 KC_ADJUST,
33 KC_PRVWD,
34 KC_NXTWD,
35 KC_LSTRT,
36 KC_LEND,
37 KC_DLINE
38};
39
40
41const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
42/*
43 * QWERTY
44 * ,-----------------------------------------. ,-----------------------------------------.
45 * | ` | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | ` |
46 * |------+------+------+------+------+------| |------+------+------+------+------+------|
47 * | ESC | Q | W | E | R | T | | Y | U | I | O | P | Bspc |
48 * |------+------+------+------+------+------| |------+------+------+------+------+------|
49 * | Tab | A | S | D | F | G |-------. ,-------| H | J | K | L | ; | ' |
50 * |------+------+------+------+------+------| | | |------+------+------+------+------+------|
51 * |LShift| Z | X | C | V | B |-------| |-------| N | M | , | . | / |RShift|
52 * `-----------------------------------------/ / \ \-----------------------------------------'
53 * | LGUI | LAlt | LCTR |LOWER | /Space / \Enter \ |RAISE | RCTR | RAlt | RGUI |
54 * | | | | |/ / \ \ | | | | |
55 * `----------------------------------' '------''---------------------------'
56 */
57
58[_QWERTY] = LAYOUT(
59 KC_MINS, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_GRV,
60 KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC,
61 KC_TAB, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT,
62 KC_LSPO, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_MUTE, KC_MPLY,KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSPC,
63 KC_LGUI,KC_LALT,KC_LCTRL, KC_LOWER, KC_SPC, KC_ENT, KC_RAISE, KC_RCTRL, KC_RALT, KC_RGUI
64),
65/* LOWER
66 * ,-----------------------------------------. ,-----------------------------------------.
67 * | | F1 | F2 | F3 | F4 | F5 | | F6 | F7 | F8 | F9 | F10 | F11 |
68 * |------+------+------+------+------+------| |------+------+------+------+------+------|
69 * | ` | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | F12 |
70 * |------+------+------+------+------+------| |------+------+------+------+------+------|
71 * | Tab | ! | @ | # | $ | % |-------. ,-------| ^ | & | * | ( | ) | | |
72 * |------+------+------+------+------+------| MUTE | | |------+------+------+------+------+------|
73 * | Shift| = | - | + | { | } |-------| |-------| [ | ] | ; | : | \ | Shift|
74 * `-----------------------------------------/ / \ \-----------------------------------------'
75 * | LGUI | LAlt | LCTR |LOWER | /Enter / \Space \ |RAISE | RCTR | RAlt | RGUI |
76 * | | | | |/ / \ \ | | | | |
77 * `----------------------------------' '------''---------------------------'
78 */
79[_LOWER] = LAYOUT(
80 _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11,
81 KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_F12,
82 _______, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_PIPE,
83 _______, KC_EQL, KC_MINS, KC_PLUS, KC_LCBR, KC_RCBR, _______, _______, KC_LBRC, KC_RBRC, KC_SCLN, KC_COLN, KC_BSLS, _______,
84 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
85),
86/* RAISE
87 * ,----------------------------------------. ,-----------------------------------------.
88 * | | | | | | | | | | | | | |
89 * |------+------+------+------+------+------| |------+------+------+------+------+------|
90 * | Esc | Ins | Pscr | Menu | |RGBTog| | | PWrd | Up | NWrd | DLine| Bspc |
91 * |------+------+------+------+------+------| |------+------+------+------+------+------|
92 * | Tab | LAt | LCtl |LShift| | Caps |-------. ,-------| | Left | Down | Rigth| Del | Bspc |
93 * |------+------+------+------+------+------| MUTE | | |------+------+------+------+------+------|
94 * |Shift | Undo | Cut | Copy | Paste| |-------| |-------| | LStr | | LEnd | | Shift|
95 * `-----------------------------------------/ / \ \-----------------------------------------'
96 * | LGUI | LAlt | LCTR |LOWER | /Enter / \Space \ |RAISE | RCTR | RAlt | RGUI |
97 * | | | | |/ / \ \ | | | | |
98 * `----------------------------------' '------''---------------------------'
99 */
100[_RAISE] = LAYOUT(
101 _______, _______ , _______ , _______ , RGB_RMOD , RGB_MOD, _______, _______ , _______, _______ , _______ ,_______,
102 _______, KC_INS, KC_PSCR, KC_APP, XXXXXXX, RGB_TOG, KC_PGUP, KC_PRVWD, KC_UP, KC_NXTWD,KC_DLINE, KC_BSPC,
103 _______, KC_LALT, KC_LCTL, KC_LSFT, XXXXXXX, KC_CAPS, KC_PGDN, KC_LEFT, KC_DOWN, KC_RGHT, KC_DEL, KC_BSPC,
104 _______,XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, _______, XXXXXXX, KC_LSTRT, XXXXXXX, KC_LEND, XXXXXXX, _______,
105 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
106),
107/* ADJUST
108 * ,-----------------------------------------. ,-----------------------------------------.
109 * | | | | | | | | | | | | | |
110 * |------+------+------+------+------+------| |------+------+------+------+------+------|
111 * | RESET| |QWERTY|COLEMAK| | | | | | | | | |
112 * |------+------+------+------+------+------| |------+------+------+------+------+------|
113 * | | |MACWIN| | | |-------. ,-------| | VOLDO| MUTE | VOLUP| | |
114 * |------+------+------+------+------+------| MUTE | | |------+------+------+------+------+------|
115 * | | | | | | |-------| |-------| | PREV | PLAY | NEXT | | |
116 * `-----------------------------------------/ / \ \-----------------------------------------'
117 * | LGUI | LAlt | LCTR |LOWER | /Enter / \Space \ |RAISE | RCTR | RAlt | RGUI |
118 * | | | | |/ / \ \ | | | | |
119 * `----------------------------------' '------''---------------------------'
120 */
121 [_ADJUST] = LAYOUT(
122 XXXXXXX , XXXXXXX, XXXXXXX , XXXXXXX , XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
123 RESET , XXXXXXX, KC_QWERTY, XXXXXXX , CG_TOGG,XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
124 XXXXXXX , XXXXXXX,CG_TOGG, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_VOLD, KC_MUTE, KC_VOLU, XXXXXXX, XXXXXXX,
125 XXXXXXX , XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_MPRV, KC_MPLY, KC_MNXT, XXXXXXX, XXXXXXX,
126 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
127 )
128};
129
130#ifdef OLED_DRIVER_ENABLE
131
132static void render_logo(void) {
133 static const char PROGMEM bananas_logo[] = {
134 // 'killmaster_bananas', 128x32px
135 0x00, 0x00, 0x80, 0x80, 0xc0, 0xc0, 0xc0, 0xe0, 0x02, 0x0e, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00,
136 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
137 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
138 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
139 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
140 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
141 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
142 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
143 0x00, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
144 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8,
145 0x00, 0x00, 0x80, 0xc0, 0x40, 0x00, 0x00, 0x00, 0x40, 0x40, 0xd8, 0xc8, 0x00, 0x00, 0x00, 0x00,
146 0x08, 0x08, 0xf8, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0xf8, 0xf8, 0x00, 0x00, 0x00,
147 0x00, 0x00, 0xc0, 0x40, 0x40, 0xc0, 0x80, 0x40, 0xc0, 0x00, 0x00, 0x00, 0x40, 0x40, 0x40, 0x40,
148 0x80, 0x00, 0x00, 0x00, 0x00, 0x80, 0x40, 0x40, 0x40, 0xc0, 0x40, 0x00, 0x00, 0x40, 0x40, 0xf0,
149 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x80, 0x40, 0x40, 0x40, 0xc0, 0x80, 0x00, 0x00, 0x00,
150 0x40, 0xc0, 0x80, 0x40, 0x40, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
151 0x00, 0x01, 0x0f, 0x3f, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xfc, 0xf8, 0xf0, 0xf0,
152 0xe0, 0xc0, 0xc0, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f,
153 0x02, 0x07, 0x0d, 0x10, 0x20, 0x20, 0x00, 0x00, 0x20, 0x20, 0x3f, 0x3f, 0x20, 0x20, 0x00, 0x00,
154 0x00, 0x00, 0x1f, 0x3f, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x3f, 0x20, 0x20, 0x20,
155 0x00, 0x00, 0x3f, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x1c, 0x36, 0x22, 0x22, 0x22,
156 0x1f, 0x20, 0x00, 0x00, 0x10, 0x23, 0x22, 0x22, 0x26, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x1f,
157 0x30, 0x20, 0x20, 0x20, 0x00, 0x00, 0x0f, 0x1f, 0x32, 0x22, 0x22, 0x32, 0x23, 0x00, 0x00, 0x00,
158 0x20, 0x3f, 0x21, 0x20, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
159 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x03, 0x03, 0x07, 0x07, 0x0f, 0x0f, 0x0f, 0x1f, 0x1f,
160 0x1f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3e, 0x3e, 0x1c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
161 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
162 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
163 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
164 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
165 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
166 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
167 };
168 oled_write_raw_P(bananas_logo, sizeof(bananas_logo));
169}
170
171static void print_status_narrow(void) {
172 // Print current mode
173 oled_write_P(PSTR("Sofle"), false);
174 oled_write_P(PSTR("\n\n\n"), false);
175 switch (get_highest_layer(default_layer_state)) {
176 case _QWERTY:
177 oled_write_ln_P(PSTR("QWERT"), false);
178 break;
179 default:
180 oled_write_P(PSTR("Undef"), false);
181 }
182 oled_write_P(PSTR("\n\n"), false);
183 // Print current layer
184 oled_write_ln_P(PSTR("Layer"), false);
185 switch (get_highest_layer(layer_state)) {
186 case _QWERTY:
187 oled_write_P(PSTR("Base\n"), false);
188 break;
189 case _RAISE:
190 oled_write_P(PSTR("Raise"), false);
191 break;
192 case _LOWER:
193 oled_write_P(PSTR("Lower"), false);
194 break;
195 case _ADJUST:
196 oled_write_P(PSTR("Adj\n"), false);
197 break;
198 default:
199 oled_write_ln_P(PSTR("Undef"), false);
200 }
201 oled_write_P(PSTR("\n\n"), false);
202}
203
204oled_rotation_t oled_init_user(oled_rotation_t rotation) {
205 if (is_keyboard_master()) {
206 return OLED_ROTATION_270;
207 }
208 else {
209 return OLED_ROTATION_180;
210 }
211 return rotation;
212}
213
214void oled_task_user(void) {
215 if (is_keyboard_master()) {
216 print_status_narrow();
217 } else {
218 render_logo();
219 }
220}
221
222
223
224#endif // OLED_DRIVER_ENABLE
225
226bool process_record_user(uint16_t keycode, keyrecord_t *record) {
227 switch (keycode) {
228 case KC_QWERTY:
229 if (record->event.pressed) {
230 set_single_persistent_default_layer(_QWERTY);
231 }
232 return false;
233 case KC_LOWER:
234 if (record->event.pressed) {
235 layer_on(_LOWER);
236 update_tri_layer(_LOWER, _RAISE, _ADJUST);
237 } else {
238 layer_off(_LOWER);
239 update_tri_layer(_LOWER, _RAISE, _ADJUST);
240 }
241 return false;
242 case KC_RAISE:
243 if (record->event.pressed) {
244 layer_on(_RAISE);
245 update_tri_layer(_LOWER, _RAISE, _ADJUST);
246 } else {
247 layer_off(_RAISE);
248 update_tri_layer(_LOWER, _RAISE, _ADJUST);
249 }
250 return false;
251 case KC_ADJUST:
252 if (record->event.pressed) {
253 layer_on(_ADJUST);
254 } else {
255 layer_off(_ADJUST);
256 }
257 return false;
258 case KC_PRVWD:
259 if (record->event.pressed) {
260 if (keymap_config.swap_lctl_lgui) {
261 register_mods(mod_config(MOD_LALT));
262 register_code(KC_LEFT);
263 } else {
264 register_mods(mod_config(MOD_LCTL));
265 register_code(KC_LEFT);
266 }
267 } else {
268 if (keymap_config.swap_lctl_lgui) {
269 unregister_mods(mod_config(MOD_LALT));
270 unregister_code(KC_LEFT);
271 } else {
272 unregister_mods(mod_config(MOD_LCTL));
273 unregister_code(KC_LEFT);
274 }
275 }
276 break;
277 case KC_NXTWD:
278 if (record->event.pressed) {
279 if (keymap_config.swap_lctl_lgui) {
280 register_mods(mod_config(MOD_LALT));
281 register_code(KC_RIGHT);
282 } else {
283 register_mods(mod_config(MOD_LCTL));
284 register_code(KC_RIGHT);
285 }
286 } else {
287 if (keymap_config.swap_lctl_lgui) {
288 unregister_mods(mod_config(MOD_LALT));
289 unregister_code(KC_RIGHT);
290 } else {
291 unregister_mods(mod_config(MOD_LCTL));
292 unregister_code(KC_RIGHT);
293 }
294 }
295 break;
296 case KC_LSTRT:
297 if (record->event.pressed) {
298 if (keymap_config.swap_lctl_lgui) {
299 //CMD-arrow on Mac, but we have CTL and GUI swapped
300 register_mods(mod_config(MOD_LCTL));
301 register_code(KC_LEFT);
302 } else {
303 register_code(KC_HOME);
304 }
305 } else {
306 if (keymap_config.swap_lctl_lgui) {
307 unregister_mods(mod_config(MOD_LCTL));
308 unregister_code(KC_LEFT);
309 } else {
310 unregister_code(KC_HOME);
311 }
312 }
313 break;
314 case KC_LEND:
315 if (record->event.pressed) {
316 if (keymap_config.swap_lctl_lgui) {
317 //CMD-arrow on Mac, but we have CTL and GUI swapped
318 register_mods(mod_config(MOD_LCTL));
319 register_code(KC_RIGHT);
320 } else {
321 register_code(KC_END);
322 }
323 } else {
324 if (keymap_config.swap_lctl_lgui) {
325 unregister_mods(mod_config(MOD_LCTL));
326 unregister_code(KC_RIGHT);
327 } else {
328 unregister_code(KC_END);
329 }
330 }
331 break;
332 case KC_DLINE:
333 if (record->event.pressed) {
334 register_mods(mod_config(MOD_LCTL));
335 register_code(KC_BSPC);
336 } else {
337 unregister_mods(mod_config(MOD_LCTL));
338 unregister_code(KC_BSPC);
339 }
340 break;
341 }
342 return true;
343}
344
345#ifdef ENCODER_ENABLE
346
347void encoder_update_user(int8_t index, bool clockwise) {
348 uint8_t temp_mod = get_mods();
349 uint8_t temp_osm = get_oneshot_mods();
350 bool is_ctrl = (temp_mod | temp_osm) & MOD_MASK_CTRL;
351 bool is_shift = (temp_mod | temp_osm) & MOD_MASK_SHIFT;
352
353 if (is_shift) {
354 if (index == 0) { /* First encoder */
355 if (clockwise) {
356 rgb_matrix_increase_hue();
357 } else {
358 rgb_matrix_decrease_hue();
359 }
360 } else if (index == 1) { /* Second encoder */
361 if (clockwise) {
362 rgb_matrix_decrease_sat();
363 } else {
364 rgb_matrix_increase_sat();
365 }
366 }
367 } else if (is_ctrl) {
368 if (index == 0) { /* First encoder */
369 if (clockwise) {
370 rgb_matrix_increase_val();
371 } else {
372 rgb_matrix_decrease_val();
373 }
374 } else if (index == 1) { /* Second encoder */
375 if (clockwise) {
376 rgb_matrix_increase_speed();
377 } else {
378 rgb_matrix_decrease_speed();
379 }
380 }
381 } else {
382 if (index == 1) { /* First encoder */
383 if (clockwise) {
384 tap_code(KC_PGUP);
385 // tap_code(KC_MS_WH_UP);
386 } else {
387 tap_code(KC_PGDOWN);
388 // tap_code(KC_MS_WH_DOWN);
389 }
390 } else if (index == 0) { /* Second encoder */
391 uint16_t mapped_code = 0;
392 if (clockwise) {
393 mapped_code = KC_VOLD;
394 } else {
395 mapped_code = KC_VOLU;
396 }
397 tap_code_delay(mapped_code, MEDIA_KEY_DELAY);
398 }
399 }
400}
401
402#endif
diff --git a/keyboards/sofle/keymaps/killmaster/readme.md b/keyboards/sofle/keymaps/killmaster/readme.md
new file mode 100644
index 000000000..6d6dea228
--- /dev/null
+++ b/keyboards/sofle/keymaps/killmaster/readme.md
@@ -0,0 +1,19 @@
1![SofleKeyboard default keymap](https://github.com/josefadamcik/SofleKeyboard/raw/master/Images/soflekeyboard.png)
2![SofleKeyboard adjust layer](https://github.com/josefadamcik/SofleKeyboard/raw/master/Images/soflekeyboard_layout_adjust.png)
3
4
5# Default keymap for Sofle Keyboard
6
7Layout in [Keyboard Layout Editor](http://www.keyboard-layout-editor.com/#/gists/76efb423a46cbbea75465cb468eef7ff) and [adjust layer](http://www.keyboard-layout-editor.com/#/gists/4bcf66f922cfd54da20ba04905d56bd4)
8
9
10Features:
11
12- Symmetric modifiers (CMD/Super, Alt/Opt, Ctrl, Shift)
13- Various modes, can be switched (using Adjust layer and the selected one is stored in EEPROM.
14- Modes for Qwerty and Colemak support
15- Modes for Mac vs Linux/Win support -> different order of modifiers and different action shortcuts on the "UPPER" layer (the red one in the image). Designed to simplify transtions when switching between operating systems often.
16- The OLED on master half shows selected mode and caps lock state and is rotated.
17- Left encoder controls volume up/down/mute. Right encoder PGUP/PGDOWN.
18
19
diff --git a/keyboards/sofle/keymaps/killmaster/rules.mk b/keyboards/sofle/keymaps/killmaster/rules.mk
new file mode 100644
index 000000000..38d611450
--- /dev/null
+++ b/keyboards/sofle/keymaps/killmaster/rules.mk
@@ -0,0 +1,4 @@
1EXTRAKEY_ENABLE = yes
2LTO_ENABLE = yes
3RGB_MATRIX_ENABLE = yes
4RGB_MATRIX_DRIVER = WS2812
diff --git a/keyboards/sofle/rev1/readme.md b/keyboards/sofle/rev1/readme.md
new file mode 100644
index 000000000..629d568e6
--- /dev/null
+++ b/keyboards/sofle/rev1/readme.md
@@ -0,0 +1,27 @@
1# Sofle Keyboard
2
3![SofleKeyboard version 1](https://raw.githubusercontent.com/josefadamcik/SofleKeyboard/master/Images/IMG_20200126_114622.jpg)
4
5Sofle is 6×4+5 keys column-staggered split keyboard. Based on Lily58, Corne and Helix keyboards.
6
7More details about the keyboard on my blog: [Let me introduce you SofleKeyboard - a split keyboard based on Lily58 and Crkbd](https://josef-adamcik.cz/electronics/let-me-introduce-you-sofle-keyboard-split-keyboard-based-on-lily58.html)
8
9The current (temporary) build guide and a build log is available here: [SofleKeyboard build log/guide](https://josef-adamcik.cz/electronics/soflekeyboard-build-log-and-build-guide.html)
10
11* Keyboard Maintainer: [Josef Adamcik](https://josef-adamcik.cz) [Twitter:@josefadamcik](https://twitter.com/josefadamcik)
12* Hardware Supported: SofleKeyboard PCB, ProMicro
13* Hardware Availability: [PCB & Case Data](https://github.com/josefadamcik/SofleKeyboard)
14
15Make example for this keyboard (after setting up your build environment):
16
17 make sofle:default
18
19Flashing example for this keyboard:
20
21 make sofle:default:flash
22
23Press reset button on he keyboard when asked.
24
25Disconnect the first half, connect the second one and repeat the process.
26
27See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs).
diff --git a/keyboards/sofle/rev1/rev1.c b/keyboards/sofle/rev1/rev1.c
index bbb014c4d..88a28e6a4 100644
--- a/keyboards/sofle/rev1/rev1.c
+++ b/keyboards/sofle/rev1/rev1.c
@@ -1 +1,87 @@
1/* Copyright 2021 Carlos Martins
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
1#include "sofle.h" 17#include "sofle.h"
18
19#ifdef RGB_MATRIX_ENABLE
20 // Physical Layout
21 // Columns
22 // 0 1 2 3 4 5 6 7 8 9 10 11 12 13
23 // ROWS
24 // 12 13 22 23 32 33 33 32 23 22 13 12 0
25 // 02 03 04 04 03 02
26 // 11 14 21 24 31 34 34 31 24 21 14 11 1
27 // 01 01
28 // 10 15 20 25 30 35 35 30 25 20 15 10 2
29 //
30 // 09 16 19 26 29 36 36 29 26 19 16 09 3
31 //
32 // 08 17 18 27 28 28 27 18 17 08 4
33 // 07 06 05 05 06 07
34
35led_config_t g_led_config = {
36 {
37 { 11, 12, 21, 22, 31, 32 },
38 { 10, 13, 20, 23, 30, 33 },
39 { 9, 14, 19, 24, 29, 34},
40 { 8, 15, 18, 25, 28, 35},
41 { 7, 16, 17, 26, 27, NO_LED },
42 { 47, 48, 57, 58, 67, 68},
43 { 46, 49, 56, 59, 66, 69},
44 { 45, 50, 55, 60, 65, 70},
45 { 44, 51, 54, 61, 64, 71},
46 { 43, 52, 53, 62, 63, NO_LED }
47 },
48 {
49 // Left side underglow
50 {96, 40}, {16, 20}, {48, 10}, {80, 18}, {88, 60}, {56, 57}, {24,60},
51 // Left side Matrix
52 {32, 57}, { 0, 48}, { 0, 36}, { 0, 24}, { 0, 12},
53 {16, 12}, {16, 24}, {16, 36}, {16, 48}, {48, 55},
54 {64, 57}, {32, 45}, {32, 33}, {32, 21}, {32, 9},
55 {48, 7}, {48, 19}, {48, 31}, {48, 43}, {80, 59},
56 {96, 64}, {64, 45}, {64, 33}, {64, 21}, {64, 9},
57 {80, 10}, {80, 22}, {80, 34}, {80, 47},
58
59
60 // Right side underglow
61 {128, 40}, {208, 20}, {176, 10}, {144, 18}, {136, 60}, {168, 57}, {200,60},
62 // Right side Matrix
63 {192, 57}, {224, 48}, {224, 36}, {224, 24}, {224, 12},
64 {208, 12}, {208, 24}, {208, 36}, {208, 48}, {176, 55},
65 {160, 57}, {192, 45}, {192, 33}, {192, 21}, {192, 9},
66 {176, 7}, {176, 19}, {176, 31}, {176, 43}, {144, 59},
67 {128, 64}, {160, 45}, {160, 33}, {160, 21}, {160, 9},
68 {144, 10}, {144, 22}, {144, 34}, {144, 47},
69 },
70 {
71 LED_FLAG_NONE, LED_FLAG_UNDERGLOW, LED_FLAG_UNDERGLOW, LED_FLAG_UNDERGLOW, LED_FLAG_UNDERGLOW, LED_FLAG_UNDERGLOW, LED_FLAG_UNDERGLOW,
72 LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT,
73 LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT,
74 LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT,
75 LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT,
76 LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT,
77 LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT,
78 LED_FLAG_NONE, LED_FLAG_UNDERGLOW, LED_FLAG_UNDERGLOW, LED_FLAG_UNDERGLOW, LED_FLAG_UNDERGLOW, LED_FLAG_UNDERGLOW, LED_FLAG_UNDERGLOW,
79 LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT,
80 LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT,
81 LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT,
82 LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT,
83 LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT,
84 LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT
85 }
86};
87#endif
diff --git a/lib/chibios b/lib/chibios
Subproject ffe54d63cb10a355add318f8e922e39f1c3d4bf Subproject 413e39c5681d181720440f2a8b7391f581788d7
diff --git a/lib/chibios-contrib b/lib/chibios-contrib
Subproject 61baa6b036138c155f7cfc5646d833d9423f324 Subproject 9c2bfa6aeba993345f5425d82807c101f8e25e6
diff --git a/quantum/matrix.c b/quantum/matrix.c
index 34d6af2e6..9298661ad 100644
--- a/quantum/matrix.c
+++ b/quantum/matrix.c
@@ -47,7 +47,7 @@ static inline void setPinInputHigh_atomic(pin_t pin) {
47 47
48#ifdef DIRECT_PINS 48#ifdef DIRECT_PINS
49 49
50static void init_pins(void) { 50__attribute__((weak)) void matrix_init_pins(void) {
51 for (int row = 0; row < MATRIX_ROWS; row++) { 51 for (int row = 0; row < MATRIX_ROWS; row++) {
52 for (int col = 0; col < MATRIX_COLS; col++) { 52 for (int col = 0; col < MATRIX_COLS; col++) {
53 pin_t pin = direct_pins[row][col]; 53 pin_t pin = direct_pins[row][col];
@@ -58,7 +58,7 @@ static void init_pins(void) {
58 } 58 }
59} 59}
60 60
61static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) { 61__attribute__((weak)) bool matrix_read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) {
62 // Start with a clear matrix row 62 // Start with a clear matrix row
63 matrix_row_t current_row_value = 0; 63 matrix_row_t current_row_value = 0;
64 64
@@ -90,14 +90,14 @@ static void unselect_rows(void) {
90 } 90 }
91} 91}
92 92
93static void init_pins(void) { 93__attribute__((weak)) void matrix_init_pins(void) {
94 unselect_rows(); 94 unselect_rows();
95 for (uint8_t x = 0; x < MATRIX_COLS; x++) { 95 for (uint8_t x = 0; x < MATRIX_COLS; x++) {
96 setPinInputHigh_atomic(col_pins[x]); 96 setPinInputHigh_atomic(col_pins[x]);
97 } 97 }
98} 98}
99 99
100static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) { 100__attribute__((weak)) bool matrix_read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) {
101 // Start with a clear matrix row 101 // Start with a clear matrix row
102 matrix_row_t current_row_value = 0; 102 matrix_row_t current_row_value = 0;
103 103
@@ -138,14 +138,14 @@ static void unselect_cols(void) {
138 } 138 }
139} 139}
140 140
141static void init_pins(void) { 141__attribute__((weak)) void matrix_init_pins(void) {
142 unselect_cols(); 142 unselect_cols();
143 for (uint8_t x = 0; x < MATRIX_ROWS; x++) { 143 for (uint8_t x = 0; x < MATRIX_ROWS; x++) {
144 setPinInputHigh_atomic(row_pins[x]); 144 setPinInputHigh_atomic(row_pins[x]);
145 } 145 }
146} 146}
147 147
148static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col) { 148__attribute__((weak)) bool matrix_read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col) {
149 bool matrix_changed = false; 149 bool matrix_changed = false;
150 150
151 // Select col 151 // Select col
@@ -190,7 +190,7 @@ static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col)
190 190
191void matrix_init(void) { 191void matrix_init(void) {
192 // initialize key pins 192 // initialize key pins
193 init_pins(); 193 matrix_init_pins();
194 194
195 // initialize matrix state: all keys off 195 // initialize matrix state: all keys off
196 for (uint8_t i = 0; i < MATRIX_ROWS; i++) { 196 for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
@@ -209,12 +209,12 @@ uint8_t matrix_scan(void) {
209#if defined(DIRECT_PINS) || (DIODE_DIRECTION == COL2ROW) 209#if defined(DIRECT_PINS) || (DIODE_DIRECTION == COL2ROW)
210 // Set row, read cols 210 // Set row, read cols
211 for (uint8_t current_row = 0; current_row < MATRIX_ROWS; current_row++) { 211 for (uint8_t current_row = 0; current_row < MATRIX_ROWS; current_row++) {
212 changed |= read_cols_on_row(raw_matrix, current_row); 212 changed |= matrix_read_cols_on_row(raw_matrix, current_row);
213 } 213 }
214#elif (DIODE_DIRECTION == ROW2COL) 214#elif (DIODE_DIRECTION == ROW2COL)
215 // Set col, read rows 215 // Set col, read rows
216 for (uint8_t current_col = 0; current_col < MATRIX_COLS; current_col++) { 216 for (uint8_t current_col = 0; current_col < MATRIX_COLS; current_col++) {
217 changed |= read_rows_on_col(raw_matrix, current_col); 217 changed |= matrix_read_rows_on_col(raw_matrix, current_col);
218 } 218 }
219#endif 219#endif
220 220
diff --git a/quantum/split_common/matrix.c b/quantum/split_common/matrix.c
index 039e7d977..a54ea90b3 100644
--- a/quantum/split_common/matrix.c
+++ b/quantum/split_common/matrix.c
@@ -61,7 +61,7 @@ static inline void setPinInputHigh_atomic(pin_t pin) {
61 61
62#ifdef DIRECT_PINS 62#ifdef DIRECT_PINS
63 63
64static void init_pins(void) { 64__attribute__((weak)) void matrix_init_pins(void) {
65 for (int row = 0; row < MATRIX_ROWS; row++) { 65 for (int row = 0; row < MATRIX_ROWS; row++) {
66 for (int col = 0; col < MATRIX_COLS; col++) { 66 for (int col = 0; col < MATRIX_COLS; col++) {
67 pin_t pin = direct_pins[row][col]; 67 pin_t pin = direct_pins[row][col];
@@ -72,7 +72,7 @@ static void init_pins(void) {
72 } 72 }
73} 73}
74 74
75static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) { 75__attribute__((weak)) bool matrix_read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) {
76 // Start with a clear matrix row 76 // Start with a clear matrix row
77 matrix_row_t current_row_value = 0; 77 matrix_row_t current_row_value = 0;
78 78
@@ -104,14 +104,14 @@ static void unselect_rows(void) {
104 } 104 }
105} 105}
106 106
107static void init_pins(void) { 107__attribute__((weak)) void matrix_init_pins(void) {
108 unselect_rows(); 108 unselect_rows();
109 for (uint8_t x = 0; x < MATRIX_COLS; x++) { 109 for (uint8_t x = 0; x < MATRIX_COLS; x++) {
110 setPinInputHigh_atomic(col_pins[x]); 110 setPinInputHigh_atomic(col_pins[x]);
111 } 111 }
112} 112}
113 113
114static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) { 114__attribute__((weak)) bool matrix_read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) {
115 // Start with a clear matrix row 115 // Start with a clear matrix row
116 matrix_row_t current_row_value = 0; 116 matrix_row_t current_row_value = 0;
117 117
@@ -152,14 +152,14 @@ static void unselect_cols(void) {
152 } 152 }
153} 153}
154 154
155static void init_pins(void) { 155__attribute__((weak)) void matrix_init_pins(void) {
156 unselect_cols(); 156 unselect_cols();
157 for (uint8_t x = 0; x < ROWS_PER_HAND; x++) { 157 for (uint8_t x = 0; x < ROWS_PER_HAND; x++) {
158 setPinInputHigh_atomic(row_pins[x]); 158 setPinInputHigh_atomic(row_pins[x]);
159 } 159 }
160} 160}
161 161
162static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col) { 162__attribute__((weak)) bool matrix_read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col) {
163 bool matrix_changed = false; 163 bool matrix_changed = false;
164 164
165 // Select col 165 // Select col
@@ -233,7 +233,7 @@ void matrix_init(void) {
233 thatHand = ROWS_PER_HAND - thisHand; 233 thatHand = ROWS_PER_HAND - thisHand;
234 234
235 // initialize key pins 235 // initialize key pins
236 init_pins(); 236 matrix_init_pins();
237 237
238 // initialize matrix state: all keys off 238 // initialize matrix state: all keys off
239 for (uint8_t i = 0; i < MATRIX_ROWS; i++) { 239 for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
@@ -293,12 +293,12 @@ uint8_t matrix_scan(void) {
293#if defined(DIRECT_PINS) || (DIODE_DIRECTION == COL2ROW) 293#if defined(DIRECT_PINS) || (DIODE_DIRECTION == COL2ROW)
294 // Set row, read cols 294 // Set row, read cols
295 for (uint8_t current_row = 0; current_row < ROWS_PER_HAND; current_row++) { 295 for (uint8_t current_row = 0; current_row < ROWS_PER_HAND; current_row++) {
296 local_changed |= read_cols_on_row(raw_matrix, current_row); 296 local_changed |= matrix_read_cols_on_row(raw_matrix, current_row);
297 } 297 }
298#elif (DIODE_DIRECTION == ROW2COL) 298#elif (DIODE_DIRECTION == ROW2COL)
299 // Set col, read rows 299 // Set col, read rows
300 for (uint8_t current_col = 0; current_col < MATRIX_COLS; current_col++) { 300 for (uint8_t current_col = 0; current_col < MATRIX_COLS; current_col++) {
301 local_changed |= read_rows_on_col(raw_matrix, current_col); 301 local_changed |= matrix_read_rows_on_col(raw_matrix, current_col);
302 } 302 }
303#endif 303#endif
304 304
diff --git a/tmk_core/avr.mk b/tmk_core/avr.mk
index 521305f1b..2ba193c76 100644
--- a/tmk_core/avr.mk
+++ b/tmk_core/avr.mk
@@ -295,7 +295,7 @@ ifneq ($(strip $(BOOTLOADER)), qmk-dfu)
295endif 295endif
296 make -C lib/lufa/Bootloaders/DFU/ clean 296 make -C lib/lufa/Bootloaders/DFU/ clean
297 $(QMK_BIN) generate-dfu-header --quiet --keyboard $(KEYBOARD) --output lib/lufa/Bootloaders/DFU/Keyboard.h 297 $(QMK_BIN) generate-dfu-header --quiet --keyboard $(KEYBOARD) --output lib/lufa/Bootloaders/DFU/Keyboard.h
298 $(eval MAX_SIZE=$(shell n=`$(CC) -E -mmcu=$(MCU) $(CFLAGS) $(OPT_DEFS) tmk_core/common/avr/bootloader_size.c 2> /dev/null | sed -ne 's/\r//;/^#/n;/^AVR_SIZE:/,$${s/^AVR_SIZE: //;p;}'` && echo $$(($$n)) || echo 0)) 298 $(eval MAX_SIZE=$(shell n=`$(CC) -E -mmcu=$(MCU) -D__ASSEMBLER__ $(CFLAGS) $(OPT_DEFS) tmk_core/common/avr/bootloader_size.c 2> /dev/null | sed -ne 's/\r//;/^#/n;/^AVR_SIZE:/,$${s/^AVR_SIZE: //;p;}'` && echo $$(($$n)) || echo 0))
299 $(eval PROGRAM_SIZE_KB=$(shell n=`expr $(MAX_SIZE) / 1024` && echo $$(($$n)) || echo 0)) 299 $(eval PROGRAM_SIZE_KB=$(shell n=`expr $(MAX_SIZE) / 1024` && echo $$(($$n)) || echo 0))
300 $(eval BOOT_SECTION_SIZE_KB=$(shell n=`expr $(BOOTLOADER_SIZE) / 1024` && echo $$(($$n)) || echo 0)) 300 $(eval BOOT_SECTION_SIZE_KB=$(shell n=`expr $(BOOTLOADER_SIZE) / 1024` && echo $$(($$n)) || echo 0))
301 $(eval FLASH_SIZE_KB=$(shell n=`expr $(PROGRAM_SIZE_KB) + $(BOOT_SECTION_SIZE_KB)` && echo $$(($$n)) || echo 0)) 301 $(eval FLASH_SIZE_KB=$(shell n=`expr $(PROGRAM_SIZE_KB) + $(BOOT_SECTION_SIZE_KB)` && echo $$(($$n)) || echo 0))
diff --git a/tmk_core/common/avr/gpio.h b/tmk_core/common/avr/gpio.h
index 231556c29..e9be68491 100644
--- a/tmk_core/common/avr/gpio.h
+++ b/tmk_core/common/avr/gpio.h
@@ -20,6 +20,8 @@
20 20
21typedef uint8_t pin_t; 21typedef uint8_t pin_t;
22 22
23/* Operation of GPIO by pin. */
24
23#define setPinInput(pin) (DDRx_ADDRESS(pin) &= ~_BV((pin)&0xF), PORTx_ADDRESS(pin) &= ~_BV((pin)&0xF)) 25#define setPinInput(pin) (DDRx_ADDRESS(pin) &= ~_BV((pin)&0xF), PORTx_ADDRESS(pin) &= ~_BV((pin)&0xF))
24#define setPinInputHigh(pin) (DDRx_ADDRESS(pin) &= ~_BV((pin)&0xF), PORTx_ADDRESS(pin) |= _BV((pin)&0xF)) 26#define setPinInputHigh(pin) (DDRx_ADDRESS(pin) &= ~_BV((pin)&0xF), PORTx_ADDRESS(pin) |= _BV((pin)&0xF))
25#define setPinInputLow(pin) _Static_assert(0, "AVR processors cannot implement an input as pull low") 27#define setPinInputLow(pin) _Static_assert(0, "AVR processors cannot implement an input as pull low")
@@ -32,3 +34,16 @@ typedef uint8_t pin_t;
32#define readPin(pin) ((bool)(PINx_ADDRESS(pin) & _BV((pin)&0xF))) 34#define readPin(pin) ((bool)(PINx_ADDRESS(pin) & _BV((pin)&0xF)))
33 35
34#define togglePin(pin) (PORTx_ADDRESS(pin) ^= _BV((pin)&0xF)) 36#define togglePin(pin) (PORTx_ADDRESS(pin) ^= _BV((pin)&0xF))
37
38/* Operation of GPIO by port. */
39
40typedef uint8_t port_data_t;
41
42#define readPort(port) PINx_ADDRESS(port)
43
44#define setPortBitInput(port, bit) (DDRx_ADDRESS(port) &= ~_BV((bit)&0xF), PORTx_ADDRESS(port) &= ~_BV((bit)&0xF))
45#define setPortBitInputHigh(port, bit) (DDRx_ADDRESS(port) &= ~_BV((bit)&0xF), PORTx_ADDRESS(port) |= _BV((bit)&0xF))
46#define setPortBitOutput(port, bit) (DDRx_ADDRESS(port) |= _BV((bit)&0xF))
47
48#define writePortBitLow(port, bit) (PORTx_ADDRESS(port) &= ~_BV((bit)&0xF))
49#define writePortBitHigh(port, bit) (PORTx_ADDRESS(port) |= _BV((bit)&0xF))
diff --git a/tmk_core/common/chibios/gpio.h b/tmk_core/common/chibios/gpio.h
index 5d0e142ab..4d057f1ca 100644
--- a/tmk_core/common/chibios/gpio.h
+++ b/tmk_core/common/chibios/gpio.h
@@ -20,6 +20,8 @@
20 20
21typedef ioline_t pin_t; 21typedef ioline_t pin_t;
22 22
23/* Operation of GPIO by pin. */
24
23#define setPinInput(pin) palSetLineMode(pin, PAL_MODE_INPUT) 25#define setPinInput(pin) palSetLineMode(pin, PAL_MODE_INPUT)
24#define setPinInputHigh(pin) palSetLineMode(pin, PAL_MODE_INPUT_PULLUP) 26#define setPinInputHigh(pin) palSetLineMode(pin, PAL_MODE_INPUT_PULLUP)
25#define setPinInputLow(pin) palSetLineMode(pin, PAL_MODE_INPUT_PULLDOWN) 27#define setPinInputLow(pin) palSetLineMode(pin, PAL_MODE_INPUT_PULLDOWN)
@@ -32,3 +34,17 @@ typedef ioline_t pin_t;
32#define readPin(pin) palReadLine(pin) 34#define readPin(pin) palReadLine(pin)
33 35
34#define togglePin(pin) palToggleLine(pin) 36#define togglePin(pin) palToggleLine(pin)
37
38/* Operation of GPIO by port. */
39
40typedef uint16_t port_data_t;
41
42#define readPort(pin) palReadPort(PAL_PORT(pin))
43
44#define setPortBitInput(pin, bit) palSetPadMode(PAL_PORT(pin), bit, PAL_MODE_INPUT)
45#define setPortBitInputHigh(pin, bit) palSetPadMode(PAL_PORT(pin), bit, PAL_MODE_INPUT_PULLUP)
46#define setPortBitInputLow(pin, bit) palSetPadMode(PAL_PORT(pin), bit, PAL_MODE_INPUT_PULLDOWN)
47#define setPortBitOutput(pin, bit) palSetPadMode(PAL_PORT(pin), bit, PAL_MODE_OUTPUT_PUSHPULL)
48
49#define writePortBitLow(pin, bit) palClearLine(PAL_LINE(PAL_PORT(pin), bit))
50#define writePortBitHigh(pin, bit) palSetLine(PAL_LINE(PAL_PORT(pin), bit))
diff --git a/tmk_core/protocol/chibios/usb_main.c b/tmk_core/protocol/chibios/usb_main.c
index d04302aca..407b8ea75 100644
--- a/tmk_core/protocol/chibios/usb_main.c
+++ b/tmk_core/protocol/chibios/usb_main.c
@@ -903,7 +903,8 @@ static void send_extra(uint8_t report_id, uint16_t data) {
903 return; 903 return;
904 } 904 }
905 905
906 report_extra_t report = {.report_id = report_id, .usage = data}; 906 static report_extra_t report;
907 report = (report_extra_t){.report_id = report_id, .usage = data};
907 908
908 usbStartTransmitI(&USB_DRIVER, SHARED_IN_EPNUM, (uint8_t *)&report, sizeof(report_extra_t)); 909 usbStartTransmitI(&USB_DRIVER, SHARED_IN_EPNUM, (uint8_t *)&report, sizeof(report_extra_t));
909 osalSysUnlock(); 910 osalSysUnlock();
@@ -1051,45 +1052,44 @@ void virtser_task(void) {
1051#ifdef JOYSTICK_ENABLE 1052#ifdef JOYSTICK_ENABLE
1052 1053
1053void send_joystick_packet(joystick_t *joystick) { 1054void send_joystick_packet(joystick_t *joystick) {
1054 joystick_report_t rep = { 1055 static joystick_report_t rep;
1056 rep = (joystick_report_t) {
1055# if JOYSTICK_AXES_COUNT > 0 1057# if JOYSTICK_AXES_COUNT > 0
1056 .axes = 1058 .axes =
1057 { 1059 { joystick->axes[0],
1058 joystick->axes[0],
1059 1060
1060# if JOYSTICK_AXES_COUNT >= 2 1061# if JOYSTICK_AXES_COUNT >= 2
1061 joystick->axes[1], 1062 joystick->axes[1],
1062# endif 1063# endif
1063# if JOYSTICK_AXES_COUNT >= 3 1064# if JOYSTICK_AXES_COUNT >= 3
1064 joystick->axes[2], 1065 joystick->axes[2],
1065# endif 1066# endif
1066# if JOYSTICK_AXES_COUNT >= 4 1067# if JOYSTICK_AXES_COUNT >= 4
1067 joystick->axes[3], 1068 joystick->axes[3],
1068# endif 1069# endif
1069# if JOYSTICK_AXES_COUNT >= 5 1070# if JOYSTICK_AXES_COUNT >= 5
1070 joystick->axes[4], 1071 joystick->axes[4],
1071# endif 1072# endif
1072# if JOYSTICK_AXES_COUNT >= 6 1073# if JOYSTICK_AXES_COUNT >= 6
1073 joystick->axes[5], 1074 joystick->axes[5],
1074# endif 1075# endif
1075 }, 1076 },
1076# endif // JOYSTICK_AXES_COUNT>0 1077# endif // JOYSTICK_AXES_COUNT>0
1077 1078
1078# if JOYSTICK_BUTTON_COUNT > 0 1079# if JOYSTICK_BUTTON_COUNT > 0
1079 .buttons = 1080 .buttons = {
1080 { 1081 joystick->buttons[0],
1081 joystick->buttons[0],
1082 1082
1083# if JOYSTICK_BUTTON_COUNT > 8 1083# if JOYSTICK_BUTTON_COUNT > 8
1084 joystick->buttons[1], 1084 joystick->buttons[1],
1085# endif 1085# endif
1086# if JOYSTICK_BUTTON_COUNT > 16 1086# if JOYSTICK_BUTTON_COUNT > 16
1087 joystick->buttons[2], 1087 joystick->buttons[2],
1088# endif 1088# endif
1089# if JOYSTICK_BUTTON_COUNT > 24 1089# if JOYSTICK_BUTTON_COUNT > 24
1090 joystick->buttons[3], 1090 joystick->buttons[3],
1091# endif 1091# endif
1092 } 1092 }
1093# endif // JOYSTICK_BUTTON_COUNT>0 1093# endif // JOYSTICK_BUTTON_COUNT>0
1094 }; 1094 };
1095 1095
diff --git a/tmk_core/protocol/lufa/lufa.c b/tmk_core/protocol/lufa/lufa.c
index 63619fdb3..4ac079e16 100644
--- a/tmk_core/protocol/lufa/lufa.c
+++ b/tmk_core/protocol/lufa/lufa.c
@@ -314,45 +314,44 @@ static void Console_Task(void) {
314void send_joystick_packet(joystick_t *joystick) { 314void send_joystick_packet(joystick_t *joystick) {
315 uint8_t timeout = 255; 315 uint8_t timeout = 255;
316 316
317 joystick_report_t r = { 317 static joystick_report_t;
318 r = (joystick_report_t) {
318# if JOYSTICK_AXES_COUNT > 0 319# if JOYSTICK_AXES_COUNT > 0
319 .axes = 320 .axes =
320 { 321 { joystick->axes[0],
321 joystick->axes[0],
322 322
323# if JOYSTICK_AXES_COUNT >= 2 323# if JOYSTICK_AXES_COUNT >= 2
324 joystick->axes[1], 324 joystick->axes[1],
325# endif 325# endif
326# if JOYSTICK_AXES_COUNT >= 3 326# if JOYSTICK_AXES_COUNT >= 3
327 joystick->axes[2], 327 joystick->axes[2],
328# endif 328# endif
329# if JOYSTICK_AXES_COUNT >= 4 329# if JOYSTICK_AXES_COUNT >= 4
330 joystick->axes[3], 330 joystick->axes[3],
331# endif 331# endif
332# if JOYSTICK_AXES_COUNT >= 5 332# if JOYSTICK_AXES_COUNT >= 5
333 joystick->axes[4], 333 joystick->axes[4],
334# endif 334# endif
335# if JOYSTICK_AXES_COUNT >= 6 335# if JOYSTICK_AXES_COUNT >= 6
336 joystick->axes[5], 336 joystick->axes[5],
337# endif 337# endif
338 }, 338 },
339# endif // JOYSTICK_AXES_COUNT>0 339# endif // JOYSTICK_AXES_COUNT>0
340 340
341# if JOYSTICK_BUTTON_COUNT > 0 341# if JOYSTICK_BUTTON_COUNT > 0
342 .buttons = 342 .buttons = {
343 { 343 joystick->buttons[0],
344 joystick->buttons[0],
345 344
346# if JOYSTICK_BUTTON_COUNT > 8 345# if JOYSTICK_BUTTON_COUNT > 8
347 joystick->buttons[1], 346 joystick->buttons[1],
348# endif 347# endif
349# if JOYSTICK_BUTTON_COUNT > 16 348# if JOYSTICK_BUTTON_COUNT > 16
350 joystick->buttons[2], 349 joystick->buttons[2],
351# endif 350# endif
352# if JOYSTICK_BUTTON_COUNT > 24 351# if JOYSTICK_BUTTON_COUNT > 24
353 joystick->buttons[3], 352 joystick->buttons[3],
354# endif 353# endif
355 } 354 }
356# endif // JOYSTICK_BUTTON_COUNT>0 355# endif // JOYSTICK_BUTTON_COUNT>0
357 }; 356 };
358 357
@@ -768,7 +767,8 @@ static void send_extra(uint8_t report_id, uint16_t data) {
768 767
769 if (USB_DeviceState != DEVICE_STATE_Configured) return; 768 if (USB_DeviceState != DEVICE_STATE_Configured) return;
770 769
771 report_extra_t r = {.report_id = report_id, .usage = data}; 770 static report_extra_t r;
771 r = (report_extra_t){.report_id = report_id, .usage = data};
772 Endpoint_SelectEndpoint(SHARED_IN_EPNUM); 772 Endpoint_SelectEndpoint(SHARED_IN_EPNUM);
773 773
774 /* Check if write ready for a polling interval around 10ms */ 774 /* Check if write ready for a polling interval around 10ms */
diff --git a/tmk_core/protocol/usb_descriptor.c b/tmk_core/protocol/usb_descriptor.c
index ba7760f28..c88aceb6e 100644
--- a/tmk_core/protocol/usb_descriptor.c
+++ b/tmk_core/protocol/usb_descriptor.c
@@ -351,7 +351,7 @@ const USB_Descriptor_Device_t PROGMEM DeviceDescriptor = {
351 .Size = sizeof(USB_Descriptor_Device_t), 351 .Size = sizeof(USB_Descriptor_Device_t),
352 .Type = DTYPE_Device 352 .Type = DTYPE_Device
353 }, 353 },
354 .USBSpecification = VERSION_BCD(1, 1, 0), 354 .USBSpecification = VERSION_BCD(2, 0, 0),
355 355
356#if VIRTSER_ENABLE 356#if VIRTSER_ENABLE
357 .Class = USB_CSCP_IADDeviceClass, 357 .Class = USB_CSCP_IADDeviceClass,
diff --git a/tmk_core/protocol/vusb/vusb.c b/tmk_core/protocol/vusb/vusb.c
index 9362fbde7..876a31378 100644
--- a/tmk_core/protocol/vusb/vusb.c
+++ b/tmk_core/protocol/vusb/vusb.c
@@ -272,7 +272,8 @@ static void send_extra(uint8_t report_id, uint16_t data) {
272 last_id = report_id; 272 last_id = report_id;
273 last_data = data; 273 last_data = data;
274 274
275 report_extra_t report = {.report_id = report_id, .usage = data}; 275 static report_extra_t report;
276 report = (report_extra_t){.report_id = report_id, .usage = data};
276 if (usbInterruptIsReadyShared()) { 277 if (usbInterruptIsReadyShared()) {
277 usbSetInterruptShared((void *)&report, sizeof(report_extra_t)); 278 usbSetInterruptShared((void *)&report, sizeof(report_extra_t));
278 } 279 }
diff --git a/tmk_core/rules.mk b/tmk_core/rules.mk
index fc2dc68be..597f7aa82 100644
--- a/tmk_core/rules.mk
+++ b/tmk_core/rules.mk
@@ -458,7 +458,7 @@ ifeq ($(findstring avr-gcc,$(CC)),avr-gcc)
458SIZE_MARGIN = 1024 458SIZE_MARGIN = 1024
459 459
460check-size: 460check-size:
461 $(eval MAX_SIZE=$(shell n=`$(CC) -E -mmcu=$(MCU) $(CFLAGS) $(OPT_DEFS) tmk_core/common/avr/bootloader_size.c 2> /dev/null | sed -ne 's/\r//;/^#/n;/^AVR_SIZE:/,$${s/^AVR_SIZE: //;p;}'` && echo $$(($$n)) || echo 0)) 461 $(eval MAX_SIZE=$(shell n=`$(CC) -E -mmcu=$(MCU) -D__ASSEMBLER__ $(CFLAGS) $(OPT_DEFS) tmk_core/common/avr/bootloader_size.c 2> /dev/null | sed -ne 's/\r//;/^#/n;/^AVR_SIZE:/,$${s/^AVR_SIZE: //;p;}'` && echo $$(($$n)) || echo 0))
462 $(eval CURRENT_SIZE=$(shell if [ -f $(BUILD_DIR)/$(TARGET).hex ]; then $(SIZE) --target=$(FORMAT) $(BUILD_DIR)/$(TARGET).hex | $(AWK) 'NR==2 {print $$4}'; else printf 0; fi)) 462 $(eval CURRENT_SIZE=$(shell if [ -f $(BUILD_DIR)/$(TARGET).hex ]; then $(SIZE) --target=$(FORMAT) $(BUILD_DIR)/$(TARGET).hex | $(AWK) 'NR==2 {print $$4}'; else printf 0; fi))
463 $(eval FREE_SIZE=$(shell expr $(MAX_SIZE) - $(CURRENT_SIZE))) 463 $(eval FREE_SIZE=$(shell expr $(MAX_SIZE) - $(CURRENT_SIZE)))
464 $(eval OVER_SIZE=$(shell expr $(CURRENT_SIZE) - $(MAX_SIZE))) 464 $(eval OVER_SIZE=$(shell expr $(CURRENT_SIZE) - $(MAX_SIZE)))