update library.json, license, minor edits (#6)
This commit is contained in:
parent
dd8cc40840
commit
ef43c007e0
2
LICENSE
2
LICENSE
|
@ -1,6 +1,6 @@
|
||||||
MIT License
|
MIT License
|
||||||
|
|
||||||
Copyright (c) 2013-2021 Rob Tillaart
|
Copyright (c) 2013-2022 Rob Tillaart
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
//
|
//
|
||||||
// FILE: ParallelPrinter.cpp
|
// FILE: ParallelPrinter.cpp
|
||||||
// AUTHOR: Rob Tillaart
|
// AUTHOR: Rob Tillaart
|
||||||
// VERSION: 0.2.3
|
// VERSION: 0.2.4
|
||||||
// PURPOSE: parallel printer class that implements the Print interface
|
// PURPOSE: parallel printer class that implements the Print interface
|
||||||
// DATE: 2013-09-30
|
// DATE: 2013-09-30
|
||||||
// URL: https://github.com/RobTillaart/ParallelPrinter
|
// URL: https://github.com/RobTillaart/ParallelPrinter
|
||||||
|
@ -13,6 +13,7 @@
|
||||||
// 0.2.2 2021-01-14 update readme, add linefeed(), add keywords.txt
|
// 0.2.2 2021-01-14 update readme, add linefeed(), add keywords.txt
|
||||||
// 0.2.3 2021-11-11 update Arduino-CI, readme,md
|
// 0.2.3 2021-11-11 update Arduino-CI, readme,md
|
||||||
// add isBusy();
|
// add isBusy();
|
||||||
|
// 0.2.4 2021-12-23 update library.json, license, minor edits
|
||||||
|
|
||||||
|
|
||||||
#include "ParallelPrinter.h"
|
#include "ParallelPrinter.h"
|
||||||
|
@ -34,7 +35,7 @@ ParallelPrinter::ParallelPrinter(uint8_t STROBE, uint8_t BUSY, uint8_t OOP, uint
|
||||||
pinMode(_oopPin, INPUT);
|
pinMode(_oopPin, INPUT);
|
||||||
pinMode(_busyPin, INPUT);
|
pinMode(_busyPin, INPUT);
|
||||||
pinMode(_strobePin, OUTPUT);
|
pinMode(_strobePin, OUTPUT);
|
||||||
|
|
||||||
// DATA LINES
|
// DATA LINES
|
||||||
for (uint8_t i = 0; i < 8; i++)
|
for (uint8_t i = 0; i < 8; i++)
|
||||||
{
|
{
|
||||||
|
@ -143,7 +144,7 @@ void ParallelPrinter::sendByte(uint8_t c)
|
||||||
// BLOCK WHEN OUT OF PAPER TODO
|
// BLOCK WHEN OUT OF PAPER TODO
|
||||||
// while (digitalRead(_oopPin) == LOW) yield();
|
// while (digitalRead(_oopPin) == LOW) yield();
|
||||||
// indication in hardware?
|
// indication in hardware?
|
||||||
|
|
||||||
Serial.write(c); // debugging
|
Serial.write(c); // debugging
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -168,3 +169,4 @@ void ParallelPrinter::sendByte(uint8_t c)
|
||||||
|
|
||||||
|
|
||||||
// -- END OF FILE --
|
// -- END OF FILE --
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
//
|
//
|
||||||
// FILE: ParallelPrinter.h
|
// FILE: ParallelPrinter.h
|
||||||
// AUTHOR: Rob Tillaart
|
// AUTHOR: Rob Tillaart
|
||||||
// VERSION: 0.2.3
|
// VERSION: 0.2.4
|
||||||
// PURPOSE: parallel printer class that implements the Print interface
|
// PURPOSE: parallel printer class that implements the Print interface
|
||||||
// DATE: 2013-09-30
|
// DATE: 2013-09-30
|
||||||
// URL: https://github.com/RobTillaart/ParallelPrinter
|
// URL: https://github.com/RobTillaart/ParallelPrinter
|
||||||
|
@ -11,10 +11,10 @@
|
||||||
#include "Arduino.h"
|
#include "Arduino.h"
|
||||||
|
|
||||||
|
|
||||||
#define PARALLELPRINTER_VERSION (F("0.2.3"))
|
#define PARALLELPRINTER_VERSION (F("0.2.4"))
|
||||||
|
|
||||||
#define FORMFEED 12
|
#define FORMFEED 12
|
||||||
#define LINEFEED 10
|
#define LINEFEED 10
|
||||||
|
|
||||||
|
|
||||||
class ParallelPrinter: public Print
|
class ParallelPrinter: public Print
|
||||||
|
@ -36,7 +36,7 @@ public:
|
||||||
uint8_t getLineNumber() { return _lineNr; };
|
uint8_t getLineNumber() { return _lineNr; };
|
||||||
uint8_t getPageNumber() { return _pageNr; };
|
uint8_t getPageNumber() { return _pageNr; };
|
||||||
uint8_t getPosition() { return _pos; };
|
uint8_t getPosition() { return _pos; };
|
||||||
|
|
||||||
// n = 2,4,6,8
|
// n = 2,4,6,8
|
||||||
void setTabSize(uint8_t n) { _tabSize = n; };
|
void setTabSize(uint8_t n) { _tabSize = n; };
|
||||||
uint8_t getTabSize() { return _tabSize; };
|
uint8_t getTabSize() { return _tabSize; };
|
||||||
|
@ -54,6 +54,7 @@ public:
|
||||||
void setStrobeDelay(uint16_t n = 2000) { _strobeDelay = n; };
|
void setStrobeDelay(uint16_t n = 2000) { _strobeDelay = n; };
|
||||||
uint16_t getStrobeDelay() { return _strobeDelay; };
|
uint16_t getStrobeDelay() { return _strobeDelay; };
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// COMMUNICATION
|
// COMMUNICATION
|
||||||
uint8_t _strobePin; // inform printer new data on the line.
|
uint8_t _strobePin; // inform printer new data on the line.
|
||||||
|
@ -72,10 +73,11 @@ private:
|
||||||
uint8_t _pageNr;
|
uint8_t _pageNr;
|
||||||
uint8_t _tabSize;
|
uint8_t _tabSize;
|
||||||
uint8_t _lineFeed;
|
uint8_t _lineFeed;
|
||||||
|
|
||||||
bool _printLineNumber;
|
bool _printLineNumber;
|
||||||
uint16_t _strobeDelay;
|
uint16_t _strobeDelay;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// -- END OF FILE --
|
// -- END OF FILE --
|
||||||
|
|
||||||
|
|
13
README.md
13
README.md
|
@ -86,13 +86,18 @@ https://en.wikipedia.org/wiki/Parallel_port#Centronics
|
||||||
|
|
||||||
- update documentation
|
- update documentation
|
||||||
- extend unit tests?
|
- extend unit tests?
|
||||||
- test more
|
- test more.
|
||||||
- extend simulator sketch
|
- extend simulator sketch.
|
||||||
- Make a front end of a parallel printer,
|
- Make a front end of a parallel printer,
|
||||||
- Accepts the clocked bytes and print them e.g. over serial.
|
- Accepts the clocked bytes and print them e.g. over serial.
|
||||||
- derive e.g. an HP or an EPSON printer from this class.
|
- derive e.g. an HP or an EPSON printer from this class.
|
||||||
- special modes e.g. bold italic underline
|
- 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
|
## Operation
|
||||||
|
|
||||||
See examples
|
See examples.
|
||||||
|
|
|
@ -1,11 +1,9 @@
|
||||||
//
|
//
|
||||||
// FILE: ParPrinter_test.ino
|
// FILE: ParPrinter_test.ino
|
||||||
// AUTHOR: Rob Tillaart
|
// AUTHOR: Rob Tillaart
|
||||||
// VERSION: 0.1.0
|
|
||||||
// PURPOSE: demo
|
// PURPOSE: demo
|
||||||
// DATE: 2020-05-26
|
// DATE: 2020-05-26
|
||||||
// (c) : MIT
|
|
||||||
//
|
|
||||||
|
|
||||||
#include "ParallelPrinter.h"
|
#include "ParallelPrinter.h"
|
||||||
|
|
||||||
|
@ -59,7 +57,7 @@ void test3()
|
||||||
for (int i = 0; i < 100; i++) PP.print("Hello World ");
|
for (int i = 0; i < 100; i++) PP.print("Hello World ");
|
||||||
PP.printLineNumber(false);
|
PP.printLineNumber(false);
|
||||||
for (int i = 0; i < 100; i++) PP.print("Hello World ");
|
for (int i = 0; i < 100; i++) PP.print("Hello World ");
|
||||||
|
|
||||||
PP.setTabSize(4);
|
PP.setTabSize(4);
|
||||||
PP.printLineNumber(true);
|
PP.printLineNumber(true);
|
||||||
for (int i = 0; i < 100; i++) PP.print("Hello World ");
|
for (int i = 0; i < 100; i++) PP.print("Hello World ");
|
||||||
|
@ -83,3 +81,4 @@ void test3()
|
||||||
|
|
||||||
|
|
||||||
// -- END OF FILE --
|
// -- END OF FILE --
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,9 @@
|
||||||
//
|
//
|
||||||
// FILE: PrinterSimulator.ino
|
// FILE: PrinterSimulator.ino
|
||||||
// AUTHOR: Rob Tillaart
|
// AUTHOR: Rob Tillaart
|
||||||
// VERSION: 0.1.0
|
|
||||||
// PURPOSE: demo
|
// PURPOSE: demo
|
||||||
// DATE: 2020-06-24
|
// DATE: 2020-06-24
|
||||||
// (c) : MIT
|
//
|
||||||
|
|
||||||
|
|
||||||
// Simple parallel printer simulator, prints to serial...
|
// Simple parallel printer simulator, prints to serial...
|
||||||
// version could be made with a shiftin register ....
|
// version could be made with a shiftin register ....
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,9 @@
|
||||||
//
|
//
|
||||||
// FILE: Serial2ParPrinter.ino
|
// FILE: Serial2ParPrinter.ino
|
||||||
// AUTHOR: Rob Tillaart
|
// AUTHOR: Rob Tillaart
|
||||||
// VERSION: 0.1.1
|
|
||||||
// PURPOSE: demo
|
// PURPOSE: demo
|
||||||
// DATE: 2020-05-26
|
// DATE: 2020-05-26
|
||||||
// (c) : MIT
|
|
||||||
//
|
|
||||||
|
|
||||||
#include "ParallelPrinter.h"
|
#include "ParallelPrinter.h"
|
||||||
|
|
||||||
|
@ -32,3 +30,4 @@ void loop()
|
||||||
|
|
||||||
|
|
||||||
// -- END OF FILE --
|
// -- END OF FILE --
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/RobTillaart/ParallelPrinter.git"
|
"url": "https://github.com/RobTillaart/ParallelPrinter.git"
|
||||||
},
|
},
|
||||||
"version": "0.2.3",
|
"version": "0.2.4",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"frameworks": "arduino",
|
"frameworks": "arduino",
|
||||||
"platforms": "*",
|
"platforms": "*",
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
name=ParallelPrinter
|
name=ParallelPrinter
|
||||||
version=0.2.3
|
version=0.2.4
|
||||||
author=Rob Tillaart <rob.tillaart@gmail.com>
|
author=Rob Tillaart <rob.tillaart@gmail.com>
|
||||||
maintainer=Rob Tillaart <rob.tillaart@gmail.com>
|
maintainer=Rob Tillaart <rob.tillaart@gmail.com>
|
||||||
sentence=Experimental (not complete) library to connect a parallel printer to Arduino.
|
sentence=Experimental (not complete) library to connect a parallel printer to Arduino.
|
||||||
|
|
|
@ -38,33 +38,34 @@
|
||||||
|
|
||||||
unittest_setup()
|
unittest_setup()
|
||||||
{
|
{
|
||||||
|
fprintf(stderr, "PARALLELPRINTER_VERSION: %s\n", (char *) PARALLELPRINTER_VERSION);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
unittest_teardown()
|
unittest_teardown()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
unittest(test_new_operator)
|
unittest(test_new_operator)
|
||||||
{
|
{
|
||||||
assertEqualINF(exp(800));
|
assertEqualINF(exp(800));
|
||||||
assertEqualINF(0.0/0.0);
|
assertEqualINF(0.0/0.0);
|
||||||
assertEqualINF(42);
|
assertEqualINF(42);
|
||||||
|
|
||||||
assertEqualNAN(INFINITY - INFINITY);
|
assertEqualNAN(INFINITY - INFINITY);
|
||||||
assertEqualNAN(0.0/0.0);
|
assertEqualNAN(0.0/0.0);
|
||||||
assertEqualNAN(42);
|
assertEqualNAN(42);
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// minimal
|
|
||||||
|
|
||||||
|
// minimal
|
||||||
unittest(test_constructor_basic)
|
unittest(test_constructor_basic)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "VERSION: %s\n", PARALLELPRINTER_VERSION);
|
|
||||||
|
|
||||||
ParallelPrinter PP;
|
ParallelPrinter PP;
|
||||||
|
|
||||||
PP.begin();
|
PP.begin();
|
||||||
assertEqual(80, PP.getLineLength());
|
assertEqual(80, PP.getLineLength());
|
||||||
assertEqual(60, PP.getPageLength());
|
assertEqual(60, PP.getPageLength());
|
||||||
|
@ -86,7 +87,7 @@ unittest(test_constructor_basic)
|
||||||
// fprintf(stderr, "%d\n", PP.getLineNumber());
|
// fprintf(stderr, "%d\n", PP.getLineNumber());
|
||||||
// fprintf(stderr, "%d\n", PP.getPageNumber());
|
// fprintf(stderr, "%d\n", PP.getPageNumber());
|
||||||
// fprintf(stderr, "%d\n", PP.getPosition());
|
// fprintf(stderr, "%d\n", PP.getPosition());
|
||||||
|
|
||||||
assertEqual(3, PP.getLineNumber()); // 0 based
|
assertEqual(3, PP.getLineNumber()); // 0 based
|
||||||
assertEqual(4, PP.getPageNumber()); // 0 based
|
assertEqual(4, PP.getPageNumber()); // 0 based
|
||||||
assertEqual(11, PP.getPosition()); // 0 based
|
assertEqual(11, PP.getPosition()); // 0 based
|
||||||
|
@ -108,7 +109,7 @@ unittest(test_tabs_linefeed)
|
||||||
fprintf(stderr, "0\t");
|
fprintf(stderr, "0\t");
|
||||||
PP.setLineFeed(0);
|
PP.setLineFeed(0);
|
||||||
assertEqual(1, PP.getLineFeed()); // minimum LF size
|
assertEqual(1, PP.getLineFeed()); // minimum LF size
|
||||||
|
|
||||||
for (int LF = 1; LF < 4; LF +=2 )
|
for (int LF = 1; LF < 4; LF +=2 )
|
||||||
{
|
{
|
||||||
fprintf(stderr, "%d\t", LF);
|
fprintf(stderr, "%d\t", LF);
|
||||||
|
@ -128,11 +129,12 @@ unittest(test_OutOfPaper)
|
||||||
// TODO
|
// TODO
|
||||||
// state->digitalPin[12] = 0;
|
// state->digitalPin[12] = 0;
|
||||||
// assertFalse(PP.isOutOfPaper());
|
// assertFalse(PP.isOutOfPaper());
|
||||||
//
|
//
|
||||||
// state->digitalPin[12] = 1;
|
// state->digitalPin[12] = 1;
|
||||||
// assertTrue(PP.isOutOfPaper());
|
// assertTrue(PP.isOutOfPaper());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
unittest_main()
|
unittest_main()
|
||||||
|
|
||||||
// --------
|
// --------
|
||||||
|
|
Loading…
Reference in New Issue