commit e0f421115d4319de7585726bac7973e52a34aa67
parent 6d8b1fc33ef7ae1bbb6050bb8acb60b4ca7e6da1
Author: Martin Ashby <martin@ashbysoft.com>
Date: Mon, 21 May 2018 09:53:17 +0000
Merge branch 'master' of github.com:MFAshby/unicornpaint
Diffstat:
2 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/unicorn/README.md b/unicorn/README.md
@@ -1,4 +1,4 @@
-A go library for interacting with Raspberry Pi Unicorn HAT HD, with a cimilar API to the official library https://github.com/pimoroni/unicorn-hat-hd
+A go library for interacting with Raspberry Pi Unicorn HAT HD, with a similar API to the official library https://github.com/pimoroni/unicorn-hat-hd
Includes a simulator when running on amd64 and 386 linux PCs.
@@ -21,4 +21,4 @@ func main() {
uni.Show()
uni.MainLoop()
}
-```
-\ No newline at end of file
+```
diff --git a/unicorn/RealUnicorn.go b/unicorn/RealUnicorn.go
@@ -6,6 +6,8 @@ import (
"github.com/ecc1/spi"
"log"
"os"
+ "os/signal"
+ "syscall"
)
type RealUnicorn struct {
@@ -65,9 +67,9 @@ func (u *RealUnicorn) Close() error {
// MainLoop ...
// Do nothing until SIGTERM, then close the SPI library
-func MainLoop() {
+func (u *RealUnicorn) MainLoop() {
c := make(chan os.Signal, 2)
signal.Notify(c, os.Interrupt, syscall.SIGTERM)
- <- c
- Close()
+ <-c
+ u.Close()
}