GY-63_MS5611/libraries/ParallelPrinter
2022-08-03 21:56:07 +02:00
..
.github add funding.yml 2022-08-03 21:56:07 +02:00
examples 0.2.4 ParallelPrinter 2021-12-23 10:08:01 +01:00
test 0.2.4 ParallelPrinter 2021-12-23 10:08:01 +01:00
.arduino-ci.yml 0.2.3 ParallelPrinter 2021-11-11 13:38:49 +01:00
keywords.txt 0.2.3 ParallelPrinter 2021-11-11 13:38:49 +01:00
library.json 0.2.4 ParallelPrinter 2021-12-23 10:08:01 +01:00
library.properties 0.2.4 ParallelPrinter 2021-12-23 10:08:01 +01:00
LICENSE 0.2.4 ParallelPrinter 2021-12-23 10:08:01 +01:00
ParallelPrinter.cpp 0.2.4 ParallelPrinter 2021-12-23 10:08:01 +01:00
ParallelPrinter.h 0.2.4 ParallelPrinter 2021-12-23 10:08:01 +01:00
README.md 0.2.4 ParallelPrinter 2021-12-23 10:08:01 +01:00

Arduino CI Arduino-lint JSON check License: MIT GitHub release

ParallelPrinter

Arduino library that implements a parallel printer (driver) - implements the PRINT interface.

Description

This library defines a parallel printer object.

It implements the Print interface to be able to print all data types using write(), print() and println(). The printer writes every byte over 8 parallel lines including a STROBE (clock) pulse, while waiting for the connected printer not to be BUSY or OUT OF PAPER (OOP).

This library is meant to be a starting point to make a "printer driver" for a specific parallel printer. These can often be bought in 2nd hand stores or so.

Have fun!

Note: This lib is a extended redo of the ParPrinter class.

Interface

Constructor

  • ParallelPrinter() uses default pins (13, 2, 12, [3,4,5,6,7,8,9,10])
  • ParallelPrinter(uint8_t strobe, uint8_t busy, uint8_t oop, uint8_t *arr) define 3 control pins + 8 data pins (= arr[8]).
  • void begin(uint8_t lineLength, uint8_t pageLength) set line and page length parameters

Print interface

  • size_t write(uint8_t c) send a single byte to printer, implements Print interface. Therefore all print() and println() functions will work.
  • void formfeed() to eject current page or forced go to the next page.
  • void linefeed() send a linefeed. The number of actual lines is set by setLineFeed()

Configuration

These settings are pretty straightforward.

  • void setLineLength(uint8_t lineLength) idem
  • uint8_t getLineLength() returns the current line length.
  • void setPageLength(uint8_t pageLength) idem
  • uint8_t getPageLength() returns the current page length.
  • uint8_t getLineNumber() returns current line number.
  • uint8_t getPageNumber() returns current page number.
  • uint8_t getPosition() returns the position on a line.
  • uint8_t setTabSize(uint8_t tabsize) tabs are replaced by spaces. n can be 0 or any size!
  • uint8_t getTabSize() returns tabSize set
  • void setLineFeed(uint8_t lineFeeds) lineFeeds = 1,2,3 1 = default.
  • uint8_t getLineFeed() returns lineFeeds set
  • void printLineNr(bool b) can be set to true, false.

Expert mode

  • bool isOutOfPaper() to check paper tray before printing starts.
  • void setStrobeDelay(uint16_t n = 2000) allows tuning of performance. Make the strobe pulse shorter == faster printing (printer dependant). Default value = 2000. Time in microseconds.
  • uint16_t getStrobeDelay() returns value set.

Note mechanical printers e.g. dot matrix, really do need a way to stop receiving data as they do not have large buffers.

See also

https://en.wikipedia.org/wiki/Parallel_port#Centronics

Future

  • update documentation
  • extend unit tests?
  • test more.
  • extend simulator sketch.
    • Make a front end of a parallel printer,
    • Accepts the clocked bytes and print them e.g. over serial.
  • derive e.g. an HP or an EPSON printer from this class.
    • special modes e.g. bold italic underline.
  • write(uint8_t * buf, uint8_t length) should be added
    • might not really add to performance..
  • fix blocking TODO in sendByte

Operation

See examples.