Driver for the JY-MCU v1.06 HC-06 Bluetooth module.
Dependents: DISCO-F746NG_rtos_test MbedTableControl
Diff: HC06Bluetooth.cpp
- Revision:
- 0:3ab5e47dde1e
- Child:
- 1:026034717620
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/HC06Bluetooth.cpp Sun Jun 05 20:44:21 2016 +0000 @@ -0,0 +1,35 @@ +/* + * HC06Bluetooth.cpp + * + * Created on: Jun 4, 2016 + * Author: Developer + */ + +#include <HC06Bluetooth.hpp> + +HC06Bluetooth::HC06Bluetooth(PinName TX, PinName RX, std::string deviceName) +: btSerialObj(TX, RX){ + // The default baud rate is 9600. Overwrite it to 230400. + btSerialObj.puts("AT+BAUD9"); + btSerialObj.baud(230400); + // Set the name of the device. + btSerialObj.puts(("AT+NAME" + deviceName).c_str()); + // Set the interrupt to be called when a byte is received. +} + +HC06Bluetooth::~HC06Bluetooth() { + // TODO Auto-generated destructor stub +} + + +void HC06Bluetooth::print(const char *buffer) { + btSerialObj.puts(buffer); +} + +void HC06Bluetooth::setCallback(void (*callbackFunc) (std::string readString)) { + +} + +void HC06Bluetooth::receiveByteISR() { + +}