bluetooth 2.0.0.0
Public function

Functions

void bluetooth_cfg_setup (bluetooth_cfg_t *cfg)
 Config Object Initialization function.
 
BLUETOOTH_RETVAL bluetooth_init (bluetooth_t *ctx, bluetooth_cfg_t *cfg)
 Initialization function.
 
void bluetooth_generic_write (bluetooth_t *ctx, char *data_buf, uint16_t len)
 Generic write function.
 
int32_t bluetooth_generic_read (bluetooth_t *ctx, char *data_buf, uint16_t max_len)
 Generic read function.
 
void bluetooth_write_command (bluetooth_t *ctx, char *data_buf, uint16_t len)
 Write command function.
 
void bluetooth_enable (bluetooth_t *ctx)
 Enable device function.
 
void bluetooth_hw_reset (bluetooth_t *ctx)
 Hardwere reset function.
 
void bluetooth_enter_command_mode (bluetooth_t *ctx)
 Enter the command mode function.
 
void bluetooth_exit_command_mode (bluetooth_t *ctx)
 Exit the command mode function.
 
void bluetooth_toggle_echo (bluetooth_t *ctx)
 Toggles echo function.
 
void bluetooth_set_device_name (bluetooth_t *ctx, uint8_t *name)
 Set the device name function.
 
void bluetooth_set_operating_mode (bluetooth_t *ctx, uint8_t op_mode)
 Set the operating mode function.
 
void bluetooth_enable_7_bit_data_mode (bluetooth_t *ctx)
 Enable 7-Bit data mode function.
 
void bluetooth_disable_7_bit_data_mode (bluetooth_t *ctx)
 Disable 7-Bit data mode function.
 
void bluetooth_set_authentication (bluetooth_t *ctx, uint8_t auth_value)
 Set the authentication function.
 
void bluetooth_set_break (bluetooth_t *ctx, uint8_t break_signal)
 Set the break function.
 
BLUETOOTH_RETVAL bluetooth_set_cod (bluetooth_t *ctx, uint8_t *msw, uint8_t *lsw)
 Sets the class of device (COD) function.
 
void bluetooth_set_factory_defaults (bluetooth_t *ctx)
 Set factory defaults settings function.
 
void bluetooth_set_discoverability (bluetooth_t *ctx, uint8_t *d_hex_value)
 Set enable an inquiry scan function.
 
void bluetooth_setConnectability (bluetooth_t *ctx, uint8_t *c_hex_value)
 Set enable page scanning function.
 
BLUETOOTH_RETVAL bluetooth_set_uart_parity (bluetooth_t *ctx, uint8_t character)
 Set UART parity function.
 
void bluetooth_set_extended_status_string (bluetooth_t *ctx, uint8_t *es_string)
 Set extended status string function.
 
BLUETOOTH_RETVAL bluetooth_set_security_pin_code (bluetooth_t *ctx, uint8_t *sp_code)
 Set security pin code function.
 
BLUETOOTH_RETVAL bluetooth_set_special_config (bluetooth_t *ctx, uint16_t special_config)
 Set special configuration settings function.
 
void bluetooth_set_remote_address (bluetooth_t *ctx, uint8_t *r_addr)
 Set the remote Bluetooth address function.
 
BLUETOOTH_RETVAL bluetooth_set_baud_rate (bluetooth_t *ctx, uint32_t baud_rate)
 Set the baud rate function.
 
void bluetooth_enable_bonding (bluetooth_t *ctx)
 Set bonding enable function.
 
void bluetooth_disable_bonding (bluetooth_t *ctx)
 Set bonding disable function.
 
void bluetooth_reboot (bluetooth_t *ctx)
 Reboot the module function.
 
BLUETOOTH_RETVAL bluetooth_set_profile (bluetooth_t *ctx, uint8_t profile)
 Set the profile function.
 
void bluetooth_enable_role_switch (bluetooth_t *ctx)
 Enables the role switch function.
 
void bluetooth_disable_role_switch (bluetooth_t *ctx)
 Disables the role switch function.
 
void bluetooth_connect_to_remote_address (bluetooth_t *ctx, uint8_t *r_addr)
 Connect the device to a remote address function.
 
void bluetooth_connect_to_remote_address_fast_mode (bluetooth_t *ctx, uint8_t *r_addr)
 Connect the device to a remote address fast mode function.
 
void bluetooth_endspecial_config (bluetooth_t *ctx)
 Ends configuration and puts the device into fast data mode function.
 
void bluetooth_get_help (bluetooth_t *ctx)
 Get displays a list of help command function.
 
void bluetooth_get_basic_settings (bluetooth_t *ctx)
 Get displays basic settings function.
 
void bluetooth_get_extended_settings (bluetooth_t *ctx)
 Get displays the device�s extended settings function.
 
void bluetooth_get_device_address (bluetooth_t *ctx)
 Get displays the device�s eBluetooth address function.
 
void bluetooth_scans_device (bluetooth_t *ctx)
 Scans for Bluetooth devices in pairing mode function.
 
void bluetooth_get_signal_status (bluetooth_t *ctx)
 Displays the remote side modem signal status function.
 
void bluetooth_set_undiscoverable (bluetooth_t *ctx)
 Set undiscoverable mode function.
 
BLUETOOTH_RETVAL bluetooth_set_quiet_mode (bluetooth_t *ctx, uint8_t q_mode)
 Set quiet mode function.
 
void bluetooth_get_firmware_version (bluetooth_t *ctx)
 Get firmware version function.
 

Detailed Description

Function Documentation

◆ bluetooth_cfg_setup()

void bluetooth_cfg_setup ( bluetooth_cfg_t * cfg)

Config Object Initialization function.

Parameters
cfgClick configuration structure.

@description This function initializes click configuration structure to init state.

Note
All used pins will be set to unconnected state.

◆ bluetooth_connect_to_remote_address()

void bluetooth_connect_to_remote_address ( bluetooth_t * ctx,
uint8_t * r_addr )

Connect the device to a remote address function.

Parameters
ctxClick object.
r_addrPointer to the memory location where the remote address string be stored

@description The function connect the device to a remote address to the RN-41 Bluetooth module on Bluetooth Click board.

◆ bluetooth_connect_to_remote_address_fast_mode()

void bluetooth_connect_to_remote_address_fast_mode ( bluetooth_t * ctx,
uint8_t * r_addr )

Connect the device to a remote address fast mode function.

Parameters
ctxClick object.
r_addrPointer to the memory location where the remote address string be stored

@description The function connect the device to a remote address fast mode to the RN-41 Bluetooth module on Bluetooth Click board.

◆ bluetooth_disable_7_bit_data_mode()

void bluetooth_disable_7_bit_data_mode ( bluetooth_t * ctx)

Disable 7-Bit data mode function.

Parameters
ctxClick object.

@description The function disable 7-Bit data mode of the RN-41 Bluetooth module on Bluetooth Click board.

◆ bluetooth_disable_bonding()

void bluetooth_disable_bonding ( bluetooth_t * ctx)

Set bonding disable function.

Parameters
ctxClick object.

@description The function set bonding disable of the RN-41 Bluetooth module on Bluetooth Click board.

◆ bluetooth_disable_role_switch()

void bluetooth_disable_role_switch ( bluetooth_t * ctx)

Disables the role switch function.

Parameters
ctxClick object.

@description The function disables the role switch of the RN-41 Bluetooth module on Bluetooth Click board.

◆ bluetooth_enable()

void bluetooth_enable ( bluetooth_t * ctx)

Enable device function.

Parameters
ctxClick object.

@description The function enable RN-41 Bluetooth module on Bluetooth Click board by set to '1' state of RST pin.

◆ bluetooth_enable_7_bit_data_mode()

void bluetooth_enable_7_bit_data_mode ( bluetooth_t * ctx)

Enable 7-Bit data mode function.

Parameters
ctxClick object.

@description The function enable 7-Bit data mode of the RN-41 Bluetooth module on Bluetooth Click board.

◆ bluetooth_enable_bonding()

void bluetooth_enable_bonding ( bluetooth_t * ctx)

Set bonding enable function.

Parameters
ctxClick object.

@description The function set bonding enable of the RN-41 Bluetooth module on Bluetooth Click board.

◆ bluetooth_enable_role_switch()

void bluetooth_enable_role_switch ( bluetooth_t * ctx)

Enables the role switch function.

Parameters
ctxClick object.

@description The function enables the role switch of the RN-41 Bluetooth module on Bluetooth Click board.

◆ bluetooth_endspecial_config()

void bluetooth_endspecial_config ( bluetooth_t * ctx)

Ends configuration and puts the device into fast data mode function.

Parameters
ctxClick object.

@description The function ends configuration and puts the device into fast data mode to the RN-41 Bluetooth module on Bluetooth Click board.

◆ bluetooth_enter_command_mode()

void bluetooth_enter_command_mode ( bluetooth_t * ctx)

Enter the command mode function.

Parameters
ctxClick object.

@description The function enter the command mode of the RN-41 Bluetooth module on Bluetooth Click board.

◆ bluetooth_exit_command_mode()

void bluetooth_exit_command_mode ( bluetooth_t * ctx)

Exit the command mode function.

Parameters
ctxClick object.

@description The function exit the command mode of the RN-41 Bluetooth module on Bluetooth Click board.

◆ bluetooth_generic_read()

int32_t bluetooth_generic_read ( bluetooth_t * ctx,
char * data_buf,
uint16_t max_len )

Generic read function.

Parameters
bluetoothClick object.
data_bufData buffer for read data.
max_lenThe maximum length of data that can be read.
Returns
Number of reads data.

◆ bluetooth_generic_write()

void bluetooth_generic_write ( bluetooth_t * ctx,
char * data_buf,
uint16_t len )

Generic write function.

Parameters
bluetoothClick object.
data_bufData buffer for sends.
lenNumber of bytes for sends.

◆ bluetooth_get_basic_settings()

void bluetooth_get_basic_settings ( bluetooth_t * ctx)

Get displays basic settings function.

Parameters
ctxClick object.

@description The function get displays basic settings of the RN-41 Bluetooth module on Bluetooth Click board.

◆ bluetooth_get_device_address()

void bluetooth_get_device_address ( bluetooth_t * ctx)

Get displays the device�s eBluetooth address function.

Parameters
ctxClick object.

@description The function get displays the Bluetooth address of the RN-41 Bluetooth module on Bluetooth Click board.

◆ bluetooth_get_extended_settings()

void bluetooth_get_extended_settings ( bluetooth_t * ctx)

Get displays the device�s extended settings function.

Parameters
ctxClick object.

@description The function get displays the device�s extended settings of the RN-41 Bluetooth module on Bluetooth Click board.

◆ bluetooth_get_firmware_version()

void bluetooth_get_firmware_version ( bluetooth_t * ctx)

Get firmware version function.

Parameters
ctxClick object.

@description The function get firmware version of the RN-41 Bluetooth module on Bluetooth Click board.

◆ bluetooth_get_help()

void bluetooth_get_help ( bluetooth_t * ctx)

Get displays a list of help command function.

Parameters
ctxClick object.

@description The function get displays a list of help command of the RN-41 Bluetooth module on Bluetooth Click board.

◆ bluetooth_get_signal_status()

void bluetooth_get_signal_status ( bluetooth_t * ctx)

Displays the remote side modem signal status function.

Parameters
ctxClick object.

@description The function displays the remote side modem signal status of the RN-41 Bluetooth module on Bluetooth Click board.

◆ bluetooth_hw_reset()

void bluetooth_hw_reset ( bluetooth_t * ctx)

Hardwere reset function.

Parameters
ctxClick object.

@description The function hardwere reset RN-41 Bluetooth module on Bluetooth Click board by cleared to '0' state of RST pin, weit 200 ms, set to '1' state of RST pin and weit 1 sec.

◆ bluetooth_init()

BLUETOOTH_RETVAL bluetooth_init ( bluetooth_t * ctx,
bluetooth_cfg_t * cfg )

Initialization function.

Parameters
bluetoothClick object.
cfgClick configuration structure.

@description This function initializes all necessary pins and peripherals used for this click.

◆ bluetooth_reboot()

void bluetooth_reboot ( bluetooth_t * ctx)

Reboot the module function.

Parameters
ctxClick object.

@description The function set bonding disable of the RN-41 Bluetooth module on Bluetooth Click board.

◆ bluetooth_scans_device()

void bluetooth_scans_device ( bluetooth_t * ctx)

Scans for Bluetooth devices in pairing mode function.

Parameters
ctxClick object.

@description The function scans for Bluetooth devices in pairing mode of the RN-41 Bluetooth module on Bluetooth Click board.

◆ bluetooth_set_authentication()

void bluetooth_set_authentication ( bluetooth_t * ctx,
uint8_t auth_value )

Set the authentication function.

Parameters
ctxClick object.
auth_value
- 0 : [ Open mode ] The module uses Bluetooth version 2.0 with NO encryption;
- 1 : [ SSP keyboard I/O mode ] Default; The remote host receives a prompt, reply yes to pair;
- 2 : [ SSP �just works� mode ] The mode works with iOS device and newer PCs;
- 4 : [ Pin code mode ] Pin code mode authentication, which requires the host device to
enter a pin code that matches the stored pin code;

@description The function set the authentication value to the RN-41 Bluetooth module on Bluetooth Click board.

◆ bluetooth_set_baud_rate()

