-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
449 additions
and
106 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
{ | ||
"panel": { | ||
"buttons": [ | ||
{ | ||
"name": "play", | ||
"gpio": "GPIO2" | ||
}, | ||
{ | ||
"name": "escape", | ||
"gpio": "GPIO3" | ||
} | ||
], | ||
"rotary": { | ||
"name": "play", | ||
"led": { | ||
"name": "rotaryLED", | ||
"red": "PWM1", | ||
"green": "PWM2", | ||
"blue": "PWM3" | ||
}, | ||
"button": { | ||
"name": "encoderClick", | ||
"gpio": "GPIO2" | ||
}, | ||
"encoderLeft": "GPIO17", | ||
"encoderRight": "GPIO27" | ||
} | ||
}, | ||
"lcd": { | ||
"device": "/dev/cu.usbmodem142444301", | ||
"baud": 115200 | ||
}, | ||
"fluidsynth": { | ||
"soundfonts": "files/soundfonts", | ||
"default": "SC-55.sf2" | ||
}, | ||
"floppy": { | ||
"device": "/dev/sdb", | ||
"mountpoint": "/media/floppy" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package config | ||
|
||
func Load(filename string) *C { | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package config | ||
a | ||
type C struct { | ||
Panel struct { | ||
Buttons []struct { | ||
Name string `json:"name"` | ||
Gpio string `json:"gpio"` | ||
} `json:"buttons"` | ||
Rotary struct { | ||
Name string `json:"name"` | ||
Led struct { | ||
Name string `json:"name"` | ||
Red string `json:"red"` | ||
Green string `json:"green"` | ||
Blue string `json:"blue"` | ||
} `json:"led"` | ||
Button struct { | ||
Name string `json:"name"` | ||
Gpio string `json:"gpio"` | ||
} `json:"button"` | ||
EncoderLeft string `json:"encoderLeft"` | ||
EncoderRight string `json:"encoderRight"` | ||
} `json:"rotary"` | ||
} `json:"panel"` | ||
Lcd struct { | ||
Device string `json:"device"` | ||
Baud int `json:"baud"` | ||
} `json:"lcd"` | ||
Fluidsynth struct { | ||
Soundfonts string `json:"soundfonts"` | ||
Default string `json:"default"` | ||
} `json:"fluidsynth"` | ||
Floppy struct { | ||
Device string `json:"device"` | ||
Mountpoint string `json:"mountpoint"` | ||
} `json:"floppy"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"io" | ||
"log" | ||
"time" | ||
|
||
"github.com/tarm/serial" | ||
) | ||
|
||
func main() { | ||
c := &serial.Config{Name: "/dev/cu.usbmodem14444301", Baud: 115200} | ||
s, err := serial.OpenPort(c) | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
go func() { | ||
|
||
// scanner := bufio.NewScanner(s) | ||
// for { | ||
// for scanner.Scan() { | ||
// fmt.Println(scanner.Text()) | ||
// } | ||
// } | ||
buf := make([]byte, 1) | ||
for { | ||
n, err := s.Read(buf) | ||
if n > 0 { | ||
fmt.Println(buf[0]) | ||
} | ||
if err == io.EOF { | ||
break | ||
} | ||
} | ||
}() | ||
|
||
time.Sleep(4 * time.Second) | ||
fmt.Println([]byte{0xCA, 0xFE, 0xBA, 0xBE, 0x00, 0x00, 0x00}) | ||
|
||
n, err := s.Write([]byte{0xCA, 0xFE, 0xBA, 0xBE, 0x00, 30, 128}) | ||
if err != nil { | ||
panic(err) | ||
} | ||
time.Sleep(50 * time.Millisecond) | ||
fmt.Println(n) | ||
|
||
m := make(chan bool) | ||
m <- true | ||
} |
Oops, something went wrong.