AS-289R2 Thermal Printer shield control library

Dependents:   AS-289R2_Hello-World AS-289R2_Hello-World-mbed-OS hybrid_image_as289r2 microbit_AS-289R2 ... more

Revision:
7:f9b9162c7e9d
Parent:
6:6aac36a293c7
Child:
8:50020195de05
--- a/AS289R2.h	Fri Feb 03 10:02:52 2017 +0000
+++ b/AS289R2.h	Sat Mar 11 03:19:06 2017 +0000
@@ -1,5 +1,12 @@
-/* AS289R2 Library, for a Thermal Printer Shield AS-289R2
- * Copyright (c) 2016, Toyomasa Watarai
+/**
+ ******************************************************************************
+ * @file    AS289T2.h
+ * @author  Toyomasa Watarai
+ * @version V1.0.0
+ * @date    11 March 2017
+ * @brief   This file contains the class of a AS289R2 thermal control component
+ ******************************************************************************
+ * @attention
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
@@ -30,7 +37,7 @@
 #pragma diag_suppress 870
 #endif
 
-/**  A thermal printer interface for driving AS-289R2 thermal printer shield
+/**  A printer interface for driving AS-289R2 thermal printer shield of NADA Electronics, Ltd.
  *
  * @code
  * #include "mbed.h"
@@ -81,36 +88,82 @@
 {
 public:
 
+    /**
+     * @enum Kanji_font_size
+     * Value of Japanese Kanji font size
+     */
     enum Kanji_font_size {
+        //! 24x24 dot font
         KANJI_24x24 = 0x30,
+        //! 16x16 dot font
         KANJI_16x16,
+        //! Defalut font size
         KANJI_DEFAULT = KANJI_24x24
     };
 
+    /**
+     * @enum ANK_font_size
+     * Value of ANK font size
+     */
     enum ANK_font_size {
+        //! 8x16 dot font
         ANK_8x16 = 0x30,
+        //! 12x24 dot font
         ANK_12x24,
+        //! 16x16 dot font
         ANK_16x16,
+        //! 24x24 dot fot
         ANK_24x24,
+        //! Defalut font size
         ANK_DEFAULT = ANK_12x24
     };
 
+    /**
+     * @enum QRcode_error_level
+     * Value of CQ code error correction level
+     */
     enum QRcode_error_level {
+        //! Error correction level L (7%)
         QR_ERR_LVL_L = 0x4C,
+        //! Error correction level M (15%)
         QR_ERR_LVL_M = 0x4D,
+        //! Error correction level Q (25%)
         QR_ERR_LVL_Q = 0x51,
+        //! Error correction level H (30%)
         QR_ERR_LVL_H = 0x48
     };
 
-    enum Barcode_mode {
+    /**
+     * @enum barcode_mode
+     * Value of barcode mode
+     */
+    enum barcode_mode {
+        //!  UPC-A : 11-digit, d1-d11, C/D
         BCODE_UPC_A = 0x30,
-        _UNUSED_,
-        BCODE_JAN13,
+        //! JAN13 : 12-digit, d1-d12, C/D
+        BCODE_JAN13 = 0x32,
+        //! JAN8 : 7-digit, d1-d7, C/D
         BCODE_JAN8,
+        //! CODE39 : variable, d1-d20, C/D
         BCODE_CODE39,
+        //! ITF : variable, d1-d20
         BCODE_ITF,
+        //! CODABAR (NW7) : variable, d1-d20
         BCODE_CODABAR
     };
+    
+    /**
+     * @enum script_mode
+     * Value of script mode
+     */
+    enum script_mode {
+        //! Cancel script mode
+        SCRIPT_CANCEL = 0,
+        //! Super script
+        SCRIPT_SUPER,
+        //! Sub script
+        SCRIPT_SUB
+    };
 
     /** Create a AS289R2 instance
      *  which is connected to specified Serial pin with specified baud rate
@@ -209,7 +262,7 @@
 
     /** Print bitmap image
      *
-     * @param cmd Type of operation mode e.g. 0x61
+     * @param cmd Type of operation mode, 0x61: print image buffer, 0x62: register image buffer, 0x63: register -> print, 0x64: print -> register, 0x65: line print
      * @param lines Number of print line
      * @param image Data to be printed
      */
@@ -228,7 +281,7 @@
 
     /** Set Print Direction
      *
-     * @param direction Print direction
+     * @param direction Print direction, 0: lister, 1: texter
      */
     void setPrintDirection(uint32_t direction);
 
@@ -257,9 +310,9 @@
 
     /** Set Script
      *
-     * @param script Superscript and Subsprict
+     * @param script mode e.g. AS289R2::SCRIPT_SUPER
      */
-    void setScript(uint32_t script);
+    void setScript(script_mode script);
 
     /** Clear Script
      *