Skip to content

Commit

Permalink
revert some structure changes to bring in line with qmk#1784.
Browse files Browse the repository at this point in the history
Also attempt to get the BLE thing more properly integrated.
Also also fix led_set() to call led_set_kb().
  • Loading branch information
BalzGuenat committed Nov 8, 2017
1 parent 3630118 commit 1856b23
Show file tree
Hide file tree
Showing 22 changed files with 58 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ BUILD
-----
$ git clone https://github.com/qmk/qmk_firmware.git
$ cd qmk_firmware
$ make ibm_terminal_converter
$ make converter/ibm_terminal:default


RESOURCE
Expand Down
1 change: 1 addition & 0 deletions keyboards/converter/ibm_terminal/ibm_terminal.c
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#include "ibm_terminal.h"
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef IBM_TERMINAL_CONVERTER_H
#define IBM_TERMINAL_CONVERTER_H
#ifndef IBM_TERMINAL_H
#define IBM_TERMINAL_H

#include "quantum.h"

Expand Down
1 change: 0 additions & 1 deletion keyboards/converter/ibm_terminal/ibm_terminal_converter.c

This file was deleted.

2 changes: 1 addition & 1 deletion keyboards/converter/ibm_terminal/keymaps/default/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "print.h"
#include "debug.h"
#include "util.h"
#include "ibm_terminal_converter.h"
#include "ibm_terminal.h"

const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
// Layer 0
Expand Down
2 changes: 1 addition & 1 deletion keyboards/converter/ibm_terminal/keymaps/priyadi/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "print.h"
#include "debug.h"
#include "util.h"
#include "ibm_terminal_converter.h"
#include "ibm_terminal.h"
#include "action_layer.h"

