From eabbc69a66ab7856ecd27a1d15a4008a07841b03 Mon Sep 17 00:00:00 2001 From: midilab Date: Mon, 4 Dec 2017 08:52:56 -0200 Subject: [PATCH] Added play time support along with elapsed time support code. --- src/uClock.cpp | 8 ++++++++ src/uClock.h | 3 ++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/uClock.cpp b/src/uClock.cpp index 7b0ca8f..d769f2b 100755 --- a/src/uClock.cpp +++ b/src/uClock.cpp @@ -58,6 +58,7 @@ void uClockClass::init() indiv96th_counter = 0; inmod6_counter = 0; pll_x = 220; + start_timer = 0; // // Configure timers and prescale @@ -113,6 +114,8 @@ void uClockClass::start() void uClockClass::stop() { + start_timer = 0; + if (mode == INTERNAL_CLOCK) { state = PAUSED; } else { @@ -315,6 +318,11 @@ uint32_t uClockClass::getNowTimer() return _timer; } +uint32_t uClockClass::getPlayTime() +{ + return start_timer; +} + } } // end namespace umodular::clock umodular::clock::uClockClass uClock; diff --git a/src/uClock.h b/src/uClock.h index ab89487..f00250d 100755 --- a/src/uClock.h +++ b/src/uClock.h @@ -119,7 +119,8 @@ class uClockClass { uint8_t getNumberOfMinutes(uint32_t time); uint8_t getNumberOfHours(uint32_t time); uint8_t getNumberOfDays(uint32_t time); - uint32_t uClockClass::getNowTimer(); + uint32_t getNowTimer(); + uint32_t getPlayTime(); };