PropWare  3.0.0.229
C++ objects and CMake build system for Parallax Propeller
Hybrid_Demo.cpp

Use PropWare's PropWare::Printer interface for easy formatting of text, but use Simple's serial driver. This combination allows for easy object-oriented programming while still using the Parallax-authored serial driver.

cmake_minimum_required(VERSION 3.12)
find_package(PropWare REQUIRED)
project(Hybrid_Demo)
create_simple_executable(${PROJECT_NAME} Hybrid_Demo.cpp)
#include <simpletext.h>
class SimplePrinter : public PrintCapable {
public:
virtual void put_char (const char c) {
}
virtual void puts (char const string[]) {
::putStr(string);
}
};
int main () {
SimplePrinter mySimpleCompatiblePrinter;
const Printer myPrinter(mySimpleCompatiblePrinter);
putStr("Hello from the Simple function!\n");
myPrinter.puts("Hello from PropWare's Printer!\n");
myPrinter.print("Hello from yet another Printer function!\n");
myPrinter.printf("All methods have their own merits. Choose one that works well for you.\n");
myPrinter.println("Printer::println() can be handy if you just want to print a single string");
myPrinter << "For lovers of C++ streams, you can even use the << operator!\n";
return 0;
}
SimplePrinter::put_char
virtual void put_char(const char c)
Print a single character.
Definition: Hybrid_Demo.cpp:23
printer.h
SimplePrinter::puts
virtual void puts(char const string[])
Send a null-terminated character array. Though this method could be created using put_char,...
Definition: Hybrid_Demo.cpp:27
PropWare::PrintCapable
Interface for all classes capable of printing.
Definition: printcapable.h:38
main
int main(void)
Definition: GraphicsTest.c:20
simpletext.h
This library provides a collection of functions for communicating with text devices such as SimpleIDE...
putChar
void putChar(char c)
Print a char to the debug port.
Definition: putChar.c:30
printcapable.h
PropWare::Printer
Container class that has formatting methods for human-readable output. This class can be constructed ...
Definition: printer.h:76
PropWare
Generic definitions and functions for the Parallax Propeller.
Definition: runnable.h:33
putStr
int putStr(const char *str)
Print string to the debug port.
Definition: putStr.c:10
SimplePrinter
Definition: Hybrid_Demo.cpp:19