Jump to content

Component: Joystick (Sparkfun Quiic) (Analog Input)

From Flowcode Help
Revision as of 10:39, 17 November 2021 by Wiki bot (talk | contribs)
Author Matrix TSL
Version 1.0
Category Analog Input


Joystick (Sparkfun Quiic) component

An XY sprung joystick with click switch allowing for easy user input control. Connected using I2C bus.

Detailed description

No detailed description exists yet for this component

Examples

There is a detailed walk through of the scenario detailed at the link below to go with this component.

Traffic Light Scenario

Downloadable macro reference

ChangeI2CAddress
Allows the I2C Device address to be changed which in turn allows more then one RFID reader to sit on the same physical I2C bus. Returns 1 if succesful. 
- BYTE NewAddress
Range: 8 to 119 or 0x08 - 0x77 
[[File:]] - Return


CheckButton
Checks to see if the button has been pressed since the last read of CheckButton or ReadButton. 
[[File:]] - Return


ReadAxis
Reads a single axis of the joystick and returns as a signed integer value. 
- BYTE Axis
Range 0-1 Where 0=X, 1=Y 
[[File:]] - Type
0 = Signed (-512 to 511), 1 = Unsigned (0 to 1023) 
[[File:]] - Return


ReadButton
Checks to see if the button is currently pressed 
[[File:]] - Return


Initialise
Initialises the I2C bus ready for communications with the module. 
- VOID Return


OpenPort
Opens the currently selected COM port, allowing data to be sent and received. 
- VOID Return


SetProp
Allows the COM port property to be set from a parent component. 
- STRING PropName
 
- ULONG PropVal
 
- VOID Return


GetProp
Allows the property filter for the COM port list to be copied to a parent component. 
- STRING PropName
 
- STRING Return


GetConsoleHandle
Gets the handle to the console allowing data displaying on the panel etc. 
[[File:]] - Return


SendByteArray
Sends an array of bytes to the COM port. 
- BYTE Data
Data byte array to send 
- UINT Length
Number of bytes to send 
- VOID Return


ReceiveBinary16Bit
Receives a binary 16-bit value split across two bytes. 
[[File:]] - MSBfirst
0=Least significant byte first, 1=Most significant byte first 
- BYTE Timeout
Max amount of time in ms to wait between bytes 
- UINT Return


ReceiveFloat
Attempts to receive a floating point number as ASCII characters and convert back into a numeric value. Note this function will receive until a timeout or a none numeric char is received, the none numeric char will be lost. 
- BYTE Timeout
Max time in ms to wait in between bytes 
[[File:]] - IgnoreData
0=Dont ignore any data, 1=Ignore any initial none numeric data 
[[File:]] - Return


SendFloat
Sends out a floating point number as an ASCII String from the UART interface. 
[[File:]] - Number
 
- VOID Return


SendHexNumber
Sends out a number as an ASCII hexadecimal String from the UART interface. 
- ULONG Number
 
- BYTE NumChars
Number of characters in the string data, 0 for auto, 2 for 0x00, 4 for 0x0000 
[[File:]] - Prefix
Generate hexadecimal prefix 0x e.g. 1= 0xFF, 0= FF 
- VOID Return


SetFlowControl
Allows the Flowcontrol signals to be enabled or disabled. 
- BYTE State
A value of 0 disables flow control, 1 or above willl enable flow control. 
- VOID Return


OpenPort
Opens the currently selected COM port, allowing data to be sent and received. 
- VOID Return


ReceiveHexNumber
Attempts to receive a hex number as ASCII characters and convert back into a numeric value. Note this function will receive until a timeout or a none hexadecimal char is received, the none numeric char will be lost. 
- BYTE Timeout
Max time in ms to wait in between bytes 
[[File:]] - IgnoreData
0=Dont ignore any data, 1=Ignore any initial none numeric data 
[[File:]] - Prefix
Look for prefix before receiving, 1=0xFF, 0=FF 
- ULONG Return


SetProp
Allows the COM port property to be set from a parent component. 
- STRING PropName
 
- ULONG PropVal
 
- VOID Return


SendBinary32Bit
Sends out a 32-bit binary value split across four bytes. 
- ULONG Value
 
[[File:]] - MSBfirst
0=Least significant byte first, 1=Most significant byte first 
- VOID Return


SendBinaryFloat
Sends out a 32-bit binary floating point value split across four bytes. 
[[File:]] - Value
 
[[File:]] - MSBfirst
0=Least significant byte first, 1=Most significant byte first 
- VOID Return


GetProp
Allows the property filter for the COM port list to be copied to a parent component. 
- STRING PropName
 
- STRING Return


ReceiveByteArray
Attempts to receive an array of bytes using the COM port Returns the number of bytes received.  
- BYTE Data
 
- UINT MaxLength
Max number of bytes to try and read 
- UINT Timeout
Time to wait for incoming data in milliseconds 
- UINT Return


ReceiveString
Attempts to receive an string using the COM port Returns the number of bytes received.  
- UINT Timeout
Time to wait for incoming data in milliseconds 
- UINT MaxLength
Max number of bytes to try and read 
- STRING Return


PWMEnable
Allows pulse width modulated transistor outputs to be switched on or off. Bit 0 = Enable AB Bit 1 = A / Bit 2 = B Bit 3 = C / Bit 4 = D Bit 5 = Enable CD 
- BYTE EnableMask
Range 0-63 or 0b00000 to 0b111111 
- VOID Return


Initialise
 
- VOID Return


GetProp
Allows the property filter for the COM port list to be copied to a parent component. 
- STRING PropName
 
- STRING Return



Property reference

Properties
Return To Center
Decides if the joystick automatically returns to the center position when released. Yes: The joystick will return to the center when released. No: The joystick will remain in the current position when released. 
X Min
 
X Max
 
Y Min
 
Y Max
 
Device Address
External device address used to communicate with the module. Default 32 or 0x20 
Connections
Channel
Channel selection 
Baud Select
Baud rate option selector 
Baud Rate
Baud rate to be used 
SDA
Pin used for SDA (data signal) 
SCL
Pin used for SCL (clock signal) 
Stop Delay
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.  
Simulations
Simulate Comms
Controls if we are using the panel simulation or simulating the I2C calls for use with an I2C injector. 
Scope Traces
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
Selects if the console data is automatically generated or not 
API
Specifies the injector component on the panel to interact with to provide comms simulation.