Andrew Ross / Adafruit_Thermal_Printer

Dependents:   Thermal_HelloWorld

Fork of AdafruitThermalPrinter by Ashley Mills

Revision:
2:de26317d87a6
Parent:
1:315c49946ded
Child:
3:1f832bfe41d1
--- a/AdafruitThermal.cpp	Fri Jun 29 08:42:23 2012 +0000
+++ b/AdafruitThermal.cpp	Wed Mar 16 01:40:10 2016 +0000
@@ -12,7 +12,9 @@
   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 **/
+
 #include "mbed.h" 
 #include "AdafruitThermal.h"
 
@@ -24,7 +26,7 @@
 
 void AdafruitThermal::begin(int heatTime) {
   _printer = new Serial(_RX_Pin, _TX_Pin);
-  _printer->baud(19200);
+  _printer->baud(9600);
 
   // The printer can't start receiving data immediately
   // upon power up -- needs a moment to initialize.  If
@@ -106,6 +108,7 @@
         write(*string);
         string++;
     }
+    feed(2);
 }
 
 void AdafruitThermal::testPage() {
@@ -203,11 +206,13 @@
 }
 
 void AdafruitThermal::inverseOn(){
-  setPrintMode(INVERSE_MASK);
+  //setPrintMode(INVERSE_MASK);
+  writeBytes(29, 'B', 1);
 }
 
 void AdafruitThermal::inverseOff(){
-  unsetPrintMode(INVERSE_MASK);
+  //unsetPrintMode(INVERSE_MASK);
+  writeBytes(29, 'B', 0, 10);
 }
 
 void AdafruitThermal::upsideDownOn(){
@@ -247,7 +252,12 @@
 }
 
 void AdafruitThermal::boldOff(){
-  unsetPrintMode(BOLD_MASK);
+  //unsetPrintMode(BOLD_MASK);
+  //writeBytes(27, 69, 0);
+  //  if (linefeedneeded)
+  //      feed();
+
+    //linefeedneeded = false;
 }
 
 void AdafruitThermal::justify(char value){
@@ -300,6 +310,8 @@
 
 void AdafruitThermal::underlineOff() {
   underlineOn(0);
+  //writeBytes(27, 45, 0, 10);
+  //Writing text with underline will work but seems to be a problem printing after turning off underline
 }
 
 /*