Skip to content

Commit 2523273

Browse files
committed
add SoftwareTimer setID/getID
1 parent d65f1cd commit 2523273

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

cores/nRF5/utility/SoftwareTimer.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,16 @@ void SoftwareTimer::begin(uint32_t ms, TimerCallbackFunction_t callback, void* t
3939
_handle = xTimerCreate(NULL, ms2tick(ms), repeating, timerID, callback);
4040
}
4141

42+
void SoftwareTimer::setID(void* id)
43+
{
44+
vTimerSetTimerID(_handle, id);
45+
}
46+
47+
void* SoftwareTimer::getID(void)
48+
{
49+
return pvTimerGetTimerID(_handle);
50+
}
51+
4252
bool SoftwareTimer::start(void)
4353
{
4454
bool ret = true;

cores/nRF5/utility/SoftwareTimer.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ class SoftwareTimer
5050
void begin(uint32_t ms, TimerCallbackFunction_t callback, void* timerID = NULL, bool repeating = true);
5151
TimerHandle_t getHandle(void) { return _handle; }
5252

53+
void setID(void* id);
54+
void* getID(void);
55+
5356
bool start(void);
5457
bool stop (void);
5558
bool reset (void);

0 commit comments

Comments
 (0)