Enabled virtual build for KBDFans/KBD4x

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

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

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

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

@ -20,6 +20,7 @@
#ifndef KALEIDOSCOPE_VIRTUAL_BUILD #ifndef KALEIDOSCOPE_VIRTUAL_BUILD
#include <avr/wdt.h> #include <avr/wdt.h>
#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD #endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD
#include "kaleidoscope/driver/bootloader/None.h"
#include "kaleidoscope/driver/bootloader/Base.h" #include "kaleidoscope/driver/bootloader/Base.h"
namespace kaleidoscope { namespace kaleidoscope {
@ -53,7 +54,7 @@ class Caterina : public kaleidoscope::driver::bootloader::Base {
} }
}; };
#else // ifndef KALEIDOSCOPE_VIRTUAL_BUILD #else // ifndef KALEIDOSCOPE_VIRTUAL_BUILD
class Caterina; typedef bootloader::None Caterina;
#endif // #ifndef KALEIDOSCOPE_VIRTUAL_BUILD #endif // #ifndef KALEIDOSCOPE_VIRTUAL_BUILD
} }

@ -25,6 +25,7 @@
#endif #endif
#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD #endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD
#include "kaleidoscope/driver/bootloader/None.h"
#include "kaleidoscope/driver/bootloader/Base.h" #include "kaleidoscope/driver/bootloader/Base.h"
namespace kaleidoscope { namespace kaleidoscope {
@ -38,7 +39,7 @@ class FLIP : public kaleidoscope::driver::bootloader::Base {
static void rebootBootloader(); static void rebootBootloader();
}; };
#else // ifndef KALEIDOSCOPE_VIRTUAL_BUILD #else // ifndef KALEIDOSCOPE_VIRTUAL_BUILD
class FLIP; typedef bootloader::None FLIP;
#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD #endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD
} }

@ -20,6 +20,7 @@
#ifndef KALEIDOSCOPE_VIRTUAL_BUILD #ifndef KALEIDOSCOPE_VIRTUAL_BUILD
#include <avr/wdt.h> #include <avr/wdt.h>
#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD #endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD
#include "kaleidoscope/driver/bootloader/None.h"
#include "kaleidoscope/driver/bootloader/Base.h" #include "kaleidoscope/driver/bootloader/Base.h"
namespace kaleidoscope { namespace kaleidoscope {
@ -69,7 +70,7 @@ class HalfKay : public kaleidoscope::driver::bootloader::Base {
} }
}; };
#else #else
class HalfKay; typedef bootloader::None HalfKay;
#endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD #endif // ifndef KALEIDOSCOPE_VIRTUAL_BUILD
} }

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

Loading…
Cancel
Save