summaryrefslogtreecommitdiff
path: root/quantum/dip_switch.c
AgeCommit message (Collapse)Author
2022-08-30Use a macro to compute the size of arrays at compile time (#18044)Jeff Epler
* 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-02-12Format code according to conventions (#16322)QMK Bot
2021-08-20Align DIP_SWITCH_PINS_RIGHT implementation with encoders (#14079)Joel Challis
2021-08-19Added right vs left specific pin assignments for dip switch (#13074)XScorpion2
* Added right vs left specific pin assignments for dip switch * Update feature_dip_switch.md * Ran formatting tools
2021-07-01Convert Dip Switch callbacks to boolean functions (#13399)Drashna Jaelre
2020-07-04format code according to conventions [skip ci]QMK Bot
2020-07-04add DIP_SWITCH_MATRIX_GRID support (#8772)Takeshi ISHII
* 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.
2020-04-12Bugfix for quantum/dip_switch.c (#8731)Takeshi ISHII
* 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.
2019-11-17Run clang-format manually to fix recently changed fileszvecr
2019-09-03Add Dip Switch as a core feature (#6140)Drashna Jaelre
* 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