File tree Expand file tree Collapse file tree 4 files changed +8
-18
lines changed
Expand file tree Collapse file tree 4 files changed +8
-18
lines changed Original file line number Diff line number Diff line change @@ -19,10 +19,8 @@ var adcAref uint32
1919
2020// InitADC resets the ADC peripheral.
2121func InitADC () {
22- rp .RESETS .RESET .SetBits (rp .RESETS_RESET_ADC )
23- rp .RESETS .RESET .ClearBits (rp .RESETS_RESET_ADC )
24- for ! rp .RESETS .RESET_DONE .HasBits (rp .RESETS_RESET_ADC ) {
25- }
22+ resetBlock (rp .RESETS_RESET_ADC )
23+ unresetBlockWait (rp .RESETS_RESET_ADC )
2624 // enable ADC
2725 rp .ADC .CS .Set (rp .ADC_CS_EN )
2826 adcAref = 3300
Original file line number Diff line number Diff line change @@ -259,10 +259,7 @@ func (i2c *I2C) init(config I2CConfig) error {
259259//go:inline
260260func (i2c * I2C ) reset () {
261261 resetVal := i2c .deinit ()
262- rp .RESETS .RESET .ClearBits (resetVal )
263- // Wait until reset is done.
264- for ! rp .RESETS .RESET_DONE .HasBits (resetVal ) {
265- }
262+ unresetBlockWait (resetVal )
266263}
267264
268265// deinit sets reset bit for I2C. Must call reset to reenable I2C after deinit.
@@ -276,7 +273,7 @@ func (i2c *I2C) deinit() (resetVal uint32) {
276273 resetVal = rp .RESETS_RESET_I2C1
277274 }
278275 // Perform I2C reset.
279- rp . RESETS . RESET . SetBits (resetVal )
276+ resetBlock (resetVal )
280277
281278 return resetVal
282279}
Original file line number Diff line number Diff line change @@ -212,10 +212,7 @@ func (spi *SPI) setFormat(mode uint8) {
212212//go:inline
213213func (spi * SPI ) reset () {
214214 resetVal := spi .deinit ()
215- rp .RESETS .RESET .ClearBits (resetVal )
216- // Wait until reset is done.
217- for ! rp .RESETS .RESET_DONE .HasBits (resetVal ) {
218- }
215+ unresetBlockWait (resetVal )
219216}
220217
221218//go:inline
@@ -227,7 +224,7 @@ func (spi *SPI) deinit() (resetVal uint32) {
227224 resetVal = rp .RESETS_RESET_SPI1
228225 }
229226 // Perform SPI reset.
230- rp . RESETS . RESET . SetBits (resetVal )
227+ resetBlock (resetVal )
231228 return resetVal
232229}
233230
Original file line number Diff line number Diff line change @@ -148,10 +148,8 @@ func initUART(uart *UART) {
148148 }
149149
150150 // reset UART
151- rp .RESETS .RESET .SetBits (resetVal )
152- rp .RESETS .RESET .ClearBits (resetVal )
153- for ! rp .RESETS .RESET_DONE .HasBits (resetVal ) {
154- }
151+ resetBlock (resetVal )
152+ unresetBlockWait (resetVal )
155153}
156154
157155// handleInterrupt should be called from the appropriate interrupt handler for
You can’t perform that action at this time.
0 commit comments