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
AS289R2 Class Reference
A printer interface for driving AS-289R2 thermal printer shield of NADA Electronics, Ltd. More...
#include <AS289R2.h>
Public Types | |
enum | Kanji_font_size { KANJI_24x24 = 0x30, KANJI_16x16, KANJI_DEFAULT = KANJI_24x24 } |
Value of Japanese Kanji font size. More... | |
enum | ANK_font_size { ANK_8x16 = 0x30, ANK_12x24, ANK_16x16, ANK_24x24, ANK_DEFAULT = ANK_12x24 } |
Value of ANK font size. More... | |
enum | QRcode_error_level { QR_ERR_LVL_L = 0x4C, QR_ERR_LVL_M = 0x4D, QR_ERR_LVL_Q = 0x51, QR_ERR_LVL_H = 0x48 } |
Value of CQ code error correction level. More... | |
enum | barcode_mode { BCODE_UPC_A = 0x30, BCODE_JAN13 = 0x32, BCODE_JAN8, BCODE_CODE39, BCODE_ITF, BCODE_CODABAR } |
Value of barcode mode. More... | |
enum | script_mode { SCRIPT_CANCEL = 0, SCRIPT_SUPER, SCRIPT_SUB } |
Value of script mode. More... | |
Public Member Functions | |
AS289R2 (PinName tx, PinName rx, uint32_t baud=9600) | |
Create a AS289R2 instance which is connected to specified Serial pin with specified baud rate. | |
AS289R2 (RawSerial &serial_obj, uint32_t baud=9600) | |
Create a AS289R2 instance which is connected to specified Serial instance with specified baud rate. | |
virtual | ~AS289R2 () |
Destructor of AS289R2. | |
void | initialize (void) |
Initializa AS289R2. | |
void | putLineFeed (uint32_t lines) |
Send line feed code which is connected to specified Serial pin with specified baud rate. | |
void | clearBuffer (void) |
Clear image buffer of the AS-289R2. | |
void | setDoubleSizeHeight (void) |
Set double height size font. | |
void | clearDoubleSizeHeight (void) |
Set normal height size font. | |
void | setDoubleSizeWidth (void) |
Set double width size font. | |
void | clearDoubleSizeWidth (void) |
Set normal width size font. | |
void | setLargeFont (void) |
Set large size font (48x96) | |
void | clearLargeFont (void) |
Set normal size font. | |
void | setANKFont (uint32_t font) |
Set ANK font. | |
void | setKanjiFont (uint32_t font) |
Set Kanji font size. | |
void | printQRCode (uint32_t err, const char *buf) |
Print QR code. | |
void | printBarCode (uint32_t code, const char *param) |
Print Bar code. | |
void | printBitmapImage (uint32_t cmd, uint16_t lines, const uint8_t *image) |
Print bitmap image. | |
void | setLineSpaceing (uint32_t space) |
Set Line Spaceing. | |
void | defaultLineSpaceing (void) |
Set as default Line Spaceing. | |
void | setPrintDirection (uint32_t direction) |
Set Print Direction. | |
void | putPaperFeed (uint32_t space) |
Send feed code. | |
void | setInterCharacterSpace (uint32_t space) |
Set Inter Character Space. | |
void | defaultInterCharacterSpace (void) |
Set as default Inter Character Space. | |
void | putPrintPosition (uint32_t position) |
Send Print Position. | |
void | setScript (script_mode script) |
Set Script. | |
void | clearScript (void) |
Clear Script. | |
void | setQuadrupleSize (void) |
Set Quadruple size. | |
void | clearQuadrupleSize (void) |
Clear Quadruple size. | |
void | setEnlargement (uint32_t width, uint32_t height) |
Set Enlargement size. | |
void | clearEnlargement (void) |
Clear Enlargement size. | |
void | setBarCodeHeight (uint32_t height) |
Set BarCode Height size. | |
void | defaultBarCodeHeight (void) |
Set as default BarCode Height size. | |
void | setBarCodeBarSize (uint32_t narrowbar, uint32_t widebar) |
Set BarCode Bar size. | |
void | defaultBarCodeBarSize (void) |
Set as default BarCode Bar size. |
Detailed Description
A printer interface for driving AS-289R2 thermal printer shield of NADA Electronics, Ltd.
#include "mbed.h" #include "AS829R2.h" Serial pc(USBTX, USBRX); AS829R2 tp(D1, D0); // tx, rx, 9600bps (default) int main() { tp.initialize(); tp.putLineFeed(2); tp.printf("** Thermal Printer Shield **\r\r"); tp.setDoubleSizeWidth(); tp.printf(" AS-289R2\r\r"); tp.clearDoubleSizeWidth(); tp.printf("日本語文字列の印字テスト:24x24\r"); tp.setKanjiFont(AS289R2::KANJI_16x16); tp.setANKFont(AS289R2::ANK_8x16); tp.printf("日本語文字列の印字テスト:16x16\r\r"); tp.setKanjiFont(AS289R2::KANJI_DEFAULT); tp.setANKFont(AS289R2::ANK_DEFAULT); tp.setDoubleSizeWidth(); tp.printf("ABCDEFG 0123456789\r"); tp.clearDoubleSizeWidth(); tp.setDoubleSizeHeight(); tp.printf("ABCDEFG 0123456789\r"); tp.clearDoubleSizeHeight(); pc.printf("AS-289R2 thermal printer shield test\n\n"); while(1) { if (pc.readable()) { int c = pc.getc(); pc.putc(c); tp.putc(c); } } }
Definition at line 87 of file AS289R2.h.
Member Enumeration Documentation
enum ANK_font_size |
enum barcode_mode |
enum Kanji_font_size |
enum QRcode_error_level |
enum script_mode |
Constructor & Destructor Documentation
AS289R2 | ( | PinName | tx, |
PinName | rx, | ||
uint32_t | baud = 9600 |
||
) |
Create a AS289R2 instance which is connected to specified Serial pin with specified baud rate.
- Parameters:
-
tx Serial TX pin rx Serial RX pin (dummy) baud (option) serial baud rate (default: 9600bps)
Definition at line 33 of file AS289R2.cpp.
AS289R2 | ( | RawSerial & | serial_obj, |
uint32_t | baud = 9600 |
||
) |
Create a AS289R2 instance which is connected to specified Serial instance with specified baud rate.
- Parameters:
-
serial_obj Serial object (instance) baud (option) serial baud rate (default: 9600bps)
Definition at line 42 of file AS289R2.cpp.
~AS289R2 | ( | ) | [virtual] |
Destructor of AS289R2.
Definition at line 51 of file AS289R2.cpp.
Member Function Documentation
void clearBuffer | ( | void | ) |
Clear image buffer of the AS-289R2.
Definition at line 68 of file AS289R2.cpp.
void clearDoubleSizeHeight | ( | void | ) |
Set normal height size font.
Definition at line 78 of file AS289R2.cpp.
void clearDoubleSizeWidth | ( | void | ) |
Set normal width size font.
Definition at line 88 of file AS289R2.cpp.
void clearEnlargement | ( | void | ) |
Clear Enlargement size.
Definition at line 239 of file AS289R2.cpp.
void clearLargeFont | ( | void | ) |
Set normal size font.
Definition at line 98 of file AS289R2.cpp.
void clearQuadrupleSize | ( | void | ) |
Clear Quadruple size.
Definition at line 226 of file AS289R2.cpp.
void clearScript | ( | void | ) |
Clear Script.
Definition at line 216 of file AS289R2.cpp.
void defaultBarCodeBarSize | ( | void | ) |
Set as default BarCode Bar size.
Definition at line 264 of file AS289R2.cpp.
void defaultBarCodeHeight | ( | void | ) |
Set as default BarCode Height size.
Definition at line 251 of file AS289R2.cpp.
void defaultInterCharacterSpace | ( | void | ) |
Set as default Inter Character Space.
Definition at line 197 of file AS289R2.cpp.
void defaultLineSpaceing | ( | void | ) |
Set as default Line Spaceing.
Definition at line 171 of file AS289R2.cpp.
void initialize | ( | void | ) |
Initializa AS289R2.
Issues initialize command for AS-289R2
Definition at line 55 of file AS289R2.cpp.
void printBarCode | ( | uint32_t | code, |
const char * | param | ||
) |
Print Bar code.
- Parameters:
-
code Type of Bar code e.g. AS289R2::JAN13 buf Data to be printed
Definition at line 131 of file AS289R2.cpp.
void printBitmapImage | ( | uint32_t | cmd, |
uint16_t | lines, | ||
const uint8_t * | image | ||
) |
Print bitmap image.
- Parameters:
-
cmd Type of operation mode, 0x61: print image buffer, 0x62: register image buffer, 0x63: register -> print, 0x64: print -> register, 0x65: line print lines Number of print line image Data to be printed
Definition at line 145 of file AS289R2.cpp.
void printQRCode | ( | uint32_t | err, |
const char * | buf | ||
) |
Print QR code.
- Parameters:
-
err QR code error correction level e.g. AS289R2::QR_ERR_LVL_M buf Data to be printed
Definition at line 117 of file AS289R2.cpp.
void putLineFeed | ( | uint32_t | lines ) |
Send line feed code which is connected to specified Serial pin with specified baud rate.
- Parameters:
-
lines Number of line feed
Definition at line 61 of file AS289R2.cpp.
void putPaperFeed | ( | uint32_t | space ) |
void putPrintPosition | ( | uint32_t | position ) |
void setANKFont | ( | uint32_t | font ) |
Set ANK font.
- Parameters:
-
font ANK font e.g. AS289R2::ANK_8x16
Definition at line 103 of file AS289R2.cpp.
void setBarCodeBarSize | ( | uint32_t | narrowbar, |
uint32_t | widebar | ||
) |
Set BarCode Bar size.
- Parameters:
-
narrowbar narrow bars size widebar wide bars size
Definition at line 256 of file AS289R2.cpp.
void setBarCodeHeight | ( | uint32_t | height ) |
void setDoubleSizeHeight | ( | void | ) |
Set double height size font.
Definition at line 73 of file AS289R2.cpp.
void setDoubleSizeWidth | ( | void | ) |
Set double width size font.
Definition at line 83 of file AS289R2.cpp.
void setEnlargement | ( | uint32_t | width, |
uint32_t | height | ||
) |
Set Enlargement size.
- Parameters:
-
width enlargement height enlargement
Definition at line 231 of file AS289R2.cpp.
void setInterCharacterSpace | ( | uint32_t | space ) |
Set Inter Character Space.
- Parameters:
-
space inter-character space
Definition at line 190 of file AS289R2.cpp.
void setKanjiFont | ( | uint32_t | font ) |
Set Kanji font size.
- Parameters:
-
font Kanji font e.g. AS289R2::KANJI_16x16
Definition at line 110 of file AS289R2.cpp.
void setLargeFont | ( | void | ) |
Set large size font (48x96)
Definition at line 93 of file AS289R2.cpp.
void setLineSpaceing | ( | uint32_t | space ) |
void setPrintDirection | ( | uint32_t | direction ) |
Set Print Direction.
- Parameters:
-
direction Print direction, 0: lister, 1: texter
Definition at line 176 of file AS289R2.cpp.
void setQuadrupleSize | ( | void | ) |
Set Quadruple size.
Definition at line 221 of file AS289R2.cpp.
void setScript | ( | script_mode | script ) |
Set Script.
- Parameters:
-
script mode e.g. AS289R2::SCRIPT_SUPER
Definition at line 209 of file AS289R2.cpp.
Generated on Thu Jul 14 2022 19:12:05 by 1.7.2