Skip to content

Commit 5701bf8

Browse files
committed
feature: modify i2s interface/implementation to better match specification
Signed-off-by: deadprogram <[email protected]>
1 parent 6110f0b commit 5701bf8

18 files changed

+173
-70
lines changed

src/examples/i2s/i2s.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ func main() {
1313
Stereo: true,
1414
})
1515

16-
data := make([]uint32, 64)
16+
data := make([]uint16, 64)
1717

1818
for {
1919
// get the next group of samples
20-
machine.I2S0.Read(data)
20+
machine.I2S0.ReadMono(data)
2121

2222
println("data", data[0], data[1], data[2], data[4], "...")
2323
}

src/machine/board_arduino_mkr1000.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,9 @@ const (
7474
// I2S pins
7575
const (
7676
I2S_SCK_PIN Pin = PA10
77-
I2S_SD_PIN Pin = PA07
78-
I2S_WS_PIN = NoPin // TODO: figure out what this is on Arduino Nano 33.
77+
I2S_SDO_PIN Pin = PA07
78+
I2S_SDI_PIN = NoPin
79+
I2S_WS_PIN = NoPin // TODO: figure out what this is on Arduino MKR1000
7980
)
8081

8182
// USB CDC identifiers

src/machine/board_arduino_mkrwifi1010.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@ const (
7474
// I2S pins
7575
const (
7676
I2S_SCK_PIN Pin = PA10
77-
I2S_SD_PIN Pin = PA07
77+
I2S_SDO_PIN Pin = PA07
78+
I2S_SDI_PIN = NoPin
7879
I2S_WS_PIN = NoPin // TODO: figure out what this is on Arduino MKR WiFi 1010.
7980
)
8081

src/machine/board_arduino_nano33.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,8 @@ const (
118118
// I2S pins
119119
const (
120120
I2S_SCK_PIN Pin = PA10
121-
I2S_SD_PIN Pin = PA08
121+
I2S_SDO_PIN Pin = PA08
122+
I2S_SDI_PIN = NoPin
122123
I2S_WS_PIN = NoPin // TODO: figure out what this is on Arduino Nano 33.
123124
)
124125

src/machine/board_arduino_zero.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@ const (
6969
// I2S pins - might not be exposed
7070
const (
7171
I2S_SCK_PIN Pin = PA10
72-
I2S_SD_PIN Pin = PA07
72+
I2S_SDO_PIN Pin = PA07
73+
I2S_SDI_PIN = NoPin
7374
I2S_WS_PIN Pin = PA11
7475
)
7576

src/machine/board_circuitplay_express.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,8 @@ var SPI0 = sercomSPIM3
102102
// I2S pins
103103
const (
104104
I2S_SCK_PIN = PA10
105-
I2S_SD_PIN = PA08
105+
I2S_SDO_PIN = PA08
106+
I2S_SDI_PIN = NoPin
106107
I2S_WS_PIN = NoPin // no WS, instead uses SCK to sync
107108
)
108109

src/machine/board_feather-m0-express.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,8 @@ var SPI0 = sercomSPIM4
8181
// I2S pins
8282
const (
8383
I2S_SCK_PIN = PA10
84-
I2S_SD_PIN = PA07
84+
I2S_SDO_PIN = PA07
85+
I2S_SDI_PIN = NoPin
8586
I2S_WS_PIN = NoPin // TODO: figure out what this is on Feather M0 Express.
8687
)
8788

src/machine/board_feather-m0.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ var SPI0 = sercomSPIM4
7676
// I2S pins
7777
const (
7878
I2S_SCK_PIN = PA10
79-
I2S_SD_PIN = PA08
79+
I2S_SDO_PIN = PA08
80+
I2S_SDI_PIN = NoPin
8081
I2S_WS_PIN = NoPin // TODO: figure out what this is on Feather M0.
8182
)
8283

src/machine/board_gemma-m0.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ var (
7676
// I2S (not connected, needed for atsamd21).
7777
const (
7878
I2S_SCK_PIN = NoPin
79-
I2S_SD_PIN = NoPin
79+
I2S_SDO_PIN = NoPin
80+
I2S_SDI_PIN = NoPin
8081
I2S_WS_PIN = NoPin
8182
)
8283

src/machine/board_grandcentral-m4.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,8 @@ const (
224224

225225
I2S_SCK_PIN = I2S0_SCK_PIN // default pins
226226
I2S_WS_PIN = I2S0_FS_PIN //
227-
I2S_SD_PIN = I2S0_SDO_PIN //
227+
I2S_SDO_PIN = I2S0_SDO_PIN
228+
I2S_SDI_PIN = NoPin
228229
)
229230

230231
// SD card pins

0 commit comments

Comments
 (0)