Adafruit Thermal Printer Library
|
#include <Adafruit_Thermal.h>
Public Member Functions | |
Adafruit_Thermal (Stream *s=&Serial, uint8_t dtr=255) | |
Thermal constructor. More... | |
size_t | write (uint8_t c) |
Writes a character to the thermal printer. More... | |
void | begin (uint16_t version=268) |
void | boldOff () |
Disables bold text. | |
void | boldOn () |
Enables bold text. | |
void | doubleHeightOff () |
Disables double-height text. | |
void | doubleHeightOn () |
Enables double-height text. | |
void | doubleWidthOff () |
Disables double-width text. | |
void | doubleWidthOn () |
Enables double-width text. | |
void | feed (uint8_t x=1) |
Feeds by the specified number of lines. More... | |
void | feedRows (uint8_t) |
Feeds by the specified number of individual pixel rows. More... | |
void | flush () |
Flush data pending in the printer. | |
void | inverseOff () |
Disables white/black reverse printing mode. | |
void | inverseOn () |
Enables white/black reverse printing mode. | |
void | justify (char value) |
Set the justification of text. More... | |
void | offline () |
Put the printer into an offline state. No other commands can be sent until an online call is made. | |
void | online () |
Put the printer into an online state after previously put offline. | |
void | printBarcode (const char *text, uint8_t type) |
Print a barcode. More... | |
void | printBitmap (int w, int h, const uint8_t *bitmap, bool fromProgMem=true) |
Prints a bitmap. More... | |
void | printBitmap (int w, int h, Stream *fromStream) |
Prints a bitmap. More... | |
void | printBitmap (Stream *fromStream) |
Prints a bitmap. More... | |
void | normal () |
Sets text to normal mode. | |
void | reset () |
Reset the printer. | |
void | setBarcodeHeight (uint8_t val=50) |
Sets the barcode height. More... | |
void | setFont (char font='A') |
Sets the font. More... | |
void | setCharSpacing (int spacing=0) |
Sets the character spacing. More... | |
void | setCharset (uint8_t val=0) |
Sets the character set. More... | |
void | setCodePage (uint8_t val=0) |
Sets character code page. More... | |
void | setDefault () |
Sets the default settings. | |
void | setLineHeight (int val=30) |
Sets the line height. More... | |
void | setMaxChunkHeight (int val=256) |
Set max rows to write. More... | |
void | setSize (char value) |
Sets text size. More... | |
void | setTimes (unsigned long, unsigned long) |
Sets print and feed speed. More... | |
void | setHeatConfig (uint8_t dots=11, uint8_t time=120, uint8_t interval=40) |
Sets print head heating configuration. More... | |
void | setPrintDensity (uint8_t density=10, uint8_t breakTime=2) |
Sets print density. More... | |
void | sleep () |
Puts the printer into a low-energy state immediately. | |
void | sleepAfter (uint16_t seconds) |
Puts the printer into a low-energe state after the given number of seconds. More... | |
void | strikeOff () |
Disables delete line mode. | |
void | strikeOn () |
Enables delete line mode. | |
void | tab () |
Sends tab to device. | |
void | test () |
Prints test text. | |
void | testPage () |
Prints test page. | |
void | timeoutSet (unsigned long) |
Sets the estimated completion time for a just-issued task. More... | |
void | timeoutWait () |
Waits for the prior task to complete. | |
void | underlineOff () |
Disables underline. | |
void | underlineOn (uint8_t weight=1) |
Enables underline. More... | |
void | upsideDownOff () |
Disables upside-down text mode. | |
void | upsideDownOn () |
Enables upside-down text mode. | |
void | wake () |
Wakes device that was in sleep mode. | |
bool | hasPaper () |
Whether or not the printer has paper. More... | |
Driver for the thermal printer
Adafruit_Thermal::Adafruit_Thermal | ( | Stream * | s = &Serial , |
uint8_t | dtr = 255 |
||
) |
Thermal constructor.
s | Serial stream |
dtr | Data Terminal Ready control |
size_t Adafruit_Thermal::write | ( | uint8_t | c | ) |
Writes a character to the thermal printer.
c | Character to write |
void Adafruit_Thermal::begin | ( | uint16_t | version = 268 | ) |
version | firmware version as integer, e.g. 268 = 2.68 firmware |
void Adafruit_Thermal::feed | ( | uint8_t | x = 1 | ) |
Feeds by the specified number of lines.
x | How many lines to feed |
void Adafruit_Thermal::feedRows | ( | uint8_t | rows | ) |
Feeds by the specified number of individual pixel rows.
rows | How many rows to feed |
void Adafruit_Thermal::justify | ( | char | value | ) |
Set the justification of text.
value | justification, must be JUSTIFY_LEFT, JUSTIFY_CENTER, JUSTIFY_RIGHT |
void Adafruit_Thermal::printBarcode | ( | const char * | text, |
uint8_t | type | ||
) |
Print a barcode.
text | The specified text/number (the meaning varies based on the type of barcode) and type to write to the barcode |
type | Value from the datasheet or class-level variables like UPC-A. Note the type value changes depending on the firmware version so use class-level values where possible |
void Adafruit_Thermal::printBitmap | ( | int | w, |
int | h, | ||
const uint8_t * | bitmap, | ||
bool | fromProgMem = true |
||
) |
Prints a bitmap.
w | Width of the image in pixels |
h | Height of the image in pixels |
bitmap | Bitmap data, from a file. |
fromProgMem |
void Adafruit_Thermal::printBitmap | ( | int | w, |
int | h, | ||
Stream * | fromStream | ||
) |
Prints a bitmap.
w | Width of the image in pixels |
h | Height of the image in pixels |
fromStream | Stream to get bitmap data from |
void Adafruit_Thermal::printBitmap | ( | Stream * | fromStream | ) |
Prints a bitmap.
fromStream | Stream to get bitmap data from |
void Adafruit_Thermal::setBarcodeHeight | ( | uint8_t | val = 50 | ) |
Sets the barcode height.
val | Desired height of the barcode |
void Adafruit_Thermal::setFont | ( | char | font = 'A' | ) |
Sets the font.
font | Desired font, either A or B |
void Adafruit_Thermal::setCharSpacing | ( | int | spacing = 0 | ) |
Sets the character spacing.
spacing | Desired character spacing |
void Adafruit_Thermal::setCharset | ( | uint8_t | val = 0 | ) |
Sets the character set.
val | Value of the desired character set |
void Adafruit_Thermal::setCodePage | ( | uint8_t | val = 0 | ) |
Sets character code page.
val | Value of the desired character code page |
void Adafruit_Thermal::setLineHeight | ( | int | val = 30 | ) |
Sets the line height.
val | Desired line height |
void Adafruit_Thermal::setMaxChunkHeight | ( | int | val = 256 | ) |
Set max rows to write.
val | Max rows to write |
void Adafruit_Thermal::setSize | ( | char | value | ) |
Sets text size.
value | Text size |
void Adafruit_Thermal::setTimes | ( | unsigned long | p, |
unsigned long | f | ||
) |
Sets print and feed speed.
p | print speed |
f | feed speed |
void Adafruit_Thermal::setHeatConfig | ( | uint8_t | dots = 11 , |
uint8_t | time = 120 , |
||
uint8_t | interval = 40 |
||
) |
Sets print head heating configuration.
dots | max printing dots, 8 dots per increment |
time | heating time, 10us per increment |
interval | heating interval, 10 us per increment |
void Adafruit_Thermal::setPrintDensity | ( | uint8_t | density = 10 , |
uint8_t | breakTime = 2 |
||
) |
Sets print density.
density | printing density |
breakTime | printing break time |
void Adafruit_Thermal::sleepAfter | ( | uint16_t | seconds | ) |
Puts the printer into a low-energe state after the given number of seconds.
seconds | How many seconds to wait until sleeping |
void Adafruit_Thermal::timeoutSet | ( | unsigned long | x | ) |
Sets the estimated completion time for a just-issued task.
x | Estimated completion time |
void Adafruit_Thermal::underlineOn | ( | uint8_t | weight = 1 | ) |
Enables underline.
weight | Weight of the line |
bool Adafruit_Thermal::hasPaper | ( | ) |
Whether or not the printer has paper.