aboutsummaryrefslogtreecommitdiff
path: root/cutter.go
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2015-04-23 01:26:27 +0200
committerDimitri Sokolyuk <demon@dim13.org>2015-04-23 01:26:27 +0200
commit963276082422d3411226955d59b9c9ca4aee2c64 (patch)
tree0ae851ee42fd9d406c9223c590ff899a729e6125 /cutter.go
parentf9fded4af01301e02a8514eaac44d5356d3f1b34 (diff)
Add TestCut and StepDir
Diffstat (limited to 'cutter.go')
-rw-r--r--cutter.go24
1 files changed, 24 insertions, 0 deletions
diff --git a/cutter.go b/cutter.go
index 6ca03a3..d41848c 100644
--- a/cutter.go
+++ b/cutter.go
@@ -56,6 +56,30 @@ func (c Cutter) EOT() {
c.WriteByte(0x03)
}
+func (c Cutter) TestCut() {
+ defer c.EOT()
+ c.WriteString("FH")
+}
+
+type StepDirection int
+
+const (
+ stepFinish StepDirection = 1<<iota
+ StepDown
+ StepUp
+ StepLeft
+ StepRight
+)
+
+func (c Cutter) step(dir StepDirection) {
+ fmt.Fprintf(c, "\x1e\x00%c", dir)
+ c.Flush()
+}
+func (c Cutter) Step(dir StepDirection) {
+ c.step(dir)
+ c.step(stepFinish)
+}
+
func (c Cutter) Home() {
defer c.EOT()
c.WriteString("H")