Enabled virtual build for Keyboardio/Model01

The Model01.h required some reordering of header includes
and some forward defines of certain types that are
used in property classes.

Signed-off-by: Florian Fleissner <florian.fleissner@inpartik.de>
pull/650/head
Florian Fleissner 5 years ago
parent c590bea35b
commit b5c9794626

@ -17,7 +17,7 @@
#pragma once
#ifdef __AVR__
#if defined(__AVR__) || defined(KALEIDOSCOPE_VIRTUAL_BUILD)
#include <Arduino.h>
#include "kaleidoscope/device/Base.h"
@ -46,6 +46,7 @@ struct ATmega32U4KeyboardProps : kaleidoscope::device::BaseProps {
typedef kaleidoscope::driver::storage::AVREEPROM<StorageProps> Storage;
};
#ifndef KALEIDOSCOPE_VIRTUAL_BUILD
template <typename _DeviceProps>
class ATmega32U4Keyboard : public kaleidoscope::device::Base<_DeviceProps> {
public:
@ -53,6 +54,10 @@ class ATmega32U4Keyboard : public kaleidoscope::device::Base<_DeviceProps> {
return Serial;
}
};
#else // ifndef KALEIDOSCOPE_VIRTUAL_BUILD
template <typename _DeviceProps>
class ATmega32U4Keyboard;
#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD
}
}

@ -16,11 +16,13 @@
*/
#ifdef ARDUINO_AVR_MODEL01
#ifndef KALEIDOSCOPE_VIRTUAL_BUILD
#include <Kaleidoscope.h>
#ifndef KALEIDOSCOPE_VIRTUAL_BUILD
#include <KeyboardioHID.h>
#include <avr/wdt.h>
#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD
namespace kaleidoscope {
namespace device {
@ -28,6 +30,8 @@ namespace keyboardio {
constexpr uint8_t Model01LEDDriverProps::key_led_map[] PROGMEM;
#ifndef KALEIDOSCOPE_VIRTUAL_BUILD
/********* Model01Hands *********/
struct Model01Hands {
@ -293,9 +297,9 @@ void Model01::enableHardwareTestMode() {
KeyScanner::setKeyscanInterval(2);
}
#endif
}
}
}
#endif
#endif

@ -21,15 +21,24 @@
#include <Arduino.h>
#include "Kaleidoscope-HIDAdaptor-KeyboardioHID.h"
#include "KeyboardioScanner.h"
#define CRGB(r,g,b) (cRGB){b, g, r}
struct cRGB {
uint8_t b;
uint8_t g;
uint8_t r;
};
#include "kaleidoscope/device/ATmega32U4Keyboard.h"
#include "kaleidoscope/driver/keyscanner/Base.h"
#include "kaleidoscope/driver/led/Base.h"
#include "Kaleidoscope-HIDAdaptor-KeyboardioHID.h"
#include "kaleidoscope/driver/bootloader/avr/Caterina.h"
#include "kaleidoscope/device/ATmega32U4Keyboard.h"
#ifndef KALEIDOSCOPE_VIRTUAL_BUILD
#include "KeyboardioScanner.h"
#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD
namespace kaleidoscope {
namespace device {
@ -45,6 +54,7 @@ struct Model01LEDDriverProps : public kaleidoscope::driver::led::BaseProps {
};
};
#ifndef KALEIDOSCOPE_VIRTUAL_BUILD
class Model01LEDDriver : public kaleidoscope::driver::led::Base<Model01LEDDriverProps> {
public:
static void syncLeds();
@ -57,11 +67,15 @@ class Model01LEDDriver : public kaleidoscope::driver::led::Base<Model01LEDDriver
private:
static bool isLEDChanged;
};
#else // ifndef KALEIDOSCOPE_VIRTUAL_BUILD
class Model01LEDDriver;
#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD
struct Model01KeyScannerProps : public kaleidoscope::driver::keyscanner::BaseProps {
KEYSCANNER_PROPS(4, 16);
};
#ifndef KALEIDOSCOPE_VIRTUAL_BUILD
class Model01KeyScanner : public kaleidoscope::driver::keyscanner::Base<Model01KeyScannerProps> {
private:
typedef Model01KeyScanner ThisType;
@ -96,8 +110,11 @@ class Model01KeyScanner : public kaleidoscope::driver::keyscanner::Base<Model01K
static void actOnHalfRow(byte row, byte colState, byte colPrevState, byte startPos);
static void enableScannerPower();
};
#else // ifndef KALEIDOSCOPE_VIRTUAL_BUILD
class Model01KeyScanner;
#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD
struct Model01Props : kaleidoscope::device::ATmega32U4KeyboardProps {
struct Model01Props : public kaleidoscope::device::ATmega32U4KeyboardProps {
typedef Model01LEDDriverProps LEDDriverProps;
typedef Model01LEDDriver LEDDriver;
typedef Model01KeyScannerProps KeyScannerProps;
@ -105,6 +122,8 @@ struct Model01Props : kaleidoscope::device::ATmega32U4KeyboardProps {
typedef kaleidoscope::driver::bootloader::avr::Caterina BootLoader;
};
#ifndef KALEIDOSCOPE_VIRTUAL_BUILD
class Model01 : public kaleidoscope::device::ATmega32U4Keyboard<Model01Props> {
public:
static void setup();
@ -112,8 +131,10 @@ class Model01 : public kaleidoscope::device::ATmega32U4Keyboard<Model01Props> {
static void enableHardwareTestMode();
};
}
}
#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD
} // namespace keyboardio
} // namespace device
EXPORT_DEVICE(kaleidoscope::device::keyboardio::Model01)

@ -18,7 +18,7 @@
Modified 2012 by Todd Krein (todd@krein.org) to implement repeated starts
*/
#ifdef __AVR__
#if defined(__AVR__) && !defined(KALEIDOSCOPE_VIRTUAL_BUILD)
#define ENABLE_TWI_SLAVE_MODE 0

@ -21,6 +21,8 @@
#ifndef twi_h
#define twi_h
#ifndef KALEIDOSCOPE_VIRTUAL_BUILD
#include <inttypes.h>
//#define ATMEGA8
@ -52,5 +54,6 @@ void twi_reply(uint8_t);
void twi_stop(void);
void twi_releaseBus(void);
#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD
#endif
#endif

@ -23,6 +23,7 @@ namespace kaleidoscope {
namespace driver {
namespace mcu {
#ifndef KALEIDOSCOPE_VIRTUAL_BUILD
class ATmega32U4 : public kaleidoscope::driver::mcu::Base {
public:
void detachFromHost() {
@ -62,6 +63,9 @@ class ATmega32U4 : public kaleidoscope::driver::mcu::Base {
void setup() {}
};
#else
typedef Base ATmega32U4;
#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD
}
}

Loading…
Cancel
Save