Difference between revisions of "Component: Bluetooth (BL0170) (E-blocks 2)"

From Flowcode Help
Jump to navigationJump to search
 
(10 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
+
{| style="width:50%"
 
 
{| width="50%"
 
 
|-
 
|-
| width="20%" style="color: gray;" | Author
+
| width="20%" style="color:gray;" | Author
 
| Matrix Ltd.
 
| Matrix Ltd.
 
|-
 
|-
| width="20%" style="color: gray;" | Version
+
| width="20%" style="color:gray;" | Version
| 1.0 (Release)
+
| 1.3
 
|-
 
|-
| width="20%" style="color: gray;" | Category
+
| width="20%" style="color:gray;" | Category
 
| E-blocks 2
 
| E-blocks 2
 
|}
 
|}
  
  
 +
==Bluetooth 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.
  
==[[File:Component Icon 5f9d5a58_6c01_4588_afa0_df4c01ce161a.png|Image]] Bluetooth (BL0170) component==
+
==Component Source Code==
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.
 
  
There are component macros in flowcode 8 that allow you to send to and receive information from the Bluetooth component in the form of a string or a single byte. The component needs to be initialised before it can send or receive information, with the ‘Initialise’ macro.
+
Please click here to download the component source project: [https://www.flowcode.co.uk/wiki/componentsource/FC_Comp_Source_EBlocks2_Bluetooth_RN4677_BL0170.fcfx FC_Comp_Source_EBlocks2_Bluetooth_RN4677_BL0170.fcfx]
Make sure the Bluetooth component is connected to the right port in flowcode, corresponding to the port it’s connected to on your E-blocks 2 upstream board.
 
  
==Examples==
+
Please click here to view the component source code (Beta): [https://www.flowcode.co.uk/FlowchartView/?wfile=componentsource/FC_Comp_Source_EBlocks2_Bluetooth_RN4677_BL0170.fcfx FC_Comp_Source_EBlocks2_Bluetooth_RN4677_BL0170.fcfx]
''<span style="color:red;">No additional examples</span>''
 
  
 +
==Detailed description==
  
==Downloadable macro reference==
 
  
===<span style="font-weight: normal;"><u><tt>ReceiveByte</tt></u></span>===
 
Receives a single data byte from the Bluetooth module.
 
  
0xFF signifies no data available.
 
  
'''Parameters'''
 
  
:[[Variable Types|UINT]] ''Timeout''
 
::Amount of time to wait in milliseconds 0=Wait forever
 
  
  
'''Return value'''
 
  
:[[Variable Types|BYTE]]
 
  
  
===<span style="font-weight: normal;"><u><tt>SendString</tt></u></span>===
 
Sends a string to the GSM module.
 
  
'''Parameters'''
+
''No detailed description exists yet for this component''
  
:[[Variable Types|<- STRING]] ''Command''
+
==Examples==
::''This parameter may be returned back to the caller''
 
  
:[[Variable Types|BYTE]] ''SendCR''
 
  
  
'''Return value'''
 
  
:''This call does not return a value''
 
  
  
===<span style="font-weight: normal;"><u><tt>ReadString</tt></u></span>===
 
Copies the incoming data from the data string array to a local string variable.
 
  
'''Parameters'''
 
  
:[[Variable Types|BYTE]] ''NumBytes''
 
::Maximum number of bytes to try and read
 
  
  
'''Return value'''
 
  
:[[Variable Types|STRING]]
 
  
 +
''<span style="color:red;">No additional examples</span>''
  
===<span style="font-weight: normal;"><u><tt>SendByte</tt></u></span>===
 
Sends a single data byte out to the Bluetooth module.
 
  
'''Parameters'''
 
  
:[[Variable Types|BYTE]] ''Data''
 
  
  
'''Return value'''
 
  
:''This call does not return a value''
 
  
  
===<span style="font-weight: normal;"><u><tt>Initialise</tt></u></span>===
 
Sets up the Bluetooth module including:
 
  
- Enabling the UART
 
  
- Configuring the module (Name / Key / etc)
 
  
Returns 1 for OK and 0 for no reply.
 
  
'''Parameters'''
+
==Macro reference==
  
:''This macro has no parameters''
+
===ConnectToMAC===
 +
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 +
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ConnectToMAC'''
 +
|-
 +
| colspan="2" | Connects to a specific Bluetooth MAC address. Waits up to 5 seconds for connection to be established. Returns 1 if connection was successful.&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING
 +
| width="90%" | MACAddress
 +
|-
 +
| colspan="2" | &nbsp;
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-bool-icon.png]] - BOOL
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
  
'''Return value'''
+
===EnterCommandMode===
 +
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 +
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''EnterCommandMode'''
 +
|-
 +
| colspan="2" | Enters command mode allowing commands to be sent using the SendCommand macro. Returns: 0 = No Reply / 1 = Command Mode OK&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-bool-icon.png]] - BOOL
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
:[[Variable Types|BYTE]]
 
  
 +
===GetMACAddress===
 +
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 +
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetMACAddress'''
 +
|-
 +
| colspan="2" | Gets the local Bluetooth device MAC address.&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-string-icon.png]] - STRING
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
  
==Simulation macro reference==
+
===Initialise===
 +
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 +
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Initialise'''
 +
|-
 +
| colspan="2" | Sets up the Bluetooth module including:  - Enabling the UART  - Configuring the module (Name / Key / etc) Returns 1 for OK and 0 for no reply.&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
''This component does not contain any simulation macros''
 
  
 +
===LeaveCommandMode===
 +
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 +
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''LeaveCommandMode'''
 +
|-
 +
| colspan="2" | Leaves command mode allowing data to be passed back and forth,&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
==Property reference==
 
<span style="font-weight: normal;"><u>Device Name</u></span>
 
  
This property is of type ''Line of text'' and can be referenced with the variable name ''DeviceName''.
+
===ReadString===
 +
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 +
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ReadString'''
 +
|-
 +
| colspan="2" | Copies the incoming data from the data string array to a local string variable. &nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" | NumBytes
 +
|-
 +
| colspan="2" | Maximum number of bytes to try and read&nbsp;
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-string-icon.png]] - STRING
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
Sets the friendly name of the Bluetooth device.
 
  
<span style="font-weight: normal;"><u>Pair Key</u></span>
+
===ReceiveByte===
 +
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 +
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ReceiveByte'''
 +
|-
 +
| colspan="2" | Receives a single data byte from the Bluetooth module. 0-255 signifies valid data / 256 signifies no data available.&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 +
| width="90%" | Timeout
 +
|-
 +
| colspan="2" | Amount of time to wait in milliseconds 0=Wait forever&nbsp;
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u16-icon.png]] - UINT
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
This property is of type ''Line of text'' and can be referenced with the variable name ''PairKey''.
 
  
''<span style="color:red;">No additional information</span>''
+
===ReceiveCount===
 +
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 +
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ReceiveCount'''
 +
