CheeseBoard
A library for use with the CheeseBoard Cheddar platform
|
HC12 Wireless Serial class. More...
#include <CbHC12.h>
Public Member Functions | |
CbHC12Class (uint8_t rxPin, uint8_t txPin, uint8_t setPin) | |
void | begin (long speed) |
void | setCommandMode (bool switchOn, bool force=false) |
bool | check () |
Static Public Attributes | |
static const uint16_t | CheckTimeoutMs = 250 |
HC12 Wireless Serial class.
This class allows use of the HC12 serial module. Inheriting from SoftwareSerial, it can be read from and written to using the usual members (write, println, read etc.). It also provides a mechanism for switching into and out of AT command mode.
In AT command mode, special command strings may be sent o the HC12 module to configure things like baud rate, transmit power and so on. See this HC12 reference for details.
CbHC12Class::CbHC12Class | ( | uint8_t | rxPin, |
uint8_t | txPin, | ||
uint8_t | setPin | ||
) |
Constructor.
rxPin | The Pin connected to the RX pin of the HC12 module. |
txPin | The Pin connected to the TX pin of the HC12 module. |
setPin | The Pin connected to the SET pin of the HC12 module. |
Definition at line 8 of file CbHC12.cpp.
void CbHC12Class::begin | ( | long | speed | ) |
Initialize.
speed | the baud rate of the HC12 module communications, typically 9600. |
Definition at line 14 of file CbHC12.cpp.
bool CbHC12Class::check | ( | ) |
Test if HC12 module comms are working.
Send "AT" in AT command mode, and verify we get "OK" back, then switch back to non-AT mode if that was the state before the call to check().
Definition at line 40 of file CbHC12.cpp.
void CbHC12Class::setCommandMode | ( | bool | switchOn, |
bool | force = false |
||
) |
Set AT command mode.
Turn on or off command mode. When enabled, the HC12 accepts AT commands to control the device.
switchOn | when true, enter AT command mode, when false leave command mode. |
force | when true explictly set the SET pin even if its already set, or has unknown state. |
Definition at line 21 of file CbHC12.cpp.