Difference between revisions of "Unit RPISENSEHAT"
(9 intermediate revisions by the same user not shown) | |||
Line 5: | Line 5: | ||
---- | ---- | ||
− | '''Raspberry Pi | + | '''Raspberry Pi Sense HAT Driver unit''' |
− | The | + | The Sense HAT 8x8 LED matrix is presented in Ultibo as an 8x8 pixel framebuffer. This allows full access to the display at both the individual pixel level and also using the higher level console functions to display text and graphics on the matrix. |
− | The framebuffer device supports rotation around the full 360 degrees by supplying the required rotation value in the framebuffer properties when calling FramebufferAllocate() or by calling the | + | The framebuffer device supports rotation around the full 360 degrees by supplying the required rotation value in the framebuffer properties when calling FramebufferAllocate() or by calling the Sense HAT specific function RPiSenseFramebufferSetRotation(). |
As per the official Python libraries, the default rotation (FRAMEBUFFER_ROTATION_0) gives correct viewing when the HDMI port is facing downwards. | As per the official Python libraries, the default rotation (FRAMEBUFFER_ROTATION_0) gives correct viewing when the HDMI port is facing downwards. | ||
− | The | + | The Sense HAT joystick appears as a keyboard device and the pressed buttons are received as key presses that represent the Left, Right, Up, Down and Enter keys. |
=== Constants === | === Constants === | ||
---- | ---- | ||
− | '' | + | |
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;"> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''RPiSenseHat specific constants''' <code> RPISENSE_* </code></div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | | <code>RPISENSE_SIGNATURE = $EAEBECED;</code> | ||
+ | | style="width: 50%;"| | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;"> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Framebuffer''' <code> RPISENSE_FRAMEBUFFER_* </code></div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | | <code>RPISENSE_FRAMEBUFFER_DESCRIPTION = 'Raspberry Pi Sense HAT Framebuffer';</code> | ||
+ | | Description of RPiSense framebuffer device | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>RPISENSE_PHYSICAL_WIDTH = 8;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>RPISENSE_PHYSICAL_HEIGHT = 8;</code> | ||
+ | | | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;"> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Joystick''' <code> RPISENSE_JOYSTICK_* </code></div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | | <code>RPISENSE_JOYSTICK_DESCRIPTION = 'Raspberry Pi Sense HAT Joystick';</code> | ||
+ | | Description of RPiSense joystick device | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | |colspan="2"|<code>RPISENSE_JOYSTICK_KEYMAP:array[0..4] of Word = (</code> | ||
+ | |- | ||
+ | | <code>SCAN_CODE_DOWN_ARROW,</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>SCAN_CODE_RIGHT_ARROW,</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>SCAN_CODE_UP_ARROW,</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>SCAN_CODE_ENTER,</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>SCAN_CODE_LEFT_ARROW</code> | ||
+ | | | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;"> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''RPiSenseHat register value''' <code> RPISENSE_FB* </code></div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | | <code>RPISENSE_FB = $00;</code> | ||
+ | | style="width: 50%;"| | ||
+ | |- | ||
+ | | <code>RPISENSE_WAI = $F0;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>RPISENSE_VER = $F1;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>RPISENSE_KEYS = $F2;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>RPISENSE_EE_WP = $F3;</code> | ||
+ | | | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;"> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''RPiSenseHat gamma reset value''' <code> RPISENSE_GAMMA_* </code></div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | | <code>RPISENSE_GAMMA_VALUES_DEFAULT = 0;</code> | ||
+ | | style="width: 50%;"| | ||
+ | |- | ||
+ | | <code>RPISENSE_GAMMA_VALUES_LOW = 1;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>RPISENSE_GAMMA_VALUES_USER = 2;</code> | ||
+ | | | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
=== Type definitions === | === Type definitions === | ||
---- | ---- | ||
− | '' | + | |
+ | '''RPi sense''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"> | ||
+ | <code>PRPiSense = ^TRPiSense;</code> | ||
+ | |||
+ | <code>TRPiSense = record</code> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | | <code>Signature:LongWord;</code> | ||
+ | | Signature for entry validation | ||
+ | |- | ||
+ | | <code>I2C:PI2CDevice;</code> | ||
+ | | I2C device | ||
+ | |- | ||
+ | | <code>GPIO:PGPIODevice;</code> | ||
+ | | GPIO device | ||
+ | |- | ||
+ | | <code>Framebuffer:PFramebufferDevice;</code> | ||
+ | | Framebuffer device | ||
+ | |- | ||
+ | | <code>Joystick:PKeyboardDevice;</code> | ||
+ | | Joystick (Keyboard) device | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''RPi sense gamma''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"> | ||
+ | <code>PRPiSenseGamma = ^TRPiSenseGamma;</code> | ||
+ | |||
+ | <code>TRPiSenseGamma = array[0..31] of Byte;</code> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | | | ||
+ | | style="width: 50%;"| | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''RPi sense framebuffer''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"> | ||
+ | <code>PRPiSenseFramebuffer = ^TRPiSenseFramebuffer;</code> | ||
+ | |||
+ | <code>TRPiSenseFramebuffer = record</code> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | |colspan="2"|''Framebuffer Properties'' | ||
+ | |- | ||
+ | | <code>Framebuffer:TFramebufferDevice;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"|''RPiSense Properties'' | ||
+ | |- | ||
+ | | <code>I2C:PI2CDevice;</code> | ||
+ | | The I2C device the device is connected to | ||
+ | |- | ||
+ | | <code>Width:LongWord;</code> | ||
+ | | Framebuffer Width in Pixels (Virtual) | ||
+ | |- | ||
+ | | <code>Height:LongWord;</code> | ||
+ | | Framebuffer Height in Pixels (Virtual) | ||
+ | |- | ||
+ | | <code>Rotation:LongWord;</code> | ||
+ | | Framebuffer Rotation (eg FRAMEBUFFER_ROTATION_180) | ||
+ | |- | ||
+ | | <code>DirtyY1:LongWord;</code> | ||
+ | | First line of dirty region (or Height - 1 if none dirty) | ||
+ | |- | ||
+ | | <code>DirtyY2:LongWord;</code> | ||
+ | | Last line of dirty region (or 0 if none dirty) | ||
+ | |- | ||
+ | | <code>Ready:LongBool;</code> | ||
+ | | If True timer should be enabled during Mark operation | ||
+ | |- | ||
+ | | <code>Blank:LongBool;</code> | ||
+ | | If True then display is currently blanked | ||
+ | |- | ||
+ | | <code>Lock:TMutexHandle;</code> | ||
+ | | Lock for dirty region redraw | ||
+ | |- | ||
+ | | <code>Timer:TTimerHandle;</code> | ||
+ | | Handle for dirty region redraw timer | ||
+ | |- | ||
+ | | <code>FrameRate:LongWord;</code> | ||
+ | | Frame rate for display refresh (in Frames Per Second) | ||
+ | |- | ||
+ | | <code>Gamma:TRPiSenseGamma;</code> | ||
+ | | Current gamma values | ||
+ | |- | ||
+ | | <code>GammaUser:TRPiSenseGamma;</code> | ||
+ | | User gamma values | ||
+ | |- | ||
+ | | <code>PixelData:array[0..63] of Word;</code> | ||
+ | | Pixel data for framebuffer update | ||
+ | |- | ||
+ | | <code>BlockData:array[0..192] of Byte;</code> | ||
+ | | Block data for display update | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''RPi sense joystick''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"> | ||
+ | <code>PRPiSenseJoystick = ^TRPiSenseJoystick;</code> | ||
+ | |||
+ | <code>TRPiSenseJoystick = record</code> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | |colspan="2"|''Keyboard Properties'' | ||
+ | |- | ||
+ | | <code>Keyboard:TKeyboardDevice;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"|''RPiSense Properties'' | ||
+ | |- | ||
+ | | <code>I2C:PI2CDevice;</code> | ||
+ | | The I2C device the device is connected to | ||
+ | |- | ||
+ | | <code>GPIO:PGPIODevice;</code> | ||
+ | | The GPIO device the device is connected to | ||
+ | |- | ||
+ | | <code>Pin:LongWord;</code> | ||
+ | | The GPIO pin used to signal joystick events (GPIO_PIN_23) | ||
+ | |- | ||
+ | | <code>Trigger:LongWord;</code> | ||
+ | | The GPIO trigger to detect joystick events (GPIO_TRIGGER_RISING) | ||
+ | |- | ||
+ | | <code>PreviousKeys:LongInt;</code> | ||
+ | | The keys pressed on the last GPIO event callback | ||
+ | |- | ||
+ | |colspan="2"|''Statistics Properties'' | ||
+ | |- | ||
+ | | <code>CallbackCount:LongWord;</code> | ||
+ | | Number of callback requests received by the device | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
=== Public variables === | === Public variables === | ||
---- | ---- | ||
− | '' | + | |
+ | '''RPiSenseHat specific variables''' | ||
+ | |||
+ | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" | ||
+ | |- | ||
+ | | <code>RPISENSE_I2C_DEVICE:String = 'I2C0';</code> | ||
+ | | style="width: 40%;"| | ||
+ | |- | ||
+ | |} | ||
+ | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" | ||
+ | |- | ||
+ | | <code>RPISENSE_GPIO_DEVICE:String = 'GPIO0';</code> | ||
+ | | style="width: 40%;"| | ||
+ | |- | ||
+ | |} | ||
+ | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" | ||
+ | |- | ||
+ | | <code>RPISENSE_FRAMEBUFFER_ROTATION:LongWord = FRAMEBUFFER_ROTATION_0;</code> | ||
+ | | style="width: 40%;"| | ||
+ | |- | ||
+ | |} | ||
+ | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" | ||
+ | |- | ||
+ | | <code>RPISENSE_FRAMEBUFFER_WIDTH:LongWord = RPISENSE_PHYSICAL_WIDTH;</code> | ||
+ | | style="width: 40%;"| | ||
+ | |- | ||
+ | |} | ||
+ | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" | ||
+ | |- | ||
+ | | <code>RPISENSE_FRAMEBUFFER_HEIGHT:LongWord = RPISENSE_PHYSICAL_HEIGHT;</code> | ||
+ | | style="width: 40%;"| | ||
+ | |- | ||
+ | |} | ||
+ | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" | ||
+ | |- | ||
+ | | <code>RPISENSE_I2C_ADDRESS:Word = $46;</code> | ||
+ | | style="width: 40%;"| | ||
+ | |- | ||
+ | |} | ||
+ | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" | ||
+ | |- | ||
+ | | <code>RPISENSE_LSM9DS1_MAGN_ADDRESS:Word = $1C;</code> | ||
+ | | style="width: 40%;"| | ||
+ | |- | ||
+ | |} | ||
+ | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" | ||
+ | |- | ||
+ | | <code>RPISENSE_LSM9DS1_ACCEL_ADDRESS:Word = $6A;</code> | ||
+ | | style="width: 40%;"| | ||
+ | |- | ||
+ | |} | ||
+ | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" | ||
+ | |- | ||
+ | | <code>RPISENSE_LPS25H_PRESS_ADDRESS:Word = $5C;</code> | ||
+ | | style="width: 40%;"| | ||
+ | |- | ||
+ | |} | ||
+ | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" | ||
+ | |- | ||
+ | | <code>RPISENSE_HTS221_HUMID_ADDRESS:Word = $5F;</code> | ||
+ | | style="width: 40%;"| | ||
+ | |- | ||
+ | |} | ||
+ | <br /> | ||
=== Function declarations === | === Function declarations === | ||
---- | ---- | ||
− | |||
+ | '''Initialization functions''' | ||
+ | |||
+ | <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 RPiSenseInit;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Initialize the RPiSenseHat unit and parameters</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! Note | ||
+ | | Called only during system startup | ||
+ | |- | ||
+ | |} | ||
+ | </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 RPiSenseStart(const I2CDevice,GPIODevice:String; Rotation,Width,Height:LongWord):THandle;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Start the RPiSenseHat driver and register the Framebuffer and Joystick devices</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! I2C | ||
+ | | The name of the I2C device that the Sense HAT is connected to | ||
+ | |- | ||
+ | ! GPIO | ||
+ | | The name of the GPIO device that the Sense HAT is connected to | ||
+ | |- | ||
+ | ! Rotation | ||
+ | | The rotation value of the framebuffer (eg FRAMEBUFFER_ROTATION_180) | ||
+ | |- | ||
+ | ! Width | ||
+ | | The width of the framebuffer in pixels (Virtual width only, the Physical width is fixed at 8 pixels) | ||
+ | |- | ||
+ | ! Height | ||
+ | | The height of the framebuffer in pixels (Virtual height only, the Physical height is fixed at 8 pixels) | ||
+ | |- | ||
+ | ! Return | ||
+ | | The handle of the RPiSenseHat on success or INVALID_HANDLE_VALUE on failure | ||
+ | |- | ||
+ | ! Note | ||
+ | | This function will be called during startup if the parameter RPISENSE_AUTOSTART is True | ||
+ | |- | ||
+ | |} | ||
+ | </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 RPiSenseStop(Handle:THandle):Boolean;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Stop the RPiSenseHat driver and deregister the Framebuffer and Joystick devices</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! Handle | ||
+ | | The handle of the RPiSenseHat or INVALID_HANDLE_VALUE for the default | ||
+ | |- | ||
+ | ! Return | ||
+ | | True if completed or False on failure | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | |||
+ | '''RPiSenseHat framebuffer functions''' | ||
+ | |||
+ | <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 RPiSenseFramebufferCreate(I2C:PI2CDevice; const Name:String; Rotation,Width,Height:LongWord):PFramebufferDevice;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Create, register and allocate a new RPiSenseHat Framebuffer device which can be accessed using the framebuffer API</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! I2C | ||
+ | | The I2C device that the RPiSenseHat is connected to | ||
+ | |- | ||
+ | ! Name | ||
+ | | The text description of this device which will show in the device list (Optional) | ||
+ | |- | ||
+ | ! Rotation | ||
+ | | The rotation value of the framebuffer (eg FRAMEBUFFER_ROTATION_180) | ||
+ | |- | ||
+ | ! Width | ||
+ | | The width of the framebuffer in pixels (Virtual width only, the Physical width is fixed at 8 pixels) | ||
+ | |- | ||
+ | ! Height | ||
+ | | The height of the framebuffer in pixels (Virtual height only, the Physical height is fixed at 8 pixels) | ||
+ | |- | ||
+ | ! Return | ||
+ | | Pointer to the new Framebuffer device or nil if the framebuffer device could not be created | ||
+ | |- | ||
+ | |} | ||
+ | </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 RPiSenseFramebufferDestroy(Framebuffer:PFramebufferDevice):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Release, deregister and destroy an RPiSenseHat Framebuffer device created by this driver}</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! Framebuffer | ||
+ | | The Framebuffer device to destroy | ||
+ | |- | ||
+ | ! Return | ||
+ | | ERROR_SUCCESS if completed 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 RPiSenseFramebufferAllocate(Framebuffer:PFramebufferDevice; Properties:PFramebufferProperties):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Implementation of FramebufferDeviceAllocate API for RPiSenseHat Framebuffer</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! Note | ||
+ | | Not intended to be called directly by applications, use FramebufferDeviceAllocate instead. | ||
+ | |- | ||
+ | |} | ||
+ | </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 RPiSenseFramebufferRelease(Framebuffer:PFramebufferDevice):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Implementation of FramebufferDeviceRelease API for RPiSenseHat Framebuffer</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! Note | ||
+ | | Not intended to be called directly by applications, use FramebufferDeviceRelease instead. | ||
+ | |- | ||
+ | |} | ||
+ | </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 RPiSenseFramebufferBlank(Framebuffer:PFramebufferDevice; Blank:Boolean):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Implementation of FramebufferDevicBlank API for RPiSenseHat Framebuffer</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! Note | ||
+ | | Not intended to be called directly by applications, use FramebufferDevicBlank instead. | ||
+ | |- | ||
+ | |} | ||
+ | </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 RPiSenseFramebufferMark(Framebuffer:PFramebufferDevice; X,Y,Width,Height,Flags:LongWord):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Implementation of FramebufferDeviceMark API for RPiSenseHat Framebuffer</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! Note | ||
+ | | Not intended to be called directly by applications, use FramebufferDeviceMark instead. | ||
+ | Marks full lines only, X and Width are ignored for RPiSenseHat Framebuffer | ||
+ | |- | ||
+ | |} | ||
+ | </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 RPiSenseFramebufferCommit(Framebuffer:PFramebufferDevice; Address:PtrUInt; Size,Flags:LongWord):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Implementation of FramebufferDeviceCommit API for RPiSenseHat Framebuffer</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! Note | ||
+ | | Not intended to be called directly by applications, use FramebufferDeviceCommit instead. | ||
+ | |- | ||
+ | |} | ||
+ | </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 RPiSenseFramebufferSetOffset(Framebuffer:PFramebufferDevice; X,Y:LongWord; Pan:Boolean):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Implementation of FramebufferDeviceSetOffset API for RPiSenseHat Framebuffer</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! Note | ||
+ | | Not intended to be called directly by applications, use FramebufferDeviceSetOffset instead. | ||
+ | |- | ||
+ | |} | ||
+ | </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 RPiSenseFramebufferGetGamma(Framebuffer:PFramebufferDevice; var Gamma:TRPiSenseGamma):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Get the current gamma values from the RPiSenseHat framebuffer</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! Framebuffer | ||
+ | | The Framebuffer device to get from | ||
+ | |- | ||
+ | ! Gamma | ||
+ | | An array of gamma values returned on completion | ||
+ | |- | ||
+ | ! Return | ||
+ | | ERROR_SUCCESS if completed 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 RPiSenseFramebufferSetGamma(Framebuffer:PFramebufferDevice; const Gamma:TRPiSenseGamma):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Set the current gamma values for the RPiSenseHat framebuffer</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! Framebuffer | ||
+ | | The Framebuffer device to set for | ||
+ | |- | ||
+ | ! Gamma | ||
+ | | An array of gamma values to set | ||
+ | |- | ||
+ | ! Return | ||
+ | | ERROR_SUCCESS if completed 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 RPiSenseFramebufferResetGamma(Framebuffer:PFramebufferDevice; Value:LongWord):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Reset the current gamma values for the RPiSenseHat framebuffer to Default, Low or User</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! Framebuffer | ||
+ | | The Framebuffer device to set for | ||
+ | |- | ||
+ | ! Value | ||
+ | | The gamma values to set (0 = Default / 1 = Low / 2 = User) | ||
+ | |- | ||
+ | ! Return | ||
+ | | ERROR_SUCCESS if completed 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 RPiSenseFramebufferSetRotation(Framebuffer:PFramebufferDevice; Rotation:LongWord):LongWord;</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 | ||
+ | |- | ||
+ | |} | ||
+ | </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 RPiSenseFramebufferUpdateDisplay(Framebuffer:PRPiSenseFramebuffer);</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Timer function for RPiSenseHat framebuffer dirty region redraw</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! Note | ||
+ | | Not intended to be called directly by applications | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | |||
+ | '''RPiSenseHat joystick functions''' | ||
+ | |||
+ | <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 RPiSenseJoystickCreate(I2C:PI2CDevice; GPIO:PGPIODevice; const Name:String):PKeyboardDevice;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Create, register and attach a new RPiSenseHat Joystick device which can be accessed using the keyboard API</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! I2C | ||
+ | | The I2C device that the RPiSenseHat is connected to | ||
+ | |- | ||
+ | ! GPIO | ||
+ | | The GPIO device that the RPiSenseHat is connected to | ||
+ | |- | ||
+ | ! Name | ||
+ | | The text description of this device which will show in the device list (Optional) | ||
+ | |- | ||
+ | ! Return | ||
+ | | Pointer to the new Joystick (Keyboard) device or nil if the device could not be created | ||
+ | |- | ||
+ | |} | ||
+ | </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 RPiSenseJoystickDestroy(Joystick:PKeyboardDevice):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Detach, deregister and destroy a RPiSenseHat Joystick device created by this driver</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! Joystick | ||
+ | | The Joystick (Keyboard) device to destroy | ||
+ | |- | ||
+ | ! Return | ||
+ | | ERROR_SUCCESS if completed 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;">procedure RPiSenseJoystickCallback(Joystick:PRPiSenseJoystick; Pin,Trigger:LongWord);</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Callback function for the RPiSenseHat Joystick device, called on a worker thread when the registered GPIO event is triggered by a rising edge on the specified pin</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! Note | ||
+ | | Not intended to be called directly by applications | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
+ | |||
+ | '''RPiSenseHat helper functions''' | ||
+ | |||
+ | <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 RPiSenseRegRead(I2C:PI2CDevice; Address:Word; Reg:Byte):LongInt;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Read a byte from an RPiSenseHat register</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! I2C | ||
+ | | The I2C device the RPiSenseHat is connected to | ||
+ | |- | ||
+ | ! Address | ||
+ | | The I2C address of the RPiSenseHat | ||
+ | |- | ||
+ | ! Reg | ||
+ | | The register to read | ||
+ | |- | ||
+ | ! Return | ||
+ | | The register value on success or -1 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 RPiSenseBlockWrite(I2C:PI2CDevice; Address:Word; Data:PByte; Size:Integer):LongWord;</pre> | ||
+ | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Write a block of data to the RPiSenseHat</div> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | ! I2C | ||
+ | | The I2C device the RPiSenseHat is connected to | ||
+ | |- | ||
+ | ! Address | ||
+ | | The I2C address of the RPiSenseHat | ||
+ | |- | ||
+ | ! Data | ||
+ | | Pointer to the data block to be written | ||
+ | |- | ||
+ | ! Size | ||
+ | | Size of the data block in bytes | ||
+ | |- | ||
+ | ! Return | ||
+ | | ERROR_SUCCESS if completed or another error code on failure | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
Return to [[Unit_Reference|Unit Reference]] | Return to [[Unit_Reference|Unit Reference]] |
Latest revision as of 05:07, 23 November 2022
Return to Unit Reference
Description
Raspberry Pi Sense HAT Driver unit
The Sense HAT 8x8 LED matrix is presented in Ultibo as an 8x8 pixel framebuffer. This allows full access to the display at both the individual pixel level and also using the higher level console functions to display text and graphics on the matrix.
The framebuffer device supports rotation around the full 360 degrees by supplying the required rotation value in the framebuffer properties when calling FramebufferAllocate() or by calling the Sense HAT specific function RPiSenseFramebufferSetRotation().
As per the official Python libraries, the default rotation (FRAMEBUFFER_ROTATION_0) gives correct viewing when the HDMI port is facing downwards.
The Sense HAT joystick appears as a keyboard device and the pressed buttons are received as key presses that represent the Left, Right, Up, Down and Enter keys.
Constants
RPISENSE_*
RPISENSE_SIGNATURE = $EAEBECED;
|
RPISENSE_FRAMEBUFFER_*
RPISENSE_FRAMEBUFFER_DESCRIPTION = 'Raspberry Pi Sense HAT Framebuffer';
|
Description of RPiSense framebuffer device |
RPISENSE_PHYSICAL_WIDTH = 8;
|
|
RPISENSE_PHYSICAL_HEIGHT = 8;
|
RPISENSE_JOYSTICK_*
RPISENSE_JOYSTICK_DESCRIPTION = 'Raspberry Pi Sense HAT Joystick';
|
Description of RPiSense joystick device |
RPISENSE_JOYSTICK_KEYMAP:array[0..4] of Word = (
| |
SCAN_CODE_DOWN_ARROW,
|
|
SCAN_CODE_RIGHT_ARROW,
|
|
SCAN_CODE_UP_ARROW,
|
|
SCAN_CODE_ENTER,
|
|
SCAN_CODE_LEFT_ARROW
|
RPISENSE_FB*
RPISENSE_FB = $00;
|
|
RPISENSE_WAI = $F0;
|
|
RPISENSE_VER = $F1;
|
|
RPISENSE_KEYS = $F2;
|
|
RPISENSE_EE_WP = $F3;
|
RPISENSE_GAMMA_*
RPISENSE_GAMMA_VALUES_DEFAULT = 0;
|
|
RPISENSE_GAMMA_VALUES_LOW = 1;
|
|
RPISENSE_GAMMA_VALUES_USER = 2;
|
Type definitions
RPi sense
PRPiSense = ^TRPiSense;
TRPiSense = record
Signature:LongWord;
|
Signature for entry validation |
I2C:PI2CDevice;
|
I2C device |
GPIO:PGPIODevice;
|
GPIO device |
Framebuffer:PFramebufferDevice;
|
Framebuffer device |
Joystick:PKeyboardDevice;
|
Joystick (Keyboard) device |
RPi sense gamma
PRPiSenseGamma = ^TRPiSenseGamma;
TRPiSenseGamma = array[0..31] of Byte;
RPi sense framebuffer
PRPiSenseFramebuffer = ^TRPiSenseFramebuffer;
TRPiSenseFramebuffer = record
Framebuffer Properties | |
Framebuffer:TFramebufferDevice;
|
|
RPiSense Properties | |
I2C:PI2CDevice;
|
The I2C device the device is connected to |
Width:LongWord;
|
Framebuffer Width in Pixels (Virtual) |
Height:LongWord;
|
Framebuffer Height in Pixels (Virtual) |
Rotation:LongWord;
|
Framebuffer Rotation (eg FRAMEBUFFER_ROTATION_180) |
DirtyY1:LongWord;
|
First line of dirty region (or Height - 1 if none dirty) |
DirtyY2:LongWord;
|
Last line of dirty region (or 0 if none dirty) |
Ready:LongBool;
|
If True timer should be enabled during Mark operation |
Blank:LongBool;
|
If True then display is currently blanked |
Lock:TMutexHandle;
|
Lock for dirty region redraw |
Timer:TTimerHandle;
|
Handle for dirty region redraw timer |
FrameRate:LongWord;
|
Frame rate for display refresh (in Frames Per Second) |
Gamma:TRPiSenseGamma;
|
Current gamma values |
GammaUser:TRPiSenseGamma;
|
User gamma values |
PixelData:array[0..63] of Word;
|
Pixel data for framebuffer update |
BlockData:array[0..192] of Byte;
|
Block data for display update |
RPi sense joystick
PRPiSenseJoystick = ^TRPiSenseJoystick;
TRPiSenseJoystick = record
Keyboard Properties | |
Keyboard:TKeyboardDevice;
|
|
RPiSense Properties | |
I2C:PI2CDevice;
|
The I2C device the device is connected to |
GPIO:PGPIODevice;
|
The GPIO device the device is connected to |
Pin:LongWord;
|
The GPIO pin used to signal joystick events (GPIO_PIN_23) |
Trigger:LongWord;
|
The GPIO trigger to detect joystick events (GPIO_TRIGGER_RISING) |
PreviousKeys:LongInt;
|
The keys pressed on the last GPIO event callback |
Statistics Properties | |
CallbackCount:LongWord;
|
Number of callback requests received by the device |
Public variables
RPiSenseHat specific variables
RPISENSE_I2C_DEVICE:String = 'I2C0';
|
RPISENSE_GPIO_DEVICE:String = 'GPIO0';
|
RPISENSE_FRAMEBUFFER_ROTATION:LongWord = FRAMEBUFFER_ROTATION_0;
|
RPISENSE_FRAMEBUFFER_WIDTH:LongWord = RPISENSE_PHYSICAL_WIDTH;
|
RPISENSE_FRAMEBUFFER_HEIGHT:LongWord = RPISENSE_PHYSICAL_HEIGHT;
|
RPISENSE_I2C_ADDRESS:Word = $46;
|
RPISENSE_LSM9DS1_MAGN_ADDRESS:Word = $1C;
|
RPISENSE_LSM9DS1_ACCEL_ADDRESS:Word = $6A;
|
RPISENSE_LPS25H_PRESS_ADDRESS:Word = $5C;
|
RPISENSE_HTS221_HUMID_ADDRESS:Word = $5F;
|
Function declarations
Initialization functions
procedure RPiSenseInit;
Note | Called only during system startup |
---|
function RPiSenseStart(const I2CDevice,GPIODevice:String; Rotation,Width,Height:LongWord):THandle;
I2C | The name of the I2C device that the Sense HAT is connected to |
---|---|
GPIO | The name of the GPIO device that the Sense HAT is connected to |
Rotation | The rotation value of the framebuffer (eg FRAMEBUFFER_ROTATION_180) |
Width | The width of the framebuffer in pixels (Virtual width only, the Physical width is fixed at 8 pixels) |
Height | The height of the framebuffer in pixels (Virtual height only, the Physical height is fixed at 8 pixels) |
Return | The handle of the RPiSenseHat on success or INVALID_HANDLE_VALUE on failure |
Note | This function will be called during startup if the parameter RPISENSE_AUTOSTART is True |
function RPiSenseStop(Handle:THandle):Boolean;
Handle | The handle of the RPiSenseHat or INVALID_HANDLE_VALUE for the default |
---|---|
Return | True if completed or False on failure |
RPiSenseHat framebuffer functions
function RPiSenseFramebufferCreate(I2C:PI2CDevice; const Name:String; Rotation,Width,Height:LongWord):PFramebufferDevice;
I2C | The I2C device that the RPiSenseHat is connected to |
---|---|
Name | The text description of this device which will show in the device list (Optional) |
Rotation | The rotation value of the framebuffer (eg FRAMEBUFFER_ROTATION_180) |
Width | The width of the framebuffer in pixels (Virtual width only, the Physical width is fixed at 8 pixels) |
Height | The height of the framebuffer in pixels (Virtual height only, the Physical height is fixed at 8 pixels) |
Return | Pointer to the new Framebuffer device or nil if the framebuffer device could not be created |
function RPiSenseFramebufferDestroy(Framebuffer:PFramebufferDevice):LongWord;
Framebuffer | The Framebuffer device to destroy |
---|---|
Return | ERROR_SUCCESS if completed or another error code on failure |
function RPiSenseFramebufferAllocate(Framebuffer:PFramebufferDevice; Properties:PFramebufferProperties):LongWord;
Note | Not intended to be called directly by applications, use FramebufferDeviceAllocate instead. |
---|
function RPiSenseFramebufferRelease(Framebuffer:PFramebufferDevice):LongWord;
Note | Not intended to be called directly by applications, use FramebufferDeviceRelease instead. |
---|
function RPiSenseFramebufferBlank(Framebuffer:PFramebufferDevice; Blank:Boolean):LongWord;
Note | Not intended to be called directly by applications, use FramebufferDevicBlank instead. |
---|
function RPiSenseFramebufferMark(Framebuffer:PFramebufferDevice; X,Y,Width,Height,Flags:LongWord):LongWord;
Note | Not intended to be called directly by applications, use FramebufferDeviceMark instead.
Marks full lines only, X and Width are ignored for RPiSenseHat Framebuffer |
---|
function RPiSenseFramebufferCommit(Framebuffer:PFramebufferDevice; Address:PtrUInt; Size,Flags:LongWord):LongWord;
Note | Not intended to be called directly by applications, use FramebufferDeviceCommit instead. |
---|
function RPiSenseFramebufferSetOffset(Framebuffer:PFramebufferDevice; X,Y:LongWord; Pan:Boolean):LongWord;
Note | Not intended to be called directly by applications, use FramebufferDeviceSetOffset instead. |
---|
function RPiSenseFramebufferGetGamma(Framebuffer:PFramebufferDevice; var Gamma:TRPiSenseGamma):LongWord;
Framebuffer | The Framebuffer device to get from |
---|---|
Gamma | An array of gamma values returned on completion |
Return | ERROR_SUCCESS if completed or another error code on failure |
function RPiSenseFramebufferSetGamma(Framebuffer:PFramebufferDevice; const Gamma:TRPiSenseGamma):LongWord;
Framebuffer | The Framebuffer device to set for |
---|---|
Gamma | An array of gamma values to set |
Return | ERROR_SUCCESS if completed or another error code on failure |
function RPiSenseFramebufferResetGamma(Framebuffer:PFramebufferDevice; Value:LongWord):LongWord;
Framebuffer | The Framebuffer device to set for |
---|---|
Value | The gamma values to set (0 = Default / 1 = Low / 2 = User) |
Return | ERROR_SUCCESS if completed or another error code on failure |
function RPiSenseFramebufferSetRotation(Framebuffer:PFramebufferDevice; Rotation:LongWord):LongWord;
Note | None documented |
---|
procedure RPiSenseFramebufferUpdateDisplay(Framebuffer:PRPiSenseFramebuffer);
Note | Not intended to be called directly by applications |
---|
RPiSenseHat joystick functions
function RPiSenseJoystickCreate(I2C:PI2CDevice; GPIO:PGPIODevice; const Name:String):PKeyboardDevice;
I2C | The I2C device that the RPiSenseHat is connected to |
---|---|
GPIO | The GPIO device that the RPiSenseHat is connected to |
Name | The text description of this device which will show in the device list (Optional) |
Return | Pointer to the new Joystick (Keyboard) device or nil if the device could not be created |
function RPiSenseJoystickDestroy(Joystick:PKeyboardDevice):LongWord;
Joystick | The Joystick (Keyboard) device to destroy |
---|---|
Return | ERROR_SUCCESS if completed or another error code on failure |
procedure RPiSenseJoystickCallback(Joystick:PRPiSenseJoystick; Pin,Trigger:LongWord);
Note | Not intended to be called directly by applications |
---|
RPiSenseHat helper functions
function RPiSenseRegRead(I2C:PI2CDevice; Address:Word; Reg:Byte):LongInt;
I2C | The I2C device the RPiSenseHat is connected to |
---|---|
Address | The I2C address of the RPiSenseHat |
Reg | The register to read |
Return | The register value on success or -1 on failure |
function RPiSenseBlockWrite(I2C:PI2CDevice; Address:Word; Data:PByte; Size:Integer):LongWord;
I2C | The I2C device the RPiSenseHat is connected to |
---|---|
Address | The I2C address of the RPiSenseHat |
Data | Pointer to the data block to be written |
Size | Size of the data block in bytes |
Return | ERROR_SUCCESS if completed or another error code on failure |
Return to Unit Reference