|-
 +
| colspan="2" | Returns the number of bytes currently sat waiting in the receive buffer.&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u16-icon.png]] - UINT
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
  
 +
===SendByte===
 +
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 +
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SendByte'''
 +
|-
 +
| colspan="2" | Sends a single data byte out to the Bluetooth module.&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" | Data
 +
|-
 +
| colspan="2" | &nbsp;
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
<span style="font-weight: normal;"><u>Discoverable</u></span>
 
  
This property is of type ''True or false'' and can be referenced with the variable name ''InitDisc''.
+
===SendCommand===
 +
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 +
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SendCommand'''
 +
|-
 +
| colspan="2" | Sends a command string to the Bluetooth module. Returns: 0 = No Reply / 1 = Command sent ok&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING
 +
| width="90%" | Command
 +
|-
 +
| colspan="2" | &nbsp;
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" | SendCR
 +
|-
 +
| colspan="2" | &nbsp;
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" | DiscardReply
 +
|-
 +
| colspan="2" | 0=Do not touch the reply, 1=Wait for reply and remove from buffer&nbsp;
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
Is the Bluetooth module discoverable by default?
 
  
<span style="font-weight: normal;"><u>Reply Timeout</u></span>
+
===SendString===
 +
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 +
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SendString'''
 +
|-
 +
| colspan="2" | Sends a string to the Bluetooth module.&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING
 +
| width="90%" | Command
 +
|-
 +
| colspan="2" | &nbsp;
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" | SendCR
 +
|-
 +
| colspan="2" | &nbsp;
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
This property is of type ''Unsigned integer'' and can be referenced with the variable name ''ReplyTimeout''.
 
  
Specifies the amount of time to wait for incoming data before timing out in milliseconds.
+
===WaitForStringValue===
 +
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 +
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''WaitForStringValue'''
 +
