Difference between revisions of "Unit RPISENSEHAT"
Line 123: | Line 123: | ||
---- | ---- | ||
− | '' | + | |
+ | '''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 === |
Revision as of 04:27, 28 March 2018
Return to Unit Reference
Description
Raspberry Pi SenstHat Driver unit
The SenseHAT 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 SenseHAT 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 SenseHAT 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
To be documented
Return to Unit Reference