runtime/atsamd21: i2s initialization fixes
Этот коммит содержится в:
родитель
5171618284
коммит
00f745e351
1 изменённых файлов: 7 добавлений и 7 удалений
|
@ -877,29 +877,29 @@ func (i2s I2S) Configure(config I2SConfig) {
|
||||||
// now set serializer data size.
|
// now set serializer data size.
|
||||||
switch config.DataFormat {
|
switch config.DataFormat {
|
||||||
case I2SDataFormat8bit:
|
case I2SDataFormat8bit:
|
||||||
i2s.Bus.SERCTRL1.SetBits(sam.I2S_SERCTRL_DATASIZE_8)
|
i2s.Bus.SERCTRL1.SetBits(sam.I2S_SERCTRL_DATASIZE_8 << sam.I2S_SERCTRL_DATASIZE_Pos)
|
||||||
|
|
||||||
case I2SDataFormat16bit:
|
case I2SDataFormat16bit:
|
||||||
i2s.Bus.SERCTRL1.SetBits(sam.I2S_SERCTRL_DATASIZE_16)
|
i2s.Bus.SERCTRL1.SetBits(sam.I2S_SERCTRL_DATASIZE_16 << sam.I2S_SERCTRL_DATASIZE_Pos)
|
||||||
|
|
||||||
case I2SDataFormat24bit:
|
case I2SDataFormat24bit:
|
||||||
i2s.Bus.SERCTRL1.SetBits(sam.I2S_SERCTRL_DATASIZE_24)
|
i2s.Bus.SERCTRL1.SetBits(sam.I2S_SERCTRL_DATASIZE_24 << sam.I2S_SERCTRL_DATASIZE_Pos)
|
||||||
|
|
||||||
case I2SDataFormat32bit:
|
case I2SDataFormat32bit:
|
||||||
case I2SDataFormatDefault:
|
case I2SDataFormatDefault:
|
||||||
i2s.Bus.SERCTRL1.SetBits(sam.I2S_SERCTRL_DATASIZE_32)
|
i2s.Bus.SERCTRL1.SetBits(sam.I2S_SERCTRL_DATASIZE_32 << sam.I2S_SERCTRL_DATASIZE_Pos)
|
||||||
}
|
}
|
||||||
|
|
||||||
// set serializer slot adjustment
|
// set serializer slot adjustment
|
||||||
if config.Standard == I2SStandardLSB {
|
if config.Standard == I2SStandardLSB {
|
||||||
// adjust right
|
// adjust right
|
||||||
i2s.Bus.SERCTRL1.ClearBits(sam.I2S_SERCTRL_SLOTADJ)
|
i2s.Bus.SERCTRL1.ClearBits(sam.I2S_SERCTRL_SLOTADJ)
|
||||||
|
|
||||||
|
// transfer LSB first
|
||||||
|
i2s.Bus.SERCTRL1.SetBits(sam.I2S_SERCTRL_BITREV)
|
||||||
} else {
|
} else {
|
||||||
// adjust left
|
// adjust left
|
||||||
i2s.Bus.SERCTRL1.SetBits(sam.I2S_SERCTRL_SLOTADJ)
|
i2s.Bus.SERCTRL1.SetBits(sam.I2S_SERCTRL_SLOTADJ)
|
||||||
|
|
||||||
// reverse bit order?
|
|
||||||
i2s.Bus.SERCTRL1.SetBits(sam.I2S_SERCTRL_BITREV)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// set serializer mode.
|
// set serializer mode.
|
||||||
|
|
Загрузка…
Создание таблицы
Сослаться в новой задаче