1
0
Fork 0
forked from forks/qmk_firmware
qmk_firmware/keyboards/crkbd/keymaps/gotham
Jeff Epler 9632360caa
Use a macro to compute the size of arrays at compile time (#18044)
* Add ARRAY_SIZE and CEILING utility macros

* Apply a coccinelle patch to use ARRAY_SIZE

* fix up some straggling items

* Fix 'make test:secure'

* Enhance ARRAY_SIZE macro to reject acting on pointers

The previous definition would not produce a diagnostic for
```
int *p;
size_t num_elem = ARRAY_SIZE(p)
```
but the new one will.

* explicitly get definition of ARRAY_SIZE

* Convert to ARRAY_SIZE when const is involved

The following spatch finds additional instances where the array is
const and the division is by the size of the type, not the size of
the first element:
```
@ rule5a using "empty.iso" @
type T;
const T[] E;
@@

- (sizeof(E)/sizeof(T))
+ ARRAY_SIZE(E)

@ rule6a using "empty.iso" @
type T;
const T[] E;
@@

- sizeof(E)/sizeof(T)
+ ARRAY_SIZE(E)
```

* New instances of ARRAY_SIZE added since initial spatch run

* Use `ARRAY_SIZE` in docs (found by grep)

* Manually use ARRAY_SIZE

hs_set is expected to be the same size as uint16_t, though it's made
of two 8-bit integers

* Just like char, sizeof(uint8_t) is guaranteed to be 1

This is at least true on any plausible system where qmk is actually used.

Per my understanding it's universally true, assuming that uint8_t exists:
https://stackoverflow.com/questions/48655310/can-i-assume-that-sizeofuint8-t-1

* Run qmk-format on core C files touched in this branch

Co-authored-by: Stefan Kerkmann <karlk90@pm.me>
2022-08-30 10:20:04 +02:00
..
config.h Migrate crkbd keymaps to oled driver (#17863) 2022-07-31 12:36:30 -07:00
glcdfont.c [Keymap] Add custom corne keymap (#9283) 2020-06-13 01:18:33 -07:00
keycodes.h [Keymap] Add custom corne keymap (#9283) 2020-06-13 01:18:33 -07:00
keymap.c RESET -> QK_BOOT user keymaps (#17940) 2022-08-21 23:55:30 +01:00
oled.c Use a macro to compute the size of arrays at compile time (#18044) 2022-08-30 10:20:04 +02:00
README.md [Keymap] fixed oled turn-off issue for crkbd:gotham (#16748) 2022-04-13 00:03:01 -07:00
rgb.c [Keymap] Add custom corne keymap (#9283) 2020-06-13 01:18:33 -07:00
rules.mk [Core] Refactor OLED to allow easy addition of other types (#13454) 2021-08-24 16:28:26 +10:00

Gotham's custom CRKBD Layout

My take on the 40% layout with programming in mind. Do read about the layers, it helps with forming a mental model to remember the keymap better than just memorization.

Layers

  • QWERTY: Base layer. The idea is to reduce thumb movement by placing commonly used keys and layers on resting thumb positions (center thumb keys). You might need to play around with TAPPING_TERM to find your perfect setting. Also, both Lower and Raise buttons appear on both halves for easy access (think of it as: middle thumb key is Lower, outer thumb key is Raise).
  • LOWER: Numbers, common symbols and navigation. Easiest layer to reach (middle thumb button on both halves). The nav is shaped as a T instead of an inverted T for a few reasons. First, Left and Right needed to be on the home row (since I use them a lot to navigate through code). But the Up key can't be on the top row because numbers occupy that space. So I moved the Up and Down keys one key down. It takes some getting used to, but I find this a great balance without separating the nav and number rows. The nav cluster also contains Home and End keys below Left and Right, making it a breeze to navigate through code.
  • RAISE: All symbols are here, arranged in a way that can be (kind of) deduced more by logic and less by memory. On the left hand, the first 2 cols contain the symbols for shifted numbers 1-6, with ! and @ in the home row instead of the top row. Think of the 3 rows as symbols for 3 and 4, 1 and 2, 5 and 6). The next 2 cols contain common brackets. On the right hand is everything else. Note that -, _ and = are close to the home row because of how common they are in code. Operators (&, | and !) are on the top row for convinience. Just try and remember where +, *, < and > located. Admitedlly, the locations for these symbols could use improvement.
  • ADJUST: Contains settings and Function keys. This is placed on the bottom-right corner (triggerred by the pinky), since the thumb keys already have multiple uses.

Custom OLED

This keymap includes custom OLED font and code. The font contains some logos and status indidcators for some of the features I use (RGB and Audio). Enable OLED in rukes.mk to check it out. Feel free to reuse the font or parts of it.

Flashing

Flash using make crkbd:gotham:avrdude for Pro Micro and make crkbd:gotham:dfu for Elite-C.