File tree Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -877,29 +877,29 @@ func (i2s I2S) Configure(config I2SConfig) {
877
877
// now set serializer data size.
878
878
switch config .DataFormat {
879
879
case I2SDataFormat8bit :
880
- i2s .Bus .SERCTRL1 .SetBits (sam .I2S_SERCTRL_DATASIZE_8 )
880
+ i2s .Bus .SERCTRL1 .SetBits (sam .I2S_SERCTRL_DATASIZE_8 << sam . I2S_SERCTRL_DATASIZE_Pos )
881
881
882
882
case I2SDataFormat16bit :
883
- i2s .Bus .SERCTRL1 .SetBits (sam .I2S_SERCTRL_DATASIZE_16 )
883
+ i2s .Bus .SERCTRL1 .SetBits (sam .I2S_SERCTRL_DATASIZE_16 << sam . I2S_SERCTRL_DATASIZE_Pos )
884
884
885
885
case I2SDataFormat24bit :
886
- i2s .Bus .SERCTRL1 .SetBits (sam .I2S_SERCTRL_DATASIZE_24 )
886
+ i2s .Bus .SERCTRL1 .SetBits (sam .I2S_SERCTRL_DATASIZE_24 << sam . I2S_SERCTRL_DATASIZE_Pos )
887
887
888
888
case I2SDataFormat32bit :
889
889
case I2SDataFormatDefault :
890
- i2s .Bus .SERCTRL1 .SetBits (sam .I2S_SERCTRL_DATASIZE_32 )
890
+ i2s .Bus .SERCTRL1 .SetBits (sam .I2S_SERCTRL_DATASIZE_32 << sam . I2S_SERCTRL_DATASIZE_Pos )
891
891
}
892
892
893
893
// set serializer slot adjustment
894
894
if config .Standard == I2SStandardLSB {
895
895
// adjust right
896
896
i2s .Bus .SERCTRL1 .ClearBits (sam .I2S_SERCTRL_SLOTADJ )
897
+
898
+ // transfer LSB first
899
+ i2s .Bus .SERCTRL1 .SetBits (sam .I2S_SERCTRL_BITREV )
897
900
} else {
898
901
// adjust left
899
902
i2s .Bus .SERCTRL1 .SetBits (sam .I2S_SERCTRL_SLOTADJ )
900
-
901
- // reverse bit order?
902
- i2s .Bus .SERCTRL1 .SetBits (sam .I2S_SERCTRL_BITREV )
903
903
}
904
904
905
905
// set serializer mode.
You can’t perform that action at this time.
0 commit comments