Component: Sense Hat (Raspberry Pi)

From Flowcode Help
Jump to navigationJump to search
Author Matrix TSL
Version 1.0 (Release)
Category Raspberry Pi


Image Sense Hat component

A component to drive various features on the Raspberry Pi Sense Hat. Supported Features: 8x8 RGB LED / 5-Way Joystick

Examples

A simple example to sample the joystick and output a fixed colour to all 8 x 8 RGB LEDs. Pressing up on the joystick outputs blue to the LEDs and pressing down outputs red.

FC6 Icon.png RPI Sense HAT


Downloadable macro reference

ReadJoystick

Reads the joystick

Returns the direction as a bit field.

1 = Down / 2 = Right / 4 = Up / 8 = Click / 16 = Left

Parameters

This macro has no parameters


Return value

BYTE


SetPixel

Seta the colour of a single pixel

Parameters

BYTE X
BYTE Y
BYTE R
BYTE G
BYTE B


Return value

This call does not return a value


SetAll

Sets all pixels to a specific colour

Parameters

BYTE R
BYTE G
BYTE B


Return value

This call does not return a value


Initialise

Initialises the I2C peripheral ready for communications.

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

Channel

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

Channel selection

SDA

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

Pin used for SDA (data signal)

SCL

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

Pin used for SCL (clock signal)

Stop Delay

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

On older microcontroller devices there is a potential for the I2C hardware channel to lock up if there is not

a 10ms delay between an I2C stop event and the next I2C start event.


Most modern microcontrollers will not have a problem so this property can be disabled to speed up the

I2C communications.

Baud Select

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

Baud rate option selector

Baud Rate

This property is of type Signed integer and can be referenced with the variable name cal_i2c1::BAUD.

Baud rate to be used

Scope Traces

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

Selects if the component pin connections are automatically generated on the data recorder window or not.

Yes: Automatically add the component pins to a group on the data recorder which will reflect the sim data during simultion.

No: Do not show the pin signals on the data recorder window.

Console Data

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

Selects if the console data is automatically generated or not

Injector

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

No additional information