Component: LED Cube (Outputs: LEDs)

From Flowcode Help
Jump to navigationJump to search


Author Ben Rowland 2014
Version 1.0 (Release)
Category Outputs: LEDs


Image LED Cube component

LED Cube component for driving 3D arrays of LEDs. A typical cube could consist of 4x4x4 or 8x8x8 but does not necessarily need to be a cuboid.

Examples

No additional examples


Downloadable macro reference

Clear

Clears the contents of the display to 0x0000

Parameters

BYTE SwitchBuffers
0=DoNotSwitch 1=SwitchAutomaticallyWhenDone


Return value

This call does not return a value


RotateShellXZ

Shifts the contents of the display by the number of vertices specified

Parameters

BYTE Direction
BYTE Shell


Return value

This call does not return a value


RotateShellXY

Shifts the contents of the display by the number of vertices specified

Parameters

BYTE Direction
BYTE Shell


Return value

This call does not return a value


DrawLine

Draws a basic 3D line onto the LEDs

Parameters

BYTE X1
BYTE Y1
BYTE Z1
BYTE X2
BYTE Y2
BYTE Z2
UINT Colour
BYTE SwitchBuffers


Return value

This call does not return a value


RotateShellYZ

Shifts the contents of the display by the number of vertices specified

Parameters

BYTE Direction
BYTE Shell


Return value

This call does not return a value


RotateDisplay

Shifts the contents of the display by the number of vertices specified

Parameters

INT X
Number of pixels to shift the display -7 to 7
INT Y
Number of pixels to shift the display -7 to 7
INT Z
Number of pixels to shift the display -7 to 7
BYTE SwitchBuffers


Return value

This call does not return a value


PWMTimer

Interrupt driven macro to clock out the signals to the LEDs in the cube.

To be called as part of a high frequency hardware timer interrupt or software loop to drive the cube hardware,

Min Frequency = 60(Hz) * 8(Height) * 32(5-bitColourChannelValue)

Parameters

This macro has no parameters


Return value

This call does not return a value


ConvRGBToColour

Converts RGB values into a single UINT colour parameter to use with other functions.

Parameters

BYTE Red
BYTE Green
BYTE Blue


Return value

UINT


ConvColourToRGB

Reads the individual RGB colour values from a single UINT colour value.

Return Index: 0=Red, 1=Green, 2=Blue

Parameters

UINT Colour


Return value

STRING


SetColour

Sets a pixel colour in the none active buffer using a 16-bit colour value

Bits 0-4 = Red

Bits 5-10 = Green

Bits 11-15 = Blue

Parameters

BYTE X
BYTE Y
BYTE Z
UINT Colour
16-bit Colour Value (MSB B5, G6, R5 LSB)


Return value

This call does not return a value


GetColour

Reads the colour value from a single pixel in the active buffer as a 16-bit value.

Bits 0-4 = Red

Bits 5-10 = Green

Bits 11-15 = Blue

Parameters

BYTE X
BYTE Y
BYTE Z


Return value

UINT


DrawCuboid

Draws a basic 3D cuboid onto the LEDs

Parameters

BYTE X1
BYTE Y1
BYTE Z1
BYTE X2
BYTE Y2
BYTE Z2
BYTE DrawStyle
Sets the draw style - 0=Soild, 1=Edge, 2=Corners
UINT Colour
BYTE SwitchBuffers


Return value

This call does not return a value


DisplayCharacter

This macro allows a character to be displayed on the screen

Parameters

BYTE Character
BYTE X1
X pixel coordinate to set the output string position.
BYTE Y1
Y pixel coordinate to set the output string position.
BYTE Z1
BYTE Font
Size of the font - 0 = Normal, 1 = Double Width, 2 = Double Width and Height, 3 = Double Height
BYTE Axis
0=XY, 1=XZ, 2=YZ
BYTE Orientation
0=Normal, 1=HFlip. 2=VFlip, 3=HFlip & VFlip
UINT Colour
Specifies the foreground colour
BYTE SwitchBuffers


Return value

This call does not return a value


ResetRotations

Resets the rotation count variables allowing for a new rotation to be started

Parameters

This macro has no parameters


Return value

This call does not return a value


SwitchBuffers

Switches the current display buffer to the updated buffer to allow for seamless updates when undergoing heavy calcaulations.

Parameters

BYTE WaitForSwitch
0=DoNotWait, 1=Waits for switch to occur


Return value

This call does not return a value


ShiftDisplay

Shifts the contents of the display by the number of vertices specified

Parameters

INT X
Number of pixels to shift the display -7 to 7
INT Y
Number of pixels to shift the display -7 to 7
INT Z
Number of pixels to shift the display -7 to 7
BYTE DataMode
0=ResetToZero, 1=WrapAroundDisplay, 2=Smear
BYTE SwitchBuffers


Return value

This call does not return a value


Initialise

Sets up the data memory and draws the simulated LED cube on the panel.

Parameters

This macro has no parameters


Return value

This call does not return a value


Simulation macro reference

This component does not contain any simulation macros


Property reference

Width (X)

This property is of type Unsigned integer and can be referenced with the variable name Width.

The number of LEDs wide

Depth (Y)

This property is of type Unsigned integer and can be referenced with the variable name Depth.

The number of LEDs deep

Height (Z)

This property is of type Unsigned integer and can be referenced with the variable name Height.

The number of LEDs tall

LED Count

This property is of type Unsigned integer and can be referenced with the variable name LEDCount.

Number of LEDs required by the component

LED Type

This property is of type Fixed list of ints and can be referenced with the variable name LEDType.

No additional information


Common Type

This property is of type Fixed list of ints and can be referenced with the variable name CommonType.

No additional information


Wiring Order

This property is of type Fixed list of ints and can be referenced with the variable name LEDWiring.

Specifies the order of the wiring of the LEDs from lowest bit to highest

Driver Pre Delay

This property is of type Unsigned integer and can be referenced with the variable name DriverDelay.

Number of micro seconds to wait between switching off the driver and clocking out the new signals.

Used to remove any ghosting effects visible on the display due to slow driver switch off times.

Driver Post Delay

This property is of type Unsigned integer and can be referenced with the variable name DriverDelay2.

Number of micro seconds to wait between switching off the driver and clocking out the new signals.

Used to remove any ghosting effects visible on the display due to slow driver switch off times.

Clock Pin

This property is of type Single digital pin and can be referenced with the variable name ClockPin.

No additional information


Data Port

This property is of type Digital port byte and can be referenced with the variable name DataPort.

No additional information


Enable Port

This property is of type Digital port byte and can be referenced with the variable name EnablePort.

No additional information


LED Size

This property is of type Floating point and can be referenced with the variable name LEDSize.

Size of each LED on the panel

Spacing

This property is of type Floating point and can be referenced with the variable name Spacing.

Number of units of spacing between each LED

Transparent

This property is of type True or false and can be referenced with the variable name Transparent.

If set to yes then a LED which is completely switched off will be set to transparent,

If set to no then the LED will be shown as black.

Toggle Pins

This property is of type Fixed list of ints and can be referenced with the variable name SimMode.

Determines if the pins are toggled as part of the PWMTimer macro during simulation.

During simulation you probably don't want the pins toggling as it will slow down simulation.

The only exception may be if you want to see the signals in the scope window.

Does not effect the compiled embedded code.