Add SetCycleTime and CycleTime to control how many ms each cycle take.

pull/946/head
Jesse Vincent 4 years ago
parent b5c744a7cf
commit a646261982
No known key found for this signature in database
GPG Key ID: CC228463465E40BC

@ -23,6 +23,14 @@ namespace kaleidoscope {
namespace testing {
void SimHarness::RunCycle() {
if (CycleTime() > 1) {
// We incrememnt the time before running the loop so that
// millisAtCycleStart ends up where we want it to
for (size_t i = 1; i < CycleTime() ; i++) {
// The current millis implementation gets us 1 milli per call to millis.
millis();
}
}
Kaleidoscope.loop();
}
@ -57,5 +65,14 @@ void SimHarness::Release(uint8_t row, uint8_t col) {
Release(KeyAddr{row, col});
}
void SimHarness::SetCycleTime(uint8_t millis) {
millis_per_cycle = millis;
}
uint8_t SimHarness::CycleTime() {
return millis_per_cycle;
}
} // namespace testing
} // namespace kaleidoscope

@ -34,6 +34,10 @@ class SimHarness {
void Release(KeyAddr key_addr);
void Press(uint8_t row, uint8_t col);
void Release(uint8_t row, uint8_t col);
void SetCycleTime(uint8_t millis);
uint8_t CycleTime();
private:
uint8_t millis_per_cycle = 1;
};
} // namespace testing

Loading…
Cancel
Save