116 virtual bool Speed(uint32_t bitsPerSecond) = 0;
173 bool Send(
const char *buffer,
size_t bufferSize) {
174 for (
size_t iChar = 0; iChar < bufferSize; iChar++) {
190 bool SendLine(
const char *buffer,
size_t bufferSize) {
200 bool Send(
const char *nullTermStr) {
201 return Send(nullTermStr, strlen(nullTermStr));
245 bool Send(
double number, uint8_t precision = 2) {
247 snprintf(buffer,
sizeof(buffer),
"%.*f", precision, number);
261 bool SendLine(
double number, uint8_t precision = 2) {
273 bool Send(int8_t number, uint8_t radix = 10) {
274 return Send(
static_cast<int32_t
>(number), radix);
287 return SendLine(
static_cast<int32_t
>(number), radix);
298 bool Send(uint8_t number, uint8_t radix = 10) {
299 return Send(
static_cast<uint32_t
>(number), radix);
311 bool SendLine(uint8_t number, uint8_t radix = 10) {
312 return SendLine(
static_cast<uint32_t
>(number), radix);
323 bool Send(int16_t number, uint8_t radix = 10) {
324 return Send(
static_cast<int32_t
>(number), radix);
336 bool SendLine(int16_t number, uint8_t radix = 10) {
337 return SendLine(
static_cast<int32_t
>(number), radix);
348 bool Send(uint16_t number, uint8_t radix = 10) {
349 return Send(
static_cast<uint32_t
>(number), radix);
361 bool SendLine(uint16_t number, uint8_t radix = 10) {
362 return SendLine(
static_cast<uint32_t
>(number), radix);
373 bool Send(int32_t number, uint8_t radix = 10) {
374 if (radix < 2 || radix > 16) {
378 char strRep[2 + 8 *
sizeof(number)];
379 itoa(number, strRep, radix);
380 Send((
const char *)strRep);
393 bool SendLine(int32_t number, uint8_t radix = 10) {
405 bool Send(uint32_t number, uint8_t radix = 10) {
406 if (radix < 2 || radix > 16) {
410 char strRep[1 + 8 *
sizeof(number)];
411 utoa(number, strRep, radix);
412 Send((
const char *)strRep);
425 bool SendLine(uint32_t number, uint8_t radix = 10) {
437 bool Send(
int number, uint8_t radix = 10) {
438 return Send(
static_cast<int32_t
>(number), radix);
450 return SendLine(
static_cast<int32_t
>(number), radix);
493 virtual operator bool() = 0;
Base class for interacting with all ClearCore serial.
Definition ISerial.h:50
bool SendLine()
Send carriage return and newline characters.
Definition ISerial.h:162
virtual void WaitForTransmitIdle()=0
bool SendLine(uint16_t number, uint8_t radix=10)
Send a 16-bit unsigned number to be printed to the serial port. Terminate the line with carriage retu...
Definition ISerial.h:361
_Parities
Definition ISerial.h:56
@ PARITY_E
Even Parity.
Definition ISerial.h:58
@ PARITY_O
Odd Parity.
Definition ISerial.h:60
@ PARITY_N
No Parity.
Definition ISerial.h:62
enum ClearCore::ISerial::_Parities Parities
bool Send(uint32_t number, uint8_t radix=10)
Send a 32-bit unsigned number to be printed to the serial port.
Definition ISerial.h:405
bool Send(int32_t number, uint8_t radix=10)
Send a 32-bit signed number to be printed to the serial port.
Definition ISerial.h:373
bool Send(int number, uint8_t radix=10)
Send an integer to be printed to the serial port.
Definition ISerial.h:437
bool Send(uint16_t number, uint8_t radix=10)
Send a 16-bit unsigned number to be printed to the serial port.
Definition ISerial.h:348
virtual int16_t CharGet()=0
Attempt to read the next character from serial channel.
virtual void FlushInput()=0
virtual bool Parity(Parities newParity)=0
Set UART transmission parity format.
virtual bool CharSize(uint8_t size)=0
Change the number of bits in a character.
virtual bool StopBits(uint8_t bits)=0
bool Send(char theChar)
Send a character to be printed to the serial port.
Definition ISerial.h:221
virtual Parities Parity()=0
Return current port UART transmission format.
virtual bool Speed(uint32_t bitsPerSecond)=0
Change the baud rate for the port.
bool Send(int16_t number, uint8_t radix=10)
Send a 16-bit signed number to be printed to the serial port.
Definition ISerial.h:323
bool Send(int8_t number, uint8_t radix=10)
Send an 8-bit signed number to be printed to the serial port.
Definition ISerial.h:273
bool SendLine(int8_t number, uint8_t radix=10)
Send an 8-bit signed number to be printed to the serial port. Terminate the line with carriage return...
Definition ISerial.h:286
virtual int16_t CharPeek()=0
Attempt to get the next character from the serial channel without pulling the character out of the bu...
bool Send(const char *nullTermStr)
Send a string of characters out the port.
Definition ISerial.h:200
bool SendLine(const char *buffer, size_t bufferSize)
Send the array of characters out the port. Terminate the line with carriage return and newline charac...
Definition ISerial.h:190
virtual bool PortIsOpen()=0
Return whether or not the port is open.
bool SendLine(char theChar)
Send a character to be printed to the serial port. Terminate the line with carriage return and newlin...
Definition ISerial.h:232
virtual void PortClose()=0
bool SendLine(const char *nullTermStr)
Send a string of characters out the port. Terminate the line with carriage return and newline charact...
Definition ISerial.h:211
bool Send(const char *buffer, size_t bufferSize)
Send the array of characters out the port.
Definition ISerial.h:173
bool SendLine(int32_t number, uint8_t radix=10)
Send a 32-bit signed number to be printed to the serial port. Terminate the line with carriage return...
Definition ISerial.h:393
virtual int32_t AvailableForRead()=0
bool Send(double number, uint8_t precision=2)
Send a floating point number to the serial port.
Definition ISerial.h:245
virtual uint32_t Speed()=0
Gets the baud rate of the port.
virtual void PortOpen()=0
bool SendLine(uint8_t number, uint8_t radix=10)
Send an 8-bit unsigned number to be printed to the serial port. Terminate the line with carriage retu...
Definition ISerial.h:311
bool Send(uint8_t number, uint8_t radix=10)
Send an 8-bit unsigned number to be printed to the serial port.
Definition ISerial.h:298
bool SendLine(int number, uint8_t radix=10)
Send an integer to be printed to the serial port.
Definition ISerial.h:449
bool SendLine(uint32_t number, uint8_t radix=10)
Send a 32-bit unsigned number to be printed to the serial port. Terminate the line with carriage retu...
Definition ISerial.h:425
bool SendLine(int16_t number, uint8_t radix=10)
Send a 16-bit signed number to be printed to the serial port. Terminate the line with carriage return...
Definition ISerial.h:336
virtual bool SendChar(uint8_t charToSend)=0
Send an ascii character on the serial channel.
virtual int32_t AvailableForWrite()=0
Determines the number of characters available in the transmit buffer.
bool SendLine(double number, uint8_t precision=2)
Send a floating point number to the serial port. Terminate the line with carriage return and newline ...
Definition ISerial.h:261
Namespace to encompass the ClearCore board API.
Definition AdcManager.h:36