Bluenet  5.7.0
Bluenet, firmware for nRF52 smart home devices
Loading...
Searching...
No Matches
cs_RTC.h
Go to the documentation of this file.
1
7#pragma once
8
9#include <stdint.h>
10#include <test/cs_TestAccess.h>
11
17#define RTC_CLOCK_FREQ 32768
18
20#define MAX_RTC_COUNTER_VAL 0x00FFFFFF
21
30class RTC {
31private:
32 RTC() = default;
33 RTC(RTC const&) = delete;
34 void operator=(RTC const&) = delete;
35
36public:
40 static uint32_t getCount();
41
45 static uint32_t ticksToMs(uint32_t ticks);
46
51 static uint32_t msToTicks(uint32_t ms);
52
56 static uint32_t difference(uint32_t ticksTo, uint32_t ticksFrom);
60 static uint32_t differenceMs(uint32_t ticksTo, uint32_t ticksFrom);
61
65 static uint32_t msPassedSince(uint32_t ticksFrom);
66
70 inline static uint32_t now();
71
72#ifdef HOST_TARGET
76 static void offsetMs(int ms);
77 static int _offsetMs;
78
82 static void start();
83
84#endif
85};
Wrapper class for RTC functions.
Definition: cs_RTC.h:30
static uint32_t ticksToMs(uint32_t ticks)
Return time in ms, given time in ticks.
void operator=(RTC const &)=delete
static uint32_t difference(uint32_t ticksTo, uint32_t ticksFrom)
return difference between two tick counter values
static uint32_t differenceMs(uint32_t ticksTo, uint32_t ticksFrom)
return difference between two tick counter values in ms.
RTC(RTC const &)=delete
static uint32_t now()
return current clock in ms
static uint32_t msPassedSince(uint32_t ticksFrom)
Returns the number of milliseconds passed since the given tick counter value.
static uint32_t msToTicks(uint32_t ms)
Return time in ticks, given time in ms Make sure time in ms is not too large! (limit is 512,...
static uint32_t getCount()
return number of ticks
RTC()=default