summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2019-02-22 14:28:55 +0100
committerDaniel Friesel <derf@finalrewind.org>2019-02-22 14:28:55 +0100
commit8abe98e1a21457ce01a25184066dff5f640718c6 (patch)
tree4eaf4767ae31954453a4a95e96cbc15a656401d6
parentec36f93ef364f4f7724a459539dcd10daaea3420 (diff)
ptalog: Add GPIO-based synchronization functions
-rw-r--r--include/object/ptalog.h22
1 files changed, 17 insertions, 5 deletions
diff --git a/include/object/ptalog.h b/include/object/ptalog.h
index 6b00e78..f53dcc5 100644
--- a/include/object/ptalog.h
+++ b/include/object/ptalog.h
@@ -13,25 +13,26 @@ class PTALog {
log_entry log[32];
uint8_t log_index;
- PTALog() : log_index(0) {}
+ PTALog(uint8_t pin_number) : log_index(0), sync_pin(pin_number) {}
- void passTransition(uint8_t transition_id)
+ inline void passTransition(uint8_t transition_id)
{
log[log_index].transition_id = transition_id;
log_index++;
}
- void reset()
+ inline void reset()
{
log_index = 0;
}
- void startBenchmark(uint8_t id)
+ inline void startBenchmark(uint8_t id)
{
kout << "[PTA] benchmark start, id=" << dec << id << endl;
+ gpio.output(sync_pin);
}
- void stopBenchmark()
+ inline void stopBenchmark()
{
kout << "[PTA] benchmark stop" << endl;
}
@@ -44,8 +45,19 @@ class PTALog {
}
}
+ inline void startTransition()
+ {
+ gpio.write(sync_pin, 1);
+ }
+
+ inline void stopTransition()
+ {
+ gpio.write(sync_pin, 0);
+ }
+
private:
PTALog(const PTALog& copy);
+ uint8_t sync_pin;
};
#endif