Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

restructure converters #1825

Merged
merged 6 commits into from
Nov 8, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 18 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -316,21 +316,21 @@ define PARSE_SUBPROJECT
ifneq ($$(CURRENT_SP),allsp)
# get a list of all keymaps
KEYMAPS := $$(notdir $$(patsubst %/.,%,$$(wildcard $(ROOT_DIR)/keyboards/$$(CURRENT_KB)/keymaps/*/.)))
LAYOUTS :=
$$(eval -include $(ROOT_DIR)/keyboards/$$(CURRENT_KB)/rules.mk)
KEYBOARD_LAYOUTS := $$(LAYOUTS)
ifneq ($$(CURRENT_SP),)
# if the subproject is defined, then also look for keymaps inside the subproject folder
SP_KEYMAPS := $$(notdir $$(patsubst %/.,%,$$(wildcard $(ROOT_DIR)/keyboards/$$(CURRENT_KB)/$$(CURRENT_SP)/keymaps/*/.)))
KEYMAPS := $$(sort $$(KEYMAPS) $$(SP_KEYMAPS))
# $$(eval -include $(ROOT_DIR)/keyboards/$$(CURRENT_KB)/$$(CURRENT_SP)/rules.mk)
# KEYBOARD_LAYOUTS := $$(sort $$(KEYBOARD_LAYOUTS) $$(LAYOUTS))
endif

LAYOUT_KEYMAPS :=
$$(foreach LAYOUT,$$(KEYBOARD_LAYOUTS),$$(eval LAYOUT_KEYMAPS += $$(notdir $$(patsubst %/.,%,$$(wildcard $(ROOT_DIR)/layouts/*/$$(LAYOUT)/*/.)))))
# LAYOUTS :=
# $$(eval -include $(ROOT_DIR)/keyboards/$$(CURRENT_KB)/rules.mk)
# KEYBOARD_LAYOUTS := $$(LAYOUTS)
# ifneq ($$(CURRENT_SP),)
# # if the subproject is defined, then also look for keymaps inside the subproject folder
# SP_KEYMAPS := $$(notdir $$(patsubst %/.,%,$$(wildcard $(ROOT_DIR)/keyboards/$$(CURRENT_KB)/$$(CURRENT_SP)/keymaps/*/.)))
# KEYMAPS := $$(sort $$(KEYMAPS) $$(SP_KEYMAPS))
# # $$(eval -include $(ROOT_DIR)/keyboards/$$(CURRENT_KB)/$$(CURRENT_SP)/rules.mk)
# # KEYBOARD_LAYOUTS := $$(sort $$(KEYBOARD_LAYOUTS) $$(LAYOUTS))
# endif

# LAYOUT_KEYMAPS :=
# $$(foreach LAYOUT,$$(KEYBOARD_LAYOUTS),$$(eval LAYOUT_KEYMAPS += $$(notdir $$(patsubst %/.,%,$$(wildcard $(ROOT_DIR)/layouts/*/$$(LAYOUT)/*/.)))))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't seen, known or used this method of loading layouts. I compiled all the keyboards with this commented out and got no errors, so I assume this is old and unused.

The reason why I removed it is because for my USB-USB converter, I need to include a makefile from the keyboard-rules.mk. The path of this makefile uses $(TMK_DIR), which is apparently not defined when the keyboard-rules.mk is first read in the above code segment. The next time that file is read, $(TMK_DIR) has been defined by common.mk and the build runs through fine.

If the removal of this segment is a problem, let me know and we can try to find another solution.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is new and being used - no errors were generated because commenting it out just ignore layouts/, effectively removing the feature ;)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have worked up a project for the KC60 SE. I think is made by the same company as KC60, NPKC. Do you have a good example of the new structure that you are implementing? My KC60SE project is at 'https://github.com/BlakeCLewis/kc60se'. I think that GH60, KC60, XD60 could all be subprojects. Though It loks like many of these keyboards have legacy code that do not use QMK features.
I had a much easier time getting QMK project to work on the keyboard than the web stuff pointed to by the seller. 

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm still working on the documentation, but generally we've been trying to keep boards that have different manufacturers separate (see the recent ergodox split), even if they have the same pinout and everything. The layout stuff helps to let these keyboards still use the same keymaps though ;)


KEYMAPS := $$(sort $$(KEYMAPS) $$(LAYOUT_KEYMAPS))
KEYMAPS := $$(sort $$(KEYMAPS))
# if the rule after removing the start of it is empty (we haven't specified a kemap or target)
# compile all the keymaps
ifeq ($$(RULE),)
Expand Down Expand Up @@ -556,6 +556,10 @@ test: test-all
.PHONY: test-clean
test-clean: test-all-clean

