Thermal Printer Basic Print Operations
Embed:
(wiki syntax)
Show/hide line numbers
APSEPM207LV.h
Go to the documentation of this file.
00001 /** 00002 ****************************************************************************** 00003 * @file APSEPM207LV.h 00004 * @author Shivanand Gowda 00005 * @version V1.0.0 00006 * @date 21 May 2018 00007 * @brief This file contains the class of a APSEPM207LV thermal control component 00008 ****************************************************************************** 00009 * @attention 00010 * 00011 * Permission is hereby granted, free of charge, to any person obtaining a copy 00012 * of this software and associated documentation files (the "Software"), to deal 00013 * in the Software without restriction, including without limitation the rights 00014 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 00015 * copies of the Software, and to permit persons to whom the Software is 00016 * furnished to do so, subject to the following conditions: 00017 * 00018 * The above copyright notice and this permission notice shall be included in 00019 * all copies or substantial portions of the Software. 00020 * 00021 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 00022 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 00023 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 00024 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 00025 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 00026 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 00027 * THE SOFTWARE. 00028 */ 00029 00030 #ifndef MBED_APSEPM207LV_H 00031 #define MBED_APSEPM207LV_H 00032 00033 #include "mbed.h" 00034 00035 #if defined(__CC_ARM) 00036 // To avoid "invalid multibyte character sequence" warning 00037 #pragma diag_suppress 870 00038 #endif 00039 00040 00041 class APSEPM207LV : public Stream 00042 { 00043 public: 00044 00045 /** 00046 * @enum Kanji_font_size 00047 * Value of Japanese Kanji font size 00048 */ 00049 enum Kanji_font_size { 00050 //! 24x24 dot font 00051 KANJI_24x24 = 0x30, 00052 //! 16x16 dot font 00053 KANJI_16x16, 00054 //! Defalut font size 00055 KANJI_DEFAULT = KANJI_24x24 00056 }; 00057 00058 /** 00059 * @enum ANK_font_size 00060 * Value of ANK font size 00061 */ 00062 enum ANK_font_size { 00063 //! 8x16 dot font 00064 ANK_8x16 = 0x30, 00065 //! 12x24 dot font 00066 ANK_12x24, 00067 //! 16x16 dot font 00068 ANK_16x16, 00069 //! 24x24 dot fot 00070 ANK_24x24, 00071 //! Defalut font size 00072 ANK_DEFAULT = ANK_12x24 00073 }; 00074 00075 /** 00076 * @enum QRcode_error_level 00077 * Value of CQ code error correction level 00078 */ 00079 enum QRcode_error_level { 00080 //! Error correction level L (7%) 00081 QR_ERR_LVL_L = 0x4C, 00082 //! Error correction level M (15%) 00083 QR_ERR_LVL_M = 0x4D, 00084 //! Error correction level Q (25%) 00085 QR_ERR_LVL_Q = 0x51, 00086 //! Error correction level H (30%) 00087 QR_ERR_LVL_H = 0x48 00088 }; 00089 00090 /** 00091 * @enum barcode_mode 00092 * Value of barcode mode 00093 */ 00094 enum barcode_mode { 00095 //! UPC-A : 11-digit, d1-d11, C/D 00096 BCODE_UPC_A = 0x30, 00097 //! JAN13 : 12-digit, d1-d12, C/D 00098 BCODE_JAN13 = 0x32, 00099 //! JAN8 : 7-digit, d1-d7, C/D 00100 BCODE_JAN8, 00101 //! CODE39 : variable, d1-d20, C/D 00102 BCODE_CODE39, 00103 //! ITF : variable, d1-d20 00104 BCODE_ITF, 00105 //! CODABAR (NW7) : variable, d1-d20 00106 BCODE_CODABAR 00107 }; 00108 00109 /** 00110 * @enum script_mode 00111 * Value of script mode 00112 */ 00113 enum script_mode { 00114 //! Cancel script mode 00115 SCRIPT_CANCEL = 0, 00116 //! Super script 00117 SCRIPT_SUPER, 00118 //! Sub script 00119 SCRIPT_SUB 00120 }; 00121 00122 /** Create a APSEPM207LV instance 00123 * which is connected to specified Serial pin with specified baud rate 00124 * 00125 * @param tx Serial TX pin 00126 * @param baud (option) serial baud rate (default: 9600bps) 00127 */ 00128 APSEPM207LV(PinName tx,PinName rx, uint32_t baud = 9600); 00129 00130 /** Create a APSEPM207LV instance 00131 * which is connected to specified Serial instance with specified baud rate 00132 * 00133 * @param serial_obj Serial object (instance) 00134 * @param baud (option) serial baud rate (default: 9600bps) 00135 */ 00136 APSEPM207LV(Serial &serial_obj, uint32_t baud = 9600); 00137 00138 /** Destructor of APSEPM207LV 00139 */ 00140 virtual ~APSEPM207LV(); 00141 00142 /** Initializa APSEPM207LV 00143 * 00144 * Issues initialize command for AS-289R2 00145 * 00146 */ 00147 void initialize(void); 00148 00149 /** Send line feed code 00150 * which is connected to specified Serial pin with specified baud rate 00151 * 00152 * @param lines Number of line feed 00153 */ 00154 void printTest(void); 00155 void printnputLineFeed(uint8_t lines); 00156 void lineFeed(void); 00157 void putHorizontaltab(void); 00158 00159 void setdefaultLinespacing(void); 00160 void setLinespacing(uint8_t lines); 00161 void setleftMargin(uint8_t n1, uint8_t n2); 00162 void absoluteprintPosition(uint8_t n1, uint8_t n2); 00163 void whiteblack(uint8_t n1); 00164 void papersensorstatus(void); 00165 void carriageReturn(void); 00166 void printModes(uint8_t n); 00167 /** pur Horizontal Tab 00168 * 00169 */ 00170 00171 void putLineFeed(uint8_t lines); 00172 00173 /** Clear image buffer of the AS-289R2 00174 * 00175 */ 00176 void clearBuffer(void); 00177 00178 /** Set double height size font 00179 * 00180 */ 00181 void setDoubleSizeHeight(void); 00182 00183 /** Set normal height size font 00184 * 00185 */ 00186 void clearDoubleSizeHeight(void); 00187 00188 /** Set double width size font 00189 * 00190 */ 00191 void setDoubleSizeWidth(void); 00192 00193 /** Set normal width size font 00194 * 00195 */ 00196 void clearDoubleSizeWidth(void); 00197 00198 /** Set large size font (48x96) 00199 * 00200 */ 00201 void setLargeFont(void); 00202 00203 /** Set normal size font 00204 * 00205 */ 00206 void clearLargeFont(void); 00207 00208 /** Set ANK font 00209 * 00210 * @param font ANK font e.g. APSEPM207LV::ANK_8x16 00211 */ 00212 void setANKFont(uint32_t font); 00213 00214 /** Set Kanji font size 00215 * 00216 * @param font Kanji font e.g. APSEPM207LV::KANJI_16x16 00217 */ 00218 void setKanjiFont(uint32_t font); 00219 00220 /** Print QR code 00221 * 00222 * @param err QR code error correction level e.g. APSEPM207LV::QR_ERR_LVL_M 00223 * @param buf Data to be printed 00224 */ 00225 void printQRCode(uint32_t err, const char* buf); 00226 00227 /** Print Bar code 00228 * 00229 * @param code Type of Bar code e.g. APSEPM207LV::JAN13 00230 * @param buf Data to be printed 00231 */ 00232 void printBarCode(uint32_t code, const char* param); 00233 00234 /** Print bitmap image 00235 * 00236 * @param cmd Type of operation mode, 0x61: print image buffer, 0x62: register image buffer, 0x63: register -> print, 0x64: print -> register, 0x65: line print 00237 * @param lines Number of print line 00238 * @param image Data to be printed 00239 */ 00240 void printBitmapImage(uint32_t cmd, uint16_t lines, const uint8_t * image); 00241 00242 /** Set Line Spaceing 00243 * 00244 * @param space line spacing 00245 */ 00246 void setLineSpaceing(uint32_t space); 00247 00248 /** Set as default Line Spaceing 00249 * 00250 */ 00251 void defaultLineSpaceing(void); 00252 00253 /** Set Print Direction 00254 * 00255 * @param direction Print direction, 0: lister, 1: texter 00256 */ 00257 void setPrintDirection(uint32_t direction); 00258 00259 /** Send feed code 00260 * 00261 * @param space Paper feed 00262 */ 00263 void putPaperFeed(uint32_t space); 00264 00265 /** Set Inter Character Space 00266 * 00267 * @param space inter-character space 00268 */ 00269 void setInterCharacterSpace(uint32_t space); 00270 00271 /** Set as default Inter Character Space 00272 * 00273 */ 00274 void defaultInterCharacterSpace(void); 00275 00276 /** Send Print Position 00277 * 00278 * @param position Print position 00279 */ 00280 void putPrintPosition(uint32_t position); 00281 00282 /** Set Script 00283 * 00284 * @param script mode e.g. APSEPM207LV::SCRIPT_SUPER 00285 */ 00286 void setScript(script_mode script); 00287 00288 /** Clear Script 00289 * 00290 */ 00291 void clearScript(void); 00292 00293 /** Set Quadruple size 00294 * 00295 */ 00296 void setQuadrupleSize(void); 00297 00298 /** Clear Quadruple size 00299 * 00300 */ 00301 void clearQuadrupleSize(void); 00302 00303 /** Set Enlargement size 00304 * 00305 * @param width enlargement 00306 * @param height enlargement 00307 */ 00308 void setEnlargement(uint32_t width, uint32_t height); 00309 00310 /** Clear Enlargement size 00311 * 00312 */ 00313 void clearEnlargement(void); 00314 00315 /** Set BarCode Height size 00316 * 00317 * @param height Bar height 00318 */ 00319 void setBarCodeHeight(uint32_t height); 00320 00321 /** Set as default BarCode Height size 00322 * 00323 */ 00324 void defaultBarCodeHeight(void); 00325 00326 /** Set BarCode Bar size 00327 * 00328 * @param narrowbar narrow bars size 00329 * @param widebar wide bars size 00330 */ 00331 void setBarCodeBarSize(uint32_t narrowbar, uint32_t widebar); 00332 00333 /** Set as default BarCode Bar size 00334 * 00335 */ 00336 void defaultBarCodeBarSize(void); 00337 00338 private: 00339 Serial *_serial_p; 00340 Serial &_serial; 00341 00342 protected: 00343 // Stream implementation functions 00344 virtual int _putc(int value); 00345 virtual int _getc(); 00346 }; 00347 00348 #endif 00349 00350
Generated on Thu Jul 28 2022 13:51:15 by
1.7.2