Component: Bluetooth (RN4677) (Wireless)

From Flowcode Help
Jump to navigationJump to search


Author Matrix Ltd.
Version 1.0 (Release)
Category Wireless


Image 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.

Examples

No additional examples


Downloadable macro reference

ReceiveByte

Receives a single data byte from the Bluetooth module.

0xFF signifies no data available.

Parameters

UINT Timeout
Amount of time to wait in milliseconds 0=Wait forever


Return value

BYTE


SendString

Sends a string to the GSM module.

Parameters

<- STRING Command
This parameter may be returned back to the caller
BYTE SendCR


Return value

This call does not return a value


ReadString

Copies the incoming data from the data string array to a local string variable.

Parameters

BYTE NumBytes
Maximum number of bytes to try and read


Return value

STRING


SendByte

Sends a single data byte out to the Bluetooth module.

Parameters

BYTE Data


Return value

This call does not return a value


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.

Parameters

This macro has no parameters


Return value

BYTE


Simulation macro reference

This component does not contain any simulation macros


Property reference

Device Name

This property is of type Line of text and can be referenced with the variable name DeviceName.

Sets the friendly name of the Bluetooth device.

Pair Key

This property is of type Line of text and can be referenced with the variable name PairKey.

No additional information


Discoverable

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

Is the Bluetooth module discoverable by default?

Reply Timeout

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.

Default 2000 = 2 seconds.

RX Buffer Size

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

Amount of RAM memory to dedicate to receiving responses and incoming data from the BT module.

Default 40

Channel

This property is of type Fixed list of ints and can be referenced with the variable name cal_uart::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.

Baud Options

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

Baud rate option selector

Baud Rate

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

No additional information


TX

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

Pin to be used for Transmit data

TX Remap Pin

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

Allows the hardware transmit pin to be configured from a list of available pins based on your target device,

RX

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

Pin to be used for Receive data

RX Remap Pin

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

Allows the hardware receive pin to be configured from a list of available pins based on your target device,

Use Flow Control

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

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.

Reset Pin

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

No additional information


Label

This property is of type Line of text and can be referenced with the variable name label.

Textual label shown on the component I/O flasher

Scope Traces

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

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.

Console Data

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

Selects if the console data is automatically generated or not

Console Columns

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

Number of characters that can be displayed on a single line of the console.

Data Source

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

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.