Merge pull request #650 from CapeLeidokos/pr_virtual_build_fix

Fixed virtual builds
pull/594/head
Jesse Vincent 5 years ago committed by GitHub
commit edb30f5105
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -17,7 +17,7 @@
#pragma once
#ifdef __AVR__
#if defined(__AVR__) || defined(KALEIDOSCOPE_VIRTUAL_BUILD)
#include <Arduino.h>
#include "kaleidoscope/device/Base.h"
@ -27,16 +27,44 @@
#include "kaleidoscope/driver/storage/ATmega32U4EEPROMProps.h"
#include "kaleidoscope/driver/storage/AVREEPROM.h"
#define ATMEGA32U4_KEYBOARD(BOARD_, BOOTLOADER_, ROW_PINS_, COL_PINS_) \
struct BOARD_##Props : kaleidoscope::device::ATmega32U4KeyboardProps { \
struct KeyScannerProps : public kaleidoscope::driver::keyscanner::ATmegaProps { \
ATMEGA_KEYSCANNER_PROPS(ROW_PIN_LIST(ROW_PINS_), COL_PIN_LIST(COL_PINS_)); \
}; \
typedef kaleidoscope::driver::keyscanner::ATmega<KeyScannerProps> KeyScanner; \
typedef kaleidoscope::driver::bootloader::avr::BOOTLOADER_ BootLoader; \
}; \
#define ATMEGA32U4_DEVICE_PROPS(BOARD_, BOOTLOADER_, ROW_PINS_, COL_PINS_) \
struct BOARD_##Props : kaleidoscope::device::ATmega32U4KeyboardProps { \
struct KeyScannerProps \
: public kaleidoscope::driver::keyscanner::ATmegaProps \
{ \
ATMEGA_KEYSCANNER_PROPS(ROW_PIN_LIST(ROW_PINS_), \
COL_PIN_LIST(COL_PINS_)); \
}; \
typedef kaleidoscope::driver::keyscanner::ATmega<KeyScannerProps> KeyScanner;\
typedef kaleidoscope::driver::bootloader::avr::BOOTLOADER_ BootLoader; \
};
#define ATMEGA32U4_DEVICE(BOARD_) \
class BOARD_: public kaleidoscope::device::ATmega32U4Keyboard<BOARD_##Props> {};
#define FORWARD(...) __VA_ARGS__
#ifndef KALEIDOSCOPE_VIRTUAL_BUILD
#define ATMEGA32U4_KEYBOARD(BOARD_, BOOTLOADER_, ROW_PINS_, COL_PINS_) \
ATMEGA32U4_DEVICE_PROPS(BOARD_, BOOTLOADER_, \
FORWARD(ROW_PINS_), FORWARD(COL_PINS_)) \
ATMEGA32U4_DEVICE(BOARD_)
#else // ifndef KALEIDOSCOPE_VIRTUAL_BUILD
#define ATMEGA32U4_KEYBOARD(BOARD_, BOOTLOADER_, ROW_PINS_, COL_PINS_) \
ATMEGA32U4_DEVICE_PROPS(BOARD_, BOOTLOADER_, \
FORWARD(ROW_PINS_), FORWARD(COL_PINS_)) \
/* Device definition omitted for virtual device builds. \
* We need to forward declare the device name, though, as there are \
* some legacy extern references to boards whose definition \
* depends on this. \
*/ \
class BOARD_;
#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD
namespace kaleidoscope {
namespace device {
@ -46,6 +74,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 +82,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
}
}