BLUETOOTH_RETVAL bluetooth_set_baud_rate ( bluetooth_t * ctx,
uint32_t baud_rate )

Set the baud rate function.

Parameters
ctxClick object.
baud_rate
 
Baud rate :
-   1200 :  1200 bps;
-   2400 :  2400 bps;
-   9600 :  9600 bps;
-  19200 : 19200 bps;
-  38400 : 38400 bps;
-  57600 : 57600 bps;
- 115200 : 115200 bps [ Default ];
Return values
status0 - ERROR; 1 - OK;

@description The function set the baud rate value to the RN-41 Bluetooth module on Bluetooth Click board.

◆ bluetooth_set_break()

void bluetooth_set_break ( bluetooth_t * ctx,
uint8_t break_signal )

Set the break function.

Parameters
ctxClick object.
break_signal
Break Length :
- 1 : 37   ms;
- 2 : 18.5 ms;
- 3 : 12   ms;
- 4 :  9   ms;
- 5 :  7   ms;
- 6 :  6   ms;

@description The function set the break signal length to the RN-41 Bluetooth module on Bluetooth Click board.

◆ bluetooth_set_cod()

BLUETOOTH_RETVAL bluetooth_set_cod ( bluetooth_t * ctx,
uint8_t * msw,
uint8_t * lsw )

Sets the class of device (COD) function.

Parameters
ctxClick object.
mswPointer to the memory location where the msw hex value be stored
lswPointer to the memory location where the lsw hex value be stored
Return values
status0 - ERROR; 1 - OK;

@description The function set the bthe class of device (COD) to the RN-41 Bluetooth module on Bluetooth Click board.

◆ bluetooth_set_device_name()

void bluetooth_set_device_name ( bluetooth_t * ctx,
uint8_t * name )

Set the device name function.

Parameters
ctxClick object.
namePointer to the memory location where the name be stored

@description The function set the device name of the RN-41 Bluetooth module on Bluetooth Click board.

◆ bluetooth_set_discoverability()

void bluetooth_set_discoverability ( bluetooth_t * ctx,
uint8_t * d_hex_value )

Set enable an inquiry scan function.

Parameters
ctxClick object.
d_hex_valuePointer to the memory loc. where the discoverability hex value be stored

@description The function set enable an inquiry scan to the RN-41 Bluetooth module on Bluetooth Click board.

◆ bluetooth_set_extended_status_string()

void bluetooth_set_extended_status_string ( bluetooth_t * ctx,
uint8_t * es_string )

Set extended status string function.

Parameters
ctxClick object.
es_stringPointer to the memory location where the extended status string be stored

@description The function set extended status string to the RN-41 Bluetooth module on Bluetooth Click board.

Note
es_string up to 8 alphanumeric characters

◆ bluetooth_set_factory_defaults()

void bluetooth_set_factory_defaults ( bluetooth_t * ctx)

Set factory defaults settings function.

Parameters
ctxClick object.

@description The function set factory defaults settings to the RN-41 Bluetooth module on Bluetooth Click board.

◆ bluetooth_set_operating_mode()

void bluetooth_set_operating_mode ( bluetooth_t * ctx,
uint8_t op_mode )

Set the operating mode function.

Parameters
ctxClick object.
op_mode
- 0 : [ Slave Mode ] Default mode, in which other Bluetooth devices can discover
and connect to the module;
- 1 : [ Master Mode ] In this low-speed connection mode, the module makes
connections when a connect command (C) is received;
- 2 : [ Trigger Mode ] In this low-speed connection mode, the module makes
connections automatically when a character is received on the serial port (UART);
- 3 : [ Auto-Connect Master Mode ] In this mode, the module makes connections
 automatically on power-up and re-connects when the connection is lost;
- 4 : [ Auto-Connect DTR Mode ] Its operates like Auto-Connect Master Mode
except that you control connection and disconnect evaluation kits;
- 5 : [ Auto-Connect ANY Mode ] This mode operates like Auto-Connect DTR Mode;
- 6 : [ Pairing Mode ] In this mode, the module attempts to connect with the
remote device matching the store remote address;

@description The function sets the operating mode of the RN-41 Bluetooth module on Bluetooth Click board.

◆ bluetooth_set_profile()

BLUETOOTH_RETVAL bluetooth_set_profile ( bluetooth_t * ctx,
uint8_t profile )

Set the profile function.

Parameters
ctxClick object.
profile
 
