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

Add docs for the LAYOUT_* macro to layouts #3772

Merged
merged 1 commit into from
Aug 29, 2018

Conversation

evantravers
Copy link
Contributor

When moving my planck layout to my let's split, I ran into this issue
because I had copied my planck layout from the default layout which just
used the {} array form for the keymap layers. I checked the docs, but
this bit wasn't clear to me. I'm sure @ishtob or @drashna helped me on
discord, but this seemed to be the logical place to add a helpful hint.

I'm not sure whether my technical lingo is correct here: Is the
LAYOUT_ortho_4x12 really a macro? Any other changes?

When moving my planck layout to my let's split, I ran into this issue
because I had copied my planck layout from the default layout which just
used the `{}` array form for the keymap layers. I checked the docs, but
this bit wasn't clear to me. I'm sure @ishtob or @drashna helped me on
discord, but this seemed to be the logical place to add a helpful hint.
@noroadsleft
Copy link
Member

LAYOUT_ortho_4x12 really is a macro, though the way it works varies by keyboard.

Most 4x12 ortho keyboards define it "directly" somewhere, like the NIU Mini:

#define LAYOUT_ortho_4x12( \
k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, \
k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, \
k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, \
k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b \
) \
{ \
{ k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b }, \
{ k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b }, \
{ k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b }, \
{ k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b } \
}

In the case of the Planck however, it currently works a bit differently.

Planck standard for a while has been to use a macro named LAYOUT_planck_grid, which is functionally identical to LAYOUT_ortho_4x12. Before that, it used the C array syntax; indeed, a lot of the Planck keymaps still do it that way. There is the possibility that the Planck macro naming scheme changes in the near future, as @jackhumbert wants a consistent standard between Planck, Preonic and the upcoming Subatomic (which will be 5x14).

The Planck currently defines LAYOUT_planck_grid on lines 20-31 of planck.h for revisions 1 through 5, and on lines 121-136 for rev6 boards. These macros are aliased as LAYOUT_ortho_4x12 on lines 48 and 139, respectively.

For the Planck, that means that a keymap can use LAYOUT_planck_grid or LAYOUT_ortho_4x12, and the end result is exactly the same.

As far as your lingo, I see no problems, though someone else may have a different preference.

I do have a review comment for you, but it's unrelated to anything you've done here; it's more of a "since you're here, could you fix this thing that was already messed up?" issue.

@noroadsleft
Copy link
Member

And subsequently, I learned you can't leave review comments about lines that haven't been edited in the PR.

Anyway, on Line 26, could you change

(`[a-z0-9_]`)

to

(`[a-z0-9_]+`)

? When I was proof-reading the document, I noticed this regex was wrong.

@drashna
Copy link
Member

drashna commented Aug 29, 2018

Thanks!

@drashna drashna merged commit 08c682c into qmk:master Aug 29, 2018
alexey-danilov pushed a commit to alexey-danilov/qmk_firmware that referenced this pull request Sep 6, 2018
When moving my planck layout to my let's split, I ran into this issue
because I had copied my planck layout from the default layout which just
used the `{}` array form for the keymap layers. I checked the docs, but
this bit wasn't clear to me. I'm sure @ishtob or @drashna helped me on
discord, but this seemed to be the logical place to add a helpful hint.
dstrelau pushed a commit to dstrelau/qmk_firmware that referenced this pull request Sep 7, 2018
* master:
  Keymap: Boy_314's Preonic and XD75 Layouts (qmk#3781)
  Docs: Add docs for the `LAYOUT_*` macro to layouts (qmk#3772)
  Keyboard: xealous (qmk#3731)
  Keyboard: Dactyl - Only initialize relevant variables (qmk#3771)
  Keymap: xtonhasvim updates (qmk#3768)
  Keymap: Adding keymap to the XD60 (qmk#3767)
  Putting my ducks in a row: Eagle/Viper V2 into Duck directory (qmk#3766)
  Putting my ducks in a row: Octagon V1/V2  (qmk#3765)
  Keymap: Bocaj - Create Userspace and Ergodox Layout (qmk#3750)
  ISSI31FL3733 driver  (qmk#3679)
  Fixes STM32F303XC timer issue for Planck Rev 6 (qmk#3777)
ChrissiQ pushed a commit to ChrissiQ/qmk_firmware that referenced this pull request Sep 25, 2018
When moving my planck layout to my let's split, I ran into this issue
because I had copied my planck layout from the default layout which just
used the `{}` array form for the keymap layers. I checked the docs, but
this bit wasn't clear to me. I'm sure @ishtob or @drashna helped me on
discord, but this seemed to be the logical place to add a helpful hint.
yamad pushed a commit to yamad/qmk_firmware that referenced this pull request Apr 10, 2019
When moving my planck layout to my let's split, I ran into this issue
because I had copied my planck layout from the default layout which just
used the `{}` array form for the keymap layers. I checked the docs, but
this bit wasn't clear to me. I'm sure @ishtob or @drashna helped me on
discord, but this seemed to be the logical place to add a helpful hint.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants