Difference between revisions of "Unit GPIO"

From Ultibo.org
Jump to: navigation, search
 
(9 intermediate revisions by the same user not shown)
Line 5: Line 5:
 
----
 
----
  
'''Ultibo GPIO interface unit'''
+
'''Ultibo GPIO Interface unit'''
  
 
GPIO devices represent the external or internal pins available on most system on chip (SoC) devices to provide control and interfacing capabilities for both hardware and software.
 
GPIO devices represent the external or internal pins available on most system on chip (SoC) devices to provide control and interfacing capabilities for both hardware and software.
Line 39: Line 39:
 
| <code>GPIO_TYPE_NONE = 0;</code>
 
| <code>GPIO_TYPE_NONE = 0;</code>
 
| style="width: 50%;"|&nbsp;
 
| style="width: 50%;"|&nbsp;
 +
|-
 +
| <code>GPIO_TYPE_MAX = 0;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|''GPIO device type name''
 +
|-
 +
|colspan="2"|<code>GPIO_TYPE_NAMES:array[GPIO_TYPE_NONE..GPIO_TYPE_MAX] of String = ('GPIO_TYPE_NONE');</code>
 
|-
 
|-
 
|}
 
|}
Line 52: Line 59:
 
|-
 
|-
 
| <code>GPIO_STATE_ENABLED = 1;</code>
 
| <code>GPIO_STATE_ENABLED = 1;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>GPIO_STATE_MAX = 1;</code>
 
| &nbsp;
 
| &nbsp;
 
|-
 
|-
Line 120: Line 132:
 
| <code>GPIO_LOG_LEVEL_INFO = LOG_LEVEL_INFO;</code>
 
| <code>GPIO_LOG_LEVEL_INFO = LOG_LEVEL_INFO;</code>
 
| GPIO informational messages, such as a device being attached or detached
 
| GPIO informational messages, such as a device being attached or detached
 +
|-
 +
| <code>GPIO_LOG_LEVEL_WARN = LOG_LEVEL_WARN;</code>
 +
| GPIO warning messages
 
|-
 
|-
 
| <code>GPIO_LOG_LEVEL_ERROR = LOG_LEVEL_ERROR;</code>
 
| <code>GPIO_LOG_LEVEL_ERROR = LOG_LEVEL_ERROR;</code>
Line 534: Line 549:
 
=== Function declarations ===
 
=== Function declarations ===
 
----
 
----
 
  
  
Line 545: Line 559:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 560: Line 574:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''GPIO'''
+
! GPIO
 
| The GPIO device to start
 
| The GPIO device to start
 
|-
 
|-
! '''Return'''
+
! Return
 
| ERROR_SUCCESS if completed or another error code on failure
 
| ERROR_SUCCESS if completed or another error code on failure
 
|-
 
|-
Line 575: Line 589:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''GPIO'''
+
! GPIO
 
| The GPIO device to stop
 
| The GPIO device to stop
 
|-
 
|-
! '''Return'''
+
! Return
 
| ERROR_SUCCESS if completed or another error code on failure
 
| ERROR_SUCCESS if completed or another error code on failure
 
|-
 
|-
Line 590: Line 604:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''GPIO'''
+
! GPIO
 
| The GPIO device to read from
 
| The GPIO device to read from
 
|-
 
|-
! '''Reg'''
+
! Reg
 
| The memory register to read from
 
| The memory register to read from
 
|-
 
|-
! '''Return'''
+
! Return
 
| The value of the memory register
 
| The value of the memory register
 
|-
 
|-
Line 608: Line 622:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''GPIO'''
+
! GPIO
 
| The GPIO device to write to
 
| The GPIO device to write to
 
|-
 
|-
! '''Reg'''
+
! Reg
 
| The memory register to write to
 
| The memory register to write to
 
|-
 
|-
! '''Return'''
+
! Return
 
| The value to write to the register
 
| The value to write to the register
 
|-
 
|-
Line 626: Line 640:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''GPIO'''
+
! GPIO
 
| The GPIO device to get from
 
| The GPIO device to get from
 
|-
 
|-
! '''Pin'''
+
! Pin
 
| The pin to get the state for (eg GPIO_PIN_1)
 
| The pin to get the state for (eg GPIO_PIN_1)
 
|-
 
|-
! '''Return'''
+
! Return
 
| The current state (eg GPIO_LEVEL_HIGH) or GPIO_LEVEL_UNKNOWN on failure
 
| The current state (eg GPIO_LEVEL_HIGH) or GPIO_LEVEL_UNKNOWN on failure
 
|-
 
|-
Line 644: Line 658:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''GPIO'''
+
! GPIO
 
| The GPIO device to wait for
 
| The GPIO device to wait for
 
|-
 
|-
! '''Pin'''
+
! Pin
 
| The pin to wait for the state to change (eg GPIO_PIN_1)
 
| The pin to wait for the state to change (eg GPIO_PIN_1)
 
|-
 
|-
! '''Trigger'''
+
! Trigger
 
| The trigger event to wait for (eg GPIO_TRIGGER_HIGH)
 
| The trigger event to wait for (eg GPIO_TRIGGER_HIGH)
 
|-
 
|-
! '''Timeout'''
+
! Timeout
 
| Number of milliseconds to wait for the change (INFINITE to wait forever)
 
| Number of milliseconds to wait for the change (INFINITE to wait forever)
 
|-
 
|-
! '''Return'''
+
! Return
 
| The state after the change (eg GPIO_LEVEL_HIGH) or GPIO_LEVEL_UNKNOWN on failure or timeout
 
| The state after the change (eg GPIO_LEVEL_HIGH) or GPIO_LEVEL_UNKNOWN on failure or timeout
 
|-
 
|-
Line 668: Line 682:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''GPIO'''
+
! GPIO
 
| The GPIO device to schedule the callback for
 
| The GPIO device to schedule the callback for
 
|-
 
|-
! '''Pin'''
+
! Pin
 
| The pin to schedule the state change for (eg GPIO_PIN_1)
 
| The pin to schedule the state change for (eg GPIO_PIN_1)
 
|-
 
|-
! '''Trigger'''
+
! Trigger
 
| The trigger event which will cause the function to be called (eg GPIO_TRIGGER_HIGH)
 
| The trigger event which will cause the function to be called (eg GPIO_TRIGGER_HIGH)
 
|-
 
|-
! '''Timeout'''
+
! Flags
 +
| The flags to control the event (eg GPIO_EVENT_FLAG_REPEAT)
 +
|-
 +
! Timeout
 
| The number of milliseconds before the scheduled trigger expires (INFINITE to never expire)
 
| The number of milliseconds before the scheduled trigger expires (INFINITE to never expire)
 
|-
 
|-
! '''Callback'''
+
! Callback
 
| The function to be called when the trigger occurs
 
| The function to be called when the trigger occurs
 
|-
 
|-
! '''Data'''
+
! Data
 
| A pointer to be pass to the function when the trigger occurs (Optional)
 
| A pointer to be pass to the function when the trigger occurs (Optional)
 
|-
 
|-
! '''Return'''
+
! Return
 
| ERROR_SUCCESS if the trigger was scheduled successfully or another error code on failure
 
| ERROR_SUCCESS if the trigger was scheduled successfully or another error code on failure
 
|-
 
|-
! '''Note'''
+
! Note
 
| The pin and trigger that caused the event will be passed to the callback function
 
| The pin and trigger that caused the event will be passed to the callback function
 
|-
 
|-
Line 701: Line 718:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''GPIO'''
+
! GPIO
 
| The GPIO device to cancel the callback for
 
| The GPIO device to cancel the callback for
 
|-
 
|-
! '''Pin'''
+
! Pin
 
| The pin to cancel the state change for (eg GPIO_PIN_1)
 
| The pin to cancel the state change for (eg GPIO_PIN_1)
 
|-
 
|-
! '''Return'''
+
! Return
 
| ERROR_SUCCESS if the callback was cancelled successfully or another error code on failure
 
| ERROR_SUCCESS if the callback was cancelled successfully or another error code on failure
 
|-
 
|-
Line 719: Line 736:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''GPIO'''
+
! GPIO
 
| The GPIO device to set for
 
| The GPIO device to set for
 
|-
 
|-
! '''Pin'''
+
! Pin
 
| The pin to set the state for (eg GPIO_PIN_1)
 
| The pin to set the state for (eg GPIO_PIN_1)
 
|-
 
|-
! '''Level'''
+
! Level
 
| The state to set the pin to (eg GPIO_LEVEL_HIGH)
 
| The state to set the pin to (eg GPIO_LEVEL_HIGH)
 
|-
 
|-
! '''Return'''
+
! Return
 
| ERROR_SUCCESS if completed successfully or another error code on failure
 
| ERROR_SUCCESS if completed successfully or another error code on failure
 +
|-
 +
|}
 +
</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;">function GPIODeviceLevelGet(GPIO:PGPIODevice; Pin:LongWord):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Get the current level (state) of a pin on the specified GPIO device</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! GPIO
 +
| The GPIO device to get from
 +
|-
 +
! Pin
 +
| The pin to get the level for (eg GPIO_PIN_1)
 +
|-
 +
! Return
 +
| The current level (eg GPIO_LEVEL_HIGH) or GPIO_LEVEL_UNKNOWN on failure
 +
|-
 +
! Note
 +
| This function is a synonym for GPIODeviceInputGet as in many cases the level can be read from a pin regardless of input or output mode. This may help to make code clearer or easier to understand in some cases.
 +
|-
 +
|}
 +
</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;">function GPIODeviceLevelSet(GPIO:PGPIODevice; Pin,Level:LongWord):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Set the level (state) of a pin on the specified GPIO device</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! GPIO
 +
| The GPIO device to set for
 +
|-
 +
! Pin
 +
| The pin to set the level for (eg GPIO_PIN_1)
 +
|-
 +
! Level
 +
| The level to set the pin to (eg GPIO_LEVEL_HIGH)
 +
|-
 +
! Return
 +
| ERROR_SUCCESS if completed successfully or another error code on failure
 +
|-
 +
! Note
 +
| This function is a synonym for GPIODeviceOutputSet as in many cases the level can be set for a pin regardless of input or output mode. This may help to make code clearer or easier to understand in some cases.
 
|-
 
|-
 
|}
 
|}
Line 740: Line 802:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''GPIO'''
+
! GPIO
 
| The GPIO device to get from
 
| The GPIO device to get from
 
|-
 
|-
! '''Pin'''
+
! Pin
 
| The pin to get the pull state for (eg GPIO_PIN_1)
 
| The pin to get the pull state for (eg GPIO_PIN_1)
 
|-
 
|-
! '''Return'''
+
! Return
 
| The current pull state of the pin (eg GPIO_PULL_UP) or GPIO_PULL_UNKNOWN on failure
 
| The current pull state of the pin (eg GPIO_PULL_UP) or GPIO_PULL_UNKNOWN on failure
 
|-
 
|-
Line 758: Line 820:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''GPIO'''
+
! GPIO
 
| The GPIO device to set for
 
| The GPIO device to set for
 
|-
 
|-
! '''Pin'''
+
! Pin
 
| The pin to change the pull state for (eg GPIO_PIN_1)
 
| The pin to change the pull state for (eg GPIO_PIN_1)
 
|-
 
|-
! '''Mode'''
+
! Mode
 
| The pull state to set for the pin (eg GPIO_PULL_UP)
 
| The pull state to set for the pin (eg GPIO_PULL_UP)
 
|-
 
|-
! '''Return'''
+
! Return
 
| ERROR_SUCCESS if completed successfully or another error code on failure
 
| ERROR_SUCCESS if completed successfully or another error code on failure
 
|-
 
|-
Line 779: Line 841:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''GPIO'''
+
! GPIO
 
| The GPIO device to get from
 
| The GPIO device to get from
 
|-
 
|-
! '''Pin'''
+
! Pin
 
| The pin to get the function for (eg GPIO_PIN_1)
 
| The pin to get the function for (eg GPIO_PIN_1)
 
|-
 
|-
! '''Return'''
+
! Return
 
| The current function of the pin (eg GPIO_FUNCTION_IN) or GPIO_FUNCTION_UNKNOWN on failure
 
| The current function of the pin (eg GPIO_FUNCTION_IN) or GPIO_FUNCTION_UNKNOWN on failure
 
|-
 
|-
Line 797: Line 859:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''GPIO'''
+
! GPIO
 
| The GPIO device to set for
 
| The GPIO device to set for
 
|-
 
|-
! '''Pin'''
+
! Pin
 
| The pin to change the function for (eg GPIO_PIN_1)
 
| The pin to change the function for (eg GPIO_PIN_1)
 
|-
 
|-
! '''Mode'''
+
! Mode
 
| The function to set for the pin (eg GPIO_FUNCTION_OUT)
 
| The function to set for the pin (eg GPIO_FUNCTION_OUT)
 
|-
 
|-
! '''Return'''
+
! Return
 
| ERROR_SUCCESS if completed successfully or another error code on failure
 
| ERROR_SUCCESS if completed successfully or another error code on failure
 
|-
 
|-
Line 818: Line 880:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''GPIO'''
+
! GPIO
 
| The GPIO device to get properties from
 
| The GPIO device to get properties from
 
|-
 
|-
! '''Properties'''
+
! Properties
 
| Pointer to a TGPIOProperties structure to fill in
 
| Pointer to a TGPIOProperties structure to fill in
 
|-
 
|-
! '''Return'''
+
! Return
 
| ERROR_SUCCESS if completed or another error code on failure
 
| ERROR_SUCCESS if completed or another error code on failure
 
|-
 
|-
! '''Note'''
+
! Note
 
| Replaced by GPIODeviceGetProperties for consistency
 
| Replaced by GPIODeviceGetProperties for consistency
 
|-
 
|-
Line 839: Line 901:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''GPIO'''
+
! GPIO
 
| The GPIO device to get properties from
 
| The GPIO device to get properties from
 
|-
 
|-
! '''Properties'''
+
! Properties
 
| Pointer to a TGPIOProperties structure to fill in
 
| Pointer to a TGPIOProperties structure to fill in
 
|-
 
|-
! '''Return'''
+
! Return
 
| ERROR_SUCCESS if completed or another error code on failure
 
| ERROR_SUCCESS if completed or another error code on failure
 
|-
 
|-
Line 857: Line 919:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Return'''
+
! Return
 
| Pointer to new GPIO entry or nil if GPIO could not be created
 
| Pointer to new GPIO entry or nil if GPIO could not be created
 
|-
 
|-
Line 869: Line 931:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Size'''
+
! Size
 
| Size in bytes to allocate for new GPIO (Including the GPIO entry)
 
| Size in bytes to allocate for new GPIO (Including the GPIO entry)
 
|-
 
|-
! '''Return'''
+
! Return
 
| Pointer to new GPIO entry or nil if GPIO could not be created
 
| Pointer to new GPIO entry or nil if GPIO could not be created
 
|-
 
|-
Line 884: Line 946:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''GPIO'''
+
! GPIO
 
| The GPIO device to destroy
 
| The GPIO device to destroy
 
|-
 
|-
! '''Return'''
+
! Return
 
| ERROR_SUCCESS if completed or another error code on failure
 
| ERROR_SUCCESS if completed or another error code on failure
 
|-
 
|-
Line 899: Line 961:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''GPIO'''
+
! GPIO
 
| The GPIO device to register
 
| The GPIO device to register
 
|-
 
|-
! '''Return'''
+
! Return
 
| ERROR_SUCCESS if completed or another error code on failure
 
| ERROR_SUCCESS if completed or another error code on failure
 
|-
 
|-
Line 914: Line 976:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''GPIO'''
+
! GPIO
 
| The GPIO device to deregister
 
| The GPIO device to deregister
 
|-
 
|-
! '''Return'''
+
! Return
 
| ERROR_SUCCESS if completed or another error code on failure
 
| ERROR_SUCCESS if completed or another error code on failure
 
|-
 
|-
Line 929: Line 991:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''GPIOId'''
+
! GPIOId
 
| The ID number of the GPIO device to find
 
| The ID number of the GPIO device to find
 
|-
 
|-
! '''Return'''
+
! Return
 
| Pointer to GPIO device entry or nil if not found
 
| Pointer to GPIO device entry or nil if not found
 
|-
 
|-
Line 944: Line 1,006:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Name'''
+
! Name
 
| The name of the GPIO to find (eg GPIO0)
 
| The name of the GPIO to find (eg GPIO0)
 
|-
 
|-
! '''Return'''
+
! Return
 
| Pointer to GPIO device entry or nil if not found
 
| Pointer to GPIO device entry or nil if not found
 
|-
 
|-
Line 959: Line 1,021:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Description'''
+
! Description
 
| The description of the GPIO to find (eg BCM2836 GPIO)
 
| The description of the GPIO to find (eg BCM2836 GPIO)
 
|-
 
|-
! '''Return'''
+
! Return
 
| Pointer to GPIO device entry or nil if not found
 
| Pointer to GPIO device entry or nil if not found
 
|-
 
|-
Line 974: Line 1,036:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Callback'''
+
! Callback
 
| The callback function to call for each GPIO in the table
 
| The callback function to call for each GPIO in the table
 
|-
 
|-
! '''Data'''
+
! Data
 
| A private data pointer to pass to callback for each GPIO in the table
 
| A private data pointer to pass to callback for each GPIO in the table
 
|-
 
|-
! '''Note'''
+
! Note
 
| ERROR_SUCCESS if completed or another error code on failure
 
| ERROR_SUCCESS if completed or another error code on failure
 
|-
 
|-
Line 992: Line 1,054:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''GPIO'''
+
! GPIO
 
| The GPIO device to notify changes for (Optional, pass nil for all GPIO devices)
 
| The GPIO device to notify changes for (Optional, pass nil for all GPIO devices)
 
|-
 
|-
! '''Callback'''
+
! Callback
 
| The function to call when a notification event occurs
 
| The function to call when a notification event occurs
 
|-
 
|-
! '''Data'''
+
! Data
 
| A private data pointer to pass to callback when a notification event occurs
 
| A private data pointer to pass to callback when a notification event occurs
 
|-
 
|-
! '''Notification'''
+
! Notification
 
| The events to register for notification of (eg DEVICE_NOTIFICATION_REGISTER)
 
| The events to register for notification of (eg DEVICE_NOTIFICATION_REGISTER)
 
|-
 
|-
! '''Flags'''
+
! Flags
 
| The flags to control the notification (eg NOTIFIER_FLAG_WORKER)
 
| The flags to control the notification (eg NOTIFIER_FLAG_WORKER)
 
|-
 
|-
Line 1,019: Line 1,081:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 1,031: Line 1,093:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Pin'''
+
! Pin
 
| The pin to get the state for (eg GPIO_PIN_1)
 
| The pin to get the state for (eg GPIO_PIN_1)
 
|-
 
|-
! '''Return'''
+
! Return
 
| The current state (eg GPIO_LEVEL_HIGH) or GPIO_LEVEL_UNKNOWN on failure
 
| The current state (eg GPIO_LEVEL_HIGH) or GPIO_LEVEL_UNKNOWN on failure
 
|-
 
|-
Line 1,046: Line 1,108:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Pin'''
+
! Pin
 
| The pin to wait for the state to change (eg GPIO_PIN_1)
 
| The pin to wait for the state to change (eg GPIO_PIN_1)
 
|-
 
|-
! '''Trigger'''
+
! Trigger
 
| The trigger event to wait for (eg GPIO_TRIGGER_HIGH)
 
| The trigger event to wait for (eg GPIO_TRIGGER_HIGH)
 
|-
 
|-
! '''Timeout'''
+
! Timeout
 
| Number of milliseconds to wait for the change (INFINITE to wait forever)
 
| Number of milliseconds to wait for the change (INFINITE to wait forever)
 
|-
 
|-
! '''Return'''
+
! Return
 
| The state after the change (eg GPIO_LEVEL_HIGH) or GPIO_LEVEL_UNKNOWN on failure or timeout
 
| The state after the change (eg GPIO_LEVEL_HIGH) or GPIO_LEVEL_UNKNOWN on failure or timeout
 
|-
 
|-
Line 1,067: Line 1,129:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Pin'''
+
! Pin
 
| The pin to schedule the state change for (eg GPIO_PIN_1)
 
| The pin to schedule the state change for (eg GPIO_PIN_1)
 
|-
 
|-
! '''Trigger'''
+
! Trigger
 
| The trigger event which will cause the function to be called (eg GPIO_TRIGGER_HIGH)
 
| The trigger event which will cause the function to be called (eg GPIO_TRIGGER_HIGH)
 
|-
 
|-
! '''Timeout'''
+
! Timeout
 
| The number of milliseconds before the scheduled trigger expires (INFINITE to never expire)
 
| The number of milliseconds before the scheduled trigger expires (INFINITE to never expire)
 
|-
 
|-
! '''Callback'''
+
! Callback
 
| The function to be called when the trigger occurs
 
| The function to be called when the trigger occurs
 
|-
 
|-
! '''Data'''
+
! Data
 
| A pointer to be pass to the function when the trigger occurs (Optional)
 
| A pointer to be pass to the function when the trigger occurs (Optional)
 
|-
 
|-
! '''Return'''
+
! Return
 
| ERROR_SUCCESS if the trigger was scheduled successfully or another error code on failure
 
| ERROR_SUCCESS if the trigger was scheduled successfully or another error code on failure
 
|-
 
|-
! '''Note'''
+
! Note
 
| The pin and trigger that caused the event will be passed to the callback function
 
| The pin and trigger that caused the event will be passed to the callback function
 
|-
 
|-
Line 1,097: Line 1,159:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Pin'''
+
! Pin
 
| The pin to set the state for (eg GPIO_PIN_1)
 
| The pin to set the state for (eg GPIO_PIN_1)
 
|-
 
|-
! '''Level'''
+
! Level
 
| The state to set the pin to (eg GPIO_LEVEL_HIGH)
 
| The state to set the pin to (eg GPIO_LEVEL_HIGH)
 
|-
 
|-
! '''Return'''
+
! Return
 
| ERROR_SUCCESS if completed successfully or another error code on failure
 
| ERROR_SUCCESS if completed successfully or another error code on failure
 
|-
 
|-
Line 1,115: Line 1,177:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Pin'''
+
! Pin
 
| The pin to get the pull state for (eg GPIO_PIN_1)
 
| The pin to get the pull state for (eg GPIO_PIN_1)
 
|-
 
|-
! '''Return'''
+
! Return
 
| The current pull state of the pin (eg GPIO_PULL_UP) or GPIO_PULL_UNKNOWN on failure
 
| The current pull state of the pin (eg GPIO_PULL_UP) or GPIO_PULL_UNKNOWN on failure
 
|-
 
|-
Line 1,130: Line 1,192:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Pin'''
+
! Pin
 
| The pin to change the pull state for (eg GPIO_PIN_1)
 
| The pin to change the pull state for (eg GPIO_PIN_1)
 
|-
 
|-
! '''Mode'''
+
! Mode
 
| The pull state to set for the pin (eg GPIO_PULL_UP)
 
| The pull state to set for the pin (eg GPIO_PULL_UP)
 
|-
 
|-
! '''Return'''
+
! Return
 
| ERROR_SUCCESS if completed successfully or another error code on failure
 
| ERROR_SUCCESS if completed successfully or another error code on failure
 
|-
 
|-
Line 1,148: Line 1,210:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Pin'''
+
! Pin
 
| The pin to get the function for (eg GPIO_PIN_1)
 
| The pin to get the function for (eg GPIO_PIN_1)
 
|-
 
|-
! '''Return'''
+
! Return
 
| The current function of the pin (eg GPIO_FUNCTION_IN) or GPIO_FUNCTION_UNKNOWN on failure
 
| The current function of the pin (eg GPIO_FUNCTION_IN) or GPIO_FUNCTION_UNKNOWN on failure
 
|-
 
|-
Line 1,163: Line 1,225:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Pin'''
+
! Pin
 
| The pin to change the function for (eg GPIO_PIN_1)
 
| The pin to change the function for (eg GPIO_PIN_1)
 
|-
 
|-
! '''Mode'''
+
! Mode
 
| The function to set for the pin (eg GPIO_FUNCTION_OUT)
 
| The function to set for the pin (eg GPIO_FUNCTION_OUT)
 
|-
 
|-
! '''Return'''
+
! Return
 
| ERROR_SUCCESS if completed successfully or another error code on failure
 
| ERROR_SUCCESS if completed successfully or another error code on failure
 
|-
 
|-
Line 1,179: Line 1,241:
  
 
<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 GPIOGetCount:LongWord; inline;</pre>
+
<pre style="border: 0; padding-bottom:0px;">function GPIOGetCount:LongWord;</pre>
 
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Get the current GPIO count</div>
 
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Get the current GPIO 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'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 1,191: Line 1,253:
 
<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 GPIODeviceGetDefault:PGPIODevice; inline;</pre>
+
<pre style="border: 0; padding-bottom:0px;">function GPIODeviceGetDefault:PGPIODevice;</pre>
 
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Get the current default GPIO device</div>
 
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Get the current default GPIO 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'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 1,208: Line 1,270:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 1,220: Line 1,282:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! 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;">function GPIOTypeToString(GPIOType:LongWord):String;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Convert a GPIO type value to a string</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| 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;">function GPIOStateToString(GPIOState:LongWord):String;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Convert a GPIO state value to a string</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 1,232: Line 1,318:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
| Event must be registered by calling GPIODeviceRegisterEvent. Caller must hold the GPIO device lock.
+
| Event must be registered by calling GPIODeviceRegisterEvent
 +
Caller must hold the GPIO device lock
 
|-
 
|-
 
|}
 
|}
Line 1,244: Line 1,331:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
| Event must be deregistered first by calling GPIODeviceDeregisterEvent. Caller must hold the GPIO device lock.
+
| Event must be deregistered first by calling GPIODeviceDeregisterEvent
 +
Caller must hold the GPIO device lock
 
|-
 
|-
 
|}
 
|}
Line 1,256: Line 1,344:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
| Event must be created by calling GPIODeviceCreateEvent. Caller must hold the GPIO device lock.
+
| Event must be created by calling GPIODeviceCreateEvent
 +
Caller must hold the GPIO device lock
 
|-
 
|-
 
|}
 
|}
Line 1,268: Line 1,357:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
| Event must be destroyed by calling GPIODeviceDestroyEvent. Caller must hold the GPIO device lock.
+
| Event must be destroyed by calling GPIODeviceDestroyEvent
 +
Caller must hold the GPIO device lock
 
|-
 
|-
 
|}
 
|}
Line 1,280: Line 1,370:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 1,290: Line 1,380:
 
<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; font-family: arial; background: white;"
+
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 1,304: Line 1,394:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 1,316: Line 1,406:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 1,328: Line 1,418:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 1,340: Line 1,430:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 1,352: Line 1,442:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 1,364: Line 1,454:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 1,376: Line 1,466:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 1,388: Line 1,478:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-

Latest revision as of 04:40, 12 September 2023

Return to Unit Reference


Description


Ultibo GPIO Interface unit

GPIO devices represent the external or internal pins available on most system on chip (SoC) devices to provide control and interfacing capabilities for both hardware and software.

This unit maintains pin numbering exactly as per the SoC documentation but abstracts other features such as alternate function selects to avoid exposing chip specific values via the API.

Not all GPIO devices support the same feature set so the GPIODeviceGetProperties function returns a structure which describes the number of pins as well as minimum and maximum pin numbers along with a set of flags that indicate what functionality is supported by the device.

Multiple GPIO devices can be accommodated, each one is registered with this unit when the driver for the device is loaded and initialized. This unit includes functions for enumerating the devices that are available and each function takes a GPIODevice parameter to allow specifying the exact device to control.

Simplified versions of many of the functions in this unit are provided in the Platform unit to allow control of the default GPIO device and in cases where there is only one device registered these functions will provide most of the capability required.

Constants



[Expand]
GPIO specific constants GPIO_*


[Expand]
GPIO device type GPIO_TYPE_*


[Expand]
GPIO device state GPIO_STATE_*


[Expand]
GPIO device flag GPIO_FLAG_*


[Expand]
GPIO event flag GPIO_EVENT_FLAG_*


[Expand]
GPIO logging GPIO_LOG_*


Type definitions



GPIO properties

[Expand]

PGPIOProperties = ^TGPIOProperties;

TGPIOProperties = record

GPIO event

[Expand]

PGPIOEvent = ^TGPIOEvent;

TGPIOEvent = record

GPIO pin

[Expand]

PGPIOPin = ^TGPIOPin;

TGPIOPin = record

GPIO enumeration callback

TGPIOEnumerate = function(GPIO:PGPIODevice; Data:Pointer):LongWord;

GPIO notification callback

TGPIONotification = function(Device:PDevice; Data:Pointer; Notification:LongWord):LongWord;

GPIO device start

TGPIODeviceStart = function(GPIO:PGPIODevice):LongWord;

GPIO device stop

TGPIODeviceStop = function(GPIO:PGPIODevice):LongWord;

GPIO device read

TGPIODeviceRead = function(GPIO:PGPIODevice; Reg:LongWord):LongWord;

GPIO device write

TGPIODeviceWrite = procedure(GPIO:PGPIODevice; Reg,Value:LongWord);

GPIO device input get

TGPIODeviceInputGet = function(GPIO:PGPIODevice; Pin:LongWord):LongWord;

GPIO device input wait

TGPIODeviceInputWait = function(GPIO:PGPIODevice; Pin,Trigger,Timeout:LongWord):LongWord;

GPIO device input event

TGPIODeviceInputEvent = function(GPIO:PGPIODevice; Pin,Trigger,Flags,Timeout:LongWord; Callback:TGPIOCallback; Data:Pointer):LongWord;

GPIO device input cancel

TGPIODeviceInputCancel = function(GPIO:PGPIODevice; Pin:LongWord):LongWord;

GPIO device output set

TGPIODeviceOutputSet = function(GPIO:PGPIODevice; Pin,Level:LongWord):LongWord;

GPIO device pull get

TGPIODevicePullGet = function(GPIO:PGPIODevice; Pin:LongWord):LongWord;

GPIO device pull select

TGPIODevicePullSelect = function(GPIO:PGPIODevice; Pin,Mode:LongWord):LongWord;

GPIO device function get

TGPIODeviceFunctionGet = function(GPIO:PGPIODevice; Pin:LongWord):LongWord;

GPIO device function select

TGPIODeviceFunctionSelect = function(GPIO:PGPIODevice; Pin,Mode:LongWord):LongWord;

GPIO device get properties

TGPIODeviceGetProperties = function(GPIO:PGPIODevice; Properties:PGPIOProperties):LongWord;

GPIO device

[Expand]

PGPIODevice = ^TGPIODevice;

TGPIODevice = record

GPIO pin information

[Expand]

PGPIOInfo = ^TGPIOInfo;

TGPIOInfo = record


Public variables



GPIO logging

GPIO_DEFAULT_LOG_LEVEL:LongWord = GPIO_LOG_LEVEL_DEBUG; Minimum level for GPIO messages. Only messages with level greater than or equal to this will be printed.
GPIO_LOG_ENABLED:Boolean;


Function declarations



Initialization functions

[Expand]
procedure GPIOInit;
Description: To be documented


GPIO functions

[Expand]
function GPIODeviceStart(GPIO:PGPIODevice):LongWord;
Description: Start the specified GPIO device and enable access


[Expand]
function GPIODeviceStop(GPIO:PGPIODevice):LongWord;
Description: Stop the specified GPIO device and disable access


[Expand]
function GPIODeviceRead(GPIO:PGPIODevice; Reg:LongWord):LongWord;
Description: Perform a direct read from a register of the specified GPIO device


[Expand]
procedure GPIODeviceWrite(GPIO:PGPIODevice; Reg,Value:LongWord);
Description: Perform a direct write to a register of the specified GPIO device


[Expand]
function GPIODeviceInputGet(GPIO:PGPIODevice; Pin:LongWord):LongWord;
Description: Get the current state of an input pin on the specified GPIO device


[Expand]
function GPIODeviceInputWait(GPIO:PGPIODevice; Pin,Trigger,Timeout:LongWord):LongWord;
Description: Wait for the state of a input pin to change on the specified GPIO device


[Expand]
function GPIODeviceInputEvent(GPIO:PGPIODevice; Pin,Trigger,Flags,Timeout:LongWord; Callback:TGPIOCallback; Data:Pointer):LongWord;
Description: Schedule a function to be called when the state of a input pin changes on the specified GPIO device


[Expand]
function GPIODeviceInputCancel(GPIO:PGPIODevice; Pin:LongWord):LongWord;
Description: Cancel a previously scheduled event callback function for an input pin on the specified GPIO device


[Expand]
function GPIODeviceOutputSet(GPIO:PGPIODevice; Pin,Level:LongWord):LongWord;
Description: Set the state of a output pin on the specified GPIO device


[Expand]
function GPIODeviceLevelGet(GPIO:PGPIODevice; Pin:LongWord):LongWord;
Description: Get the current level (state) of a pin on the specified GPIO device


[Expand]
function GPIODeviceLevelSet(GPIO:PGPIODevice; Pin,Level:LongWord):LongWord;
Description: Set the level (state) of a pin on the specified GPIO device


[Expand]
function GPIODevicePullGet(GPIO:PGPIODevice;Pin:LongWord):LongWord;
Description: Get the current pull state of a pin on the specified GPIO device


[Expand]
function GPIODevicePullSelect(GPIO:PGPIODevice; Pin,Mode:LongWord):LongWord;
Description: Change the pull state of a pin on the specified GPIO device


[Expand]
function GPIODeviceFunctionGet(GPIO:PGPIODevice; Pin:LongWord):LongWord;
Description: Get the current function of a pin on the specified GPIO device


[Expand]
function GPIODeviceFunctionSelect(GPIO:PGPIODevice; Pin,Mode:LongWord):LongWord;
Description: Change the function of a pin on the specified GPIO device


[Expand]
function GPIODeviceProperties(GPIO:PGPIODevice; Properties:PGPIOProperties):LongWord; inline;
Description: Get the properties for the specified GPIO device


[Expand]
function GPIODeviceGetProperties(GPIO:PGPIODevice; Properties:PGPIOProperties):LongWord;
Description: Get the properties for the specified GPIO device


[Expand]
function GPIODeviceCreate:PGPIODevice;
Description: Create a new GPIO entry


[Expand]
function GPIODeviceCreateEx(Size:LongWord):PGPIODevice;
Description: Create a new GPIO entry


[Expand]
function GPIODeviceDestroy(GPIO:PGPIODevice):LongWord;
Description: Destroy an existing GPIO entry


[Expand]
function GPIODeviceRegister(GPIO:PGPIODevice):LongWord;
Description: Register a new GPIO in the GPIO table


[Expand]
function GPIODeviceDeregister(GPIO:PGPIODevice):LongWord;
Description: Deregister a GPIO in the GPIO table


[Expand]
function GPIODeviceFind(GPIOId:LongWord):PGPIODevice;
Description: Find a GPIO device by ID in the GPIO table


[Expand]
function GPIODeviceFindByName(const Name:String):PGPIODevice; inline;
Description: Find a GPIO device by name in the GPIO table


[Expand]
function GPIODeviceFindByDescription(const Description:String):PGPIODevice; inline;
Description: Find a GPIO device by description in the GPIO table


[Expand]
function GPIODeviceEnumerate(Callback:TGPIOEnumerate; Data:Pointer):LongWord;
Description: Enumerate all GPIO devices in the GPIO table


[Expand]
function GPIODeviceNotification(GPIO:PGPIODevice; Callback:TGPIONotification; Data:Pointer; Notification,Flags:LongWord):LongWord;
Description: Register a notification for GPIO device changes


RTL GPIO functions

[Expand]
function SysGPIOAvailable:Boolean;
Description: Check if a GPIO device is available


[Expand]
function SysGPIOInputGet(Pin:LongWord):LongWord;
Description: Get the current state of a GPIO input pin


[Expand]
function SysGPIOInputWait(Pin,Trigger,Timeout:LongWord):LongWord;
Description: Wait for the state of a GPIO input pin to change


[Expand]
function SysGPIOInputEvent(Pin,Trigger,Timeout:LongWord; Callback:TGPIOCallback; Data:Pointer):LongWord;
Description: Schedule a function to be called when the state of a GPIO input pin changes


[Expand]
function SysGPIOOutputSet(Pin,Level:LongWord):LongWord; 
Description: Set the state of a GPIO output pin


[Expand]
function SysGPIOPullGet(Pin:LongWord):LongWord;
Description: Get the current pull state of a GPIO pin


[Expand]
function SysGPIOPullSelect(Pin,Mode:LongWord):LongWord;
Description: Change the pull state of a GPIO pin


[Expand]
function SysGPIOFunctionGet(Pin:LongWord):LongWord;
Description: Get the current function of a GPIO pin


[Expand]
function SysGPIOFunctionSelect(Pin,Mode:LongWord):LongWord;
Description: Change the function of a GPIO pin


GPIO helper functions

[Expand]
function GPIOGetCount:LongWord;
Description: Get the current GPIO count


[Expand]
function GPIODeviceGetDefault:PGPIODevice;
Description: Get the current default GPIO device


[Expand]
function GPIODeviceSetDefault(GPIO:PGPIODevice):LongWord;
Description: Set the current default GPIO device


[Expand]
function GPIODeviceCheck(GPIO:PGPIODevice):PGPIODevice;
Description: Check if the supplied GPIO is in the GPIO table


[Expand]
function GPIOTypeToString(GPIOType:LongWord):String;
Description: Convert a GPIO type value to a string


[Expand]
function GPIOStateToString(GPIOState:LongWord):String;
Description: Convert a GPIO state value to a string


[Expand]
function GPIODeviceCreateEvent(GPIO:PGPIODevice; Pin:PGPIOPin; Callback:TGPIOCallback; Data:Pointer; Timeout:LongWord):PGPIOEvent;
Description: Create a new event using the supplied parameters


[Expand]
function GPIODeviceDestroyEvent(GPIO:PGPIODevice; Event:PGPIOEvent):LongWord;
Description: Destroy an existing event


[Expand]
function GPIODeviceRegisterEvent(GPIO:PGPIODevice; Pin:PGPIOPin; Event:PGPIOEvent):LongWord;
Description: Register an event in the event list of the supplied Pin


[Expand]
function GPIODeviceDeregisterEvent(GPIO:PGPIODevice;Pin:PGPIOPin;Event:PGPIOEvent):LongWord;
Description: Deregister an event in the event list of the supplied Pin


[Expand]
procedure GPIOLog(Level:LongWord; GPIO:PGPIODevice; const AText:String);
Description: To be documented


[Expand]
procedure GPIOLogInfo(GPIO:PGPIODevice; const AText:String); inline;
Description: To be documented


[Expand]
procedure GPIOLogWarn(GPIO:PGPIODevice; const AText:String); inline;
Description: To be documented


[Expand]
procedure GPIOLogError(GPIO:PGPIODevice; const AText:String); inline;
Description: To be documented


[Expand]
procedure GPIOLogDebug(GPIO:PGPIODevice; const AText:String); inline;
Description: To be documented


[Expand]
function GPIOPinToString(Pin:LongWord):String;
Description: To be documented


[Expand]
function GPIOLevelToString(Level:LongWord):String;
Description: To be documented


[Expand]
function GPIOTriggerToString(Trigger:LongWord):String;
Description: To be documented


[Expand]
function GPIOPullToString(Value:LongWord):String;
Description: To be documented


[Expand]
function GPIOFunctionToString(Value:LongWord):String;
Description: To be documented


Return to Unit Reference