Beamlib  3.0.1
This is the Beam C++ class library.
BRtc.h
Go to the documentation of this file.
1 /*******************************************************************************
2  * BRtc.h Real Time Clock interface
3  * T.Barnaby, BEAM Ltd, 19/5/04
4  * Copyright (c) 2022 All Right Reserved, Beam Ltd, https://www.beam.ltd.uk
5  * For license see LICENSE.txt at the root of the beamlib source tree.
6  *******************************************************************************
7  */
8 #ifndef BRTC_H
9 #define BRTC_H
10 
11 #include <BError.h>
12 #include <BThread.h>
13 #include <BCond.h>
14 
16 class BRtc {
17 public:
18  BRtc();
19  ~BRtc();
20 
21  BError init(int rate);
22  void wait(int delayUs);
23 private:
24  int ofd;
25  int orate;
26 };
27 
29 class BRtcThreaded : private BThread {
30 public:
31  BRtcThreaded();
32  ~BRtcThreaded();
33 
34  BError init(int rate);
35  void wait(int delayUs);
36 private:
37  void* function();
38  BRtc ortc;
39  int orate;
40  BCond ocond;
41 };
42 #endif
void delayUs(BUInt us)
Will delay for given time in us, if tasks running task will sleep.
Definition: BSys.cpp:14
Thread safe conditional variable.
Definition: BCond.h:15
Error return class. This class is used to return the error status from a function....
Definition: BError.h:31
A thread safe class to access to the systems real time battery backed up time hardware.
Definition: BRtc.h:29
void wait(int delayUs)
Wait specified uS.
Definition: BRtc.cpp:83
BRtcThreaded()
Definition: BRtc.cpp:56
BError init(int rate)
Setup interrupt rate.
Definition: BRtc.cpp:63
~BRtcThreaded()
Definition: BRtc.cpp:60
Realtime clock for access to the systems real time battery backed up time hardware.
Definition: BRtc.h:16
~BRtc()
Definition: BRtc.cpp:23
BError init(int rate)
Setup interrupt rate.
Definition: BRtc.cpp:28
void wait(int delayUs)
Wait specified uS.
Definition: BRtc.cpp:44
BRtc()
Definition: BRtc.cpp:18
Implements a program execution thread.
Definition: BThread.h:14