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:
Fri Jan 18 08:38:24 2013 +0000
Parent:
3:0e12bed6b295
Commit message:
update

Changed in this revision

AdafruitThermal.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/AdafruitThermal.cpp	Wed Dec 05 10:00:33 2012 +0000
+++ b/AdafruitThermal.cpp	Fri Jan 18 08:38:24 2013 +0000
@@ -42,15 +42,11 @@
 
 LPC_UART_TypeDef *lpcUart;
 
-
+// look at http://mrkindustries.com.ar/files/titan-doxy-html/lpc17xx__uart_8c_source.html
 AdafruitThermal::AdafruitThermal(PinName RX_Pin, PinName TX_Pin)
 {
     _RX_Pin = RX_Pin;
     _TX_Pin = TX_Pin;
-//    if( TX_Pin == p28 )
-//        lpcUart = ((LPC_UART_TypeDef *)LPC_UART2_BASE);
-//    else  if( TX_Pin == p9 )
-//        lpcUart = ((LPC_UART_TypeDef *)LPC_UART3_BASE);
 }
 
 void AdafruitThermal::begin(int heatTime)
@@ -58,6 +54,11 @@
     _printer = new Serial(_RX_Pin, _TX_Pin);
     _printer->baud(19200);
 
+//    if( TX_Pin == p28 )
+        lpcUart = ((LPC_UART_TypeDef *)LPC_UART2_BASE);
+//    else  if( TX_Pin == p9 )
+//        lpcUart = ((LPC_UART_TypeDef *)LPC_UART3_BASE);
+
     // The printer can't start receiving data immediately
     // upon power up -- needs a moment to initialize.  If
     // Arduino & printer are powered from the same supply,
@@ -154,16 +155,16 @@
 
 void AdafruitThermal::directPutc( uint8_t c ) {
 
-    do {
+/*    do {
     } while ((LPC_UART2->LSR & 0x20)==0) ;
     //write character to UART
     LPC_UART2->THR = c ;
-/*
+*/
     do {
     } while ((lpcUart->LSR & 0x20)==0) ;
     //write character to UART
     lpcUart->THR = c ;
-*/
+
 }