diff --git a/src/Kaleidoscope-LEDControl.h b/src/Kaleidoscope-LEDControl.h index 6a1ea252..8ae7b0db 100644 --- a/src/Kaleidoscope-LEDControl.h +++ b/src/Kaleidoscope-LEDControl.h @@ -16,7 +16,7 @@ #pragma once -#include -#include -#include -#include +#include "kaleidoscope/plugin/LEDMode.h" +#include "kaleidoscope/plugin/LEDControl.h" +#include "kaleidoscope/plugin/LEDControl/LEDUtils.h" +#include "kaleidoscope/plugin/LEDControl/LED-Off.h" diff --git a/src/Kaleidoscope.h b/src/Kaleidoscope.h index 6f18da6c..62ccee7c 100644 --- a/src/Kaleidoscope.h +++ b/src/Kaleidoscope.h @@ -86,7 +86,7 @@ void setup(); #include "kaleidoscope/layers.h" #include "kaleidoscope_internal/sketch_exploration/sketch_exploration.h" #include "kaleidoscope/macro_map.h" -#include "kaleidoscope_internal/event_dispatch.h" +#include "kaleidoscope/hooks.h" #include "kaleidoscope_internal/LEDModeManager.h" #include "kaleidoscope/macro_helpers.h" #include "kaleidoscope/plugin.h" diff --git a/src/kaleidoscope/KeyAddr.h b/src/kaleidoscope/KeyAddr.h index c27c930c..f55b7298 100644 --- a/src/kaleidoscope/KeyAddr.h +++ b/src/kaleidoscope/KeyAddr.h @@ -16,6 +16,6 @@ #pragma once -#include "kaleidoscope/device/device.h" +#include "kaleidoscope/device/device.h" // for Device typedef kaleidoscope::Device::KeyAddr KeyAddr; diff --git a/src/kaleidoscope/KeyAddrBitfield.h b/src/kaleidoscope/KeyAddrBitfield.h index ef75baa6..ef85e07c 100644 --- a/src/kaleidoscope/KeyAddrBitfield.h +++ b/src/kaleidoscope/KeyAddrBitfield.h @@ -16,10 +16,11 @@ #pragma once -#include - -#include "kaleidoscope/KeyAddr.h" +#include // for bitClear, bitRead, bitSet, bitWrite +#include // for uint8_t +#include // for memset +#include "kaleidoscope/KeyAddr.h" // for KeyAddr namespace kaleidoscope { diff --git a/src/kaleidoscope/KeyAddrEventQueue.h b/src/kaleidoscope/KeyAddrEventQueue.h index 214e535a..6a60c18a 100644 --- a/src/kaleidoscope/KeyAddrEventQueue.h +++ b/src/kaleidoscope/KeyAddrEventQueue.h @@ -17,13 +17,15 @@ #pragma once -#include +#include // for bitRead, bitWrite +#include // for uint8_t, uint16_t //#include -#include "kaleidoscope/Runtime.h" -#include "kaleidoscope/KeyEvent.h" -#include "kaleidoscope/KeyAddr.h" -#include "kaleidoscope/keyswitch_state.h" +#include "kaleidoscope/KeyAddr.h" // for KeyAddr +#include "kaleidoscope/KeyEvent.h" // for KeyEvent, KeyEventId +#include "kaleidoscope/Runtime.h" // for Runtime, Runtime_ +#include "kaleidoscope/key_defs.h" // for Key_Undefined +#include "kaleidoscope/keyswitch_state.h" // for IS_PRESSED, WAS_PRESSED namespace kaleidoscope { diff --git a/src/kaleidoscope/KeyAddrMap.h b/src/kaleidoscope/KeyAddrMap.h index 6ef7c0c3..3026de6f 100644 --- a/src/kaleidoscope/KeyAddrMap.h +++ b/src/kaleidoscope/KeyAddrMap.h @@ -16,9 +16,9 @@ #pragma once -#include "kaleidoscope_internal/device.h" -#include "kaleidoscope/KeyAddr.h" -#include "kaleidoscope/key_defs.h" +#include // for uint8_t + +#include "kaleidoscope/KeyAddr.h" // for KeyAddr namespace kaleidoscope { diff --git a/src/kaleidoscope/KeyEvent.h b/src/kaleidoscope/KeyEvent.h index 355b4739..d96dad32 100644 --- a/src/kaleidoscope/KeyEvent.h +++ b/src/kaleidoscope/KeyEvent.h @@ -18,8 +18,8 @@ #include // for uint8_t, int8_t -#include "kaleidoscope/key_defs.h" // for Key, Key_NoKey #include "kaleidoscope/KeyAddr.h" // for KeyAddr +#include "kaleidoscope/key_defs.h" // for Key_Undefined, Key namespace kaleidoscope { diff --git a/src/kaleidoscope/KeyEventTracker.h b/src/kaleidoscope/KeyEventTracker.h index ae7c1666..cd91f1ab 100644 --- a/src/kaleidoscope/KeyEventTracker.h +++ b/src/kaleidoscope/KeyEventTracker.h @@ -16,8 +16,7 @@ #pragma once -#include "kaleidoscope/event_handler_result.h" // for EventHandlerResult -#include "kaleidoscope/KeyEvent.h" // for KeyEvent, KeyEventId +#include "kaleidoscope/KeyEvent.h" // for KeyEvent, KeyEventId namespace kaleidoscope { diff --git a/src/kaleidoscope/KeyMap.h b/src/kaleidoscope/KeyMap.h index bee7696d..9d8e93e0 100644 --- a/src/kaleidoscope/KeyMap.h +++ b/src/kaleidoscope/KeyMap.h @@ -16,7 +16,9 @@ #pragma once -#include "kaleidoscope/KeyAddrMap.h" +#include "kaleidoscope/KeyAddr.h" // for KeyAddr +#include "kaleidoscope/KeyAddrMap.h" // for KeyAddrMap +#include "kaleidoscope/key_defs.h" // for Key namespace kaleidoscope { diff --git a/src/kaleidoscope/LiveKeys.h b/src/kaleidoscope/LiveKeys.h index bccc549c..53e51e66 100644 --- a/src/kaleidoscope/LiveKeys.h +++ b/src/kaleidoscope/LiveKeys.h @@ -16,9 +16,10 @@ #pragma once -#include "kaleidoscope/key_defs.h" // for Key, Key_NoKey, Key_Transparent #include "kaleidoscope/KeyAddr.h" // for KeyAddr +#include "kaleidoscope/KeyAddrMap.h" // for KeyAddrMap<>::Iterator, KeyAddrMap #include "kaleidoscope/KeyMap.h" // for KeyMap +#include "kaleidoscope/key_defs.h" // for Key, Key_Masked, Key_Inactive namespace kaleidoscope { diff --git a/src/kaleidoscope/MatrixAddr.h b/src/kaleidoscope/MatrixAddr.h index 83fe58da..40a71449 100644 --- a/src/kaleidoscope/MatrixAddr.h +++ b/src/kaleidoscope/MatrixAddr.h @@ -14,10 +14,11 @@ * this program. If not, see . */ +// IWYU pragma: private, include "kaleidoscope/KeyAddr.h" + #pragma once -#include -#include +#include // for uint8_t, int8_t namespace kaleidoscope { diff --git a/src/kaleidoscope/Runtime.cpp b/src/kaleidoscope/Runtime.cpp index d96fc82c..eb22393e 100644 --- a/src/kaleidoscope/Runtime.cpp +++ b/src/kaleidoscope/Runtime.cpp @@ -15,9 +15,17 @@ */ #include "kaleidoscope/Runtime.h" -#include "kaleidoscope/LiveKeys.h" -#include "kaleidoscope/layers.h" -#include "kaleidoscope/keyswitch_state.h" + +#include // for millis +#include // for HardwareSerial + +#include "kaleidoscope/KeyAddr.h" // for KeyAddr +#include "kaleidoscope/KeyEvent.h" // for KeyEvent +#include "kaleidoscope/LiveKeys.h" // for LiveKeys +#include "kaleidoscope/device/device.h" // for Base<>::HID +#include "kaleidoscope/driver/hid/keyboardio/Keyboard.h" // for Keyboard +#include "kaleidoscope/keyswitch_state.h" // for keyToggledOff +#include "kaleidoscope/layers.h" // for Layer, Layer_ namespace kaleidoscope { diff --git a/src/kaleidoscope/Runtime.h b/src/kaleidoscope/Runtime.h index 227b7d17..b84c7846 100644 --- a/src/kaleidoscope/Runtime.h +++ b/src/kaleidoscope/Runtime.h @@ -16,12 +16,17 @@ #pragma once -#include "kaleidoscope_internal/device.h" -#include "kaleidoscope/event_handler_result.h" -#include "kaleidoscope/hooks.h" -#include "kaleidoscope/KeyEvent.h" -#include "kaleidoscope/LiveKeys.h" -#include "kaleidoscope/layers.h" +#include // for uint32_t + +#include "kaleidoscope/KeyAddr.h" // for KeyAddr +#include "kaleidoscope/KeyEvent.h" // for KeyEvent +#include "kaleidoscope/LiveKeys.h" // for LiveKeys, live_keys +#include "kaleidoscope/device/device.h" // for Device +#include "kaleidoscope/event_handler_result.h" // for EventHandlerResult +#include "kaleidoscope/hooks.h" // for Hooks +#include "kaleidoscope/key_defs.h" // for Key, Key_Transparent +#include "kaleidoscope/layers.h" // for Layer, Layer_ +#include "kaleidoscope_internal/device.h" // for device namespace kaleidoscope { diff --git a/src/kaleidoscope/bitfields.cpp b/src/kaleidoscope/bitfields.cpp index 959f672f..2c7413aa 100644 --- a/src/kaleidoscope/bitfields.cpp +++ b/src/kaleidoscope/bitfields.cpp @@ -14,9 +14,10 @@ * this program. If not, see . */ -#include +#include "kaleidoscope/bitfields.h" -#include "bitfields.h" +#include // for pgm_read_byte +#include // for uint8_t namespace kaleidoscope { namespace bitfields { diff --git a/src/kaleidoscope/bitfields.h b/src/kaleidoscope/bitfields.h index 52621143..c7cb6d9a 100644 --- a/src/kaleidoscope/bitfields.h +++ b/src/kaleidoscope/bitfields.h @@ -16,8 +16,9 @@ #pragma once -#include -#include +#include // for PROGMEM +#include // for size_t +#include // for uint8_t namespace kaleidoscope { namespace bitfields { diff --git a/src/kaleidoscope/device/ATmega32U4Keyboard.h b/src/kaleidoscope/device/ATmega32U4Keyboard.h index f710c12d..393d1f90 100644 --- a/src/kaleidoscope/device/ATmega32U4Keyboard.h +++ b/src/kaleidoscope/device/ATmega32U4Keyboard.h @@ -19,14 +19,13 @@ #if defined(__AVR__) || defined(KALEIDOSCOPE_VIRTUAL_BUILD) -#include -#include "kaleidoscope/device/Base.h" - -#include "kaleidoscope/driver/mcu/ATmega32U4.h" -#include "kaleidoscope/driver/hid/Keyboardio.h" -#include "kaleidoscope/driver/keyscanner/ATmega.h" -#include "kaleidoscope/driver/storage/ATmega32U4EEPROMProps.h" -#include "kaleidoscope/driver/storage/AVREEPROM.h" +// IWYU pragma: begin_exports +#include "kaleidoscope/device/Base.h" // for BaseP... +#include "kaleidoscope/driver/hid/Keyboardio.h" // for Keybo... +#include "kaleidoscope/driver/mcu/ATmega32U4.h" // for ATmeg... +#include "kaleidoscope/driver/storage/ATmega32U4EEPROMProps.h" // for ATmeg... +#include "kaleidoscope/driver/storage/AVREEPROM.h" // for AVREE... +// IWYU pragma: end_exports namespace kaleidoscope { namespace device { diff --git a/src/kaleidoscope/device/Base.h b/src/kaleidoscope/device/Base.h index 13d6cae7..5aa81401 100644 --- a/src/kaleidoscope/device/Base.h +++ b/src/kaleidoscope/device/Base.h @@ -15,22 +15,26 @@ * this program. If not, see . */ +// IWYU pragma: private, include "kaleidoscope/device/device.h" + /** @file kaleidoscope/device/Base.h * Base class for Kaleidoscope device libraries. */ #pragma once -#include "kaleidoscope/MatrixAddr.h" -#include "kaleidoscope_internal/deprecations.h" -#include "kaleidoscope/macro_helpers.h" - -#include "kaleidoscope/driver/hid/Base.h" -#include "kaleidoscope/driver/keyscanner/None.h" -#include "kaleidoscope/driver/led/None.h" -#include "kaleidoscope/driver/mcu/None.h" -#include "kaleidoscope/driver/bootloader/None.h" -#include "kaleidoscope/driver/storage/None.h" +#include // for uint8_t, int8_t +#include // for size_t, strlen, memcpy + +#include "kaleidoscope/driver/bootloader/None.h" // for None +#include "kaleidoscope/driver/hid/Base.h" // for Base, BaseProps +#include "kaleidoscope/driver/keyscanner/Base.h" // for BaseProps +#include "kaleidoscope/driver/keyscanner/None.h" // for None +#include "kaleidoscope/driver/led/None.h" // for cRGB, BaseProps, CRGB +#include "kaleidoscope/driver/mcu/Base.h" // for BaseProps +#include "kaleidoscope/driver/mcu/None.h" // for None +#include "kaleidoscope/driver/storage/Base.h" // for BaseProps +#include "kaleidoscope/driver/storage/None.h" // for None #ifndef CRGB #error cRGB and CRGB *must* be defined before including this header! diff --git a/src/kaleidoscope/device/device.h b/src/kaleidoscope/device/device.h index ed16ea93..574f8de2 100644 --- a/src/kaleidoscope/device/device.h +++ b/src/kaleidoscope/device/device.h @@ -1,5 +1,6 @@ -/* Kaleidoscope - Firmware for computer input devices - * Copyright (C) 2013-2019 Keyboard.io, Inc. +/* -*- mode: c++ -*- + * Kaleidoscope - Firmware for computer input devices + * Copyright (C) 2013-2022 Keyboard.io, Inc. * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU General Public License as published by the Free Software @@ -16,8 +17,42 @@ #pragma once +/** @file kaleidoscope/device/device.h + * + * Provider of the following types: + * - `kaleidoscope::Device` + * - `kaleidoscope::Device::KeyAddr` + * - `kaleidoscope::DeviceProps` + * - `kaleidoscope::device::HID` + * - `kaleidoscope::device::Storage` + * - `kaleidoscope::device::StorageProps` + */ + +// This file includes whatever hardware plugin is specified during the build. +// Depending on which device is targeted, you can find the sources in one of the +// following files under the `plugins` directory: +// +// `Kaleidoscope-Hardware--/src/kaleidoscope/device//.h` +// +// Each hardware device header defines a types `kaleidoscope::Device` and +// `kaleidoscope::DeviceProps` by using the `EXPORT_DEVICE()` preprocessor +// macro, which then becomes available to client code by means of this header. +// Client code should not include specific hardware device headers directly. +// +// `KALEIDOSCOPE_HARDWARE_H` gets defined during the build process like this: +// The fully-qualified board name (fqbn) is read from the `sketch.json` file (in +// the same directory as the sketch's *.ino file), and that tells Arduino which +// core to use and which definition to read from `boards.txt`, which adds +// compiler flags that set `KALEIDOSCOPE_HARDWARE_H` to the appropriate header +// for the hardware plugin. +// +// For a description of the API for the `kaleidoscope::Device` class, see the +// base device class definition in the following file: +// +// `kaleidoscope/device/Base.h` + #ifdef KALEIDOSCOPE_VIRTUAL_BUILD -#include "kaleidoscope/device/virtual/Virtual.h" +#include "kaleidoscope/device/virtual/Virtual.h" // IWYU pragma: export #else #include KALEIDOSCOPE_HARDWARE_H #endif diff --git a/src/kaleidoscope/device/key_indexes.h b/src/kaleidoscope/device/key_indexes.h index b74eeca9..b983c7d6 100644 --- a/src/kaleidoscope/device/key_indexes.h +++ b/src/kaleidoscope/device/key_indexes.h @@ -17,7 +17,9 @@ #pragma once -#include "kaleidoscope/KeyAddr.h" +#include // for uint8_t + +#include "kaleidoscope/KeyAddr.h" // for KeyAddr /* To be used by the hardware implementations, `keyIndex` tells us the index of * a key, from which we can figure out the row and column as needed. The index diff --git a/src/kaleidoscope/device/virtual/DefaultHIDReportConsumer.cpp b/src/kaleidoscope/device/virtual/DefaultHIDReportConsumer.cpp index 05ea9c04..3e54e268 100644 --- a/src/kaleidoscope/device/virtual/DefaultHIDReportConsumer.cpp +++ b/src/kaleidoscope/device/virtual/DefaultHIDReportConsumer.cpp @@ -16,16 +16,24 @@ #ifdef KALEIDOSCOPE_VIRTUAL_BUILD -#include "DefaultHIDReportConsumer.h" -#include "MultiReport/Keyboard.h" -#include "Logging.h" +#include "kaleidoscope/device/virtual/DefaultHIDReportConsumer.h" -#include "virtual_io.h" +// From KeyboardioHID: +#include // for HID_REPORTID_NKRO_K... +#include // for HID_KeyboardReport_... +// From system: +#include // for uint8_t +// From Arduino core: +#include // for logUSBEvent_keyboard + +// From Kaleidoscope: +#include "kaleidoscope/device/virtual/Logging.h" // for log_info, logging #undef min #undef max -#include +#include // for operator<<, strings... +#include // for char_traits, operator+ namespace kaleidoscope { diff --git a/src/kaleidoscope/device/virtual/DefaultHIDReportConsumer.h b/src/kaleidoscope/device/virtual/DefaultHIDReportConsumer.h index 77ce8552..cb2eaba3 100644 --- a/src/kaleidoscope/device/virtual/DefaultHIDReportConsumer.h +++ b/src/kaleidoscope/device/virtual/DefaultHIDReportConsumer.h @@ -18,7 +18,7 @@ #ifdef KALEIDOSCOPE_VIRTUAL_BUILD -#include +#include // for uint8_t namespace kaleidoscope { diff --git a/src/kaleidoscope/device/virtual/HID.cpp b/src/kaleidoscope/device/virtual/HID.cpp index 51720732..a3b6ff03 100644 --- a/src/kaleidoscope/device/virtual/HID.cpp +++ b/src/kaleidoscope/device/virtual/HID.cpp @@ -22,11 +22,9 @@ // library KeyboardioHID. It replaces all hardware related stuff // with stub implementations. -// Include KeyboardioHID's HID.h header -// +// From KeyboardioHID: #include "HID.h" - -#include "HIDReportObserver.h" +#include "HIDReportObserver.h" // for HIDReportObserver #if defined(USBCON) diff --git a/src/kaleidoscope/device/virtual/Logging.h b/src/kaleidoscope/device/virtual/Logging.h index 94c592e3..7bdf45ca 100644 --- a/src/kaleidoscope/device/virtual/Logging.h +++ b/src/kaleidoscope/device/virtual/Logging.h @@ -18,8 +18,9 @@ #ifdef KALEIDOSCOPE_VIRTUAL_BUILD -#include "utility" -#include "stdio.h" +#include // for fprintf, stderr, stdout +#include // IWYU pragma: keep +// IWYU pragma: no_include <__utility/forward.h> namespace kaleidoscope { namespace logging { diff --git a/src/kaleidoscope/device/virtual/Virtual.cpp b/src/kaleidoscope/device/virtual/Virtual.cpp index 82fef177..2d44f595 100644 --- a/src/kaleidoscope/device/virtual/Virtual.cpp +++ b/src/kaleidoscope/device/virtual/Virtual.cpp @@ -18,20 +18,28 @@ #ifdef KALEIDOSCOPE_VIRTUAL_BUILD #include "kaleidoscope/device/virtual/Virtual.h" -#include "kaleidoscope/device/virtual/DefaultHIDReportConsumer.h" -#include "kaleidoscope/device/virtual/Logging.h" -#include "kaleidoscope/keyswitch_state.h" -#include "kaleidoscope/MatrixAddr.h" -#include "kaleidoscope/key_defs.h" +// From system: +#include // for uint8_t, uint16_t +#include // for exit, size_t +// From Arduino: +#include // for EEPROMClass, EERef +#include // for getLineOfInput, isI... -#include "HIDReportObserver.h" -#include "virtual_io.h" -#include "EEPROM.h" +// From KeyboardioHID: +#include // for HIDReportObserver -#include -#include +// From Kaleidoscope: +#include "kaleidoscope/KeyAddr.h" // for MatrixAddr, MatrixA... +#include "kaleidoscope/device/virtual/DefaultHIDReportConsumer.h" // for DefaultHIDReportCon... +#include "kaleidoscope/device/virtual/Logging.h" // for log_error, logging +#include "kaleidoscope/key_defs.h" // for Key_NoKey +#include "kaleidoscope/keyswitch_state.h" // for IS_PRESSED, WAS_PRE... + +// These must come after other headers: +#include // for operator<<, string +#include // for operator==, char_tr... // FIXME: This relates to virtual/cores/arduino/EEPROM.h. // EEPROM static data must be defined here as only diff --git a/src/kaleidoscope/device/virtual/Virtual.h b/src/kaleidoscope/device/virtual/Virtual.h index a6ea731f..a0ff389d 100644 --- a/src/kaleidoscope/device/virtual/Virtual.h +++ b/src/kaleidoscope/device/virtual/Virtual.h @@ -15,15 +15,25 @@ * this program. If not, see . */ +// IWYU pragma: private, include "kaleidoscope/device/device.h" + #pragma once #ifdef KALEIDOSCOPE_VIRTUAL_BUILD +// Compile-time (emulated) hardware header: #include KALEIDOSCOPE_HARDWARE_H -#include "kaleidoscope/driver/bootloader/None.h" -#include "kaleidoscope/driver/hid/Keyboardio.h" -#include "kaleidoscope/driver/led/Base.h" +// From system: +#include // for uint8_t +// From Arduino libraries: +#include // for Serial +// From Kaleidoscope: +#include "kaleidoscope/device/Base.h" // for Base +#include "kaleidoscope/driver/bootloader/None.h" // for None +#include "kaleidoscope/driver/hid/Keyboardio.h" // for Keyboardio +#include "kaleidoscope/driver/keyscanner/Base.h" // for Base +#include "kaleidoscope/driver/mcu/None.h" // for None namespace kaleidoscope { namespace device { diff --git a/src/kaleidoscope/driver/bootloader/None.h b/src/kaleidoscope/driver/bootloader/None.h index a240ae0a..048e262f 100644 --- a/src/kaleidoscope/driver/bootloader/None.h +++ b/src/kaleidoscope/driver/bootloader/None.h @@ -17,7 +17,7 @@ #pragma once -#include "kaleidoscope/driver/bootloader/Base.h" +#include "kaleidoscope/driver/bootloader/Base.h" // for Base namespace kaleidoscope { namespace driver { diff --git a/src/kaleidoscope/driver/bootloader/avr/Caterina.h b/src/kaleidoscope/driver/bootloader/avr/Caterina.h index 52447cb5..582a2e9d 100644 --- a/src/kaleidoscope/driver/bootloader/avr/Caterina.h +++ b/src/kaleidoscope/driver/bootloader/avr/Caterina.h @@ -20,8 +20,8 @@ #ifndef KALEIDOSCOPE_VIRTUAL_BUILD #include #endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD -#include "kaleidoscope/driver/bootloader/None.h" -#include "kaleidoscope/driver/bootloader/Base.h" +#include "kaleidoscope/driver/bootloader/Base.h" // IWYU pragma: keep +#include "kaleidoscope/driver/bootloader/None.h" // for None namespace kaleidoscope { namespace driver { diff --git a/src/kaleidoscope/driver/bootloader/avr/FLIP.h b/src/kaleidoscope/driver/bootloader/avr/FLIP.h index c4e993e1..6379c911 100644 --- a/src/kaleidoscope/driver/bootloader/avr/FLIP.h +++ b/src/kaleidoscope/driver/bootloader/avr/FLIP.h @@ -25,8 +25,8 @@ #endif #endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD -#include "kaleidoscope/driver/bootloader/None.h" -#include "kaleidoscope/driver/bootloader/Base.h" +#include "kaleidoscope/driver/bootloader/Base.h" // IWYU pragma: keep +#include "kaleidoscope/driver/bootloader/None.h" // for None namespace kaleidoscope { namespace driver { diff --git a/src/kaleidoscope/driver/bootloader/avr/HalfKay.h b/src/kaleidoscope/driver/bootloader/avr/HalfKay.h index ae8d1268..330a3f96 100644 --- a/src/kaleidoscope/driver/bootloader/avr/HalfKay.h +++ b/src/kaleidoscope/driver/bootloader/avr/HalfKay.h @@ -20,8 +20,8 @@ #ifndef KALEIDOSCOPE_VIRTUAL_BUILD #include #endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD -#include "kaleidoscope/driver/bootloader/None.h" -#include "kaleidoscope/driver/bootloader/Base.h" +#include "kaleidoscope/driver/bootloader/Base.h" // IWYU pragma: keep +#include "kaleidoscope/driver/bootloader/None.h" // for None namespace kaleidoscope { namespace driver { diff --git a/src/kaleidoscope/driver/bootloader/gd32/Base.h b/src/kaleidoscope/driver/bootloader/gd32/Base.h index 73ca94f6..7391c1b3 100644 --- a/src/kaleidoscope/driver/bootloader/gd32/Base.h +++ b/src/kaleidoscope/driver/bootloader/gd32/Base.h @@ -17,6 +17,8 @@ #pragma once +#include // IWYU pragma: keep + #include "kaleidoscope/driver/bootloader/Base.h" namespace kaleidoscope { diff --git a/src/kaleidoscope/driver/bootloader/samd/Bossac.h b/src/kaleidoscope/driver/bootloader/samd/Bossac.h index fdd48e2f..6a9ece42 100644 --- a/src/kaleidoscope/driver/bootloader/samd/Bossac.h +++ b/src/kaleidoscope/driver/bootloader/samd/Bossac.h @@ -20,6 +20,8 @@ #ifdef ARDUINO_ARCH_SAMD +#include + #include "kaleidoscope/driver/bootloader/Base.h" namespace kaleidoscope { diff --git a/src/kaleidoscope/driver/color/GammaCorrection.h b/src/kaleidoscope/driver/color/GammaCorrection.h index f11137e3..0e1f5880 100644 --- a/src/kaleidoscope/driver/color/GammaCorrection.h +++ b/src/kaleidoscope/driver/color/GammaCorrection.h @@ -17,7 +17,8 @@ #pragma once -#include +#include // for PROGMEM +#include // for uint8_t namespace kaleidoscope { namespace driver { diff --git a/src/kaleidoscope/driver/hid/Base.h b/src/kaleidoscope/driver/hid/Base.h index 4f0d1d4b..05a26f44 100644 --- a/src/kaleidoscope/driver/hid/Base.h +++ b/src/kaleidoscope/driver/hid/Base.h @@ -16,12 +16,10 @@ */ #pragma once -#include -#include "kaleidoscope/key_defs.h" -#include "base/Keyboard.h" -#include "base/Mouse.h" -#include "base/AbsoluteMouse.h" +#include "base/AbsoluteMouse.h" // for AbsoluteMouse, AbsoluteMouseProps +#include "base/Keyboard.h" // for Keyboard, KeyboardProps +#include "base/Mouse.h" // for Mouse, MouseProps namespace kaleidoscope { namespace driver { diff --git a/src/kaleidoscope/driver/hid/Keyboardio.h b/src/kaleidoscope/driver/hid/Keyboardio.h index f73ea914..0de6a6f3 100644 --- a/src/kaleidoscope/driver/hid/Keyboardio.h +++ b/src/kaleidoscope/driver/hid/Keyboardio.h @@ -16,15 +16,11 @@ */ #pragma once -#include -#include -#include "kaleidoscope/key_defs.h" -#include "kaleidoscope/driver/hid/Base.h" - -#include "keyboardio/Keyboard.h" -#include "keyboardio/Mouse.h" -#include "keyboardio/AbsoluteMouse.h" +#include "kaleidoscope/driver/hid/Base.h" // for Base, BaseProps +#include "keyboardio/AbsoluteMouse.h" // for AbsoluteMouse, AbsoluteMou... +#include "keyboardio/Keyboard.h" // for Keyboard, KeyboardProps +#include "keyboardio/Mouse.h" // for Mouse, MouseProps namespace kaleidoscope { namespace driver { diff --git a/src/kaleidoscope/driver/hid/base/AbsoluteMouse.h b/src/kaleidoscope/driver/hid/base/AbsoluteMouse.h index a1e20d8c..9539866b 100644 --- a/src/kaleidoscope/driver/hid/base/AbsoluteMouse.h +++ b/src/kaleidoscope/driver/hid/base/AbsoluteMouse.h @@ -17,7 +17,7 @@ #pragma once -#include +#include // for uint8_t, int8_t, uint16_t namespace kaleidoscope { namespace driver { diff --git a/src/kaleidoscope/driver/hid/base/Keyboard.h b/src/kaleidoscope/driver/hid/base/Keyboard.h index 61bcbdbd..8010c4f1 100644 --- a/src/kaleidoscope/driver/hid/base/Keyboard.h +++ b/src/kaleidoscope/driver/hid/base/Keyboard.h @@ -16,9 +16,10 @@ */ #pragma once -#include -#include "kaleidoscope/key_defs.h" +#include // for uint8_t + +#include "kaleidoscope/key_defs.h" // for Key, Key_LeftAlt, Key_LeftControl #ifndef HID_BOOT_PROTOCOL #define HID_BOOT_PROTOCOL 0 diff --git a/src/kaleidoscope/driver/hid/base/Mouse.h b/src/kaleidoscope/driver/hid/base/Mouse.h index ebd71d3c..8b420a45 100644 --- a/src/kaleidoscope/driver/hid/base/Mouse.h +++ b/src/kaleidoscope/driver/hid/base/Mouse.h @@ -16,7 +16,8 @@ */ #pragma once -#include + +#include // for int8_t, uint8_t namespace kaleidoscope { namespace driver { diff --git a/src/kaleidoscope/driver/hid/keyboardio/AbsoluteMouse.h b/src/kaleidoscope/driver/hid/keyboardio/AbsoluteMouse.h index cb6660ff..ff73f882 100644 --- a/src/kaleidoscope/driver/hid/keyboardio/AbsoluteMouse.h +++ b/src/kaleidoscope/driver/hid/keyboardio/AbsoluteMouse.h @@ -17,10 +17,14 @@ #pragma once -#include -#include +#include // for uint8_t, int8_t -#include "kaleidoscope/driver/hid/base/AbsoluteMouse.h" +#include +// From KeyboardioHID: +#include "DeviceAPIs/AbsoluteMouseAPI.hpp" // for AbsoluteMous... +#include "SingleReport/SingleAbsoluteMouse.h" // for SingleAbsolu... +// From Kaleidoscope: +#include "kaleidoscope/driver/hid/base/AbsoluteMouse.h" // for AbsoluteMouse namespace kaleidoscope { namespace driver { diff --git a/src/kaleidoscope/driver/hid/keyboardio/Keyboard.h b/src/kaleidoscope/driver/hid/keyboardio/Keyboard.h index 6db99718..04c50700 100644 --- a/src/kaleidoscope/driver/hid/keyboardio/Keyboard.h +++ b/src/kaleidoscope/driver/hid/keyboardio/Keyboard.h @@ -16,10 +16,17 @@ */ #pragma once -#include -#include -#include "kaleidoscope/driver/hid/base/Keyboard.h" +#include // for uint8_t, uint16_t + +#include +// From KeyboardioHID: +#include "BootKeyboard/BootKeyboard.h" // for BootKeyboard, Boo... +#include "MultiReport/ConsumerControl.h" // for ConsumerControl +#include "MultiReport/Keyboard.h" // for Keyboard, Keyboard_ +#include "MultiReport/SystemControl.h" // for SystemControl +// From Kaleidoscope: +#include "kaleidoscope/driver/hid/base/Keyboard.h" // for Keyboard, Keyboar... namespace kaleidoscope { namespace driver { diff --git a/src/kaleidoscope/driver/hid/keyboardio/Mouse.h b/src/kaleidoscope/driver/hid/keyboardio/Mouse.h index f8773cd5..ff5bae5b 100644 --- a/src/kaleidoscope/driver/hid/keyboardio/Mouse.h +++ b/src/kaleidoscope/driver/hid/keyboardio/Mouse.h @@ -16,10 +16,14 @@ */ #pragma once -#include -#include -#include "kaleidoscope/driver/hid/base/Mouse.h" +#include // for int8_t, uint8_t + +#include +// From KeyboardioHID: +#include "MultiReport/Mouse.h" // for HID_MouseReport_Data_t +// From Kaleidoscope: +#include "kaleidoscope/driver/hid/base/Mouse.h" // for Mouse, MouseProps namespace kaleidoscope { namespace driver { diff --git a/src/kaleidoscope/driver/keyscanner/ATmega.h b/src/kaleidoscope/driver/keyscanner/ATmega.h index b8e05eb3..7b42a897 100644 --- a/src/kaleidoscope/driver/keyscanner/ATmega.h +++ b/src/kaleidoscope/driver/keyscanner/ATmega.h @@ -17,13 +17,11 @@ #pragma once -#include +#include // for uint16_t, uint8_t -#include "kaleidoscope/macro_helpers.h" -#include "kaleidoscope/driver/keyscanner/Base.h" -#include "kaleidoscope/driver/keyscanner/None.h" - -#include "kaleidoscope/device/avr/pins_and_ports.h" +#include "kaleidoscope/device/avr/pins_and_ports.h" // IWYU pragma: keep +#include "kaleidoscope/driver/keyscanner/Base.h" // for BaseProps +#include "kaleidoscope/driver/keyscanner/None.h" // for None #ifndef KALEIDOSCOPE_VIRTUAL_BUILD #include diff --git a/src/kaleidoscope/driver/keyscanner/Base.h b/src/kaleidoscope/driver/keyscanner/Base.h index ccdeaff3..7c4b1860 100644 --- a/src/kaleidoscope/driver/keyscanner/Base.h +++ b/src/kaleidoscope/driver/keyscanner/Base.h @@ -17,10 +17,10 @@ #pragma once -#include +#include // for uint8_t -#include "kaleidoscope/key_defs.h" -#include "kaleidoscope/MatrixAddr.h" +#include "kaleidoscope/MatrixAddr.h" // for MatrixAddr +#include "kaleidoscope/key_defs.h" // for Key namespace kaleidoscope { namespace driver { diff --git a/src/kaleidoscope/driver/keyscanner/Base_Impl.h b/src/kaleidoscope/driver/keyscanner/Base_Impl.h index fb958e0f..4a41dca5 100644 --- a/src/kaleidoscope/driver/keyscanner/Base_Impl.h +++ b/src/kaleidoscope/driver/keyscanner/Base_Impl.h @@ -17,11 +17,14 @@ #pragma once -#include "kaleidoscope/driver/keyscanner/Base.h" -#include "kaleidoscope/device/device.h" -#include "kaleidoscope/keyswitch_state.h" -#include "kaleidoscope/KeyEvent.h" -#include "kaleidoscope/Runtime.h" +#include // for uint8_t + +#include "kaleidoscope/KeyEvent.h" // for KeyEvent +#include "kaleidoscope/Runtime.h" // for Runtime, Runtime_ +#include "kaleidoscope/device/virtual/Virtual.h" // for Device +#include "kaleidoscope/driver/keyscanner/Base.h" // for Base +#include "kaleidoscope/key_defs.h" // for Key +#include "kaleidoscope/keyswitch_state.h" // for keyToggledOff, keyT... namespace kaleidoscope { namespace driver { diff --git a/src/kaleidoscope/driver/keyscanner/None.h b/src/kaleidoscope/driver/keyscanner/None.h index 8ad6b155..8e0319d6 100644 --- a/src/kaleidoscope/driver/keyscanner/None.h +++ b/src/kaleidoscope/driver/keyscanner/None.h @@ -17,9 +17,7 @@ #pragma once -#include - -#include "kaleidoscope/driver/keyscanner/Base.h" +#include "kaleidoscope/driver/keyscanner/Base.h" // for BaseProps, Base namespace kaleidoscope { namespace driver { diff --git a/src/kaleidoscope/driver/led/Base.h b/src/kaleidoscope/driver/led/Base.h index d2d727bf..661c8b99 100644 --- a/src/kaleidoscope/driver/led/Base.h +++ b/src/kaleidoscope/driver/led/Base.h @@ -21,6 +21,9 @@ #error cRGB and CRGB *must* be defined before including this header! #endif +#include // for PROGMEM, pgm_read_byte +#include // for uint8_t + namespace kaleidoscope { namespace driver { namespace led { diff --git a/src/kaleidoscope/driver/led/Color.h b/src/kaleidoscope/driver/led/Color.h index 62da7728..2a6eb5d5 100644 --- a/src/kaleidoscope/driver/led/Color.h +++ b/src/kaleidoscope/driver/led/Color.h @@ -17,6 +17,8 @@ #pragma once +#include // for uint8_t + namespace kaleidoscope { namespace driver { namespace led { diff --git a/src/kaleidoscope/driver/led/None.h b/src/kaleidoscope/driver/led/None.h index 19328573..f3164766 100644 --- a/src/kaleidoscope/driver/led/None.h +++ b/src/kaleidoscope/driver/led/None.h @@ -17,6 +17,8 @@ #pragma once +#include // for uint8_t + #ifndef CRGB struct cRGB { @@ -27,7 +29,7 @@ struct cRGB { #endif -#include "kaleidoscope/driver/led/Base.h" +#include "kaleidoscope/driver/led/Base.h" // for Base, BaseProps (ptr only) namespace kaleidoscope { namespace driver { diff --git a/src/kaleidoscope/driver/led/WS2812.h b/src/kaleidoscope/driver/led/WS2812.h index 3a006d04..4f0a7953 100644 --- a/src/kaleidoscope/driver/led/WS2812.h +++ b/src/kaleidoscope/driver/led/WS2812.h @@ -33,8 +33,8 @@ #pragma once -#include "kaleidoscope/hardware/avr/pins_and_ports.h" #include "kaleidoscope/driver/led/Color.h" +#include "kaleidoscope/hardware/avr/pins_and_ports.h" #include "ws2812/config.h" namespace kaleidoscope { diff --git a/src/kaleidoscope/driver/mcu/ATmega32U4.h b/src/kaleidoscope/driver/mcu/ATmega32U4.h index d65ad398..fb5c2995 100644 --- a/src/kaleidoscope/driver/mcu/ATmega32U4.h +++ b/src/kaleidoscope/driver/mcu/ATmega32U4.h @@ -17,7 +17,7 @@ #pragma once -#include "kaleidoscope/driver/mcu/Base.h" +#include "kaleidoscope/driver/mcu/Base.h" // for Base, BaseProps namespace kaleidoscope { namespace driver { diff --git a/src/kaleidoscope/driver/mcu/None.h b/src/kaleidoscope/driver/mcu/None.h index 9baaf274..69774c35 100644 --- a/src/kaleidoscope/driver/mcu/None.h +++ b/src/kaleidoscope/driver/mcu/None.h @@ -17,7 +17,7 @@ #pragma once -#include "kaleidoscope/driver/mcu/Base.h" +#include "kaleidoscope/driver/mcu/Base.h" // for Base, BaseProps (ptr only) namespace kaleidoscope { namespace driver { diff --git a/src/kaleidoscope/driver/storage/ATmega32U4EEPROMProps.h b/src/kaleidoscope/driver/storage/ATmega32U4EEPROMProps.h index 78fa4411..42fc5cf3 100644 --- a/src/kaleidoscope/driver/storage/ATmega32U4EEPROMProps.h +++ b/src/kaleidoscope/driver/storage/ATmega32U4EEPROMProps.h @@ -17,7 +17,9 @@ #pragma once -#include "kaleidoscope/driver/storage/AVREEPROM.h" +#include // for uint16_t + +#include "kaleidoscope/driver/storage/AVREEPROM.h" // for AVREEPROMProps namespace kaleidoscope { namespace driver { diff --git a/src/kaleidoscope/driver/storage/AVREEPROM.h b/src/kaleidoscope/driver/storage/AVREEPROM.h index 691d0e68..48e82fba 100644 --- a/src/kaleidoscope/driver/storage/AVREEPROM.h +++ b/src/kaleidoscope/driver/storage/AVREEPROM.h @@ -17,10 +17,12 @@ #pragma once +#include // for uint16_t, uint8_t #if defined(__AVR__) || defined(KALEIDOSCOPE_VIRTUAL_BUILD) -#include "kaleidoscope/driver/storage/Base.h" -#include +#include // for EEPROM, EEPROMClass + +#include "kaleidoscope/driver/storage/Base.h" // for Base, BaseProps namespace kaleidoscope { namespace driver { diff --git a/src/kaleidoscope/driver/storage/Base.h b/src/kaleidoscope/driver/storage/Base.h index 97ae7f4c..6e58e909 100644 --- a/src/kaleidoscope/driver/storage/Base.h +++ b/src/kaleidoscope/driver/storage/Base.h @@ -17,6 +17,8 @@ #pragma once +#include // for uint16_t, uint8_t + namespace kaleidoscope { namespace driver { namespace storage { diff --git a/src/kaleidoscope/driver/storage/Flash.h b/src/kaleidoscope/driver/storage/Flash.h index a8dc0617..96d455ee 100644 --- a/src/kaleidoscope/driver/storage/Flash.h +++ b/src/kaleidoscope/driver/storage/Flash.h @@ -27,9 +27,10 @@ #ifdef __SAMD21G18A__ -#include "kaleidoscope/driver/storage/Base.h" -#include #include +#include + +#include "kaleidoscope/driver/storage/Base.h" // We need to undefine Flash, because `FlashStorage` defines it as a macro, yet, // we want to use it as a class name. diff --git a/src/kaleidoscope/driver/storage/GD32Flash.h b/src/kaleidoscope/driver/storage/GD32Flash.h index fbc02738..e0d09d69 100644 --- a/src/kaleidoscope/driver/storage/GD32Flash.h +++ b/src/kaleidoscope/driver/storage/GD32Flash.h @@ -19,9 +19,10 @@ #if defined(ARDUINO_ARCH_GD32) || defined(KALEIDOSCOPE_VIRTUAL_BUILD) +#include +#include + #include "kaleidoscope/driver/storage/Base.h" -#include "FlashStorage.h" -#include "FlashAsEEPROM.h" namespace kaleidoscope { namespace driver { diff --git a/src/kaleidoscope/driver/storage/None.h b/src/kaleidoscope/driver/storage/None.h index f45b141a..7bcce495 100644 --- a/src/kaleidoscope/driver/storage/None.h +++ b/src/kaleidoscope/driver/storage/None.h @@ -17,7 +17,7 @@ #pragma once -#include "kaleidoscope/driver/storage/Base.h" +#include "kaleidoscope/driver/storage/Base.h" // for Base, BaseProps (ptr o... namespace kaleidoscope { namespace driver { diff --git a/src/kaleidoscope/event_handler_result.h b/src/kaleidoscope/event_handler_result.h index 1cf05c75..f9b6625e 100644 --- a/src/kaleidoscope/event_handler_result.h +++ b/src/kaleidoscope/event_handler_result.h @@ -16,7 +16,7 @@ #pragma once -#include +#include // for uint8_t namespace kaleidoscope { diff --git a/src/kaleidoscope/hooks.cpp b/src/kaleidoscope/hooks.cpp index c99a0032..cdecf296 100644 --- a/src/kaleidoscope/hooks.cpp +++ b/src/kaleidoscope/hooks.cpp @@ -14,10 +14,10 @@ * this program. If not, see . */ -#include "kaleidoscope/event_handler_result.h" -#include "kaleidoscope/event_handlers.h" -#include "kaleidoscope/macro_helpers.h" -#include "kaleidoscope/hooks.h" +#include "kaleidoscope/event_handler_result.h" // for EventHandlerResult +#include "kaleidoscope/event_handlers.h" // for _FOR_EACH_EVENT_HANDLER +#include "kaleidoscope/hooks.h" // for Hooks +#include "kaleidoscope/macro_helpers.h" // for __NL__, MAKE_TEMPLATE... namespace kaleidoscope { diff --git a/src/kaleidoscope/hooks.h b/src/kaleidoscope/hooks.h index 58faed8e..a1275f88 100644 --- a/src/kaleidoscope/hooks.h +++ b/src/kaleidoscope/hooks.h @@ -16,30 +16,22 @@ #pragma once -#include +#include "kaleidoscope/KeyEvent.h" // IWYU pragma: keep +#include "kaleidoscope/event_handler_result.h" // for EventHandlerResult +#include "kaleidoscope/event_handlers.h" // for _FOR_EACH_EVENT_HANDLER +#include "kaleidoscope/macro_helpers.h" // for __NL__, MAKE_TEMPLATE... +#include "kaleidoscope_internal/event_dispatch.h" // IWYU pragma: keep namespace kaleidoscope { -class Key; -} - -#include "kaleidoscope/KeyAddr.h" -#include "kaleidoscope/KeyEvent.h" -#include "kaleidoscope/plugin.h" -#include "kaleidoscope/event_handlers.h" - -// Forward declaration required to enable friend declarations -// in class Hooks. -class kaleidoscope_; +// Forward declarations to enable friend declarations. +class Layer_; +class Runtime_; -namespace kaleidoscope { namespace plugin { -// Forward declaration to enable friend declarations. -class LEDControl; +// Forward declarations to enable friend declarations. class FocusSerial; -} - -// Forward declaration to enable friend declarations. -class Layer_; +class LEDControl; +} // namespace plugin namespace sketch_exploration { void pluginsExploreSketch(); @@ -61,11 +53,11 @@ class Hooks { // Runtime_ calls Hooks::onSetup, Hooks::beforeReportingState // and Hooks::afterEachCycle. + friend class Layer_; friend class Runtime_; - friend class ::kaleidoscope::plugin::FocusSerial; - friend class ::kaleidoscope::Layer_; - friend class ::kaleidoscope::plugin::LEDControl; - friend void ::kaleidoscope::sketch_exploration::pluginsExploreSketch(); + friend class plugin::FocusSerial; + friend class plugin::LEDControl; + friend void sketch_exploration::pluginsExploreSketch(); private: diff --git a/src/kaleidoscope/key_defs.h b/src/kaleidoscope/key_defs.h index c357faf2..1aa92e70 100644 --- a/src/kaleidoscope/key_defs.h +++ b/src/kaleidoscope/key_defs.h @@ -16,16 +16,18 @@ #pragma once -#include // for uint8_t, uint16_t - #include // for pgm_read_byte, INPUT +#include // for uint8_t, uint16_t #include "kaleidoscope/HIDTables.h" // for HID_KEYBOARD_LEFT_CONTROL + +// IWYU pragma: begin_exports +#include "kaleidoscope/key_defs/aliases.h" +#include "kaleidoscope/key_defs/consumerctl.h" #include "kaleidoscope/key_defs/keyboard.h" +#include "kaleidoscope/key_defs/keymaps.h" // for LAYER_MOVE_OFFSET, LAYER_... #include "kaleidoscope/key_defs/sysctl.h" -#include "kaleidoscope/key_defs/consumerctl.h" -#include "kaleidoscope/key_defs/keymaps.h" // for LAYER_SHIFT_OFFSET -#include "kaleidoscope/key_defs/aliases.h" +// IWYU pragma: end_exports // ----------------------------------------------------------------------------- // Constant keycode values diff --git a/src/kaleidoscope/key_defs/keymaps.h b/src/kaleidoscope/key_defs/keymaps.h index 21698eab..22854edd 100644 --- a/src/kaleidoscope/key_defs/keymaps.h +++ b/src/kaleidoscope/key_defs/keymaps.h @@ -16,9 +16,7 @@ #pragma once -#include - -#include "kaleidoscope_internal/deprecations.h" +#include // for uint8_t static const uint8_t LAYER_OP_OFFSET = 42; static const uint8_t LAYER_SHIFT_OFFSET = LAYER_OP_OFFSET; diff --git a/src/kaleidoscope/keymaps.h b/src/kaleidoscope/keymaps.h index 3cbfe08f..904aeca4 100644 --- a/src/kaleidoscope/keymaps.h +++ b/src/kaleidoscope/keymaps.h @@ -16,9 +16,12 @@ #pragma once -#include "kaleidoscope/key_defs.h" -#include "kaleidoscope/KeyAddr.h" -#include "kaleidoscope_internal/device.h" +#include // for uint8_t + +#include "kaleidoscope/KeyAddr.h" // for KeyAddr +#include "kaleidoscope/device/device.h" // for Device +#include "kaleidoscope/key_defs.h" // for Key +#include "kaleidoscope_internal/device.h" // for device extern const Key keymaps_linear[][kaleidoscope_internal::device.matrix_rows * kaleidoscope_internal::device.matrix_columns]; diff --git a/src/kaleidoscope/keyswitch_state.h b/src/kaleidoscope/keyswitch_state.h index 6210a868..1e6e37e1 100644 --- a/src/kaleidoscope/keyswitch_state.h +++ b/src/kaleidoscope/keyswitch_state.h @@ -17,8 +17,6 @@ #pragma once // switch debouncing and status -#include - #define INJECTED 0b10000000 #define IS_PRESSED 0b00000010 #define WAS_PRESSED 0b00000001 diff --git a/src/kaleidoscope/layers.cpp b/src/kaleidoscope/layers.cpp index 9a395d48..490a4d1d 100644 --- a/src/kaleidoscope/layers.cpp +++ b/src/kaleidoscope/layers.cpp @@ -14,12 +14,22 @@ * this program. If not, see . */ -#include "kaleidoscope_internal/device.h" -#include "kaleidoscope/hooks.h" -#include "kaleidoscope/layers.h" -#include "kaleidoscope/keyswitch_state.h" -#include "kaleidoscope/KeyEvent.h" -#include "kaleidoscope/LiveKeys.h" +#include // for uint8_t, int8_t +#include // for memmove, memset + +#include "kaleidoscope/KeyAddr.h" // for KeyAddr +#include "kaleidoscope/KeyAddrMap.h" // for KeyAddrMap<>::Iterator +#include "kaleidoscope/KeyEvent.h" // for KeyEvent +#include "kaleidoscope/KeyMap.h" // for KeyMap +#include "kaleidoscope/LiveKeys.h" // for LiveKeys, live_keys +#include "kaleidoscope/MatrixAddr.h" // for MatrixAddr, MatrixA... +#include "kaleidoscope/device/virtual/Virtual.h" // for Device +#include "kaleidoscope/hooks.h" // for Hooks +#include "kaleidoscope/key_defs.h" // for Key, LAYER_MOVE_OFFSET +#include "kaleidoscope/keymaps.h" // for keyFromKeymap +#include "kaleidoscope/keyswitch_state.h" // for keyToggledOn +#include "kaleidoscope/layers.h" // for Layer_, Layer, Laye... +#include "kaleidoscope_internal/device.h" // for device // The maximum number of layers allowed. #define MAX_LAYERS 32; diff --git a/src/kaleidoscope/layers.h b/src/kaleidoscope/layers.h index 9f92d9f2..9cb3320f 100644 --- a/src/kaleidoscope/layers.h +++ b/src/kaleidoscope/layers.h @@ -16,15 +16,18 @@ #pragma once -#include -#include "kaleidoscope/key_defs.h" -#include "kaleidoscope/keymaps.h" -#include "kaleidoscope/KeyEvent.h" -#include "kaleidoscope/device/device.h" -#include "kaleidoscope_internal/device.h" -#include "kaleidoscope_internal/sketch_exploration/sketch_exploration.h" -#include "kaleidoscope_internal/shortname.h" -#include "kaleidoscope_internal/deprecations.h" +#include // for PROGMEM +#include // for uint8_t, int8_t + +#include "kaleidoscope/KeyAddr.h" // for KeyAddr +#include "kaleidoscope/KeyEvent.h" // for KeyEvent +#include "kaleidoscope/device/device.h" // for Device +#include "kaleidoscope/key_defs.h" // for Key +#include "kaleidoscope/keymaps.h" // IWYU pragma: keep +#include "kaleidoscope/macro_helpers.h" // for __NL__ +#include "kaleidoscope_internal/device.h" // for device +#include "kaleidoscope_internal/shortname.h" // for _INIT_HID_GETSHOR... +#include "kaleidoscope_internal/sketch_exploration/sketch_exploration.h" // for _INIT_SKETCH_EXPL... #define START_KEYMAPS __NL__ \ constexpr Key keymaps_linear[][kaleidoscope_internal::device.matrix_rows * kaleidoscope_internal::device.matrix_columns] PROGMEM = { diff --git a/src/kaleidoscope/plugin.h b/src/kaleidoscope/plugin.h index 2c7c1193..4e7a1d53 100644 --- a/src/kaleidoscope/plugin.h +++ b/src/kaleidoscope/plugin.h @@ -16,10 +16,6 @@ #pragma once -#include "kaleidoscope/event_handler_result.h" -#include "kaleidoscope_internal/event_dispatch.h" -#include "kaleidoscope/event_handlers.h" - #if KALEIDOSCOPE_ENABLE_V1_PLUGIN_API #error The V1 plugin API has been removed, please see UPGRADING.md. #endif diff --git a/src/kaleidoscope/plugin/AccessTransientLEDMode.h b/src/kaleidoscope/plugin/AccessTransientLEDMode.h index 5cb353df..82e55c13 100644 --- a/src/kaleidoscope/plugin/AccessTransientLEDMode.h +++ b/src/kaleidoscope/plugin/AccessTransientLEDMode.h @@ -16,6 +16,8 @@ #pragma once +#include // for uint8_t + namespace kaleidoscope { namespace plugin { diff --git a/src/kaleidoscope/plugin/LEDControl.cpp b/src/kaleidoscope/plugin/LEDControl.cpp index 98ff2720..78527bca 100644 --- a/src/kaleidoscope/plugin/LEDControl.cpp +++ b/src/kaleidoscope/plugin/LEDControl.cpp @@ -14,11 +14,18 @@ * this program. If not, see . */ -#include "Kaleidoscope-LEDControl.h" -#include "Kaleidoscope-FocusSerial.h" -#include "kaleidoscope_internal/LEDModeManager.h" -#include "kaleidoscope/keyswitch_state.h" -#include "kaleidoscope/LiveKeys.h" +#include "kaleidoscope/plugin/LEDControl.h" + +#include // for PSTR, strcmp_P +#include // for Focus, FocusSerial + +#include "kaleidoscope/KeyAddrMap.h" // for KeyAddrMap<>::Iter... +#include "kaleidoscope/KeyEvent.h" // for KeyEvent +#include "kaleidoscope/KeyMap.h" // for KeyMap +#include "kaleidoscope/LiveKeys.h" // for LiveKeys, live_keys +#include "kaleidoscope/hooks.h" // for Hooks +#include "kaleidoscope/keyswitch_state.h" // for keyToggledOn +#include "kaleidoscope_internal/LEDModeManager.h" // for LEDModeManager using namespace kaleidoscope::internal; // NOLINT(build/namespaces) diff --git a/src/kaleidoscope/plugin/LEDControl.h b/src/kaleidoscope/plugin/LEDControl.h index 2b119922..595c0031 100644 --- a/src/kaleidoscope/plugin/LEDControl.h +++ b/src/kaleidoscope/plugin/LEDControl.h @@ -16,8 +16,17 @@ #pragma once -#include "kaleidoscope/Runtime.h" -#include "kaleidoscope/plugin/LEDMode.h" +#include // for uint8_t, uint16_t + +#include "kaleidoscope/KeyAddr.h" // for KeyAddr +#include "kaleidoscope/KeyEvent.h" // for KeyEvent +#include "kaleidoscope/Runtime.h" // for Runtime, Runtime_ +#include "kaleidoscope/device/device.h" // for cRGB, Device, Base... +#include "kaleidoscope/event_handler_result.h" // for EventHandlerResult +#include "kaleidoscope/key_defs.h" // for Key, IS_INTERNAL +#include "kaleidoscope/plugin.h" // for Plugin +#include "kaleidoscope/plugin/LEDMode.h" // for LEDMode +#include "kaleidoscope/plugin/LEDModeInterface.h" // for LEDModeInterface constexpr uint8_t LED_TOGGLE = 0b00000001; // Synthetic, internal @@ -28,8 +37,6 @@ constexpr Key Key_LEDToggle = Key(2, KEY_FLAGS | SYNTHETIC | IS_INTERNAL | LED_T namespace kaleidoscope { namespace plugin { -class LEDMode; - class LEDControl : public kaleidoscope::Plugin { public: LEDControl(void); diff --git a/src/kaleidoscope/plugin/LEDControl/LED-Off.cpp b/src/kaleidoscope/plugin/LEDControl/LED-Off.cpp index e6792160..6eb85473 100644 --- a/src/kaleidoscope/plugin/LEDControl/LED-Off.cpp +++ b/src/kaleidoscope/plugin/LEDControl/LED-Off.cpp @@ -16,6 +16,8 @@ #include "kaleidoscope/plugin/LEDControl/LED-Off.h" +#include "kaleidoscope/plugin/LEDControl.h" // for LEDControl + namespace kaleidoscope { namespace plugin { void LEDOff::onActivate(void) { diff --git a/src/kaleidoscope/plugin/LEDControl/LED-Off.h b/src/kaleidoscope/plugin/LEDControl/LED-Off.h index 3acfffad..7c208081 100644 --- a/src/kaleidoscope/plugin/LEDControl/LED-Off.h +++ b/src/kaleidoscope/plugin/LEDControl/LED-Off.h @@ -16,7 +16,8 @@ #pragma once -#include "Kaleidoscope-LEDControl.h" +#include "kaleidoscope/KeyAddr.h" // for KeyAddr +#include "kaleidoscope/plugin/LEDMode.h" // for LEDMode namespace kaleidoscope { namespace plugin { diff --git a/src/kaleidoscope/plugin/LEDControl/LEDUtils.cpp b/src/kaleidoscope/plugin/LEDControl/LEDUtils.cpp index 57c422da..dca9e84e 100644 --- a/src/kaleidoscope/plugin/LEDControl/LEDUtils.cpp +++ b/src/kaleidoscope/plugin/LEDControl/LEDUtils.cpp @@ -16,6 +16,8 @@ #include "kaleidoscope/plugin/LEDControl/LEDUtils.h" +#include "kaleidoscope/Runtime.h" // for Runtime, Runtime_ + cRGB breath_compute(uint8_t hue, uint8_t saturation, uint8_t phase_offset) { diff --git a/src/kaleidoscope/plugin/LEDControl/LEDUtils.h b/src/kaleidoscope/plugin/LEDControl/LEDUtils.h index ed8ffdcf..3e11ab53 100644 --- a/src/kaleidoscope/plugin/LEDControl/LEDUtils.h +++ b/src/kaleidoscope/plugin/LEDControl/LEDUtils.h @@ -16,7 +16,9 @@ #pragma once -#include "kaleidoscope/Runtime.h" +#include // for uint16_t, uint8_t + +#include "kaleidoscope/device/device.h" // for cRGB cRGB breath_compute(uint8_t hue = 170, uint8_t saturation = 255, uint8_t phase_offset = 0); cRGB hsvToRgb(uint16_t h, uint16_t s, uint16_t v); diff --git a/src/kaleidoscope/plugin/LEDMode.h b/src/kaleidoscope/plugin/LEDMode.h index e8678018..43e8b1ff 100644 --- a/src/kaleidoscope/plugin/LEDMode.h +++ b/src/kaleidoscope/plugin/LEDMode.h @@ -16,9 +16,11 @@ #pragma once -#include "kaleidoscope/plugin.h" -#include "kaleidoscope/plugin/AccessTransientLEDMode.h" -#include "kaleidoscope/plugin/LEDModeInterface.h" +#include "kaleidoscope/KeyAddr.h" // for KeyAddr +#include "kaleidoscope/event_handler_result.h" // for EventHandlerResult +#include "kaleidoscope/plugin.h" // for Plugin +#include "kaleidoscope/plugin/AccessTransientLEDMode.h" // IWYU pragma: keep +#include "kaleidoscope/plugin/LEDModeInterface.h" // for LEDModeInterface namespace kaleidoscope { diff --git a/src/kaleidoscope/plugin/LEDModeInterface.cpp b/src/kaleidoscope/plugin/LEDModeInterface.cpp index 6205f0eb..d74ab692 100644 --- a/src/kaleidoscope/plugin/LEDModeInterface.cpp +++ b/src/kaleidoscope/plugin/LEDModeInterface.cpp @@ -15,8 +15,8 @@ */ -#include -#include +#include // for LEDControl +#include // for LEDModeInterface namespace kaleidoscope { namespace plugin { diff --git a/src/kaleidoscope/progmem_helpers.h b/src/kaleidoscope/progmem_helpers.h index 012564af..33e616d8 100644 --- a/src/kaleidoscope/progmem_helpers.h +++ b/src/kaleidoscope/progmem_helpers.h @@ -17,6 +17,8 @@ #pragma once +#include // for memcpy_P + // Load any intrinsic data type or trivial class stored in PROGMEM into an // object of that type in memory. template diff --git a/src/kaleidoscope/util/crc16.h b/src/kaleidoscope/util/crc16.h index 7c6a925c..4ff17823 100644 --- a/src/kaleidoscope/util/crc16.h +++ b/src/kaleidoscope/util/crc16.h @@ -33,7 +33,7 @@ #pragma once -#include +#include // for uint16_t, uint8_t static inline uint16_t _crc16_update(uint16_t crc, uint8_t data) __attribute__((always_inline, unused)); static inline uint16_t _crc16_update(uint16_t crc, uint8_t data) { diff --git a/src/kaleidoscope/util/flasher/Base.h b/src/kaleidoscope/util/flasher/Base.h index 839f4bed..a485e29a 100644 --- a/src/kaleidoscope/util/flasher/Base.h +++ b/src/kaleidoscope/util/flasher/Base.h @@ -18,6 +18,8 @@ #pragma once +#include // for uint8_t + namespace kaleidoscope { namespace util { namespace flasher { diff --git a/src/kaleidoscope/util/flasher/KeyboardioI2CBootloader.h b/src/kaleidoscope/util/flasher/KeyboardioI2CBootloader.h index 88f789bc..01febf29 100644 --- a/src/kaleidoscope/util/flasher/KeyboardioI2CBootloader.h +++ b/src/kaleidoscope/util/flasher/KeyboardioI2CBootloader.h @@ -21,10 +21,11 @@ // TODO(@algernon): We should support AVR here, too. #ifdef __SAMD21G18A__ +#include #include -#include "kaleidoscope/util/flasher/Base.h" #include "kaleidoscope/util/crc16.h" +#include "kaleidoscope/util/flasher/Base.h" namespace kaleidoscope { namespace util { diff --git a/src/kaleidoscope_internal/LEDModeManager.cpp b/src/kaleidoscope_internal/LEDModeManager.cpp index c3e9ab78..513ef1bc 100644 --- a/src/kaleidoscope_internal/LEDModeManager.cpp +++ b/src/kaleidoscope_internal/LEDModeManager.cpp @@ -15,7 +15,8 @@ */ #include "kaleidoscope_internal/LEDModeManager.h" -#include "kaleidoscope/plugin/LEDMode.h" + +#include "kaleidoscope/plugin/LEDMode.h" // for LEDMode namespace kaleidoscope { namespace internal { diff --git a/src/kaleidoscope_internal/LEDModeManager.h b/src/kaleidoscope_internal/LEDModeManager.h index 835ffca6..1edec09a 100644 --- a/src/kaleidoscope_internal/LEDModeManager.h +++ b/src/kaleidoscope_internal/LEDModeManager.h @@ -16,12 +16,17 @@ #pragma once -#include "kaleidoscope_internal/array_like_storage.h" -#include "kaleidoscope/plugin.h" -#include "kaleidoscope/plugin/LEDMode.h" -#include "kaleidoscope_internal/type_traits/has_method.h" - -#include +#include // for PROGMEM +#include // for size_t +#include // for uint8_t +// IWYU pragma: no_include + +#include "kaleidoscope/macro_helpers.h" // for __NL__ +#include "kaleidoscope/plugin.h" // for Plugin +#include "kaleidoscope/plugin/LEDMode.h" // for LEDMode +#include "kaleidoscope/plugin/LEDModeInterface.h" // for LEDModeInt... +#include "kaleidoscope_internal/array_like_storage.h" // IWYU pragma: keep +#include "kaleidoscope_internal/type_traits/has_method.h" // for DEFINE_HAS... #if defined(KALEIDOSCOPE_VIRTUAL_BUILD) || defined(ARDUINO_ARCH_STM32) #include diff --git a/src/kaleidoscope_internal/array_like_storage.h b/src/kaleidoscope_internal/array_like_storage.h index 6001126b..8e72de0b 100644 --- a/src/kaleidoscope_internal/array_like_storage.h +++ b/src/kaleidoscope_internal/array_like_storage.h @@ -16,7 +16,7 @@ #pragma once -#include +#include // for uint8_t namespace kaleidoscope { namespace internal { diff --git a/src/kaleidoscope_internal/event_dispatch.h b/src/kaleidoscope_internal/event_dispatch.h index 747dc270..0e58d9d4 100644 --- a/src/kaleidoscope_internal/event_dispatch.h +++ b/src/kaleidoscope_internal/event_dispatch.h @@ -33,11 +33,10 @@ #pragma once +#include "kaleidoscope/event_handlers.h" #include "kaleidoscope/macro_helpers.h" #include "kaleidoscope/plugin.h" -#include "kaleidoscope/hooks.h" #include "kaleidoscope_internal/eventhandler_signature_check.h" -#include "kaleidoscope/event_handlers.h" #include "kaleidoscope_internal/sketch_exploration/sketch_exploration.h" // Some words about the design of hook routing: diff --git a/src/kaleidoscope_internal/eventhandler_signature_check.h b/src/kaleidoscope_internal/eventhandler_signature_check.h index 17616fca..117e70c3 100644 --- a/src/kaleidoscope_internal/eventhandler_signature_check.h +++ b/src/kaleidoscope_internal/eventhandler_signature_check.h @@ -16,10 +16,10 @@ #pragma once -#include "kaleidoscope/macro_helpers.h" -#include "kaleidoscope/plugin.h" -#include "kaleidoscope_internal/type_traits/has_member.h" -#include "kaleidoscope_internal/type_traits/has_method.h" +#include "kaleidoscope/event_handlers.h" // for _PROCESS_E... +#include "kaleidoscope/macro_helpers.h" // for __NL__ +#include "kaleidoscope_internal/type_traits/has_member.h" // for DEFINE_HAS... +#include "kaleidoscope_internal/type_traits/has_method.h" // for DEFINE_HAS... // ************************************************************************* // ************************************************************************* diff --git a/src/kaleidoscope_internal/sketch_exploration/keymap_exploration.h b/src/kaleidoscope_internal/sketch_exploration/keymap_exploration.h index d5ad3f86..eb49fc0f 100644 --- a/src/kaleidoscope_internal/sketch_exploration/keymap_exploration.h +++ b/src/kaleidoscope_internal/sketch_exploration/keymap_exploration.h @@ -16,7 +16,10 @@ #pragma once -#include "kaleidoscope/key_defs.h" +#include // for uint8_t + +#include "kaleidoscope/KeyAddr.h" // for KeyAddr +#include "kaleidoscope/key_defs.h" // for Key, Key_NoKey namespace kaleidoscope { // NOLINT(build/namespaces) namespace sketch_exploration { // NOLINT(build/namespaces) @@ -175,11 +178,6 @@ struct HasKey { Key k_; }; -// This class is actually defined and implemented in _INIT_KEYMAP_EXPLORATION -// which is invoked by KALEIDOSCOPE_INIT_PLUGINS -// -class KeymapInterface; - extern void pluginsExploreSketch(); //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! diff --git a/src/kaleidoscope_internal/sketch_exploration/plugin_exploration.h b/src/kaleidoscope_internal/sketch_exploration/plugin_exploration.h index afb20bb6..e2085454 100644 --- a/src/kaleidoscope_internal/sketch_exploration/plugin_exploration.h +++ b/src/kaleidoscope_internal/sketch_exploration/plugin_exploration.h @@ -16,7 +16,8 @@ #pragma once -#include "kaleidoscope_internal/type_traits/type_traits" +#include "kaleidoscope_internal/type_traits/type_traits" // IWYU pragma: keep +// IWYU pragma: no_include namespace kaleidoscope { namespace sketch_exploration { diff --git a/src/kaleidoscope_internal/sketch_exploration/sketch_exploration.cpp b/src/kaleidoscope_internal/sketch_exploration/sketch_exploration.cpp index d4ea8cf7..6338c377 100644 --- a/src/kaleidoscope_internal/sketch_exploration/sketch_exploration.cpp +++ b/src/kaleidoscope_internal/sketch_exploration/sketch_exploration.cpp @@ -15,7 +15,6 @@ */ namespace kaleidoscope { -\ namespace sketch_exploration { // This empty weak symbol is necessary if the KEYMAP(...) macro diff --git a/src/kaleidoscope_internal/sketch_exploration/sketch_exploration.h b/src/kaleidoscope_internal/sketch_exploration/sketch_exploration.h index 9fd9b5ad..75dd6760 100644 --- a/src/kaleidoscope_internal/sketch_exploration/sketch_exploration.h +++ b/src/kaleidoscope_internal/sketch_exploration/sketch_exploration.h @@ -17,7 +17,7 @@ #pragma once #include "kaleidoscope_internal/sketch_exploration/keymap_exploration.h" -#include "kaleidoscope_internal/sketch_exploration/plugin_exploration.h" +#include "kaleidoscope_internal/sketch_exploration/plugin_exploration.h" // IWYU pragma: keep //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! // Read carefully diff --git a/src/kaleidoscope_internal/type_traits/has_member.h b/src/kaleidoscope_internal/type_traits/has_member.h index a36cb1a5..62de2755 100644 --- a/src/kaleidoscope_internal/type_traits/has_member.h +++ b/src/kaleidoscope_internal/type_traits/has_member.h @@ -16,7 +16,7 @@ #pragma once -#include "kaleidoscope/macro_helpers.h" +#include "kaleidoscope/macro_helpers.h" // for __NL__ // The following code has been stolen from // diff --git a/src/kaleidoscope_internal/type_traits/has_method.h b/src/kaleidoscope_internal/type_traits/has_method.h index 80222431..a0961543 100644 --- a/src/kaleidoscope_internal/type_traits/has_method.h +++ b/src/kaleidoscope_internal/type_traits/has_method.h @@ -16,7 +16,7 @@ #pragma once -#include "kaleidoscope/macro_helpers.h" +#include "kaleidoscope/macro_helpers.h" // for __NL__, UNWRAP, ADD_TEMPLATE... #define DEFINE_HAS_METHOD_TRAITS(PREFIX, \ TMPL_PARAM_TYPE_LIST, TMPL_PARAM_LIST, \