* 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>
* dipsw test on helix/rev2/sc/back:five_rows
* add peek_matrix() to matrix_common.c
* add DIP_SWITCH_MATRIX_GRID support to quantum/dip_switch.c
* update docs/feature_dip_switch.md about DIP_SWITCH_MATRIX_GRID
* Test end. remove test code. Revert "dipsw test on helix/rev2/sc/back:five_rows"
This reverts commit 6d4304c74557597c9fb4d324f79c3ae4793ae874.
* dipsw test on helix/rev2/sc/back:five_rows
* bug fix quantum/dip_switch.c
* test end. remove test code. Revert "dipsw test on helix/rev2/sc/back:five_rows"
This reverts commit 4b13ebb996e1c4997e6deb1fa3b3227db5fa9661.
* dipsw test on helix/rev2/sc/back:five_rows
* update quantum/dip_switch.c
* test end. remove test code. Revert "dipsw test on helix/rev2/sc/back:five_rows"
This reverts commit bf99ace095528ad65c531229bcf5ece037dda595.
* Add Dip Switches as a core feature
* Add documentation for Dip Switch feature
* Update Preonic Rev3 to use new feature and remove custom matrix
* Apply suggestions from code review
Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com>
* Remove custom matrix line completely
Rather than just disabling it
Co-Authored-By: fauxpark <fauxpark@gmail.com>
* DIP changes
Co-Authored-By: fauxpark <fauxpark@gmail.com>
* Use better check for DIP Switch configuration
* Add to show features
* Add bitmask callback for dip switch
* Fix OLKB Boards dip switch config
* Update docs to include bitmask example
* Fix comments/documentation
Co-Authored-By: fauxpark <fauxpark@gmail.com>
* Fix issues with docs and use example from @tuzonghua
* Fix wording
Co-Authored-By: fauxpark <fauxpark@gmail.com>
* Fix example to use proper formatting
Bad, BAAAAAAD drashna!!!
* Handle dip switch initialization better