You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
61 lines
2.2 KiB
61 lines
2.2 KiB
5 years ago
|
/* -*- mode: c++ -*-
|
||
5 years ago
|
* device::ATmega32U4Keyboard -- Generic ATmega32U4 keyboard base class
|
||
5 years ago
|
* Copyright (C) 2019 Keyboard.io, Inc
|
||
|
*
|
||
|
* This program is free software: you can redistribute it and/or modify
|
||
|
* it under the terms of version 3 of the GNU General Public License as
|
||
|
* published by the Free Software Foundation.
|
||
|
*
|
||
|
* This program is distributed in the hope that it will be useful,
|
||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
|
* GNU General Public License for more details.
|
||
|
*
|
||
|
* You should have received a copy of the GNU General Public License
|
||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||
|
*/
|
||
|
|
||
|
#pragma once
|
||
|
|
||
|
#ifdef __AVR__
|
||
|
|
||
|
#include <Arduino.h>
|
||
|
#include "kaleidoscope/device/Base.h"
|
||
|
|
||
5 years ago
|
#include "kaleidoscope/driver/mcu/ATmega32U4.h"
|
||
|
#include "kaleidoscope/driver/keyscanner/ATmega.h"
|
||
|
#include "kaleidoscope/driver/storage/ATmega32U4EEPROMProps.h"
|
||
5 years ago
|
#include "kaleidoscope/driver/storage/AVREEPROM.h"
|
||
|
|
||
|
#define ATMEGA32U4_KEYBOARD(BOARD_, BOOTLOADER_, ROW_PINS_, COL_PINS_) \
|
||
5 years ago
|
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_)); \
|
||
5 years ago
|
}; \
|
||
5 years ago
|
typedef kaleidoscope::driver::keyscanner::ATmega<KeyScannerProps> KeyScanner; \
|
||
5 years ago
|
typedef kaleidoscope::driver::bootloader::avr::BOOTLOADER_ BootLoader; \
|
||
|
}; \
|
||
5 years ago
|
class BOARD_: public kaleidoscope::device::ATmega32U4Keyboard<BOARD_##Props> {};
|
||
5 years ago
|
|
||
|
namespace kaleidoscope {
|
||
|
namespace device {
|
||
|
|
||
5 years ago
|
struct ATmega32U4KeyboardProps : kaleidoscope::device::BaseProps {
|
||
|
typedef kaleidoscope::driver::mcu::ATmega32U4 MCU;
|
||
|
typedef kaleidoscope::driver::storage::ATmega32U4EEPROMProps StorageProps;
|
||
5 years ago
|
typedef kaleidoscope::driver::storage::AVREEPROM<StorageProps> Storage;
|
||
|
};
|
||
|
|
||
|
template <typename _DeviceProps>
|
||
5 years ago
|
class ATmega32U4Keyboard : public kaleidoscope::device::Base<_DeviceProps> {
|
||
5 years ago
|
public:
|
||
|
auto serialPort() -> decltype(Serial) & {
|
||
|
return Serial;
|
||
|
}
|
||
|
};
|
||
|
|
||
|
}
|
||
|
}
|
||
|
|
||
|
#endif
|