@ -21,7 +21,7 @@
#pragma once
#ifndef __ASSEMBLER__
#if !defined(__ASSEMBLER__) && !defined(KALEIDOSCOPE_VIRTUAL_BUILD)
#include <avr/io.h>
#endif
#define PORT_SHIFTER 4 // this may be 4 for all AVR chips
@ -55,13 +55,22 @@
#define PINC_ADDRESS 0x3
#define PINB_ADDRESS 0x6
#define PINA_ADDRESS 0x9
#else
#elif !defined(KALEIDOSCOPE_VIRTUAL_BUILD)
#error "Pins are not defined"
#endif
/* I/O pins */
#ifndef KALEIDOSCOPE_VIRTUAL_BUILD
#define PINDEF(port, pin) ((PIN##port##_ADDRESS << PORT_SHIFTER) | pin)
#else // ifndef KALEIDOSCOPE_VIRTUAL_BUILD
#define PINDEF(port, pin) 0
#define PORTA
#define PORTB
#define PORTC
#define PORTD
#define PORTE
#define PORTF
#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD
#ifdef PORTA
#define PIN_A0 PINDEF(A, 0)
@ -124,7 +133,6 @@
#define PIN_F7 PINDEF(F, 7)
#endif
/* converting pins to ports */
enum { PIN_OFFSET, DDR_OFFSET, PORT_OFFSET};

