This is the Adafruit thermal printer, whose Arduino library is published here: http://www.ladyada.net/products/thermalprinter/. This is a basic port to mbed that needs proper testing. The first printBitmap function is implemented but not fully tested, the stream versions are not ported yet.

Dependents:   SMS_LEDMatrixPrinter

Fork of AdafruitThermalPrinter by Ashley Mills

Files at this revision

API Documentation at this revision

Comitter:
SomeRandomBloke
Date:
Tue Nov 20 13:07:13 2012 +0000
Parent:
1:315c49946ded
Child:
3:0e12bed6b295
Commit message:
a

Changed in this revision

AdafruitThermal.cpp Show annotated file Show diff for this revision Revisions of this file
AdafruitThermal.h Show annotated file Show diff for this revision Revisions of this file
--- a/AdafruitThermal.cpp	Fri Jun 29 08:42:23 2012 +0000
+++ b/AdafruitThermal.cpp	Tue Nov 20 13:07:13 2012 +0000
@@ -302,7 +302,7 @@
   underlineOn(0);
 }
 
-/*
+
 void AdafruitThermal::printBitmap(int w, int h, const uint8_t *bitmap) {
   if (w > 384) return; // maximum width of the printer
   for (int rowStart=0; rowStart < h; rowStart += 256) {
@@ -312,13 +312,14 @@
     writeBytes(chunkHeight, w/8);
     delay(500);
     for (int i=0; i<((w/8)*chunkHeight); i++) {
-      PRINTER_PRINT(pgm_read_byte(bitmap + (rowStart*(w/8)) + i));
+      PRINTER_PRINT(bitmap[(rowStart*(w/8)) + i]);
+//      PRINTER_PRINT(pgm_read_byte(bitmap + (rowStart*(w/8)) + i));
     }
     delay(500);
   }
 }
 
-
+/*
 void AdafruitThermal::printBitmap(int w, int h, Stream *stream) {
   if (w > 384) return; // maximum width of the printer
   for (int rowStart=0; rowStart < h; rowStart += 256) {
--- a/AdafruitThermal.h	Fri Jun 29 08:42:23 2012 +0000
+++ b/AdafruitThermal.h	Tue Nov 20 13:07:13 2012 +0000
@@ -84,9 +84,9 @@
     void setBarcodeHeight(int val);
 
     // not ported
-    //void printBitmap(int w, int h, const uint8_t *bitmap);
-    //void printBitmap(int w, int h, Stream *stream);
-    //void printBitmap(Stream *stream);
+    void printBitmap(int w, int h, const uint8_t *bitmap);
+//    void printBitmap(int w, int h, Stream *stream);
+//    void printBitmap(Stream *stream);
 
     // ??
     void tab();