.PHONY: clean
clean:
rm -r .build

lib/%:
git submodule sync $?
git submodule update --init $?
Expand Down
1 change: 0 additions & 1 deletion keyboards/converter/converter.c

This file was deleted.

1 change: 0 additions & 1 deletion keyboards/converter/converter.h

This file was deleted.

6 changes: 0 additions & 6 deletions keyboards/converter/ibm_terminal/ibm_terminal.c

This file was deleted.

Empty file removed keyboards/converter/rules.mk
Empty file.
1 change: 0 additions & 1 deletion keyboards/converter/usb_usb/usb_usb.c

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ This is a port of TMK's converter/terminal_usb to QMK.
It supports PS/2 Scan Code Set 3 and runs on USB AVR chips such like PJRC Teensy.
I tested the converter on ATMega32U4 with 1392595(102keys) and 6110345(122keys).

Source code: https://github.com/tmk/tmk_keyboard
Source code: https://github.com/qmk/qmk_firmware.git
Article: http://geekhack.org/index.php?topic=27272.0


Expand All @@ -22,9 +22,9 @@ And VCC and GND, of course. See RESOURCE for keyboard connector pin assign.

BUILD
-----
$ git clone https://github.com/tmk/tmk_keyboard.git
$ cd converter/terminal_usb
$ make
$ git clone https://github.com/qmk/qmk_firmware.git
$ cd qmk_firmware
$ make ibm_terminal_converter


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

#include "quantum.h"

Expand Down
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.h"
#include "ibm_terminal_converter.h"

const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
// Layer 0
Expand Down
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.h"
#include "ibm_terminal_converter.h"
#include "action_layer.h"

// Fillers to make layering clearer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,22 @@ Hardware Availability: [GH thread](https://geekhack.org/index.php?topic=72052.0)

Make example for this keyboard (after setting up your build environment):

make converter-usb_usb-default
make usb_usb-pro_micro-default

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.

Note that you have to choose the right hardware variant as your subproject, otherwise you will probably have issues.

Troubleshooting & Known Issues
------------------------------
The Pro Micro variant runs at 8MHz, hence the following line in `usb_usb/rules.mk`:
`F_CPU ?= 8000000`
If the firmware doesn't work, try changing that line to
`F_CPU ?= 16000000`
or override the `F_CPU` variable in the `rules.mk` of your keymap.
If something doesn't work, it's probably because of the CPU clock.
Be sure to select the correct subproject (the middle part of the `make` argument) according to your hardware.
If you are sure you have this correct, try changeing the default in `usb_usb/rules.mk` or overriding the value in the `rules.mk` of your keymap.

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:
`F_CPU = 16000000`

Getting the Hardware
--------------------
Expand Down
1 change: 1 addition & 0 deletions keyboards/usb_usb_converter/hasu/hasu.c
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#include "hasu.h"
6 changes: 6 additions & 0 deletions keyboards/usb_usb_converter/hasu/hasu.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#ifndef HASU_H
#define HASU_H

#include QMK_KEYBOARD_H

#endif
1 change: 1 addition & 0 deletions keyboards/usb_usb_converter/hasu/rules.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
F_CPU = 16000000
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.h"
#include "usb_usb_converter.h"

const uint16_t keymaps[][MATRIX_ROWS][MATRIX_COLS] PROGMEM = {
/* 0: plain Qwerty without layer switching
Expand Down
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.h"
#include "usb_usb_converter.h"

const uint16_t keymaps[][MATRIX_ROWS][MATRIX_COLS] PROGMEM = {
/* 0: plain Qwerty without layer switching
Expand Down
File renamed without changes.
1 change: 1 addition & 0 deletions keyboards/usb_usb_converter/pro_micro/pro_micro.c
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#include "pro_micro.h"
6 changes: 6 additions & 0 deletions keyboards/usb_usb_converter/pro_micro/pro_micro.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#ifndef PRO_MICRO_H
#define PRO_MICRO_H

#include QMK_KEYBOARD_H

#endif
1 change: 1 addition & 0 deletions keyboards/usb_usb_converter/pro_micro/rules.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
F_CPU = 8000000
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,13 @@ MCU ?= atmega32u4
# does not *change* the processor frequency - it should merely be updated to
# reflect the processor speed set externally so that the code can use accurate
# software delays.
F_CPU ?= 8000000

# Since there are different hardware variations of these adapters and since these
# have different CPU clocks, the clock speed should be set in the rules.mk file of the
# 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


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

#include "quantum.h"

Expand Down