@ -24,6 +24,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef KALEIDOSCOPE_VIRTUAL_BUILD
#ifdef ARDUINO_AVR_ERGODOX
#include <Kaleidoscope.h>
@ -232,3 +233,4 @@ uint8_t ErgoDox::pressedKeyswitchCount() {
kaleidoscope::device::ez::ErgoDox &ErgoDox = kaleidoscope_internal::device;
#endif
#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD

@ -29,8 +29,6 @@
#include <Arduino.h>
#include "kaleidoscope/device/ez/ErgoDox/ErgoDoxScanner.h"
#include "Kaleidoscope-HIDAdaptor-KeyboardioHID.h"
struct cRGB {
@ -42,6 +40,9 @@ struct cRGB {
#include "kaleidoscope/driver/keyscanner/Base.h"
#include "kaleidoscope/driver/bootloader/avr/HalfKay.h"
#include "kaleidoscope/device/ATmega32U4Keyboard.h"
#ifndef KALEIDOSCOPE_VIRTUAL_BUILD
#include "kaleidoscope/device/ez/ErgoDox/ErgoDoxScanner.h"
#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD
namespace kaleidoscope {
namespace device {
@ -54,6 +55,7 @@ struct ErgoDoxProps : public kaleidoscope::device::ATmega32U4KeyboardProps {
typedef kaleidoscope::driver::bootloader::avr::HalfKay Bootloader;
};
#ifndef KALEIDOSCOPE_VIRTUAL_BUILD
class ErgoDox : public kaleidoscope::device::ATmega32U4Keyboard<ErgoDoxProps> {
public:
ErgoDox(void) {}
@ -93,6 +95,9 @@ class ErgoDox : public kaleidoscope::device::ATmega32U4Keyboard<ErgoDoxProps> {
static void debounceRow(uint8_t change, uint8_t row);
static void readMatrixRow(uint8_t row);
};
#else // ifndef KALEIDOSCOPE_VIRTUAL_BUILD
class ErgoDox;
#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD
#define PER_KEY_DATA_STACKED(dflt, \
/* left hand, spatial positions */ \

@ -23,6 +23,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef KALEIDOSCOPE_VIRTUAL_BUILD
#ifdef ARDUINO_AVR_ERGODOX
#include "kaleidoscope/device/ez/ErgoDox/ErgoDoxScanner.h"
@ -171,3 +172,4 @@ ErgoDoxScanner::reattachExpanderOnError() {
}
#endif
#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD

@ -7,6 +7,7 @@
* Usage: API compatible with I2C Software Library i2cmaster.h
**************************************************************************/
#ifndef KALEIDOSCOPE_VIRTUAL_BUILD
#ifdef ARDUINO_AVR_ERGODOX
#include <inttypes.h>
@ -201,3 +202,4 @@ unsigned char i2c_readNak(void) {
}/* i2c_readNak */
#endif
#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD

@ -15,6 +15,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef KALEIDOSCOPE_VIRTUAL_BUILD
#ifdef ARDUINO_AVR_KBD4X
#include <Kaleidoscope.h>
@ -32,3 +33,4 @@ ATMEGA_KEYSCANNER_BOILERPLATE
kaleidoscope::device::kbdfans::KBD4x &KBD4x = kaleidoscope_internal::device;
#endif
#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD

@ -42,6 +42,7 @@ struct KBD4xProps : kaleidoscope::device::ATmega32U4KeyboardProps {
typedef kaleidoscope::driver::bootloader::avr::FLIP Bootloader;
};
#ifndef KALEIDOSCOPE_VIRTUAL_BUILD
class KBD4x: public kaleidoscope::device::ATmega32U4Keyboard<KBD4xProps> {
public:
KBD4x() {
@ -49,6 +50,9 @@ class KBD4x: public kaleidoscope::device::ATmega32U4Keyboard<KBD4xProps> {
mcu_.disableClockDivision();
}
};
#else // ifndef KALEIDOSCOPE_VIRTUAL_BUILD
class KBD4x;
#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD
#define PER_KEY_DATA(dflt, \
R0C0, R0C1, R0C2, R0C3, R0C4, R0C5, R0C6, R0C7, R0C8, R0C9, R0C10, R0C11, \

@ -33,6 +33,8 @@ namespace keyboardio {
constexpr uint8_t ImagoLEDDriverProps::key_led_map[] PROGMEM;
#ifndef KALEIDOSCOPE_VIRTUAL_BUILD
static constexpr uint8_t CMD_SET_REGISTER = 0xFD;
static constexpr uint8_t CMD_WRITE_ENABLE = 0xFE;
static constexpr uint8_t WRITE_ENABLE_ONCE = 0b11000101;
@ -172,6 +174,8 @@ void Imago::setup() {
kaleidoscope::device::ATmega32U4Keyboard<ImagoProps>::setup();
}
#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD
}
}
}

@ -51,6 +51,7 @@ struct ImagoLEDDriverProps: public kaleidoscope::driver::led::BaseProps {
};
};
#ifndef KALEIDOSCOPE_VIRTUAL_BUILD
class ImagoLEDDriver : public kaleidoscope::driver::led::Base<ImagoLEDDriverProps> {
public:
static void setup();
@ -68,6 +69,9 @@ class ImagoLEDDriver : public kaleidoscope::driver::led::Base<ImagoLEDDriverProp
static void setAllPwmTo(uint8_t);
static void twiSend(uint8_t addr, uint8_t Reg_Add, uint8_t Reg_Dat);
};
#else // ifndef KALEIDOSCOPE_VIRTUAL_BUILD
class ImagoLEDDriver;
#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD
struct ImagoProps : kaleidoscope::device::ATmega32U4KeyboardProps {
struct KeyScannerProps : public kaleidoscope::driver::keyscanner::ATmegaProps {
@ -82,10 +86,12 @@ struct ImagoProps : kaleidoscope::device::ATmega32U4KeyboardProps {
typedef kaleidoscope::driver::bootloader::avr::Caterina BootLoader;
};
#ifndef KALEIDOSCOPE_VIRTUAL_BUILD
class Imago: public kaleidoscope::device::ATmega32U4Keyboard<ImagoProps> {
public:
void setup();
};
#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD
#define PER_KEY_DATA(dflt, \
R0C0, R0C1, R0C2, R0C3, R0C4, R0C5, R0C6, R0C7, R0C8, R0C9, R0C10, R0C11, R0C12, R0C13, R0C14, R0C15, \

@ -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

@ -15,6 +15,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef KALEIDOSCOPE_VIRTUAL_BUILD
#ifdef ARDUINO_AVR_PLANCK
#include <Kaleidoscope.h>
@ -32,3 +33,4 @@ ATMEGA_KEYSCANNER_BOILERPLATE
kaleidoscope::device::olkb::Planck &Planck = kaleidoscope_internal::device;
#endif
#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD

@ -22,6 +22,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef KALEIDOSCOPE_VIRTUAL_BUILD
#ifdef ARDUINO_AVR_SPLITOGRAPHY
#include <Kaleidoscope.h>
@ -39,3 +40,4 @@ ATMEGA_KEYSCANNER_BOILERPLATE
kaleidoscope::device::softhruf::Splitography &Splitography = kaleidoscope_internal::device;
#endif
#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD

@ -49,12 +49,16 @@ struct SplitographyProps : kaleidoscope::device::ATmega32U4KeyboardProps {
typedef kaleidoscope::driver::bootloader::avr::FLIP BootLoader;
};
#ifndef KALEIDOSCOPE_VIRTUAL_BUILD
class Splitography: public kaleidoscope::device::ATmega32U4Keyboard<SplitographyProps> {
public:
Splitography() {
mcu_.disableJTAG();
}
};
#else // ifndef KALEIDOSCOPE_VIRTUAL_BUILD
class Splitography;
#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD
#define PER_KEY_DATA(dflt, \
r0c0 ,r0c1 ,r0c2 ,r0c3 ,r0c4 ,r0c5 ,r0c6 ,r0c7 ,r0c8 ,r0c9 ,r0c10 ,r0c11 \

@ -24,6 +24,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef KALEIDOSCOPE_VIRTUAL_BUILD
#ifdef ARDUINO_AVR_ATREUS
#include <Kaleidoscope.h>
@ -41,3 +42,4 @@ ATMEGA_KEYSCANNER_BOILERPLATE
kaleidoscope::device::technomancy::Atreus &Atreus = kaleidoscope_internal::device;
#endif
#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD

@ -16,6 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef KALEIDOSCOPE_VIRTUAL_BUILD
#ifdef ARDUINO_AVR_ATREUS2
#include <Kaleidoscope.h>
@ -33,3 +34,4 @@ ATMEGA_KEYSCANNER_BOILERPLATE
kaleidoscope::device::technomancy::Atreus2 &Atreus2 = kaleidoscope_internal::device;
#endif
#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD

@ -17,7 +17,10 @@
#pragma once
#ifndef KALEIDOSCOPE_VIRTUAL_BUILD
#include <avr/wdt.h>
#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD
#include "kaleidoscope/driver/bootloader/None.h"
#include "kaleidoscope/driver/bootloader/Base.h"
namespace kaleidoscope {
@ -25,6 +28,7 @@ namespace driver {
namespace bootloader {
namespace avr {
#ifndef KALEIDOSCOPE_VIRTUAL_BUILD
class Caterina : public kaleidoscope::driver::bootloader::Base {
public:
static void rebootBootloader() {
@ -49,6 +53,9 @@ class Caterina : public kaleidoscope::driver::bootloader::Base {
// happens before the watchdog reboots us
}
};
#else // ifndef KALEIDOSCOPE_VIRTUAL_BUILD
typedef bootloader::None Caterina;
#endif // #ifndef KALEIDOSCOPE_VIRTUAL_BUILD
}
}

@ -15,6 +15,7 @@
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef KALEIDOSCOPE_VIRTUAL_BUILD
#include <Kaleidoscope.h>
#ifdef KALEIDOSCOPE_BOOTLOADER_FLIP_WORKAROUND
@ -74,3 +75,4 @@ void FLIP::rebootBootloader() {
}
#endif
#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD

@ -17,12 +17,15 @@
#pragma once
#ifndef KALEIDOSCOPE_VIRTUAL_BUILD
#include <avr/wdt.h>
#ifndef KALEIDOSCOPE_BOOTLOADER_FLIP_WORKAROUND
#error To use the FLIP bootloader driver, KALEIDOSCOPE_BOOTLOADER_FLIP_WORKAROUND *must* be defined prior to including this header!
#endif
#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD
#include "kaleidoscope/driver/bootloader/None.h"
#include "kaleidoscope/driver/bootloader/Base.h"
namespace kaleidoscope {
@ -30,10 +33,14 @@ namespace driver {
namespace bootloader {
namespace avr {
#ifndef KALEIDOSCOPE_VIRTUAL_BUILD
class FLIP : public kaleidoscope::driver::bootloader::Base {
public:
static void rebootBootloader();
};
#else // ifndef KALEIDOSCOPE_VIRTUAL_BUILD
typedef bootloader::None FLIP;
#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD
}
}

@ -17,7 +17,10 @@
#pragma once
#ifndef KALEIDOSCOPE_VIRTUAL_BUILD
#include <avr/wdt.h>
#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD
#include "kaleidoscope/driver/bootloader/None.h"
#include "kaleidoscope/driver/bootloader/Base.h"
namespace kaleidoscope {
@ -25,6 +28,7 @@ namespace driver {
namespace bootloader {
namespace avr {
#ifndef KALEIDOSCOPE_VIRTUAL_BUILD
class HalfKay : public kaleidoscope::driver::bootloader::Base {
public:
// To reset a Teensy with the HalfKay bootloader, we need to disable all
@ -65,6 +69,9 @@ class HalfKay : public kaleidoscope::driver::bootloader::Base {
asm volatile("jmp 0x7E00");
}
};
#else
typedef bootloader::None HalfKay;
#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD
}
}

@ -22,17 +22,26 @@
#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"
#ifndef KALEIDOSCOPE_VIRTUAL_BUILD
#include <avr/wdt.h>
#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD
#define ROW_PIN_LIST(...) __VA_ARGS__
#define COL_PIN_LIST(...) __VA_ARGS__
#ifndef KALEIDOSCOPE_VIRTUAL_BUILD
#define ATMEGA_KEYSCANNER_PROPS(ROW_PINS_, COL_PINS_) \
KEYSCANNER_PROPS(NUM_ARGS(ROW_PINS_), NUM_ARGS(COL_PINS_)); \
static constexpr uint8_t matrix_row_pins[matrix_rows] = ROW_PINS_; \
static constexpr uint8_t matrix_col_pins[matrix_columns] = COL_PINS_;
#else // ifndef KALEIDOSCOPE_VIRTUAL_BUILD
#define ATMEGA_KEYSCANNER_PROPS(ROW_PINS_, COL_PINS_) \
KEYSCANNER_PROPS(NUM_ARGS(ROW_PINS_), NUM_ARGS(COL_PINS_));
#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD
#define ATMEGA_KEYSCANNER_BOILERPLATE \
KEYSCANNER_PROPS_BOILERPLATE(kaleidoscope::Device::KeyScannerProps); \
@ -66,6 +75,8 @@ struct ATmegaProps: kaleidoscope::driver::keyscanner::BaseProps {
static constexpr uint8_t matrix_col_pins[] = {};
};
#ifndef KALEIDOSCOPE_VIRTUAL_BUILD
template <typename _KeyScannerProps>
class ATmega: public kaleidoscope::driver::keyscanner::Base<_KeyScannerProps> {
private:
@ -233,6 +244,10 @@ class ATmega: public kaleidoscope::driver::keyscanner::Base<_KeyScannerProps> {
}
}
};
#else // ifndef KALEIDOSCOPE_VIRTUAL_BUILD
template <typename _KeyScannerProps>
class ATmega : public keyscanner::None {};
#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD
}
}

@ -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
}
}

@ -17,7 +17,7 @@
#pragma once
#ifdef __AVR__
#if defined(__AVR__) || defined(KALEIDOSCOPE_VIRTUAL_BUILD)
#include "kaleidoscope/driver/storage/Base.h"
#include <EEPROM.h>

Loading…
Cancel
Save