2021-01-29 06:31:58 -05:00
|
|
|
|
|
|
|
[![Arduino CI](https://github.com/RobTillaart/ParallelPrinter/workflows/Arduino%20CI/badge.svg)](https://github.com/marketplace/actions/arduino_ci)
|
2021-11-11 07:38:49 -05:00
|
|
|
[![Arduino-lint](https://github.com/RobTillaart/ParallelPrinter/actions/workflows/arduino-lint.yml/badge.svg)](https://github.com/RobTillaart/ParallelPrinter/actions/workflows/arduino-lint.yml)
|
|
|
|
[![JSON check](https://github.com/RobTillaart/ParallelPrinter/actions/workflows/jsoncheck.yml/badge.svg)](https://github.com/RobTillaart/ParallelPrinter/actions/workflows/jsoncheck.yml)
|
2021-01-29 06:31:58 -05:00
|
|
|
[![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/RobTillaart/ParallelPrinter/blob/master/LICENSE)
|
|
|
|
[![GitHub release](https://img.shields.io/github/release/RobTillaart/ParallelPrinter.svg?maxAge=3600)](https://github.com/RobTillaart/ParallelPrinter/releases)
|
|
|
|
|
2021-11-11 07:38:49 -05:00
|
|
|
|
2021-01-29 06:31:58 -05:00
|
|
|
# ParallelPrinter
|
|
|
|
|
2021-11-11 07:38:49 -05:00
|
|
|
Arduino library that implements a parallel printer (driver) - implements the PRINT interface.
|
2021-01-29 06:31:58 -05:00
|
|
|
|
|
|
|
|
|
|
|
## Description
|
|
|
|
|
|
|
|
This library defines a parallel printer object.
|
|
|
|
|
2021-11-11 07:38:49 -05:00
|
|
|
It implements the **Print interface** to be able to print all data types
|
|
|
|
using **write()**, **print()** and **println()**.
|
2021-01-29 06:31:58 -05:00
|
|
|
The printer writes every byte over 8 parallel lines including a **STROBE** (clock) pulse,
|
2021-11-11 07:38:49 -05:00
|
|
|
while waiting for the connected printer not to be **BUSY** or **OUT OF PAPER** (OOP).
|
2021-01-29 06:31:58 -05:00
|
|
|
|
|
|
|
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\])
|
2021-11-11 07:38:49 -05:00
|
|
|
- **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
|
2021-01-29 06:31:58 -05:00
|
|
|
|
|
|
|
|
|
|
|
### Print interface
|
2021-11-11 07:38:49 -05:00
|
|
|
|
|
|
|
- **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()**
|
2021-01-29 06:31:58 -05:00
|
|
|
|
|
|
|
|
2021-11-11 07:38:49 -05:00
|
|
|
### Configuration
|
2021-01-29 06:31:58 -05:00
|
|
|
|
|
|
|
These settings are pretty straightforward.
|
|
|
|
|
2021-11-11 07:38:49 -05:00
|
|
|
- **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.
|
2021-01-29 06:31:58 -05:00
|
|
|
|
|
|
|
|
|
|
|
### Expert mode
|
|
|
|
|
2021-11-11 07:38:49 -05:00
|
|
|
- **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.
|
2021-01-29 06:31:58 -05:00
|
|
|
|
|
|
|
**Note** mechanical printers e.g. dot matrix, really do need a way to stop receiving
|
2022-11-19 09:28:46 -05:00
|
|
|
data as they do not have large buffers. (==> BUSY line)
|
2021-01-29 06:31:58 -05:00
|
|
|
|
|
|
|
|
|
|
|
## See also
|
|
|
|
|
|
|
|
https://en.wikipedia.org/wiki/Parallel_port#Centronics
|
|
|
|
|
|
|
|
|
2022-11-19 09:28:46 -05:00
|
|
|
## Operation
|
|
|
|
|
|
|
|
See examples.
|
|
|
|
|
|
|
|
|
2021-01-29 06:31:58 -05:00
|
|
|
## Future
|
|
|
|
|
2022-11-19 09:28:46 -05:00
|
|
|
#### must
|
2021-11-11 07:38:49 -05:00
|
|
|
- update documentation
|
2022-11-19 09:28:46 -05:00
|
|
|
|
|
|
|
#### should
|
2021-11-11 07:38:49 -05:00
|
|
|
- extend unit tests?
|
2021-12-23 04:08:01 -05:00
|
|
|
- test more.
|
|
|
|
- extend simulator sketch.
|
2021-11-11 07:38:49 -05:00
|
|
|
- Make a front end of a parallel printer,
|
|
|
|
- Accepts the clocked bytes and print them e.g. over serial.
|
2022-11-19 09:28:46 -05:00
|
|
|
|
|
|
|
#### could
|
2021-01-29 06:31:58 -05:00
|
|
|
- derive e.g. an HP or an EPSON printer from this class.
|
2021-12-23 04:08:01 -05:00
|
|
|
- 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
|
|
|
|
|
2022-11-19 09:28:46 -05:00
|
|
|
#### wont
|
2021-01-29 06:31:58 -05:00
|
|
|
|
|
|
|
|