github.com/tinygo-org/tinygo@v0.31.3-0.20240404173401-90b0bf646c27/src/machine/i2s.go (about) 1 //go:build sam 2 3 // This is the definition for I2S bus functions. 4 // Actual implementations if available for any given hardware 5 // are to be found in its the board definition. 6 // 7 // For more info about I2S, see: https://en.wikipedia.org/wiki/I%C2%B2S 8 // 9 10 package machine 11 12 type I2SMode uint8 13 type I2SStandard uint8 14 type I2SClockSource uint8 15 type I2SDataFormat uint8 16 17 const ( 18 I2SModeSource I2SMode = iota 19 I2SModeReceiver 20 I2SModePDM 21 ) 22 23 const ( 24 I2StandardPhilips I2SStandard = iota 25 I2SStandardMSB 26 I2SStandardLSB 27 ) 28 29 const ( 30 I2SClockSourceInternal I2SClockSource = iota 31 I2SClockSourceExternal 32 ) 33 34 const ( 35 I2SDataFormatDefault I2SDataFormat = 0 36 I2SDataFormat8bit = 8 37 I2SDataFormat16bit = 16 38 I2SDataFormat24bit = 24 39 I2SDataFormat32bit = 32 40 ) 41 42 // All fields are optional and may not be required or used on a particular platform. 43 type I2SConfig struct { 44 SCK Pin 45 WS Pin 46 SD Pin 47 Mode I2SMode 48 Standard I2SStandard 49 ClockSource I2SClockSource 50 DataFormat I2SDataFormat 51 AudioFrequency uint32 52 MainClockOutput bool 53 Stereo bool 54 }