// Fillers to make layering clearer
Expand Down
2 changes: 1 addition & 1 deletion keyboards/converter/usb_usb/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ If you are sure you have this correct, try changeing the default in `usb_usb/rul

The Pro Micro variant uses a 3.3V Pro Micro and thus runs at 8MHz, hence the following line in `usb_usb/pro_micro/rules.mk`:
`F_CPU = 8000000`
The converter sold by Hasu runs at 16MHz and so the corresponding line in `usb_usb/hasurules.mk` is:
The converter sold by Hasu runs at 16MHz and so the corresponding line in `usb_usb/hasu/rules.mk` is:
`F_CPU = 16000000`

Getting the Hardware
Expand Down
File renamed without changes.
1 change: 1 addition & 0 deletions keyboards/converter/usb_usb/ble/ble.c
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#include "ble.h"
6 changes: 6 additions & 0 deletions keyboards/converter/usb_usb/ble/ble.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#ifndef BLE_H
#define BLE_H

#include QMK_KEYBOARD_H

#endif
13 changes: 13 additions & 0 deletions keyboards/converter/usb_usb/ble/config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#ifndef CONFIG_BLE_H
#define CONFIG_BLE_H

#undef PRODUCT
#define PRODUCT QMK BLE Adapter
#undef DESCRIPTION
#define DESCRIPTION

// Turn off the mode leds on the BLE module
#define ADAFRUIT_BLE_ENABLE_MODE_LEDS 0
#define ADAFRUIT_BLE_ENABLE_POWER_LED 0

#endif
4 changes: 4 additions & 0 deletions keyboards/converter/usb_usb/ble/rules.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
BLUETOOTH = AdafruitBLE
ADAFRUIT_BLE_ENABLE = yes
OPT_DEFS += -DCATERINA_BOOTLOADER
F_CPU = 8000000
1 change: 1 addition & 0 deletions keyboards/converter/usb_usb/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// do not #include "config_common.h" because the pin names conflict with the USB HID code.
// CUSTOM_MATRIX is defined it that file, though, and we need it, so we define it ourselves.
// It's a hack, yeah...

#define CUSTOM_MATRIX 2

/* USB Device descriptor parameter */
Expand Down
37 changes: 20 additions & 17 deletions keyboards/converter/usb_usb/custom_matrix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "host.h"
#include "keyboard.h"

extern "C" {
#include "quantum.h"
}

/* KEY CODE to Matrix
*
Expand Down Expand Up @@ -62,7 +65,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.


// Integrated key state of all keyboards
static report_keyboard_t keyboard_report;
static report_keyboard_t local_keyboard_report;

static bool matrix_is_mod = false;

Expand Down Expand Up @@ -98,13 +101,13 @@ extern "C"
}

static void or_report(report_keyboard_t report) {
// integrate reports into keyboard_report
keyboard_report.mods |= report.mods;
// integrate reports into local_keyboard_report
local_keyboard_report.mods |= report.mods;
for (uint8_t i = 0; i < KEYBOARD_REPORT_KEYS; i++) {
if (IS_ANY(report.keys[i])) {
for (uint8_t j = 0; j < KEYBOARD_REPORT_KEYS; j++) {
if (! keyboard_report.keys[j]) {
keyboard_report.keys[j] = report.keys[i];
if (! local_keyboard_report.keys[j]) {
local_keyboard_report.keys[j] = report.keys[i];
break;
}
}
Expand All @@ -130,17 +133,17 @@ extern "C"
last_time_stamp4 = kbd_parser4.time_stamp;

// clear and integrate all reports
keyboard_report = {};
local_keyboard_report = {};
or_report(kbd_parser1.report);
or_report(kbd_parser2.report);
or_report(kbd_parser3.report);
or_report(kbd_parser4.report);

matrix_is_mod = true;

dprintf("state: %02X %02X", keyboard_report.mods, keyboard_report.reserved);
dprintf("state: %02X %02X", local_keyboard_report.mods, local_keyboard_report.reserved);
for (uint8_t i = 0; i < KEYBOARD_REPORT_KEYS; i++) {
dprintf(" %02X", keyboard_report.keys[i]);
dprintf(" %02X", local_keyboard_report.keys[i]);
}
dprint("\r\n");
} else {
Expand Down Expand Up @@ -177,12 +180,12 @@ extern "C"
uint8_t code = CODE(row, col);

if (IS_MOD(code)) {
if (keyboard_report.mods & ROW_BITS(code)) {
if (local_keyboard_report.mods & ROW_BITS(code)) {
return true;
}
}
for (uint8_t i = 0; i < KEYBOARD_REPORT_KEYS; i++) {
if (keyboard_report.keys[i] == code) {
if (local_keyboard_report.keys[i] == code) {
return true;
}
}
Expand All @@ -192,14 +195,14 @@ extern "C"
matrix_row_t matrix_get_row(uint8_t row) {
uint16_t row_bits = 0;

if (IS_MOD(CODE(row, 0)) && keyboard_report.mods) {
row_bits |= keyboard_report.mods;
if (IS_MOD(CODE(row, 0)) && local_keyboard_report.mods) {
row_bits |= local_keyboard_report.mods;
}

for (uint8_t i = 0; i < KEYBOARD_REPORT_KEYS; i++) {
if (IS_ANY(keyboard_report.keys[i])) {
if (row == ROW(keyboard_report.keys[i])) {
row_bits |= ROW_BITS(keyboard_report.keys[i]);
if (IS_ANY(local_keyboard_report.keys[i])) {
if (row == ROW(local_keyboard_report.keys[i])) {
row_bits |= ROW_BITS(local_keyboard_report.keys[i]);
}
}
}
Expand All @@ -209,9 +212,9 @@ extern "C"
uint8_t matrix_key_count(void) {
uint8_t count = 0;

count += bitpop(keyboard_report.mods);
count += bitpop(local_keyboard_report.mods);
for (uint8_t i = 0; i < KEYBOARD_REPORT_KEYS; i++) {
if (IS_ANY(keyboard_report.keys[i])) {
if (IS_ANY(local_keyboard_report.keys[i])) {
count++;
}
}
Expand Down
9 changes: 0 additions & 9 deletions keyboards/converter/usb_usb/keymaps/ble/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,4 @@

#include "../../config.h"

#undef PRODUCT
#define PRODUCT QMK BLE Adapter
#undef DESCRIPTION
#define DESCRIPTION

// Turn off the mode leds on the BLE module
#define ADAFRUIT_BLE_ENABLE_MODE_LEDS 0
#define ADAFRUIT_BLE_ENABLE_POWER_LED 0

#endif
3 changes: 0 additions & 3 deletions keyboards/converter/usb_usb/keymaps/ble/rules.mk

This file was deleted.

2 changes: 1 addition & 1 deletion keyboards/converter/usb_usb/keymaps/coloneljesus/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ 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 "usb_usb_converter.h"
#include "usb_usb.h"

const uint16_t keymaps[][MATRIX_ROWS][MATRIX_COLS] PROGMEM = {
/* 0: plain Qwerty without layer switching
Expand Down
2 changes: 1 addition & 1 deletion keyboards/converter/usb_usb/keymaps/default/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ 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 "usb_usb_converter.h"
#include "usb_usb.h"

const uint16_t keymaps[][MATRIX_ROWS][MATRIX_COLS] PROGMEM = {
/* 0: plain Qwerty without layer switching
Expand Down
2 changes: 1 addition & 1 deletion keyboards/converter/usb_usb/rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ MCU = atmega32u4
# respective hardware variantion (i.e. subproject). For example, in /pro_micro/rules.mk
# this is set to 8000000.
# The value here is only a fallback and is ignored if it is defined in the subproject.
# F_CPU ?= 16000000
F_CPU ?= 16000000

DEFAULT_FOLDER = converter/usb_usb/hasu

Expand Down
1 change: 1 addition & 0 deletions keyboards/converter/usb_usb/usb_usb.c
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#include "usb_usb.h"
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ 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 USB_USB_CONVERTER_H
#define USB_USB_CONVERTER_H
#ifndef USB_USB_H
#define USB_USB_H

#include "quantum.h"

Expand Down
1 change: 0 additions & 1 deletion keyboards/converter/usb_usb/usb_usb_converter.c

This file was deleted.

0 comments on commit 1856b23

Please sign in to comment.