Component: Bluetooth (RN4677) (RN4677) (Wireless)

From Flowcode Help
Jump to navigationJump to search
Author Matrix Ltd.
Version 1.4
Category Wireless


Bluetooth (RN4677) component

Low level routines for controlling a Microchip RN4677 Bluetooth Module. Also available in the form of the BL0170 Bluetooth E-block. Uses an interrupt to receive characters from the UART and improve reliability, Must be used with a hardware UART channel.

Component Source Code

Please click here to download the component source project: FC_Comp_Source_Bluetooth_RN4677.fcfx

Please click here to view the component source code (Beta): FC_Comp_Source_Bluetooth_RN4677.fcfx

Detailed description

No detailed description exists yet for this component

Examples

No additional examples







Macro reference

ConnectToMAC

Fc9-comp-macro.png ConnectToMAC
Connects to a specific Bluetooth MAC address. Waits up to 5 seconds for connection to be established. Returns 1 if connection was successful. 
Fc9-string-icon.png - STRING MACAddress
MAC Address of the Bluetooth Device we wish to connect to 
Fc9-bool-icon.png - BOOL Return


EnterCommandMode

Fc9-comp-macro.png EnterCommandMode
Enters command mode allowing commands to be sent using the SendCommand macro. Returns: 0 = No Reply / 1 = Command Mode OK 
Fc9-bool-icon.png - BOOL Return


GetMACAddress

Fc9-comp-macro.png GetMACAddress
Gets the local Bluetooth device MAC address. 
Fc9-string-icon.png - STRING Return


Initialise

Fc9-comp-macro.png Initialise
Sets up the Bluetooth module including: - Enabling the UART - Configuring the module (Name / Key / etc) Returns 1 for OK and 0 for no reply. 
Fc9-u8-icon.png - BYTE Return


LeaveCommandMode

Fc9-comp-macro.png LeaveCommandMode
Leaves command mode allowing data to be passed back and forth, 
Fc9-void-icon.png - VOID Return


ReadString

Fc9-comp-macro.png ReadString
Copies the incoming data from the data string array to a local string variable.  
Fc9-u8-icon.png - BYTE NumBytes
Maximum number of bytes to try and read 
Fc9-string-icon.png - STRING Return


ReceiveByte

Fc9-comp-macro.png ReceiveByte
Receives a single data byte from the Bluetooth module. 0-255 - Valid Data / 256 signifies no data available. 
Fc9-u16-icon.png - UINT Timeout
Amount of time to wait in milliseconds 0=Wait forever 
Fc9-u16-icon.png - UINT Return


SendByte

Fc9-comp-macro.png SendByte
Sends a single data byte out to the Bluetooth module. 
Fc9-u8-icon.png - BYTE Data
 
Fc9-void-icon.png - VOID Return


SendCommand

Fc9-comp-macro.png SendCommand
Sends a command string to the Bluetooth module. 0 = Command sent ok, 255 = No Reply 
Fc9-string-icon.png - STRING Command
 
Fc9-u8-icon.png - BYTE SendCR
 
Fc9-u8-icon.png - BYTE DiscardReply
0=Do not touch the reply, 1=Wait for reply and remove from buffer 
Fc9-u8-icon.png - BYTE Return


SendString

Fc9-comp-macro.png SendString
Sends a string to the Bluetooth module. 
Fc9-string-icon.png - STRING Text
 
Fc9-u8-icon.png - BYTE SendCR
 
Fc9-void-icon.png - VOID Return


WaitForStringValue

Fc9-comp-macro.png WaitForStringValue
Allows us to wait and check for an incoming value. Returns 1 if the string value is found otherwise returns 0. 
Fc9-string-icon.png - STRING Value
String value to look for 
Fc9-u16-icon.png - UINT Timeout
Length of time to wait in milliseconds 
Fc9-bool-icon.png - BOOL Return


Property reference

Fc9-prop-icon.png Properties
Fc9-conn-icon.png Bluetooth Settings
Fc9-type-7-icon.png Init Details
Allows the Bluetooth device name and key to be automatically assigned on initialise. 
Fc9-type-10-icon.png Device Name
Sets the friendly name of the Bluetooth device. 
Fc9-type-10-icon.png Pair Key
 
Fc9-type-7-icon.png Discoverable
Is the Bluetooth module discoverable by default? 
Fc9-type-21-icon.png Reply Timeout
Specifies the amount of time to wait for incoming data before timing out in milliseconds. Default 2000 = 2 seconds. 
Fc9-type-14-icon.png RX Buffer Size
Amount of RAM memory to dedicate to receiving responses and incoming data from the BT module. Default 40 
Fc9-conn-icon.png Connections
Fc9-type-16-icon.png Channel
UART Channel selector Software channels are bit banged using generic I/O pins but are not as reliable as hardware channels. Hardware channels use the selected peripheral on-board the target microcontroller. 
Fc9-type-16-icon.png Baud Options
Baud rate option selector 
Fc9-type-14-icon.png Baud Rate
 
Fc9-type-5-icon.png TX
Pin to be used for Transmit data 
Fc9-type-16-icon.png TX Remap Pin
Allows the hardware transmit pin to be configured from a list of available pins based on your target device, 
Fc9-type-5-icon.png RX
Pin to be used for Receive data 
Fc9-type-16-icon.png RX Remap Pin
Allows the hardware receive pin to be configured from a list of available pins based on your target device, 
Fc9-type-16-icon.png Use Flow Control
Flow Control (Handshake) enable or disable. On: Two I/O pins are used to control the flow of data in and out of the device. Off: Flow control is disabled. 
Fc9-type-5-icon.png Reset Pin
 
Fc9-conn-icon.png Simulation
Fc9-type-7-icon.png Simulate Comms
 
Fc9-conn-icon.png Simulation
Fc9-type-7-icon.png Scope Traces
Selects if the scope traces are automatically added to the data recorder window or not. Simulation - draws an approximation of the UART data onto the scope trace. ICT - sets up the scope trace for incoming data and adds UART packet decoding at the correct BAUD. 
Fc9-type-7-icon.png Console Data
Selects if the console data is automatically generated or not 
Fc9-type-21-icon.png Console Columns
Number of characters that can be displayed on a single line of the console. 
Fc9-type-16-icon.png Data Source
Simulation data source used to allow the component to connect to various remote devices Nothing - Simulation data is ignored COM port - Routes the communication data to and from a physical or virtual COM port Injector - Routes the communication data via a data injector component on the Panel.