Profile :
- 0 : [ SPP ], Default, no modem control;
- 1 : [ DUN-DCE ], Slave or gateway;
- 2 : [ DUN-DTE ], Master or client;
- 3 : [ MDM SPP ], With modem control signals;
- 4 : [ SPP and DUN-DCE ], Multi-profile;
- 5 : [ APL ], Apple (iAP) profile, Refer to the iAP Bluetooth Evaluation Kit for
Developing Accessories Compatible with iOS Devices User
Manual for more information on using this profile;
- 6 : [ HID ], Device must be running a special firmware version
Return values
status0 - ERROR; 1 - OK;

@description The function set the profile of the RN-41 Bluetooth module on Bluetooth Click board.

◆ bluetooth_set_quiet_mode()

BLUETOOTH_RETVAL bluetooth_set_quiet_mode ( bluetooth_t * ctx,
uint8_t q_mode )

Set quiet mode function.

Parameters
ctxClick object.
q_mode
 
- 0 : The module is discoverable and able to connect.;
- 1 : The module is not discoverable and not able to connect;
- 2 : The module is able to connect but is not discoverable;
- 3 : Displays the current quiet mode is defined above;
Return values
status0 - ERROR; 1 - OK;

@description The function set quiet mode of the RN-41 Bluetooth module on Bluetooth Click board.

◆ bluetooth_set_remote_address()

void bluetooth_set_remote_address ( bluetooth_t * ctx,
uint8_t * r_addr )

Set the remote Bluetooth address function.

Parameters
ctxClick object.
r_addrPointer to the memory location where the remote address string be stored

@description The function stores the remote Bluetooth address to the RN-41 Bluetooth module on Bluetooth Click board.

Note
r_addr is string of the 12 hexadecimal digits

◆ bluetooth_set_security_pin_code()

BLUETOOTH_RETVAL bluetooth_set_security_pin_code ( bluetooth_t * ctx,
uint8_t * sp_code )

Set security pin code function.

Parameters
ctxClick object.
sp_codePointer to the memory location where the security pin code string be stored
Return values
status0 - ERROR; 1 - OK;

@description The function set security pin code string to the RN-41 Bluetooth module on Bluetooth Click board.

Note
sp_code up to 20 alphanumeric characters

◆ bluetooth_set_special_config()

BLUETOOTH_RETVAL bluetooth_set_special_config ( bluetooth_t * ctx,
uint16_t special_config )

Set special configuration settings function.

Parameters
ctxClick object.
special_config
 
-   0 : Default. The device does not use any special configuration;
-   4 : With this option set, the device does not read the GPIO3 and GPIO6 pin
 values on power-up;
-   8 : Disables discoverability at power up;
-  16 : This option configures the firmware to optimize for low latency data
transfers rather than throughput;
- 128 : This option causes the device to reboot after disconnect;
- 256 : This option sets 2 stop bit mode on the UART;
Return values
status0 - ERROR; 1 - OK;

@description The function set special configuration settings to the RN-41 Bluetooth module on Bluetooth Click board.

◆ bluetooth_set_uart_parity()

BLUETOOTH_RETVAL bluetooth_set_uart_parity ( bluetooth_t * ctx,
uint8_t character )

Set UART parity function.

Parameters
ctxClick object.
character
UART parity values:
- 'E' : Even;
- 'O' : Odd;
- 'N' : None;
Return values
status0 - ERROR; 1 - OK;

@description The function set UART parity to the RN-41 Bluetooth module on Bluetooth Click board.

◆ bluetooth_set_undiscoverable()

void bluetooth_set_undiscoverable ( bluetooth_t * ctx)

Set undiscoverable mode function.

Parameters
ctxClick object.

@description The function set undiscoverable mode of the RN-41 Bluetooth module on Bluetooth Click board.

◆ bluetooth_setConnectability()

void bluetooth_setConnectability ( bluetooth_t * ctx,
uint8_t * c_hex_value )

Set enable page scanning function.

Parameters
ctxClick object.
c_hex_valuePointer to the memory location where the connectability hex value be stored

@description The function set enable page scanning to the RN-41 Bluetooth module on Bluetooth Click board.

◆ bluetooth_toggle_echo()

void bluetooth_toggle_echo ( bluetooth_t * ctx)

Toggles echo function.

Parameters
ctxClick object.

@description The function toggles the local echo ON and OFF of RN-41 Bluetooth module on Bluetooth Click board.

◆ bluetooth_write_command()

void bluetooth_write_command ( bluetooth_t * ctx,
char * data_buf,
uint16_t len )

Write command function.

Parameters
bluetoothClick object.
data_bufData buffer for sends.
lenNumber of bytes for sends.