File tree Expand file tree Collapse file tree 3 files changed +33
-2
lines changed Expand file tree Collapse file tree 3 files changed +33
-2
lines changed Original file line number Diff line number Diff line change @@ -29,14 +29,22 @@ type RCS struct {
29
29
state keyboard.State
30
30
}
31
31
32
+ var (
33
+ i2c = machine .I2C0
34
+ sclPin machine.Pin
35
+ sdaPin machine.Pin
36
+ )
37
+
32
38
func run () error {
33
- machine . I2C0 .Configure (machine.I2CConfig {
39
+ i2c .Configure (machine.I2CConfig {
34
40
Frequency : machine .TWI_FREQ_400KHZ ,
41
+ SCL : sclPin ,
42
+ SDA : sdaPin ,
35
43
})
36
44
37
45
ch := make (chan RCS , 16 )
38
46
39
- display := ssd1306 .NewI2C (machine . I2C0 )
47
+ display := ssd1306 .NewI2C (i2c )
40
48
display .Configure (ssd1306.Config {
41
49
Address : 0x3C ,
42
50
Width : 128 ,
Original file line number Diff line number Diff line change
1
+ //go:build xiao_ble
2
+
3
+ package main
4
+
5
+ import (
6
+ "machine"
7
+ )
8
+
9
+ func init () {
10
+ sclPin = machine .SCL0_PIN
11
+ sdaPin = machine .SDA0_PIN
12
+ }
Original file line number Diff line number Diff line change
1
+ //go:build xiao_rp2040
2
+
3
+ package main
4
+
5
+ import (
6
+ "machine"
7
+ )
8
+
9
+ func init () {
10
+ i2c = machine .I2C1
11
+ }
You can’t perform that action at this time.
0 commit comments