From 8abe98e1a21457ce01a25184066dff5f640718c6 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Fri, 22 Feb 2019 14:28:55 +0100 Subject: ptalog: Add GPIO-based synchronization functions --- include/object/ptalog.h | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'include') 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 -- cgit v1.2.3