|-
 +
| colspan="2" | Allows us to wait and check for an incoming value. Returns 1 if the string value is found otherwise returns 0.&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING
 +
| width="90%" | Value
 +
|-
 +
| colspan="2" | String value to look for&nbsp;
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 +
| width="90%" | Timeout
 +
|-
 +
| colspan="2" | Length of time to wait in milliseconds&nbsp;
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-bool-icon.png]] - BOOL
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
Default 2000 = 2 seconds.
 
  
<span style="font-weight: normal;"><u>RX Buffer Size</u></span>
+
==Property reference==
  
This property is of type ''Signed integer'' and can be referenced with the variable name ''string_size''.
+
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
+
|-
Amount of RAM memory to dedicate to receiving responses and incoming data from the BT module.
+
| width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-prop-icon.png]]
 
+
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Properties'''  
Default 40
+
|-
 
+
|-
<span style="font-weight: normal;"><u>Channel</u></span>
+
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
 
+
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Bluetooth Settings
This property is of type ''Fixed list of ints'' and can be referenced with the variable name ''cal_uart::CHANNEL''.
+
|-
 
+
|-
UART Channel selector
+
| width="10%" align="center" | [[File:Fc9-type-10-icon.png]]
 
+
| width="90%" | Device Name
Software channels are bit banged using generic I/O pins but are not as reliable as hardware channels.
+
|-
 
+
| colspan="2" | Sets the friendly name of the Bluetooth device.&nbsp;
Hardware channels use the selected peripheral on-board the target microcontroller.
+
|-
 
+
| width="10%" align="center" | [[File:Fc9-type-10-icon.png]]
<span style="font-weight: normal;"><u>Baud Options</u></span>
+
| width="90%" | Pair Key
 
+
|-
This property is of type ''Fixed list of ints'' and can be referenced with the variable name ''cal_uart::BAUD_LIST''.
+
| colspan="2" | &nbsp;
 
+
|-
Baud rate option selector
+
| width="10%" align="center" | [[File:Fc9-type-7-icon.png]]
 
+
| width="90%" | Discoverable
<span style="font-weight: normal;"><u>Baud Rate</u></span>
+
|-
 
+
| colspan="2" | Is the Bluetooth module discoverable by default?&nbsp;
This property is of type ''Signed integer'' and can be referenced with the variable name ''cal_uart::BAUD''.
+
|-
 
+
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
''<span style="color:red;">No additional information</span>''
+
| width="90%" | Reply Timeout
 
+
|-
 
+
| colspan="2" | Specifies the amount of time to wait for incoming data before timing out in milliseconds. Default 2000 = 2 seconds.&nbsp;
 
+
|-
<span style="font-weight: normal;"><u>TX</u></span>
+
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]]
 
+
| width="90%" | RX Buffer Size
This property is of type ''Single digital pin'' and can be referenced with the variable name ''cal_uart::TX''.
+
|-
 
+
| colspan="2" | Amount of RAM memory to dedicate to receiving responses and incoming data from the BT module. Default 40&nbsp;
Pin to be used for Transmit data
+
|-
 
+
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
<span style="font-weight: normal;"><u>TX Remap Pin</u></span>
+
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Connections
 
+
|-
This property is of type ''Fixed list of ints'' and can be referenced with the variable name ''cal_uart::OutputPins''.
+
|-
 
+
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
Allows the hardware transmit pin to be configured from a list of available pins based on your target device,
+
| width="90%" | Channel
 
+
|-
<span style="font-weight: normal;"><u>RX</u></span>
+
| colspan="2" | 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.&nbsp;
 
+
|-
This property is of type ''Single digital pin'' and can be referenced with the variable name ''cal_uart::RX''.
+
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
 
+
| width="90%" | Baud Options
Pin to be used for Receive data
+
|-
 
+
| colspan="2" | Baud rate option selector&nbsp;
<span style="font-weight: normal;"><u>RX Remap Pin</u></span>
+
|-
 
+
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]]
This property is of type ''Fixed list of ints'' and can be referenced with the variable name ''cal_uart::InputPins''.
+
| width="90%" | Baud Rate
 
+
|-
Allows the hardware receive pin to be configured from a list of available pins based on your target device,
+
| colspan="2" | &nbsp;
 
+
|-
<span style="font-weight: normal;"><u>Use Flow Control</u></span>
+
| width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
 
+
| width="90%" | TX
This property is of type ''Fixed list of ints'' and can be referenced with the variable name ''cal_uart::FLOWEN''.
+
|-
 
+
| colspan="2" | Pin to be used for Transmit data&nbsp;
Flow Control (Handshake) enable or disable.
+
|-
 
+
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
    On: Two I/O pins are used to control the flow of data in and out of the device.
+
| width="90%" | TX Remap Pin
 
+
|-
    Off: Flow control is disabled.
+
| colspan="2" | Allows the hardware transmit pin to be configured from a list of available pins based on your target device,&nbsp;
 
+
|-
<span style="font-weight: normal;"><u>Reset Pin</u></span>
+
| width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
 
+
| width="90%" | RX
This property is of type ''Single digital pin'' and can be referenced with the variable name ''Reset''.
+
|-
 
+
| colspan="2" | Pin to be used for Receive data&nbsp;
''<span style="color:red;">No additional information</span>''
+
|-
 
+
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
 
+
| width="90%" | RX Remap Pin
 
+
|-
<span style="font-weight: normal;"><u>Label</u></span>
+
| colspan="2" | Allows the hardware receive pin to be configured from a list of available pins based on your target device,&nbsp;
 
+
|-
This property is of type ''Line of text'' and can be referenced with the variable name ''label''.
+
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
 
+
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Simulation
Textual label shown on the component I/O flasher
+
|-
 
+
|-
<span style="font-weight: normal;"><u>Scope Traces</u></span>
+
| width="10%" align="center" | [[File:Fc9-type-7-icon.png]]
 
+
| width="90%" | Simulate Comms
This property is of type ''True or false'' and can be referenced with the variable name ''cal_uart::ScopeTraces''.
+
|-
 
+
| colspan="2" | &nbsp;
Selects if the scope traces are automatically added to the data recorder window or not.
+
|-
 
+
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
     Simulation - draws an approximation of the UART data onto the scope trace.
+
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Simulation
 
+
|-
     ICT - sets up the scope trace for incoming data and adds UART packet decoding at the correct BAUD.
+
|-
 
+
| width="10%" align="center" | [[File:Fc9-type-7-icon.png]]
<span style="font-weight: normal;"><u>Console Data</u></span>
+
| width="90%" | Scope Traces
 
+
|-
This property is of type ''True or false'' and can be referenced with the variable name ''cal_uart::ConsoleData''.
+
| colspan="2" | 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.&nbsp;
 
+
|-
Selects if the console data is automatically generated or not
+
| width="10%" align="center" | [[File:Fc9-type-7-icon.png]]
 
+
| width="90%" | Console Data
<span style="font-weight: normal;"><u>Console Columns</u></span>
+
|-
 
+
| colspan="2" | Selects if the console data is automatically generated or not&nbsp;
This property is of type ''Unsigned integer'' and can be referenced with the variable name ''cal_uart::ConsoleColumns''.
+
|-
 
+
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
Number of characters that can be displayed on a single line of the console.
+
| width="90%" | Console Columns
 
+
|-
<span style="font-weight: normal;"><u>Data Source</u></span>
+
| colspan="2" | Number of characters that can be displayed on a single line of the console.&nbsp;
 
+
|-
This property is of type ''Fixed list of ints'' and can be referenced with the variable name ''cal_uart::DataSource''.
+
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
 
+
| width="90%" | Data Source
Simulation data source used to allow the component to connect to various remote devices
+
|-
 
+
| colspan="2" | 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.&nbsp;
     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.
 

Latest revision as of 13:09, 7 February 2023

Author Matrix Ltd.
Version 1.3
Category E-blocks 2


Bluetooth 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_EBlocks2_Bluetooth_RN4677_BL0170.fcfx

Please click here to view the component source code (Beta): FC_Comp_Source_EBlocks2_Bluetooth_RN4677_BL0170.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
 
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 signifies 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


ReceiveCount

Fc9-comp-macro.png ReceiveCount
Returns the number of bytes currently sat waiting in the receive buffer. 
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. Returns: 0 = No Reply / 1 = Command sent ok 
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 Command
 
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-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-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.