Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: Thermal_HelloWorld
Fork of AdafruitThermalPrinter by
Diff: AdafruitThermal.h
- Revision:
- 2:de26317d87a6
- Parent:
- 1:315c49946ded
--- a/AdafruitThermal.h Fri Jun 29 08:42:23 2012 +0000
+++ b/AdafruitThermal.h Wed Mar 16 01:40:10 2016 +0000
@@ -12,7 +12,8 @@
MIT license, all text above must be included in any redistribution
****************************************************/
-/** Ported hastily to mbed by Ashley Mills - NOTE: printBitmap not ported, nothing tested **/
+// Ported to mbed by Ashley Mills
+// Documentation by Andrew Ross - NOTE: printBitmap not ported, nothing tested
#pragma once
@@ -34,7 +35,25 @@
#define PRINTER_PRINT(a) _printer->putc(a);
#define delay(a) wait(a/1000)
-
+//**************************************************************************
+// \class AdafruitThermal AdafruitThermal.h
+// \brief This is the main class. It shoud be used like this : AdafruitThermal printer(p9,p10);
+/**
+Example:
+* @code
+* // Print a char array onto the thermal paper
+* #include "mbed.h"
+* #include "AdafruitThermal.h"
+*
+* AdafruitThermal printer(p9,p10);
+*
+* int main() {
+* printer.begin();
+* char *Text_Out = "Hello World!\n";
+* printer.print(Text_Out);
+* }
+* @endcode
+*/
class AdafruitThermal {
public:
@@ -42,15 +61,25 @@
AdafruitThermal(PinName RX_Pin, PinName TX_Pin); // constructor
void begin(int heatTime=255);
void reset();
+
+ // General Commands *******************************************************************************
+
+ /** Sets Default settings on printer*/
void setDefault();
void test();
void testPage();
+ /** Basic function for all printing. Prints character to stream
+ * @param char to print (see AdafruitThermal.h)
+ */
size_t write(uint8_t c);
-
-
+
void normal();
+
+ /** Inverses the printer color space*/
void inverseOn();
+
+ /** Turns off inverse*/
void inverseOff();
void upsideDownOn();
void upsideDownOff();
@@ -65,6 +94,9 @@
void strikeOn();
void strikeOff();
+ /** Allows you to left, right or center justify your text
+ * @param string containing L, R, or C for alignment
+ */
void justify(char value);
void feed(uint8_t x = 1);
void feedRows(uint8_t);
@@ -74,6 +106,10 @@
void sleep();
void sleepAfter(uint8_t seconds);
void wake();
+
+ /** Main function to print information
+ * @param array of chars which is parsed by the write function
+ */
void print(char *string);
void setCharSpacing(int spacing);

Adafruit Thermal Printer