mirror of
https://github.com/keyboardio/Kaleidoscope.git
synced 2025-12-12 20:35:54 +01:00
This mixes some manual work (IWYU pragmas, a better solution to the Arduino
preprocessor macros problem) with automated running of the tools. At this
point, it would be too much work to separate these into distinct commits, and
there isn't that much value to doing so.
There are still some things we could do to make things more robust, as some of
the headers need to be in a certain order, which happens to be in the same sort
order used by IWYU (`testing/*` files need to come after certain headers than
include `Arduino.h`), but it's probably not worth the clutter of adding an `#if
1` just to stop IWYU from re-ordering them.
I tried to get `#pragma push_macro("max")/pop_macro("max")` to work, but ended
up getting completely nonsensical compilation errors, so I gave up on it.
Signed-off-by: Michael Richters <gedankenexperimenter@gmail.com>
46 lines
1.4 KiB
C++
46 lines
1.4 KiB
C++
/* -*- mode: c++ -*-
|
|
* Copyright (C) 2020 Eric Paniagua (epaniagua@google.com)
|
|
*
|
|
* This program is free software: you can redistribute it and/or modify it under
|
|
* the terms of the GNU General Public License as published by the Free Software
|
|
* Foundation, version 3.
|
|
*
|
|
* 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/>.
|
|
*/
|
|
|
|
#include "testing/SystemControlReport.h"
|
|
|
|
#include <cstring> // for memcpy
|
|
|
|
#include "kaleidoscope/Runtime.h" // for Runtime, Runtime_
|
|
|
|
namespace kaleidoscope {
|
|
namespace testing {
|
|
|
|
SystemControlReport::SystemControlReport(const void *data) {
|
|
const ReportData &report_data =
|
|
*static_cast<const ReportData *>(data);
|
|
memcpy(&report_data_, &report_data, sizeof(report_data_));
|
|
if (report_data_.key != 0) {
|
|
this->push_back(report_data_.key);
|
|
}
|
|
timestamp_ = Runtime.millisAtCycleStart();
|
|
}
|
|
|
|
uint32_t SystemControlReport::Timestamp() const {
|
|
return timestamp_;
|
|
}
|
|
|
|
uint8_t SystemControlReport::ActiveKeycode() const {
|
|
return report_data_.key;
|
|
}
|
|
|
|
} // namespace testing
|
|
} // namespace kaleidoscope
|