keychron_qmk_firmware/keyboards/gboards
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
..
butterstick Use a macro to compute the size of arrays at compile time (#18044) 2022-08-30 10:20:04 +02:00
combos
dicts/aset
engine Use a macro to compute the size of arrays at compile time (#18044) 2022-08-30 10:20:04 +02:00
ergotaco
g Use a macro to compute the size of arrays at compile time (#18044) 2022-08-30 10:20:04 +02:00
georgi Use a macro to compute the size of arrays at compile time (#18044) 2022-08-30 10:20:04 +02:00
gergo
gergoplex
readme.md

gBoards Monorepo

Ever wanted to do some crazy stuff with combos or onboard steno? Here's a big repo for you to include into your keymaps. You may need to do some configuration on your part, for the documentation hit up docs.gboards.ca

Building

You can find all of my keyboards under the k/ folder. Make with

make gboards/k/gergoplex:default:flash or similar

Configuration

Dictionaries are layered ontop of each other at compile time, you specify these in dicts.def and combos.def respectively. This system allows the easy integration of other users combos and a simple way to break out combos by functionality.

If you have a cool dictionary, please submit a PR against the respective directory!

Combos

This is a set of dicts that templates macros ontop of QMK. Use this for augmenting your current setup with multi-chords! You can browse the available combo lists in combos/

Engine

This is the onboard chording engine for all sorts of fun shenanigans. Be aware that this currently is a bit of a QMK replacement focused on pure chording. Take a look at the configuration in keyboards/gboards/ginny for ideas, all these dicts are stored over in dicts/

Installation

You will need to add the following bits to your rules.mk, refer to keyboards/gboards/ginny for a working example VPATH += keyboards/gboards/

And if you're using the chording engine, this as well. SRC += g/engine.c

For combos, add #include "g/keymap_combos.h" to keymap.c to compile your combos.def into your keymap

For the chording engine, add #include "g/keymap_engine.h" to keymap.c compile your dicts.def into your keymap. If you don't have a config_engine.h file for your keyboard, you will need to create it. (Once again, look at keyboards/gboards/ginny/ for a example of how to do this.