summaryrefslogtreecommitdiff
path: root/tmk_core
diff options
context:
space:
mode:
Diffstat (limited to 'tmk_core')
-rw-r--r--tmk_core/avr.mk42
-rw-r--r--tmk_core/chibios.mk4
-rw-r--r--tmk_core/common.mk20
-rw-r--r--tmk_core/common/action.c49
-rw-r--r--tmk_core/common/action_util.c6
-rw-r--r--tmk_core/common/avr/suspend.c1
-rw-r--r--tmk_core/common/keyboard.c58
-rw-r--r--tmk_core/common/keyboard.h1
-rw-r--r--tmk_core/common/mousekey.h13
-rw-r--r--tmk_core/protocol/lufa/adafruit_ble.cpp20
-rw-r--r--tmk_core/protocol/lufa/adafruit_ble.h2
-rw-r--r--tmk_core/protocol/lufa/lufa.c4
-rw-r--r--tmk_core/protocol/ps2_mouse.c29
-rw-r--r--tmk_core/rules.mk6
14 files changed, 191 insertions, 64 deletions
diff --git a/tmk_core/avr.mk b/tmk_core/avr.mk
index 5df539def..ccecdb192 100644
--- a/tmk_core/avr.mk
+++ b/tmk_core/avr.mk
@@ -89,9 +89,9 @@ DEBUG_HOST = localhost
#============================================================================
# Autodecct teensy loader
ifneq (, $(shell which teensy-loader-cli 2>/dev/null))
- TEENSY_LOADER_CLI = teensy-loader-cli
+ TEENSY_LOADER_CLI ?= teensy-loader-cli
else
- TEENSY_LOADER_CLI = teensy_loader_cli
+ TEENSY_LOADER_CLI ?= teensy_loader_cli
endif
# Program the device.
@@ -100,43 +100,47 @@ program: $(BUILD_DIR)/$(TARGET).hex $(BUILD_DIR)/$(TARGET).eep
teensy: $(BUILD_DIR)/$(TARGET).hex
$(TEENSY_LOADER_CLI) -mmcu=$(MCU) -w -v $(BUILD_DIR)/$(TARGET).hex
+
+BATCHISP ?= batchisp
flip: $(BUILD_DIR)/$(TARGET).hex
- batchisp -hardware usb -device $(MCU) -operation erase f
- batchisp -hardware usb -device $(MCU) -operation loadbuffer $(BUILD_DIR)/$(TARGET).hex program
- batchisp -hardware usb -device $(MCU) -operation start reset 0
+ $(BATCHISP) -hardware usb -device $(MCU) -operation erase f
+ $(BATCHISP) -hardware usb -device $(MCU) -operation loadbuffer $(BUILD_DIR)/$(TARGET).hex program
+ $(BATCHISP) -hardware usb -device $(MCU) -operation start reset 0
+
+DFU_PROGRAMMER ?= dfu-programmer
dfu: $(BUILD_DIR)/$(TARGET).hex sizeafter
- until dfu-programmer $(MCU) get bootloader-version; do\
+ until $(DFU_PROGRAMMER) $(MCU) get bootloader-version; do\
echo "Error: Bootloader not found. Trying again in 5s." ;\
sleep 5 ;\
done
-ifneq (, $(findstring 0.7, $(shell dfu-programmer --version 2>&1)))
- dfu-programmer $(MCU) erase --force
+ifneq (, $(findstring 0.7, $(shell $(DFU_PROGRAMMER) --version 2>&1)))
+ $(DFU_PROGRAMMER) $(MCU) erase --force
else
- dfu-programmer $(MCU) erase
+ $(DFU_PROGRAMMER) $(MCU) erase
endif
- dfu-programmer $(MCU) flash $(BUILD_DIR)/$(TARGET).hex
- dfu-programmer $(MCU) reset
+ $(DFU_PROGRAMMER) $(MCU) flash $(BUILD_DIR)/$(TARGET).hex
+ $(DFU_PROGRAMMER) $(MCU) reset
dfu-start:
- dfu-programmer $(MCU) reset
- dfu-programmer $(MCU) start
+ $(DFU_PROGRAMMER) $(MCU) reset
+ $(DFU_PROGRAMMER) $(MCU) start
flip-ee: $(BUILD_DIR)/$(TARGET).hex $(BUILD_DIR)/$(TARGET).eep
$(COPY) $(BUILD_DIR)/$(TARGET).eep $(BUILD_DIR)/$(TARGET)eep.hex
- batchisp -hardware usb -device $(MCU) -operation memory EEPROM erase
- batchisp -hardware usb -device $(MCU) -operation memory EEPROM loadbuffer $(BUILD_DIR)/$(TARGET)eep.hex program
- batchisp -hardware usb -device $(MCU) -operation start reset 0
+ $(BATCHISP) -hardware usb -device $(MCU) -operation memory EEPROM erase
+ $(BATCHISP) -hardware usb -device $(MCU) -operation memory EEPROM loadbuffer $(BUILD_DIR)/$(TARGET)eep.hex program
+ $(BATCHISP) -hardware usb -device $(MCU) -operation start reset 0
$(REMOVE) $(BUILD_DIR)/$(TARGET)eep.hex
dfu-ee: $(BUILD_DIR)/$(TARGET).hex $(BUILD_DIR)/$(TARGET).eep
ifneq (, $(findstring 0.7, $(shell dfu-programmer --version 2>&1)))
- dfu-programmer $(MCU) flash --eeprom $(BUILD_DIR)/$(TARGET).eep
+ $(DFU_PROGRAMMER) $(MCU) flash --eeprom $(BUILD_DIR)/$(TARGET).eep
else
- dfu-programmer $(MCU) flash-eeprom $(BUILD_DIR)/$(TARGET).eep
+ $(DFU_PROGRAMMER) $(MCU) flash-eeprom $(BUILD_DIR)/$(TARGET).eep
endif
- dfu-programmer $(MCU) reset
+ $(DFU_PROGRAMMER) $(MCU) reset
# Convert hex to bin.
flashbin: $(BUILD_DIR)/$(TARGET).hex
diff --git a/tmk_core/chibios.mk b/tmk_core/chibios.mk
index eb0c40138..2a8d32fb9 100644
--- a/tmk_core/chibios.mk
+++ b/tmk_core/chibios.mk
@@ -151,5 +151,7 @@ endif
# List any extra directories to look for libraries here.
EXTRALIBDIRS = $(RULESPATH)/ld
+DFU_UTIL ?= dfu-util
+
dfu-util: $(BUILD_DIR)/$(TARGET).bin sizeafter
- dfu-util $(DFU_ARGS) -D $(BUILD_DIR)/$(TARGET).bin
+ $(DFU_UTIL) $(DFU_ARGS) -D $(BUILD_DIR)/$(TARGET).bin
diff --git a/tmk_core/common.mk b/tmk_core/common.mk
index 3e0bd7dbc..edec2acb4 100644
--- a/tmk_core/common.mk
+++ b/tmk_core/common.mk
@@ -95,27 +95,35 @@ endif
ifeq ($(strip $(BLUETOOTH_ENABLE)), yes)
TMK_COMMON_DEFS += -DBLUETOOTH_ENABLE
+ TMK_COMMON_DEFS += -DNO_USB_STARTUP_CHECK
endif
ifeq ($(strip $(BLUETOOTH)), AdafruitBLE)
- TMK_COMMON_DEFS += -DBLUETOOTH_ENABLE
- TMK_COMMON_DEFS += -DMODULE_ADAFRUIT_BLE
+ TMK_COMMON_DEFS += -DBLUETOOTH_ENABLE
+ TMK_COMMON_DEFS += -DMODULE_ADAFRUIT_BLE
+ TMK_COMMON_DEFS += -DNO_USB_STARTUP_CHECK
endif
ifeq ($(strip $(BLUETOOTH)), AdafruitEZKey)
- TMK_COMMON_DEFS += -DBLUETOOTH_ENABLE
- TMK_COMMON_DEFS += -DMODULE_ADAFRUIT_EZKEY
+ TMK_COMMON_DEFS += -DBLUETOOTH_ENABLE
+ TMK_COMMON_DEFS += -DMODULE_ADAFRUIT_EZKEY
+ TMK_COMMON_DEFS += -DNO_USB_STARTUP_CHECK
endif
ifeq ($(strip $(BLUETOOTH)), RN42)
- TMK_COMMON_DEFS += -DBLUETOOTH_ENABLE
- TMK_COMMON_DEFS += -DMODULE_RN42
+ TMK_COMMON_DEFS += -DBLUETOOTH_ENABLE
+ TMK_COMMON_DEFS += -DMODULE_RN42
+ TMK_COMMON_DEFS += -DNO_USB_STARTUP_CHECK
endif
ifeq ($(strip $(ONEHAND_ENABLE)), yes)
TMK_COMMON_DEFS += -DONEHAND_ENABLE
endif
+ifeq ($(strip $(NO_USB_STARTUP_CHECK)), yes)
+ TMK_COMMON_DEFS += -DNO_USB_STARTUP_CHECK
+endif
+
ifeq ($(strip $(KEYMAP_SECTION_ENABLE)), yes)
TMK_COMMON_DEFS += -DKEYMAP_SECTION_ENABLE
diff --git a/tmk_core/common/action.c b/tmk_core/common/action.c
index 94de36918..cffc0b9eb 100644
--- a/tmk_core/common/action.c
+++ b/tmk_core/common/action.c
@@ -26,6 +26,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "action_macro.h"
#include "action_util.h"
#include "action.h"
+#include "wait.h"
#ifdef DEBUG_ACTION
#include "debug.h"
@@ -33,6 +34,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "nodebug.h"
#endif
+int tp_buttons;
+
#ifdef FAUXCLICKY_ENABLE
#include <fauxclicky.h>
#endif
@@ -140,7 +143,6 @@ void process_record(keyrecord_t *record)
void process_action(keyrecord_t *record, action_t action)
{
- bool do_release_oneshot = false;
keyevent_t event = record->event;
#ifndef NO_ACTION_TAPPING
uint8_t tap_count = record->tap.count;
@@ -152,6 +154,7 @@ void process_action(keyrecord_t *record, action_t action)
}
#ifndef NO_ACTION_ONESHOT
+ bool do_release_oneshot = false;
// notice we only clear the one shot layer if the pressed key is not a modifier.
if (is_oneshot_layer_active() && event.pressed && !IS_MOD(action.key.code)) {
clear_oneshot_layer_state(ONESHOT_OTHER_KEY_PRESSED);
@@ -310,9 +313,35 @@ void process_action(keyrecord_t *record, action_t action)
/* Mouse key */
case ACT_MOUSEKEY:
if (event.pressed) {
+ switch (action.key.code) {
+ case KC_MS_BTN1:
+ tp_buttons |= (1<<0);
+ break;
+ case KC_MS_BTN2:
+ tp_buttons |= (1<<1);
+ break;
+ case KC_MS_BTN3:
+ tp_buttons |= (1<<2);
+ break;
+ default:
+ break;
+ }
mousekey_on(action.key.code);
mousekey_send();
} else {
+ switch (action.key.code) {
+ case KC_MS_BTN1:
+ tp_buttons &= ~(1<<0);
+ break;
+ case KC_MS_BTN2:
+ tp_buttons &= ~(1<<1);
+ break;
+ case KC_MS_BTN3:
+ tp_buttons &= ~(1<<2);
+ break;
+ default:
+ break;
+ }
mousekey_off(action.key.code);
mousekey_send();
}
@@ -438,6 +467,9 @@ void process_action(keyrecord_t *record, action_t action)
} else {
if (tap_count > 0) {
dprint("KEYMAP_TAP_KEY: Tap: unregister_code\n");
+ if (action.layer_tap.code == KC_CAPS) {
+ wait_ms(80);
+ }
unregister_code(action.layer_tap.code);
} else {
dprint("KEYMAP_TAP_KEY: No tap: Off on release\n");
@@ -537,6 +569,21 @@ void process_action(keyrecord_t *record, action_t action)
break;
}
+#ifndef NO_ACTION_LAYER
+ // if this event is a layer action, update the leds
+ switch (action.kind.id) {
+ case ACT_LAYER:
+ #ifndef NO_ACTION_TAPPING
+ case ACT_LAYER_TAP:
+ case ACT_LAYER_TAP_EXT:
+ #endif
+ led_set(host_keyboard_leds());
+ break;
+ default:
+ break;
+ }
+#endif
+
#ifndef NO_ACTION_ONESHOT
/* Because we switch layers after a oneshot event, we need to release the
* key before we leave the layer or no key up event will be generated.
diff --git a/tmk_core/common/action_util.c b/tmk_core/common/action_util.c
index cb4b25264..77848c092 100644
--- a/tmk_core/common/action_util.c
+++ b/tmk_core/common/action_util.c
@@ -58,9 +58,13 @@ void set_oneshot_locked_mods(int8_t mods) { oneshot_locked_mods = mods; }
void clear_oneshot_locked_mods(void) { oneshot_locked_mods = 0; }
#if (defined(ONESHOT_TIMEOUT) && (ONESHOT_TIMEOUT > 0))
static int16_t oneshot_time = 0;
-inline bool has_oneshot_mods_timed_out() {
+bool has_oneshot_mods_timed_out(void) {
return TIMER_DIFF_16(timer_read(), oneshot_time) >= ONESHOT_TIMEOUT;
}
+#else
+bool has_oneshot_mods_timed_out(void) {
+ return false;
+}
#endif
#endif
diff --git a/tmk_core/common/avr/suspend.c b/tmk_core/common/avr/suspend.c
index 0c81e8361..1c7618ff5 100644
--- a/tmk_core/common/avr/suspend.c
+++ b/tmk_core/common/avr/suspend.c
@@ -9,6 +9,7 @@
#include "suspend.h"
#include "timer.h"
#include "led.h"
+#include "host.h"
#ifdef PROTOCOL_LUFA
#include "lufa.h"
diff --git a/tmk_core/common/keyboard.c b/tmk_core/common/keyboard.c
index eac1f1dd8..97a8f1cd8 100644
--- a/tmk_core/common/keyboard.c
+++ b/tmk_core/common/keyboard.c
@@ -61,23 +61,51 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
# include "visualizer/visualizer.h"
#endif
+#ifdef MATRIX_HAS_GHOST
+extern const uint16_t keymaps[][MATRIX_ROWS][MATRIX_COLS];
+static matrix_row_t get_real_keys(uint8_t row, matrix_row_t rowdata){
+ matrix_row_t out = 0;
+ for (uint8_t col = 0; col < MATRIX_COLS; col++) {
+ //read each key in the row data and check if the keymap defines it as a real key
+ if (pgm_read_byte(&keymaps[0][row][col]) && (rowdata & (1<<col))){
+ //this creates new row data, if a key is defined in the keymap, it will be set here
+ out |= 1<<col;
+ }
+ }
+ return out;
+}
+static inline bool popcount_more_than_one(matrix_row_t rowdata)
+{
+ rowdata &= rowdata-1; //if there are less than two bits (keys) set, rowdata will become zero
+ return rowdata;
+}
-#ifdef MATRIX_HAS_GHOST
-static bool has_ghost_in_row(uint8_t row)
+static inline bool has_ghost_in_row(uint8_t row, matrix_row_t rowdata)
{
- matrix_row_t matrix_row = matrix_get_row(row);
- // No ghost exists when less than 2 keys are down on the row
- if (((matrix_row - 1) & matrix_row) == 0)
+ /* No ghost exists when less than 2 keys are down on the row.
+ If there are "active" blanks in the matrix, the key can't be pressed by the user,
+ there is no doubt as to which keys are really being pressed.
+ The ghosts will be ignored, they are KC_NO. */
+ rowdata = get_real_keys(row, rowdata);
+ if ((popcount_more_than_one(rowdata)) == 0){
return false;
-
- // Ghost occurs when the row shares column line with other row
+ }
+ /* Ghost occurs when the row shares a column line with other row,
+ and two columns are read on each row. Blanks in the matrix don't matter,
+ so they are filtered out.
+ If there are two or more real keys pressed and they match columns with
+ at least two of another row's real keys, the row will be ignored. Keep in mind,
+ we are checking one row at a time, not all of them at once.
+ */
for (uint8_t i=0; i < MATRIX_ROWS; i++) {
- if (i != row && (matrix_get_row(i) & matrix_row))
+ if (i != row && popcount_more_than_one(get_real_keys(i, matrix_get_row(i)) & rowdata)){
return true;
+ }
}
return false;
}
+
#endif
__attribute__ ((weak))
@@ -127,7 +155,7 @@ void keyboard_task(void)
{
static matrix_row_t matrix_prev[MATRIX_ROWS];
#ifdef MATRIX_HAS_GHOST
- static matrix_row_t matrix_ghost[MATRIX_ROWS];
+ // static matrix_row_t matrix_ghost[MATRIX_ROWS];
#endif
static uint8_t led_status = 0;
matrix_row_t matrix_row = 0;
@@ -139,18 +167,18 @@ void keyboard_task(void)
matrix_change = matrix_row ^ matrix_prev[r];
if (matrix_change) {
#ifdef MATRIX_HAS_GHOST
- if (has_ghost_in_row(r)) {
+ if (has_ghost_in_row(r, matrix_row)) {
/* Keep track of whether ghosted status has changed for
* debugging. But don't update matrix_prev until un-ghosted, or
* the last key would be lost.
*/
- if (debug_matrix && matrix_ghost[r] != matrix_row) {
- matrix_print();
- }
- matrix_ghost[r] = matrix_row;
+ //if (debug_matrix && matrix_ghost[r] != matrix_row) {
+ // matrix_print();
+ //}
+ //matrix_ghost[r] = matrix_row;
continue;
}
- matrix_ghost[r] = matrix_row;
+ //matrix_ghost[r] = matrix_row;
#endif
if (debug_matrix) matrix_print();
for (uint8_t c = 0; c < MATRIX_COLS; c++) {
diff --git a/tmk_core/common/keyboard.h b/tmk_core/common/keyboard.h
index 7738251b6..f17003c2f 100644
--- a/tmk_core/common/keyboard.h
+++ b/tmk_core/common/keyboard.h
@@ -57,7 +57,6 @@ static inline bool IS_RELEASED(keyevent_t event) { return (!IS_NOEVENT(event) &&
.time = (timer_read() | 1) \
}
-
/* it runs once at early stage of startup before keyboard_init. */
void keyboard_setup(void);
/* it runs once after initializing host side protocol, debug and MCU peripherals. */
diff --git a/tmk_core/common/mousekey.h b/tmk_core/common/mousekey.h
index 6eede06b4..9338d0af7 100644
--- a/tmk_core/common/mousekey.h
+++ b/tmk_core/common/mousekey.h
@@ -23,8 +23,17 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
/* max value on report descriptor */
-#define MOUSEKEY_MOVE_MAX 127
-#define MOUSEKEY_WHEEL_MAX 127
+#ifndef MOUSEKEY_MOVE_MAX
+ #define MOUSEKEY_MOVE_MAX 127
+#elif MOUSEKEY_MOVE_MAX > 127
+ #error MOUSEKEY_MOVE_MAX needs to be smaller than 127
+#endif
+
+#ifndef MOUSEKEY_WHEEL_MAX
+ #define MOUSEKEY_WHEEL_MAX 127
+#elif MOUSEKEY_WHEEL_MAX > 127
+ #error MOUSEKEY_WHEEL_MAX needs to be smaller than 127
+#endif
#ifndef MOUSEKEY_MOVE_DELTA
#define MOUSEKEY_MOVE_DELTA 5
diff --git a/tmk_core/protocol/lufa/adafruit_ble.cpp b/tmk_core/protocol/lufa/adafruit_ble.cpp
index fd6edd42c..bee6bb2c1 100644
--- a/tmk_core/protocol/lufa/adafruit_ble.cpp
+++ b/tmk_core/protocol/lufa/adafruit_ble.cpp
@@ -87,6 +87,7 @@ struct queue_item {
uint16_t consumer;
struct __attribute__((packed)) {
int8_t x, y, scroll, pan;
+ uint8_t buttons;
} mousemove;
};
};
@@ -699,6 +700,22 @@ static bool process_queue_item(struct queue_item *item, uint16_t timeout) {
strcpy_P(fmtbuf, PSTR("AT+BLEHIDMOUSEMOVE=%d,%d,%d,%d"));
snprintf(cmdbuf, sizeof(cmdbuf), fmtbuf, item->mousemove.x,
item->mousemove.y, item->mousemove.scroll, item->mousemove.pan);
+ if (!at_command(cmdbuf, NULL, 0, true, timeout)) {
+ return false;
+ }
+ strcpy_P(cmdbuf, PSTR("AT+BLEHIDMOUSEBUTTON="));
+ if (item->mousemove.buttons & MOUSE_BTN1) {
+ strcat(cmdbuf, "L");
+ }
+ if (item->mousemove.buttons & MOUSE_BTN2) {
+ strcat(cmdbuf, "R");
+ }
+ if (item->mousemove.buttons & MOUSE_BTN3) {
+ strcat(cmdbuf, "M");
+ }
+ if (item->mousemove.buttons == 0) {
+ strcat(cmdbuf, "0");
+ }
return at_command(cmdbuf, NULL, 0, true, timeout);
#endif
default:
@@ -757,7 +774,7 @@ bool adafruit_ble_send_consumer_key(uint16_t keycode, int hold_duration) {
#ifdef MOUSE_ENABLE
bool adafruit_ble_send_mouse_move(int8_t x, int8_t y, int8_t scroll,
- int8_t pan) {
+ int8_t pan, uint8_t buttons) {
struct queue_item item;
item.queue_type = QTMouseMove;
@@ -765,6 +782,7 @@ bool adafruit_ble_send_mouse_move(int8_t x, int8_t y, int8_t scroll,
item.mousemove.y = y;
item.mousemove.scroll = scroll;
item.mousemove.pan = pan;
+ item.mousemove.buttons = buttons;
while (!send_buf.enqueue(item)) {
send_buf_send_one();
diff --git a/tmk_core/protocol/lufa/adafruit_ble.h b/tmk_core/protocol/lufa/adafruit_ble.h
index b3bab3ca0..036b7d14e 100644
--- a/tmk_core/protocol/lufa/adafruit_ble.h
+++ b/tmk_core/protocol/lufa/adafruit_ble.h
@@ -43,7 +43,7 @@ extern bool adafruit_ble_send_consumer_key(uint16_t keycode, int hold_duration);
* The parameters are signed and indicate positive of negative direction
* change. */
extern bool adafruit_ble_send_mouse_move(int8_t x, int8_t y, int8_t scroll,
- int8_t pan);
+ int8_t pan, uint8_t buttons);
#endif
/* Compute battery voltage by reading an analog pin.
diff --git a/tmk_core/protocol/lufa/lufa.c b/tmk_core/protocol/lufa/lufa.c
index ae6129d1a..e3f8724e8 100644
--- a/tmk_core/protocol/lufa/lufa.c
+++ b/tmk_core/protocol/lufa/lufa.c
@@ -669,7 +669,7 @@ static void send_mouse(report_mouse_t *report)
if (where == OUTPUT_BLUETOOTH || where == OUTPUT_USB_AND_BT) {
#ifdef MODULE_ADAFRUIT_BLE
// FIXME: mouse buttons
- adafruit_ble_send_mouse_move(report->x, report->y, report->v, report->h);
+ adafruit_ble_send_mouse_move(report->x, report->y, report->v, report->h, report->buttons);
#else
bluefruit_serial_send(0xFD);
bluefruit_serial_send(0x00);
@@ -1180,7 +1180,7 @@ int main(void)
print("Keyboard start.\n");
while (1) {
- #if !defined(BLUETOOTH_ENABLE)
+ #if !defined(NO_USB_STARTUP_CHECK)
while (USB_DeviceState == DEVICE_STATE_Suspended) {
print("[s]");
suspend_power_down();
diff --git a/tmk_core/protocol/ps2_mouse.c b/tmk_core/protocol/ps2_mouse.c
index d9ccbecb4..4ed3cae1f 100644
--- a/tmk_core/protocol/ps2_mouse.c
+++ b/tmk_core/protocol/ps2_mouse.c
@@ -72,12 +72,13 @@ void ps2_mouse_init_user(void) {
void ps2_mouse_task(void) {
static uint8_t buttons_prev = 0;
+ extern int tp_buttons;
/* receives packet from mouse */
uint8_t rcv;
rcv = ps2_host_send(PS2_MOUSE_READ_DATA);
if (rcv == PS2_ACK) {
- mouse_report.buttons = ps2_host_recv_response();
+ mouse_report.buttons = ps2_host_recv_response() | tp_buttons;
mouse_report.x = ps2_host_recv_response() * PS2_MOUSE_X_MULTIPLIER;
mouse_report.y = ps2_host_recv_response() * PS2_MOUSE_Y_MULTIPLIER;
#ifdef PS2_MOUSE_ENABLE_SCROLLING
@@ -106,34 +107,34 @@ void ps2_mouse_task(void) {
#endif
host_mouse_send(&mouse_report);
}
-
+
ps2_mouse_clear_report(&mouse_report);
}
void ps2_mouse_disable_data_reporting(void) {
- PS2_MOUSE_SEND(PS2_MOUSE_DISABLE_DATA_REPORTING, "ps2 mouse disable data reporting");
+ PS2_MOUSE_SEND(PS2_MOUSE_DISABLE_DATA_REPORTING, "ps2 mouse disable data reporting");
}
void ps2_mouse_enable_data_reporting(void) {
PS2_MOUSE_SEND(PS2_MOUSE_ENABLE_DATA_REPORTING, "ps2 mouse enable data reporting");
}
-void ps2_mouse_set_remote_mode(void) {
- PS2_MOUSE_SEND_SAFE(PS2_MOUSE_SET_REMOTE_MODE, "ps2 mouse set remote mode");
+void ps2_mouse_set_remote_mode(void) {
+ PS2_MOUSE_SEND_SAFE(PS2_MOUSE_SET_REMOTE_MODE, "ps2 mouse set remote mode");
ps2_mouse_mode = PS2_MOUSE_REMOTE_MODE;
}
-void ps2_mouse_set_stream_mode(void) {
- PS2_MOUSE_SEND_SAFE(PS2_MOUSE_SET_STREAM_MODE, "ps2 mouse set stream mode");
+void ps2_mouse_set_stream_mode(void) {
+ PS2_MOUSE_SEND_SAFE(PS2_MOUSE_SET_STREAM_MODE, "ps2 mouse set stream mode");
ps2_mouse_mode = PS2_MOUSE_STREAM_MODE;
}
void ps2_mouse_set_scaling_2_1(void) {
- PS2_MOUSE_SEND_SAFE(PS2_MOUSE_SET_SCALING_2_1, "ps2 mouse set scaling 2:1");
+ PS2_MOUSE_SEND_SAFE(PS2_MOUSE_SET_SCALING_2_1, "ps2 mouse set scaling 2:1");
}
void ps2_mouse_set_scaling_1_1(void) {
- PS2_MOUSE_SEND_SAFE(PS2_MOUSE_SET_SCALING_1_1, "ps2 mouse set scaling 1:1");
+ PS2_MOUSE_SEND_SAFE(PS2_MOUSE_SET_SCALING_1_1, "ps2 mouse set scaling 1:1");
}
void ps2_mouse_set_resolution(ps2_mouse_resolution_t resolution) {
@@ -204,9 +205,9 @@ static inline void ps2_mouse_enable_scrolling(void) {
#define PRESS_SCROLL_BUTTONS mouse_report->buttons |= (PS2_MOUSE_SCROLL_BTN_MASK)
#define RELEASE_SCROLL_BUTTONS mouse_report->buttons &= ~(PS2_MOUSE_SCROLL_BTN_MASK)
static inline void ps2_mouse_scroll_button_task(report_mouse_t *mouse_report) {
- static enum {
- SCROLL_NONE,
- SCROLL_BTN,
+ static enum {
+ SCROLL_NONE,
+ SCROLL_BTN,
SCROLL_SENT,
} scroll_state = SCROLL_NONE;
static uint16_t scroll_button_time = 0;
@@ -228,10 +229,10 @@ static inline void ps2_mouse_scroll_button_task(report_mouse_t *mouse_report) {
mouse_report->y = 0;
}
} else if (0 == (PS2_MOUSE_SCROLL_BTN_MASK & mouse_report->buttons)) {
- // None of the scroll buttons are pressed
+ // None of the scroll buttons are pressed
#if PS2_MOUSE_SCROLL_BTN_SEND
- if (scroll_state == SCROLL_BTN
+ if (scroll_state == SCROLL_BTN
&& timer_elapsed(scroll_button_time) < PS2_MOUSE_SCROLL_BTN_SEND) {
PRESS_SCROLL_BUTTONS;
host_mouse_send(mouse_report);
diff --git a/tmk_core/rules.mk b/tmk_core/rules.mk
index e4c8aecb2..b7cb0a559 100644
--- a/tmk_core/rules.mk
+++ b/tmk_core/rules.mk
@@ -92,6 +92,9 @@ endif
endif
CFLAGS += -Wall
CFLAGS += -Wstrict-prototypes
+ifneq ($(strip $(ALLOW_WARNINGS)), yes)
+ CFLAGS += -Werror
+endif
#CFLAGS += -mshort-calls
#CFLAGS += -fno-unit-at-a-time
#CFLAGS += -Wundef
@@ -115,6 +118,9 @@ CPPFLAGS += -O$(OPT)
CPPFLAGS += -w
CPPFLAGS += -Wall
CPPFLAGS += -Wundef
+ifneq ($(strip $(ALLOW_WARNINGS)), yes)
+ CPPFLAGS += -Werror
+endif
#CPPFLAGS += -mshort-calls
#CPPFLAGS += -fno-unit-at-a-time
#CPPFLAGS += -Wstrict-prototypes