Difference between revisions of "Unit W1"
(3 intermediate revisions by the same user not shown) | |||
Line 5: | Line 5: | ||
---- | ---- | ||
− | '''Ultibo 1-Wire | + | '''Ultibo 1-Wire Interface unit''' |
1-Wire is a communications bus designed by Dallas Semiconductor Corp that combines low speed signalling, data and power over a single signal line. It is often used for small devices such as digital thermometers. | 1-Wire is a communications bus designed by Dallas Semiconductor Corp that combines low speed signalling, data and power over a single signal line. It is often used for small devices such as digital thermometers. | ||
Line 74: | Line 74: | ||
| <code>W1_LOG_LEVEL_INFO = LOG_LEVEL_INFO;</code> | | <code>W1_LOG_LEVEL_INFO = LOG_LEVEL_INFO;</code> | ||
| W1 informational messages, such as a device being attached or detached | | W1 informational messages, such as a device being attached or detached | ||
+ | |- | ||
+ | | <code> W1_LOG_LEVEL_WARN = LOG_LEVEL_WARN;</code> | ||
+ | | W1 warning messages | ||
|- | |- | ||
| <code>W1_LOG_LEVEL_ERROR = LOG_LEVEL_ERROR;</code> | | <code>W1_LOG_LEVEL_ERROR = LOG_LEVEL_ERROR;</code> | ||
Line 212: | Line 215: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Note |
| Called only during system startup | | Called only during system startup | ||
|- | |- | ||
Line 227: | Line 230: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! W1 |
| The W1 device to get properties from | | The W1 device to get properties from | ||
|- | |- | ||
− | ! | + | ! Properties |
| Pointer to a TW1Properties structure to fill in | | Pointer to a TW1Properties structure to fill in | ||
|- | |- | ||
− | ! | + | ! Return |
| ERROR_SUCCESS if completed or another error code on failure | | ERROR_SUCCESS if completed or another error code on failure | ||
|- | |- | ||
Line 245: | Line 248: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Return |
| Pointer to new W1 entry or nil if W1 could not be created | | Pointer to new W1 entry or nil if W1 could not be created | ||
|- | |- | ||
Line 257: | Line 260: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Size |
| Size in bytes to allocate for new W1 (Including the W1 entry) | | Size in bytes to allocate for new W1 (Including the W1 entry) | ||
|- | |- | ||
− | ! | + | ! Return |
| Pointer to new W1 entry or nil if W1 could not be created | | Pointer to new W1 entry or nil if W1 could not be created | ||
|- | |- | ||
Line 272: | Line 275: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Note |
| None documented | | None documented | ||
|- | |- | ||
Line 284: | Line 287: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Note |
| None documented | | None documented | ||
|- | |- | ||
Line 296: | Line 299: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Note |
| None documented | | None documented | ||
|- | |- | ||
Line 308: | Line 311: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Note |
| None documented | | None documented | ||
|- | |- | ||
Line 320: | Line 323: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Note |
| None documented | | None documented | ||
|- | |- | ||
Line 332: | Line 335: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Note |
| None documented | | None documented | ||
|- | |- | ||
Line 344: | Line 347: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Note |
| None documented | | None documented | ||
|- | |- | ||
Line 356: | Line 359: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Note |
| None documented | | None documented | ||
|- | |- | ||
Line 366: | Line 369: | ||
<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 W1GetCount:LongWord | + | <pre style="border: 0; padding-bottom:0px;">function W1GetCount:LongWord;</pre> |
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Get the current W1 count</div> | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Get the current W1 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;"> | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Note |
| None documented | | None documented | ||
|- | |- | ||
Line 378: | Line 381: | ||
<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 W1DeviceGetDefault:PW1Device | + | <pre style="border: 0; padding-bottom:0px;">function W1DeviceGetDefault:PW1Device;</pre> |
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Get the current default W1 device</div> | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Get the current default W1 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;"> | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Note |
| None documented | | None documented | ||
|- | |- | ||
Line 395: | Line 398: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Note |
| None documented | | None documented | ||
|- | |- | ||
Line 407: | Line 410: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Note |
| None documented | | None documented | ||
|- | |- | ||
Line 414: | Line 417: | ||
<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;">procedure W1Log(Level:LongWord; W1:PW1Device;const AText:String);</pre> | + | <pre style="border: 0; padding-bottom:0px;">procedure W1Log(Level:LongWord; W1:PW1Device; const AText:String);</pre> |
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div> | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</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;"> | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Note |
| None documented | | None documented | ||
|- | |- | ||
Line 431: | Line 434: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! ''' | + | ! Note |
+ | | None documented | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <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;">procedure W1LogWarn(W1:PW1Device; const AText:String); inline;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! Note | ||
| None documented | | None documented | ||
|- | |- | ||
Line 443: | Line 458: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Note |
| None documented | | None documented | ||
|- | |- | ||
Line 455: | Line 470: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Note |
| None documented | | None documented | ||
|- | |- |
Latest revision as of 02:31, 15 December 2022
Return to Unit Reference
Contents
[hide]Description
Ultibo 1-Wire Interface unit
1-Wire is a communications bus designed by Dallas Semiconductor Corp that combines low speed signalling, data and power over a single signal line. It is often used for small devices such as digital thermometers.
Devices can actually be powered over the 1-Wire interface allowing the use of just data and ground lines.
Note: Because FreePascal does not permit the use of functions or variables that begin with a numeric value such as 1WIRE we use the term W1 throughout this unit to refer to a 1-Wire device. This is the same terminology as used in Linux and other systems.
Constants
W1_*
W1_TYPE_*
W1_STATE_*
W1_FLAG_*
W1_LOG_*
Type definitions
W1 properties
W1 enumeration callback
TW1Enumerate = function(W1:PW1Device; Data:Pointer):LongWord;
|
W1 notification callback
TW1Notification = function(Device:PDevice; Data:Pointer; Notification:LongWord):LongWord;
|
W1 device get properties
TW1DeviceGetProperties = function(W1:PW1Device; Properties:PW1Properties):LongWord;
|
W1 device
Public variables
W1 logging
W1_DEFAULT_LOG_LEVEL:LongWord = W1_LOG_LEVEL_DEBUG;
|
Minimum level for W1 messages. Only messages with level greater than or equal to this will be printed. |
W1_LOG_ENABLED:Boolean;
|
Function declarations
Initialization functions
W1 functions
function W1DeviceGetProperties(W1:PW1Device; Properties:PW1Properties):LongWord;
function W1DeviceRegister(W1:PW1Device):LongWord;
function W1DeviceDeregister(W1:PW1Device):LongWord;
function W1DeviceFindByName(const Name:String):PW1Device; inline;
function W1DeviceFindByDescription(const Description:String):PW1Device; inline;
function W1DeviceEnumerate(Callback:TW1Enumerate; Data:Pointer):LongWord;
function W1DeviceNotification(W1:PW1Device; Callback:TW1Notification; Data:Pointer; Notification,Flags:LongWord):LongWord;
W1 helper functions
function W1DeviceSetDefault(W1:PW1Device):LongWord;
function W1DeviceCheck(W1:PW1Device):PW1Device;
procedure W1Log(Level:LongWord; W1:PW1Device; const AText:String);
procedure W1LogInfo(W1:PW1Device; const AText:String); inline;
procedure W1LogWarn(W1:PW1Device; const AText:String); inline;
procedure W1LogError(W1:PW1Device; const AText:String); inline;
procedure W1LogDebug(W1:PW1Device; const AText:String); inline;
Return to Unit Reference