CheeseBoard
A library for use with the CheeseBoard Cheddar platform
Public Member Functions | Static Public Attributes | List of all members
CbHC12Class Class Reference

HC12 Wireless Serial class. More...

#include <CbHC12.h>

Inheritance diagram for CbHC12Class:
Inheritance graph

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
 

Detailed Description

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.

Definition at line 16 of file CbHC12.h.

Constructor & Destructor Documentation

◆ CbHC12Class()

CbHC12Class::CbHC12Class ( uint8_t  rxPin,
uint8_t  txPin,
uint8_t  setPin 
)

Constructor.

Parameters
rxPinThe Pin connected to the RX pin of the HC12 module.
txPinThe Pin connected to the TX pin of the HC12 module.
setPinThe Pin connected to the SET pin of the HC12 module.

Definition at line 8 of file CbHC12.cpp.

Member Function Documentation

◆ begin()

void CbHC12Class::begin ( long  speed)

Initialize.

Parameters
speedthe baud rate of the HC12 module communications, typically 9600.

Definition at line 14 of file CbHC12.cpp.

Here is the call graph for this function:

◆ check()

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().

Returns
true if OK, else false.

Definition at line 40 of file CbHC12.cpp.

Here is the call graph for this function:

◆ setCommandMode()

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.

Parameters
switchOnwhen true, enter AT command mode, when false leave command mode.
forcewhen true explictly set the SET pin even if its already set, or has unknown state.

Definition at line 21 of file CbHC12.cpp.

Here is the caller graph for this function:

The documentation for this class was generated from the following files: