Skip to content

Commit

Permalink
documentation updates
Browse files Browse the repository at this point in the history
  • Loading branch information
ndroid committed Sep 29, 2023
1 parent 44464e9 commit 3a999c0
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 40 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ Arduino program for simplifying AT command configuration of HC-05/06 devices ove
Version 2.0

## Overview
Description: Simple HC05/06 AT configuration program. Requires 2nd UART (Serial1) defined.
<b>Description</b>: Simple HC05/06 AT configuration program. Requires 2nd
UART (Serial1) defined. Full repo can be found at
[HC06_AT_CommandCenter](https://github.com/ndroid/HC06_AT_CommandCenter).

Provides user menu for selecting configuration changes. Automatically identifies
device (HC-05 or HC-06), firmware version, baud and parity settings.
Expand Down Expand Up @@ -74,7 +76,7 @@ Version 2.0
### History

Created on: 18-Oct, 2021
Author: miller4@rose-hulman.edu
Author: ndroid (miller4@rose-hulman.edu)

Modified: 25-Sep, 2023
Revision: 2.0
Expand Down
62 changes: 24 additions & 38 deletions src/configureBT.h
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ class HCBT
bool uartBegun;

public:
/**
/*
* Create instance of HCBT class.
* UART interface may be HardwareSerial or SoftwareSerial object,
* Serial1 is default.
Expand All @@ -287,25 +287,23 @@ class HCBT
// HCBT(Stream * uart = &Serial1, int keyPin = 0, int statePin = 0);

/**
* Create instance of HCBT class.
* Uses Serial1 for UART connection.
* @brief Default HCBT constructor.
*
* Uses Serial1 for UART connection. Pin values are optional, defaults to 0.
*
* @param keyPin pin conencted to EN/KEY input of HC-05 (not used for HC-06)
* @param statePin pin conencted to STATE output of HC-05 (not used for HC-06)
*/
HCBT(int keyPin = 0, int statePin = 0);

/**
* commandMenu
*
* @brief Print user menu to Serial and handle selection.
* @brief Print user menu with config options to Serial and handle selection.
*/
void commandMenu();

/**
* detectDevice
*
* Automated scan of Bluetooth module to determine configuration of UART.
* @brief Automated scan of Bluetooth module to determine configuration of UART.
*
* Will identify version of firmware, baud rate, and parity setting, and set
* Serial1 to match HC-xx UART settings.
*
Expand All @@ -316,10 +314,10 @@ class HCBT
bool detectDevice(bool verboseOut = false);

/**
* getRole
*
* Send AT command to request current BT role for HC-05 device. Returns cached
* value if role previously fetched. Cached value reset by detectDevice().
* @brief Send AT command to request current BT role for HC-05 device.
*
* Returns cached value if role previously fetched. Cached value
* reset by detectDevice().
*
* @param verboseOut if true, prints verbose output to Serial
*
Expand All @@ -332,9 +330,7 @@ class HCBT
int getRole(bool verboseOut = false);

/**
* setRole
*
* Send AT command to set BT role of HC-05 device.
* @brief Send AT command to set BT role of HC-05 device.
*
* @param role role to set HC-05 device:
* - ROLE_SECONDARY - acts as discoverable wireless UART device ready for transparent data exchange
Expand All @@ -347,9 +343,8 @@ class HCBT
bool setRole(int role, bool verboseOut = false);

/**
* getVersionString
*
* Send AT command to request firmware version to Serial1 and return response.
* @brief Send AT command to request firmware version to Serial1 and return response.
*
* Returns cached value if version string previously fetched.
*
* @param verboseOut if true, prints verbose output to Serial
Expand All @@ -359,9 +354,8 @@ class HCBT
String getVersionString(bool verboseOut = false);

/**
* configUART
*
* Configure baud rate and parity of HC-xx UART.
* @brief Configure baud rate and parity of HC-xx UART.
*
* Sends AT command(s) to configure baud rate and parity of HC-xx UART.
* If successful, updates Serial1 configuration to new UART settings.
*
Expand All @@ -381,9 +375,8 @@ class HCBT
bool configUART(unsigned long baud, int parity, bool verboseOut = false);

/**
* setName
*
* Configure name of Bluetooth module.
* @brief Configure name of Bluetooth module.
*
* Sends AT command to set Bluetooth broadcast name of HC-xx device. Some
* devices with firmware version 1.x exhibited failures when trying to set
* name to more than 14 characters with higher baud rates.
Expand All @@ -396,9 +389,8 @@ class HCBT
bool setName(String newName, bool verboseOut = false);

/**
* setPin
*
* Configure Bluetooth pin of HC-xx device.
* @brief Configure Bluetooth pin (passcode) of HC-xx device.
*
* Sends AT command to configure BT pin/passkey of HC-xx UART device.
* For firmware version 1.x, 4-digit code is accepted. For firmware version
* 3.x, up to 16 alphanumeric character passkey is accepted according to
Expand All @@ -413,32 +405,26 @@ class HCBT
bool setPin(String newPin, bool verboseOut);

/**
* setCommandMode
*
* @brief Set EN pin high to place HC-05 in command mode.
*/
void setCommandMode();

/**
* setDataMode
*
* @brief Set EN pin low (or float) to place HC-05 in data mode.
*/
void setDataMode();

/**
* setLocalBaud
*
* Manually configure baud rate of Serial1, for testing/debugging purposes.
* @brief Manually configure baud rate of Serial1, for testing/debugging purposes.
*
* Preferred to allow detectDevice() to automatically set configuration.
* Prints menu to Serial to select desired baud rate.
*/
void setLocalBaud();

/**
* setLocalParity
*
* Manually configure parity of Serial1, for testing/debugging purposes.
* @brief Manually configure parity of Serial1, for testing/debugging purposes.
*
* Preferred to allow detectDevice() to automatically set configuration.
* Prints menu to Serial to select desired parity setting.
*/
Expand Down

0 comments on commit 3a999c0

Please sign in to comment.