-
Notifications
You must be signed in to change notification settings - Fork 0
/
features.go
52 lines (42 loc) · 907 Bytes
/
features.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package bootstrap
import (
"log"
"os"
europi "github.com/awonak/EuroPiGo"
"github.com/awonak/EuroPiGo/experimental/displaylogger"
"github.com/awonak/EuroPiGo/hardware/hal"
)
var (
dispLog displaylogger.Logger
)
func enableDisplayLogger(e europi.Hardware) {
if dispLog != nil {
// already enabled - can happen when panicking
return
}
display := europi.Display(e)
if display == nil {
// no display, can't continue
return
}
log.SetFlags(0)
dispLog = displaylogger.NewLogger(display)
log.SetOutput(dispLog)
}
func disableDisplayLogger(e europi.Hardware) {
flushDisplayLogger(e)
dispLog = nil
log.SetOutput(os.Stdout)
}
func flushDisplayLogger(e europi.Hardware) {
if dispLog != nil {
dispLog.Flush()
}
}
func initRandom(e europi.Hardware) {
if rnd := e.Random(); rnd != nil {
_ = rnd.Configure(hal.RandomGeneratorConfig{})
}
}
func uninitRandom(e europi.Hardware) {
}