|
|
|
@ -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_) \
|
|
|
|
|
#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_)); \
|
|
|
|
|
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::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
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|