Guard a couple of AVR-specific places with an ifdef

We have a few AVR-specific things which do not have a guard yet, and cause
issues on other architectures. This adds those missing guards to the following
places:

- The `kaleidoscope::Hardware` base class, which is deprecated, but still
exists. As such, it needs to be restricted to AVR devices only (since that's all
it supported, non-AVR devices should use the new APIs).
- `device/keyboardio/twi` are only used by the Imago at the moment, and is
AVR-specific, so guard that too.
- Removed an unneeded include from `driver::bootloader::None`, because it
doesn't need `<avr/wdt.h>`.
- `plugin::FirmwareDump` is now restricted to AVR, because that's the only
architecture we support dumping the firmware on.

Signed-off-by: Gergely Nagy <algernon@keyboard.io>
pull/719/head
Gergely Nagy 5 years ago
parent caaf67f6bb
commit faba5dfdf2
No known key found for this signature in database
GPG Key ID: AC1E90BAC433F68F

@ -21,6 +21,8 @@
#pragma once #pragma once
#ifdef __AVR__
#include "kaleidoscope/MatrixAddr.h" #include "kaleidoscope/MatrixAddr.h"
#include "kaleidoscope_internal/deprecations.h" #include "kaleidoscope_internal/deprecations.h"
@ -402,3 +404,5 @@ class Hardware {
/** @} */ /** @} */
}; };
} }
#endif

@ -18,6 +18,8 @@
Modified 2012 by Todd Krein (todd@krein.org) to implement repeated starts Modified 2012 by Todd Krein (todd@krein.org) to implement repeated starts
*/ */
#ifdef __AVR__
#define ENABLE_TWI_SLAVE_MODE 0 #define ENABLE_TWI_SLAVE_MODE 0
#include <math.h> #include <math.h>
@ -559,3 +561,5 @@ ISR(TWI_vect) {
break; break;
} }
} }
#endif

@ -16,6 +16,8 @@
with this program. If not, see <http://www.gnu.org/licenses/>. with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifdef __AVR__
#ifndef twi_h #ifndef twi_h
#define twi_h #define twi_h
@ -51,3 +53,4 @@ void twi_stop(void);
void twi_releaseBus(void); void twi_releaseBus(void);
#endif #endif
#endif

@ -17,7 +17,6 @@
#pragma once #pragma once
#include <avr/wdt.h>
#include "kaleidoscope/driver/bootloader/Base.h" #include "kaleidoscope/driver/bootloader/Base.h"
namespace kaleidoscope { namespace kaleidoscope {

@ -17,7 +17,7 @@
#pragma once #pragma once
#ifdef ARDUINO_ARCH_AVR #ifdef __AVR__
#include "kaleidoscope/driver/storage/Base.h" #include "kaleidoscope/driver/storage/Base.h"
#include <EEPROM.h> #include <EEPROM.h>

@ -15,6 +15,7 @@
* this program. If not, see <http://www.gnu.org/licenses/>. * this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifdef __AVR__
#ifndef KALEIDOSCOPE_VIRTUAL_BUILD #ifndef KALEIDOSCOPE_VIRTUAL_BUILD
#include <Kaleidoscope-FirmwareDump.h> #include <Kaleidoscope-FirmwareDump.h>
@ -72,3 +73,4 @@ EventHandlerResult FirmwareDump::onFocusEvent(const char *command) {
kaleidoscope::plugin::FirmwareDump FirmwareDump; kaleidoscope::plugin::FirmwareDump FirmwareDump;
#endif #endif
#endif

@ -21,6 +21,8 @@
#error "Firmware Dump is not available for virtual builds" #error "Firmware Dump is not available for virtual builds"
#else #else
#ifdef __AVR__
#include <Kaleidoscope.h> #include <Kaleidoscope.h>
namespace kaleidoscope { namespace kaleidoscope {
@ -42,3 +44,4 @@ class FirmwareDump : public kaleidoscope::Plugin {
extern kaleidoscope::plugin::FirmwareDump FirmwareDump; extern kaleidoscope::plugin::FirmwareDump FirmwareDump;
#endif #endif
#endif

Loading…
Cancel
Save