PropWare
C++ objects and CMake build system for Parallax Propeller
|
Print formatted text to a serial terminal, an LCD, or any other device from any cog at any time with no worries about contention. More...
#include <synchronousprinter.h>
Public Member Functions | |
SynchronousPrinter (const Printer *printer) | |
Creates a synchronous instance of a Printer that can be used from multiple cogs simultaneously. More... | |
~SynchronousPrinter () | |
Ensure that, when a SynchronousPrinter is no longer being used, the lock is returned. | |
bool | has_lock () const |
Determine if an instance of a SynchronousPrinter successfully retrieved a lock. More... | |
bool | refreshLock () |
Retrieve a new lock. More... | |
const Printer * | borrow_printer () |
Retrieve the printer and acquire the lock. Useful when a class that only supports Printer and not SynchronousPrinter needs to print. More... | |
bool | return_printer (const Printer *printer) |
After calling SynchronousPrinter::borrow_printer, this method. | |
template<typename T > | |
void | print (const T var) const |
void | println (const char string[]) const |
Print a string along with a newline at the end. More... | |
void | printf (const char fmt[]) const |
template<typename T , typename... Targs> | |
void | printf (const char fmt[], const T first, const Targs...remaining) const |
Print formatted text to a serial terminal, an LCD, or any other device from any cog at any time with no worries about contention.
Definition at line 39 of file synchronousprinter.h.
PropWare::SynchronousPrinter::SynchronousPrinter | ( | const Printer * | printer | ) |
Creates a synchronous instance of a Printer that can be used from multiple cogs simultaneously.
*printer | Address of an instance of a PropWare::Printer device that can be shared across multiple cogs |
Definition at line 47 of file synchronousprinter.h.
const Printer* PropWare::SynchronousPrinter::borrow_printer | ( | ) |
Retrieve the printer and acquire the lock. Useful when a class that only supports Printer and not SynchronousPrinter needs to print.
Definition at line 97 of file synchronousprinter.h.
bool PropWare::SynchronousPrinter::has_lock | ( | ) | const |
Determine if an instance of a SynchronousPrinter
successfully retrieved a lock.
Definition at line 66 of file synchronousprinter.h.
void PropWare::SynchronousPrinter::print | ( | const T | var | ) | const |
Definition at line 119 of file synchronousprinter.h.
void PropWare::SynchronousPrinter::printf | ( | const char | fmt[] | ) | const |
Definition at line 139 of file synchronousprinter.h.
void PropWare::SynchronousPrinter::printf | ( | const char | fmt[], |
const T | first, | ||
const Targs... | remaining | ||
) | const |
Definition at line 149 of file synchronousprinter.h.
void PropWare::SynchronousPrinter::println | ( | const char | string[] | ) | const |
Print a string along with a newline at the end.
[in] | string[] | String to be printed |
Definition at line 130 of file synchronousprinter.h.
bool PropWare::SynchronousPrinter::refreshLock | ( | ) |
Retrieve a new lock.
If this instance already has a lock, the call will block until the lock has been cleared. The lock will then be returned and a new lock will be retrieved.
Definition at line 78 of file synchronousprinter.h.