Difference between revisions of "Unit RTC"
(2 intermediate revisions by the same user not shown) | |||
Line 5: | Line 5: | ||
---- | ---- | ||
− | '''Ultibo Real Time Clock | + | '''Ultibo Real Time Clock Device Interface unit''' |
The RTC unit provides the device interface for real time clock modules to be registered with Ultibo core. Each RTC module requires a driver that communicates with the specific hardware to implement the device interface although many devices may use the same chip and will be covered by a single driver. | The RTC unit provides the device interface for real time clock modules to be registered with Ultibo core. Each RTC module requires a driver that communicates with the specific hardware to implement the device interface although many devices may use the same chip and will be covered by a single driver. | ||
Line 33: | Line 33: | ||
| <code>RTC_TYPE_NONE = 0;</code> | | <code>RTC_TYPE_NONE = 0;</code> | ||
| style="width: 50%;"| | | style="width: 50%;"| | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>RTC_TYPE_MAX = 0;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>RTC_TYPE_NAMES:array[RTC_TYPE_NONE..RTC_TYPE_MAX] of String = ('RTC_TYPE_NONE');</code> | ||
+ | | | ||
|- | |- | ||
|} | |} | ||
Line 46: | Line 56: | ||
|- | |- | ||
| <code>RTC_STATE_ENABLED = 1;</code> | | <code>RTC_STATE_ENABLED = 1;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>RTC_STATE_MAX = 1;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>RTC_STATE_NAMES:array[RTC_STATE_DISABLED..RTC_STATE_MAX] of String = ('RTC_STATE_DISABLED', 'RTC_STATE_ENABLED');</code> | ||
| | | | ||
|- | |- | ||
Line 548: | Line 568: | ||
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
− | <pre style="border: 0; padding-bottom:0px;">function RTCGetCount:LongWord | + | <pre style="border: 0; padding-bottom:0px;">function RTCGetCount:LongWord;</pre> |
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Get the current RTC count</div> | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Get the current RTC count</div> | ||
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
Line 560: | Line 580: | ||
<br /> | <br /> | ||
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
− | <pre style="border: 0; padding-bottom:0px;">function RTCDeviceGetDefault:PRTCDevice | + | <pre style="border: 0; padding-bottom:0px;">function RTCDeviceGetDefault:PRTCDevice;</pre> |
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Get the current default RTC device</div> | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Get the current default RTC device</div> | ||
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> |
Latest revision as of 03:36, 15 December 2022
Return to Unit Reference
Contents
[hide]Description
Ultibo Real Time Clock Device Interface unit
The RTC unit provides the device interface for real time clock modules to be registered with Ultibo core. Each RTC module requires a driver that communicates with the specific hardware to implement the device interface although many devices may use the same chip and will be covered by a single driver.
This unit registers the RTCGetTime
and RTCSetTime
functions with the Platform unit to enable hardware independent access to a real time clock module.
Constants
RTC_*
RTC_TYPE_*
RTC_STATE_*
RTC_FLAG_*
RTC_LOG_*
Type definitions
RTC properties
RTC enumeration callback
TRTCEnumerate = function(RTC:PRTCDevice; Data:Pointer):LongWord;
|
RTC notification callback
TRTCNotification = function(Device:PDevice; Data:Pointer; Notification:LongWord):LongWord;
|
RTC device start
TRTCDeviceStart = function(RTC:PRTCDevice):LongWord;
|
RTC device stop
TRTCDeviceStop = function(RTC:PRTCDevice):LongWord;
|
RTC device get time
TRTCDeviceGetTime = function(RTC:PRTCDevice):Int64;
|
RTC device set time
TRTCDeviceSetTime = function(RTC:PRTCDevice; const Time:Int64):Int64;
|
RTC device get properties
TRTCDeviceGetProperties = function(RTC:PRTCDevice; Properties:PRTCProperties):LongWord;
|
RTC device
Public variables
RTC logging
RTC_DEFAULT_LOG_LEVEL:LongWord = RTC_LOG_LEVEL_DEBUG;
|
Minimum level for RTC messages. Only messages with level greater than or equal to this will be printed. |
RTC_LOG_ENABLED:Boolean;
|
Function declarations
Initialization functions
RTC functions
function RTCDeviceSetTime(RTC:PRTCDevice; const Time:Int64):Int64;
function RTCDeviceProperties(RTC:PRTCDevice; Properties:PRTCProperties):LongWord; inline;
function RTCDeviceGetProperties(RTC:PRTCDevice;Properties:PRTCProperties):LongWord;
function RTCDeviceDestroy(RTC:PRTCDevice):LongWord;
function RTCDeviceRegister(RTC:PRTCDevice):LongWord;
function RTCDeviceDeregister(RTC:PRTCDevice):LongWord;
function RTCDeviceFindByName(const Name:String):PRTCDevice; inline;
function RTCDeviceFindByDescription(const Description:String):PRTCDevice; inline;
function RTCDeviceEnumerate(Callback:TRTCEnumerate; Data:Pointer):LongWord;
function RTCDeviceNotification(RTC:PRTCDevice; Callback:TRTCNotification; Data:Pointer; Notification,Flags:LongWord):LongWord;
RTL RTC functions
function SysRTCSetTime(const Time:Int64):Int64;
RTC helper functions
function RTCDeviceSetDefault(RTC:PRTCDevice):LongWord;
function RTCDeviceCheck(RTC:PRTCDevice):PRTCDevice;
function RTCSystemTimeToFileTime(const SystemTime:TSystemTime; var FileTime:Int64):Boolean;
function RTCFileTimeToSystemTime(const FileTime:Int64; var SystemTime:TSystemTime):Boolean;
procedure RTCLog(Level:LongWord; RTC:PRTCDevice; const AText:String);
procedure RTCLogInfo(RTC:PRTCDevice; const AText:String); inline;
procedure RTCLogWarn(RTC:PRTCDevice; const AText:String); inline;
procedure RTCLogError(RTC:PRTCDevice; const AText:String); inline;
procedure RTCLogDebug(RTC:PRTCDevice; const AText:String); inline;
Return to Unit Reference