-
Notifications
You must be signed in to change notification settings - Fork 0
/
sys_gpio.go
54 lines (50 loc) · 1.2 KB
/
sys_gpio.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
53
54
package rn2483
// PinName identifies the GPIO pin that may be asserted
type PinName string
const (
PinGPIO00 PinName = "GPIO00"
PinGPIO01 PinName = "GPIO01"
PinGPIO02 PinName = "GPIO02"
PinGPIO03 PinName = "GPIO03"
PinGPIO04 PinName = "GPIO04"
PinGPIO05 PinName = "GPIO05"
PinGPIO06 PinName = "GPIO06"
PinGPIO07 PinName = "GPIO07"
PinGPIO08 PinName = "GPIO08"
PinGPIO09 PinName = "GPIO09"
PinGPIO10 PinName = "GPIO10"
PinGPIO11 PinName = "GPIO11"
PinGPIO12 PinName = "GPIO12"
PinGPIO13 PinName = "GPIO13"
PinGPIO14 PinName = "GPIO14"
PinUARTCTS PinName = "UART_CTS"
PinUARTRTS PinName = "UART_RTS"
PinTEST0 PinName = "TEST0"
PinTEST1 PinName = "TEST1"
)
// AllPins lists all the GPIO pins that can be asserted
var AllPins = []PinName{
PinGPIO00,
PinGPIO01,
PinGPIO02,
PinGPIO03,
PinGPIO04,
PinGPIO05,
PinGPIO06,
PinGPIO07,
PinGPIO08,
PinGPIO09,
PinGPIO10,
PinGPIO11,
PinGPIO12,
PinGPIO13,
PinGPIO14,
PinUARTCTS,
PinUARTRTS,
PinTEST0,
PinTEST1,
}
// SetDigitalGPIO sets the specified GPIO pin to on or off
func (d *Device) SetDigitalGPIO(gpio PinName, value bool) error {
return d.ExecuteCommandCheckedStrict("sys set pindig %s %d", string(gpio), encodeBoolean(value))
}