From 25232734f92f824fc086d6b37ede0c4200e04430 Mon Sep 17 00:00:00 2001 From: hathach Date: Wed, 22 Jan 2020 17:18:06 +0700 Subject: [PATCH] add SoftwareTimer setID/getID --- cores/nRF5/utility/SoftwareTimer.cpp | 10 ++++++++++ cores/nRF5/utility/SoftwareTimer.h | 3 +++ 2 files changed, 13 insertions(+) diff --git a/cores/nRF5/utility/SoftwareTimer.cpp b/cores/nRF5/utility/SoftwareTimer.cpp index 9a73706c..f5899a0f 100644 --- a/cores/nRF5/utility/SoftwareTimer.cpp +++ b/cores/nRF5/utility/SoftwareTimer.cpp @@ -39,6 +39,16 @@ void SoftwareTimer::begin(uint32_t ms, TimerCallbackFunction_t callback, void* t _handle = xTimerCreate(NULL, ms2tick(ms), repeating, timerID, callback); } +void SoftwareTimer::setID(void* id) +{ + vTimerSetTimerID(_handle, id); +} + +void* SoftwareTimer::getID(void) +{ + return pvTimerGetTimerID(_handle); +} + bool SoftwareTimer::start(void) { bool ret = true; diff --git a/cores/nRF5/utility/SoftwareTimer.h b/cores/nRF5/utility/SoftwareTimer.h index 24453c49..2216d98e 100644 --- a/cores/nRF5/utility/SoftwareTimer.h +++ b/cores/nRF5/utility/SoftwareTimer.h @@ -50,6 +50,9 @@ class SoftwareTimer void begin(uint32_t ms, TimerCallbackFunction_t callback, void* timerID = NULL, bool repeating = true); TimerHandle_t getHandle(void) { return _handle; } + void setID(void* id); + void* getID(void); + bool start(void); bool stop (void); bool reset (void);