@@ -201,7 +201,7 @@ func (a ADC) Get() uint16 {
201
201
waitADCSync ()
202
202
203
203
// Waiting for conversion to complete
204
- for ( sam .ADC .INTFLAG .Get () & sam .ADC_INTFLAG_RESRDY ) == 0 {
204
+ for ! sam .ADC .INTFLAG .HasBits ( sam .ADC_INTFLAG_RESRDY ) {
205
205
}
206
206
val := sam .ADC .RESULT .Get ()
207
207
@@ -242,7 +242,7 @@ func (a ADC) getADCChannel() uint8 {
242
242
}
243
243
244
244
func waitADCSync () {
245
- for ( sam .ADC .STATUS .Get () & sam .ADC_STATUS_SYNCBUSY ) > 0 {
245
+ for sam .ADC .STATUS .HasBits ( sam .ADC_STATUS_SYNCBUSY ) {
246
246
}
247
247
}
248
248
@@ -325,8 +325,8 @@ func (uart UART) Configure(config UARTConfig) {
325
325
326
326
// reset SERCOM0
327
327
uart .Bus .CTRLA .SetBits (sam .SERCOM_USART_CTRLA_SWRST )
328
- for ( uart .Bus .CTRLA .Get () & sam .SERCOM_USART_CTRLA_SWRST ) > 0 ||
329
- ( uart .Bus .SYNCBUSY .Get () & sam .SERCOM_USART_SYNCBUSY_SWRST ) > 0 {
328
+ for uart .Bus .CTRLA .HasBits ( sam .SERCOM_USART_CTRLA_SWRST ) ||
329
+ uart .Bus .SYNCBUSY .HasBits ( sam .SERCOM_USART_SYNCBUSY_SWRST ) {
330
330
}
331
331
332
332
// set UART mode/sample rate
@@ -365,7 +365,7 @@ func (uart UART) Configure(config UARTConfig) {
365
365
// Enable USART1 port.
366
366
// sercom->USART.CTRLA.bit.ENABLE = 0x1u;
367
367
uart .Bus .CTRLA .SetBits (sam .SERCOM_USART_CTRLA_ENABLE )
368
- for ( uart .Bus .SYNCBUSY .Get () & sam .SERCOM_USART_SYNCBUSY_ENABLE ) > 0 {
368
+ for uart .Bus .SYNCBUSY .HasBits ( sam .SERCOM_USART_SYNCBUSY_ENABLE ) {
369
369
}
370
370
371
371
// setup interrupt on receive
@@ -398,7 +398,7 @@ func (uart UART) SetBaudRate(br uint32) {
398
398
// WriteByte writes a byte of data to the UART.
399
399
func (uart UART ) WriteByte (c byte ) error {
400
400
// wait until ready to receive
401
- for ( uart .Bus .INTFLAG .Get () & sam .SERCOM_USART_INTFLAG_DRE ) == 0 {
401
+ for ! uart .Bus .INTFLAG .HasBits ( sam .SERCOM_USART_INTFLAG_DRE ) {
402
402
}
403
403
uart .Bus .DATA .Set (uint16 (c ))
404
404
return nil
@@ -454,8 +454,8 @@ func (i2c I2C) Configure(config I2CConfig) {
454
454
455
455
// reset SERCOM
456
456
i2c .Bus .CTRLA .SetBits (sam .SERCOM_I2CM_CTRLA_SWRST )
457
- for ( i2c .Bus .CTRLA .Get () & sam .SERCOM_I2CM_CTRLA_SWRST ) > 0 ||
458
- ( i2c .Bus .SYNCBUSY .Get () & sam .SERCOM_I2CM_SYNCBUSY_SWRST ) > 0 {
457
+ for i2c .Bus .CTRLA .HasBits ( sam .SERCOM_I2CM_CTRLA_SWRST ) ||
458
+ i2c .Bus .SYNCBUSY .HasBits ( sam .SERCOM_I2CM_SYNCBUSY_SWRST ) {
459
459
}
460
460
461
461
// Set i2c master mode
@@ -467,12 +467,12 @@ func (i2c I2C) Configure(config I2CConfig) {
467
467
// Enable I2CM port.
468
468
// sercom->USART.CTRLA.bit.ENABLE = 0x1u;
469
469
i2c .Bus .CTRLA .SetBits (sam .SERCOM_I2CM_CTRLA_ENABLE )
470
- for ( i2c .Bus .SYNCBUSY .Get () & sam .SERCOM_I2CM_SYNCBUSY_ENABLE ) > 0 {
470
+ for i2c .Bus .SYNCBUSY .HasBits ( sam .SERCOM_I2CM_SYNCBUSY_ENABLE ) {
471
471
}
472
472
473
473
// set bus idle mode
474
474
i2c .Bus .STATUS .SetBits (wireIdleState << sam .SERCOM_I2CM_STATUS_BUSSTATE_Pos )
475
- for ( i2c .Bus .SYNCBUSY .Get () & sam .SERCOM_I2CM_SYNCBUSY_SYSOP ) > 0 {
475
+ for i2c .Bus .SYNCBUSY .HasBits ( sam .SERCOM_I2CM_SYNCBUSY_SYSOP ) {
476
476
}
477
477
478
478
// enable pins
@@ -499,15 +499,15 @@ func (i2c I2C) Tx(addr uint16, w, r []byte) error {
499
499
500
500
// wait until transmission complete
501
501
timeout := i2cTimeout
502
- for ( i2c .Bus .INTFLAG .Get () & sam .SERCOM_I2CM_INTFLAG_MB ) == 0 {
502
+ for ! i2c .Bus .INTFLAG .HasBits ( sam .SERCOM_I2CM_INTFLAG_MB ) {
503
503
timeout --
504
504
if timeout == 0 {
505
505
return errors .New ("I2C timeout on ready to write data" )
506
506
}
507
507
}
508
508
509
509
// ACK received (0: ACK, 1: NACK)
510
- if ( i2c .Bus .STATUS .Get () & sam .SERCOM_I2CM_STATUS_RXNACK ) > 0 {
510
+ if i2c .Bus .STATUS .HasBits ( sam .SERCOM_I2CM_STATUS_RXNACK ) {
511
511
return errors .New ("I2C write error: expected ACK not NACK" )
512
512
}
513
513
@@ -529,17 +529,17 @@ func (i2c I2C) Tx(addr uint16, w, r []byte) error {
529
529
i2c .sendAddress (addr , false )
530
530
531
531
// wait transmission complete
532
- for ( i2c .Bus .INTFLAG .Get () & sam .SERCOM_I2CM_INTFLAG_SB ) == 0 {
532
+ for ! i2c .Bus .INTFLAG .HasBits ( sam .SERCOM_I2CM_INTFLAG_SB ) {
533
533
// If the slave NACKS the address, the MB bit will be set.
534
534
// In that case, send a stop condition and return error.
535
- if ( i2c .Bus .INTFLAG .Get () & sam .SERCOM_I2CM_INTFLAG_MB ) > 0 {
535
+ if i2c .Bus .INTFLAG .HasBits ( sam .SERCOM_I2CM_INTFLAG_MB ) {
536
536
i2c .Bus .CTRLB .SetBits (wireCmdStop << sam .SERCOM_I2CM_CTRLB_CMD_Pos ) // Stop condition
537
537
return errors .New ("I2C read error: expected ACK not NACK" )
538
538
}
539
539
}
540
540
541
541
// ACK received (0: ACK, 1: NACK)
542
- if ( i2c .Bus .STATUS .Get () & sam .SERCOM_I2CM_STATUS_RXNACK ) > 0 {
542
+ if i2c .Bus .STATUS .HasBits ( sam .SERCOM_I2CM_STATUS_RXNACK ) {
543
543
return errors .New ("I2C read error: expected ACK not NACK" )
544
544
}
545
545
@@ -574,9 +574,9 @@ func (i2c I2C) WriteByte(data byte) error {
574
574
575
575
// wait until transmission successful
576
576
timeout := i2cTimeout
577
- for ( i2c .Bus .INTFLAG .Get () & sam .SERCOM_I2CM_INTFLAG_MB ) == 0 {
577
+ for ! i2c .Bus .INTFLAG .HasBits ( sam .SERCOM_I2CM_INTFLAG_MB ) {
578
578
// check for bus error
579
- if ( sam .SERCOM3_I2CM .STATUS .Get () & sam .SERCOM_I2CM_STATUS_BUSERR ) > 0 {
579
+ if sam .SERCOM3_I2CM .STATUS .HasBits ( sam .SERCOM_I2CM_STATUS_BUSERR ) {
580
580
return errors .New ("I2C bus error" )
581
581
}
582
582
timeout --
@@ -585,7 +585,7 @@ func (i2c I2C) WriteByte(data byte) error {
585
585
}
586
586
}
587
587
588
- if ( i2c .Bus .STATUS .Get () & sam .SERCOM_I2CM_STATUS_RXNACK ) > 0 {
588
+ if i2c .Bus .STATUS .HasBits ( sam .SERCOM_I2CM_STATUS_RXNACK ) {
589
589
return errors .New ("I2C write error: expected ACK not NACK" )
590
590
}
591
591
@@ -601,8 +601,8 @@ func (i2c I2C) sendAddress(address uint16, write bool) error {
601
601
602
602
// wait until bus ready
603
603
timeout := i2cTimeout
604
- for ( i2c .Bus .STATUS .Get () & ( wireIdleState << sam .SERCOM_I2CM_STATUS_BUSSTATE_Pos )) == 0 &&
605
- ( i2c .Bus .STATUS .Get () & ( wireOwnerState << sam .SERCOM_I2CM_STATUS_BUSSTATE_Pos )) == 0 {
604
+ for ! i2c .Bus .STATUS .HasBits ( wireIdleState << sam .SERCOM_I2CM_STATUS_BUSSTATE_Pos ) &&
605
+ ! i2c .Bus .STATUS .HasBits ( wireOwnerState << sam .SERCOM_I2CM_STATUS_BUSSTATE_Pos ) {
606
606
timeout --
607
607
if timeout == 0 {
608
608
return errors .New ("I2C timeout on bus ready" )
@@ -616,7 +616,7 @@ func (i2c I2C) sendAddress(address uint16, write bool) error {
616
616
func (i2c I2C ) signalStop () error {
617
617
i2c .Bus .CTRLB .SetBits (wireCmdStop << sam .SERCOM_I2CM_CTRLB_CMD_Pos ) // Stop command
618
618
timeout := i2cTimeout
619
- for ( i2c .Bus .SYNCBUSY .Get () & sam .SERCOM_I2CM_SYNCBUSY_SYSOP ) > 0 {
619
+ for i2c .Bus .SYNCBUSY .HasBits ( sam .SERCOM_I2CM_SYNCBUSY_SYSOP ) {
620
620
timeout --
621
621
if timeout == 0 {
622
622
return errors .New ("I2C timeout on signal stop" )
@@ -628,7 +628,7 @@ func (i2c I2C) signalStop() error {
628
628
func (i2c I2C ) signalRead () error {
629
629
i2c .Bus .CTRLB .SetBits (wireCmdRead << sam .SERCOM_I2CM_CTRLB_CMD_Pos ) // Read command
630
630
timeout := i2cTimeout
631
- for ( i2c .Bus .SYNCBUSY .Get () & sam .SERCOM_I2CM_SYNCBUSY_SYSOP ) > 0 {
631
+ for i2c .Bus .SYNCBUSY .HasBits ( sam .SERCOM_I2CM_SYNCBUSY_SYSOP ) {
632
632
timeout --
633
633
if timeout == 0 {
634
634
return errors .New ("I2C timeout on signal read" )
@@ -638,7 +638,7 @@ func (i2c I2C) signalRead() error {
638
638
}
639
639
640
640
func (i2c I2C ) readByte () byte {
641
- for ( i2c .Bus .INTFLAG .Get () & sam .SERCOM_I2CM_INTFLAG_SB ) == 0 {
641
+ for ! i2c .Bus .INTFLAG .HasBits ( sam .SERCOM_I2CM_INTFLAG_SB ) {
642
642
}
643
643
return byte (i2c .Bus .DATA .Get ())
644
644
}
@@ -697,11 +697,11 @@ func (i2s I2S) Configure(config I2SConfig) {
697
697
698
698
// reset the device
699
699
i2s .Bus .CTRLA .SetBits (sam .I2S_CTRLA_SWRST )
700
- for ( i2s .Bus .SYNCBUSY .Get () & sam .I2S_SYNCBUSY_SWRST ) > 0 {
700
+ for i2s .Bus .SYNCBUSY .HasBits ( sam .I2S_SYNCBUSY_SWRST ) {
701
701
}
702
702
703
703
// disable device before continuing
704
- for ( i2s .Bus .SYNCBUSY .Get () & sam .I2S_SYNCBUSY_ENABLE ) > 0 {
704
+ for i2s .Bus .SYNCBUSY .HasBits ( sam .I2S_SYNCBUSY_ENABLE ) {
705
705
}
706
706
i2s .Bus .CTRLA .ClearBits (sam .I2S_CTRLA_ENABLE )
707
707
@@ -797,17 +797,17 @@ func (i2s I2S) Configure(config I2SConfig) {
797
797
798
798
// re-enable
799
799
i2s .Bus .CTRLA .SetBits (sam .I2S_CTRLA_ENABLE )
800
- for ( i2s .Bus .SYNCBUSY .Get () & sam .I2S_SYNCBUSY_ENABLE ) > 0 {
800
+ for i2s .Bus .SYNCBUSY .HasBits ( sam .I2S_SYNCBUSY_ENABLE ) {
801
801
}
802
802
803
803
// enable i2s clock
804
804
i2s .Bus .CTRLA .SetBits (sam .I2S_CTRLA_CKEN0 )
805
- for ( i2s .Bus .SYNCBUSY .Get () & sam .I2S_SYNCBUSY_CKEN0 ) > 0 {
805
+ for i2s .Bus .SYNCBUSY .HasBits ( sam .I2S_SYNCBUSY_CKEN0 ) {
806
806
}
807
807
808
808
// enable i2s serializer
809
809
i2s .Bus .CTRLA .SetBits (sam .I2S_CTRLA_SEREN1 )
810
- for ( i2s .Bus .SYNCBUSY .Get () & sam .I2S_SYNCBUSY_SEREN1 ) > 0 {
810
+ for i2s .Bus .SYNCBUSY .HasBits ( sam .I2S_SYNCBUSY_SEREN1 ) {
811
811
}
812
812
}
813
813
@@ -817,10 +817,10 @@ func (i2s I2S) Read(p []uint32) (n int, err error) {
817
817
i := 0
818
818
for i = 0 ; i < len (p ); i ++ {
819
819
// Wait until ready
820
- for ( i2s .Bus .INTFLAG .Get () & sam .I2S_INTFLAG_RXRDY1 ) == 0 {
820
+ for ! i2s .Bus .INTFLAG .HasBits ( sam .I2S_INTFLAG_RXRDY1 ) {
821
821
}
822
822
823
- for ( i2s .Bus .SYNCBUSY .Get () & sam .I2S_SYNCBUSY_DATA1 ) > 0 {
823
+ for i2s .Bus .SYNCBUSY .HasBits ( sam .I2S_SYNCBUSY_DATA1 ) {
824
824
}
825
825
826
826
// read data
@@ -839,10 +839,10 @@ func (i2s I2S) Write(p []uint32) (n int, err error) {
839
839
i := 0
840
840
for i = 0 ; i < len (p ); i ++ {
841
841
// Wait until ready
842
- for ( i2s .Bus .INTFLAG .Get () & sam .I2S_INTFLAG_TXRDY1 ) == 0 {
842
+ for ! i2s .Bus .INTFLAG .HasBits ( sam .I2S_INTFLAG_TXRDY1 ) {
843
843
}
844
844
845
- for ( i2s .Bus .SYNCBUSY .Get () & sam .I2S_SYNCBUSY_DATA1 ) > 0 {
845
+ for i2s .Bus .SYNCBUSY .HasBits ( sam .I2S_SYNCBUSY_DATA1 ) {
846
846
}
847
847
848
848
// write data
@@ -858,7 +858,7 @@ func (i2s I2S) Write(p []uint32) (n int, err error) {
858
858
// Close the I2S bus.
859
859
func (i2s I2S ) Close () error {
860
860
// Sync wait
861
- for ( i2s .Bus .SYNCBUSY .Get () & sam .I2S_SYNCBUSY_ENABLE ) > 0 {
861
+ for i2s .Bus .SYNCBUSY .HasBits ( sam .I2S_SYNCBUSY_ENABLE ) {
862
862
}
863
863
864
864
// disable I2S
@@ -868,7 +868,7 @@ func (i2s I2S) Close() error {
868
868
}
869
869
870
870
func waitForSync () {
871
- for ( sam .GCLK .STATUS .Get () & sam .GCLK_STATUS_SYNCBUSY ) > 0 {
871
+ for sam .GCLK .STATUS .HasBits ( sam .GCLK_STATUS_SYNCBUSY ) {
872
872
}
873
873
}
874
874
@@ -903,7 +903,7 @@ func (spi SPI) Configure(config SPIConfig) {
903
903
904
904
// Disable SPI port.
905
905
spi .Bus .CTRLA .ClearBits (sam .SERCOM_SPI_CTRLA_ENABLE )
906
- for ( spi .Bus .SYNCBUSY .Get () & sam .SERCOM_SPI_SYNCBUSY_ENABLE ) > 0 {
906
+ for spi .Bus .SYNCBUSY .HasBits ( sam .SERCOM_SPI_SYNCBUSY_ENABLE ) {
907
907
}
908
908
909
909
// enable pins
@@ -913,8 +913,8 @@ func (spi SPI) Configure(config SPIConfig) {
913
913
914
914
// reset SERCOM
915
915
spi .Bus .CTRLA .SetBits (sam .SERCOM_SPI_CTRLA_SWRST )
916
- for ( spi .Bus .CTRLA .Get () & sam .SERCOM_SPI_CTRLA_SWRST ) > 0 ||
917
- ( spi .Bus .SYNCBUSY .Get () & sam .SERCOM_SPI_SYNCBUSY_SWRST ) > 0 {
916
+ for spi .Bus .CTRLA .HasBits ( sam .SERCOM_SPI_CTRLA_SWRST ) ||
917
+ spi .Bus .SYNCBUSY .HasBits ( sam .SERCOM_SPI_SYNCBUSY_SWRST ) {
918
918
}
919
919
920
920
// set bit transfer order
@@ -932,7 +932,7 @@ func (spi SPI) Configure(config SPIConfig) {
932
932
spi .Bus .CTRLB .SetBits ((0 << sam .SERCOM_SPI_CTRLB_CHSIZE_Pos ) | // 8bit char size
933
933
sam .SERCOM_SPI_CTRLB_RXEN ) // receive enable
934
934
935
- for ( spi .Bus .SYNCBUSY .Get () & sam .SERCOM_SPI_SYNCBUSY_CTRLB ) > 0 {
935
+ for spi .Bus .SYNCBUSY .HasBits ( sam .SERCOM_SPI_SYNCBUSY_CTRLB ) {
936
936
}
937
937
938
938
// set mode
@@ -959,7 +959,7 @@ func (spi SPI) Configure(config SPIConfig) {
959
959
960
960
// Enable SPI port.
961
961
spi .Bus .CTRLA .SetBits (sam .SERCOM_SPI_CTRLA_ENABLE )
962
- for ( spi .Bus .SYNCBUSY .Get () & sam .SERCOM_SPI_SYNCBUSY_ENABLE ) > 0 {
962
+ for spi .Bus .SYNCBUSY .HasBits ( sam .SERCOM_SPI_SYNCBUSY_ENABLE ) {
963
963
}
964
964
}
965
965
@@ -969,7 +969,7 @@ func (spi SPI) Transfer(w byte) (byte, error) {
969
969
spi .Bus .DATA .Set (uint32 (w ))
970
970
971
971
// wait for receive
972
- for ( spi .Bus .INTFLAG .Get () & sam .SERCOM_SPI_INTFLAG_RXC ) == 0 {
972
+ for ! spi .Bus .INTFLAG .HasBits ( sam .SERCOM_SPI_INTFLAG_RXC ) {
973
973
}
974
974
975
975
// return data
@@ -988,14 +988,14 @@ func InitPWM() {
988
988
sam .GCLK .CLKCTRL .Set ((sam .GCLK_CLKCTRL_ID_TCC0_TCC1 << sam .GCLK_CLKCTRL_ID_Pos ) |
989
989
(sam .GCLK_CLKCTRL_GEN_GCLK0 << sam .GCLK_CLKCTRL_GEN_Pos ) |
990
990
sam .GCLK_CLKCTRL_CLKEN )
991
- for ( sam .GCLK .STATUS .Get () & sam .GCLK_STATUS_SYNCBUSY ) > 0 {
991
+ for sam .GCLK .STATUS .HasBits ( sam .GCLK_STATUS_SYNCBUSY ) {
992
992
}
993
993
994
994
// Use GCLK0 for TCC2/TC3
995
995
sam .GCLK .CLKCTRL .Set ((sam .GCLK_CLKCTRL_ID_TCC2_TC3 << sam .GCLK_CLKCTRL_ID_Pos ) |
996
996
(sam .GCLK_CLKCTRL_GEN_GCLK0 << sam .GCLK_CLKCTRL_GEN_Pos ) |
997
997
sam .GCLK_CLKCTRL_CLKEN )
998
- for ( sam .GCLK .STATUS .Get () & sam .GCLK_STATUS_SYNCBUSY ) > 0 {
998
+ for sam .GCLK .STATUS .HasBits ( sam .GCLK_STATUS_SYNCBUSY ) {
999
999
}
1000
1000
}
1001
1001
@@ -1007,20 +1007,20 @@ func (pwm PWM) Configure() {
1007
1007
// disable timer
1008
1008
timer .CTRLA .ClearBits (sam .TCC_CTRLA_ENABLE )
1009
1009
// Wait for synchronization
1010
- for ( timer .SYNCBUSY .Get () & sam .TCC_SYNCBUSY_ENABLE ) > 0 {
1010
+ for timer .SYNCBUSY .HasBits ( sam .TCC_SYNCBUSY_ENABLE ) {
1011
1011
}
1012
1012
1013
1013
// Use "Normal PWM" (single-slope PWM)
1014
1014
timer .WAVE .SetBits (sam .TCC_WAVE_WAVEGEN_NPWM )
1015
1015
// Wait for synchronization
1016
- for ( timer .SYNCBUSY .Get () & sam .TCC_SYNCBUSY_WAVE ) > 0 {
1016
+ for timer .SYNCBUSY .HasBits ( sam .TCC_SYNCBUSY_WAVE ) {
1017
1017
}
1018
1018
1019
1019
// Set the period (the number to count to (TOP) before resetting timer)
1020
1020
//TCC0->PER.reg = period;
1021
1021
timer .PER .Set (period )
1022
1022
// Wait for synchronization
1023
- for ( timer .SYNCBUSY .Get () & sam .TCC_SYNCBUSY_PER ) > 0 {
1023
+ for timer .SYNCBUSY .HasBits ( sam .TCC_SYNCBUSY_PER ) {
1024
1024
}
1025
1025
1026
1026
// Set pin as output
@@ -1060,23 +1060,23 @@ func (pwm PWM) Set(value uint16) {
1060
1060
timer .CTRLA .ClearBits (sam .TCC_CTRLA_ENABLE )
1061
1061
1062
1062
// Wait for synchronization
1063
- for ( timer .SYNCBUSY .Get () & sam .TCC_SYNCBUSY_ENABLE ) > 0 {
1063
+ for timer .SYNCBUSY .HasBits ( sam .TCC_SYNCBUSY_ENABLE ) {
1064
1064
}
1065
1065
1066
1066
// Set PWM signal to output duty cycle
1067
1067
pwm .setChannel (uint32 (value ))
1068
1068
1069
1069
// Wait for synchronization on all channels
1070
- for ( timer .SYNCBUSY .Get () & (sam .TCC_SYNCBUSY_CC0 |
1070
+ for timer .SYNCBUSY .HasBits (sam .TCC_SYNCBUSY_CC0 |
1071
1071
sam .TCC_SYNCBUSY_CC1 |
1072
1072
sam .TCC_SYNCBUSY_CC2 |
1073
- sam .TCC_SYNCBUSY_CC3 )) > 0 {
1073
+ sam .TCC_SYNCBUSY_CC3 ) {
1074
1074
}
1075
1075
1076
1076
// enable
1077
1077
timer .CTRLA .SetBits (sam .TCC_CTRLA_ENABLE )
1078
1078
// Wait for synchronization
1079
- for ( timer .SYNCBUSY .Get () & sam .TCC_SYNCBUSY_ENABLE ) > 0 {
1079
+ for timer .SYNCBUSY .HasBits ( sam .TCC_SYNCBUSY_ENABLE ) {
1080
1080
}
1081
1081
}
1082
1082
@@ -1233,8 +1233,8 @@ var (
1233
1233
func (usbcdc USBCDC ) Configure (config UARTConfig ) {
1234
1234
// reset USB interface
1235
1235
sam .USB_DEVICE .CTRLA .SetBits (sam .USB_DEVICE_CTRLA_SWRST )
1236
- for ( sam .USB_DEVICE .SYNCBUSY .Get () & sam .USB_DEVICE_SYNCBUSY_SWRST ) > 0 ||
1237
- ( sam .USB_DEVICE .SYNCBUSY .Get () & sam .USB_DEVICE_SYNCBUSY_ENABLE ) > 0 {
1236
+ for sam .USB_DEVICE .SYNCBUSY .HasBits ( sam .USB_DEVICE_SYNCBUSY_SWRST ) ||
1237
+ sam .USB_DEVICE .SYNCBUSY .HasBits ( sam .USB_DEVICE_SYNCBUSY_ENABLE ) {
1238
1238
}
1239
1239
1240
1240
sam .USB_DEVICE .DESCADD .Set (uint32 (uintptr (unsafe .Pointer (& usbEndpointDescriptors ))))
0 commit comments