Driver for thermal printer using serial communication like http://www.sparkfun.com/products/10438. This is port from arduino library available at http://bildr.org/2011/08/thermal-printer-arduino/
Dependents: ThermalSample mbedica_on_yehowshua mbedica
Thermal.h
00001 /* 00002 Copyright (c) 2010 bildr community 00003 Ported to mbed by mimilowns 00004 00005 Permission is hereby granted, free of charge, to any person obtaining a copy 00006 of this software and associated documentation files (the "Software"), to deal 00007 in the Software without restriction, including without limitation the rights 00008 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 00009 copies of the Software, and to permit persons to whom the Software is 00010 furnished to do so, subject to the following conditions: 00011 00012 The above copyright notice and this permission notice shall be included in 00013 all copies or substantial portions of the Software. 00014 00015 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 00016 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 00017 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 00018 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 00019 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 00020 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 00021 THE SOFTWARE. 00022 */ 00023 00024 #ifndef Thermal_h 00025 #define Thermal_h 00026 00027 #include "mbed.h" 00028 00029 00030 00031 class Thermal : public Serial 00032 00033 { 00034 00035 public: 00036 Thermal(PinName tx, PinName rx, int baud = 9600); 00037 00038 void setDefault(); 00039 void test(); 00040 00041 00042 00043 void inverseOn(); 00044 void inverseOff(); 00045 void doubleHeightOn(); 00046 void doubleHeightOff(); 00047 void boldOn(); 00048 void boldOff(); 00049 void underlineOn(); 00050 void underlineOff(); 00051 00052 00053 00054 void justify(char value); 00055 void feed(uint8_t x = 1); 00056 void sleep(); 00057 void wake(); 00058 00059 00060 00061 void setCharSpacing(int spacing); 00062 void setSize(char value); 00063 void setLineHeight(int val = 32); 00064 00065 00066 00067 void printBarcode(char * text); 00068 void printFancyBarcode(char * text); 00069 void setBarcodeHeight(int val); 00070 00071 00072 00073 void printBitmap(uint8_t w, uint8_t h, const uint8_t *bitmap); 00074 00075 // ?? 00076 void tab(); 00077 00078 00079 00080 void setHeatTime(int vHeatTime); 00081 00082 void setHeatInterval(int vHeatInterval); 00083 00084 void setPrintDensity(char vPrintDensity); 00085 00086 void setPrintBreakTime(char vPrintBreakTime); 00087 00088 00089 private: 00090 bool linefeedneeded; 00091 00092 00093 // little helpers to make code easier to read&use 00094 void writeBytes(uint8_t a, uint8_t b); 00095 void writeBytes(uint8_t a, uint8_t b, uint8_t c); 00096 void writeBytes(uint8_t a, uint8_t b, uint8_t c, uint8_t d); 00097 00098 // port from arduino serial to mbed serial 00099 void write(uint8_t a); 00100 void delay(uint8_t a); 00101 00102 int zero; 00103 00104 00105 int heatTime; 00106 int heatInterval; 00107 char printDensity; 00108 char printBreakTime; 00109 }; 00110 00111 #endif
Generated on Mon Jul 18 2022 10:36:05 by 1.7.2