Reset peripherals on enable
This commit is contained in:
		
							parent
							
								
									5f39f13616
								
							
						
					
					
						commit
						ca88ace98d
					
				@ -32,6 +32,7 @@ impl<'d, T: Instance> I2c<'d, T> {
 | 
				
			|||||||
        unborrow!(scl, sda);
 | 
					        unborrow!(scl, sda);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        T::enable();
 | 
					        T::enable();
 | 
				
			||||||
 | 
					        T::reset();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        unsafe {
 | 
					        unsafe {
 | 
				
			||||||
            scl.set_as_af(scl.af_num(), AFType::OutputOpenDrain);
 | 
					            scl.set_as_af(scl.af_num(), AFType::OutputOpenDrain);
 | 
				
			||||||
 | 
				
			|||||||
@ -53,6 +53,7 @@ impl<'d, T: Instance, TXDMA, RXDMA> I2c<'d, T, TXDMA, RXDMA> {
 | 
				
			|||||||
        unborrow!(irq, scl, sda, tx_dma, rx_dma);
 | 
					        unborrow!(irq, scl, sda, tx_dma, rx_dma);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        T::enable();
 | 
					        T::enable();
 | 
				
			||||||
 | 
					        T::reset();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        unsafe {
 | 
					        unsafe {
 | 
				
			||||||
            scl.set_as_af(scl.af_num(), AFType::OutputOpenDrain);
 | 
					            scl.set_as_af(scl.af_num(), AFType::OutputOpenDrain);
 | 
				
			||||||
 | 
				
			|||||||
@ -200,6 +200,7 @@ impl<'d, T: Instance, TxDma, RxDma> Uart<'d, T, TxDma, RxDma> {
 | 
				
			|||||||
        unborrow!(_inner, rx, tx, tx_dma, rx_dma);
 | 
					        unborrow!(_inner, rx, tx, tx_dma, rx_dma);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        T::enable();
 | 
					        T::enable();
 | 
				
			||||||
 | 
					        T::reset();
 | 
				
			||||||
        let pclk_freq = T::frequency();
 | 
					        let pclk_freq = T::frequency();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // TODO: better calculation, including error checking and OVER8 if possible.
 | 
					        // TODO: better calculation, including error checking and OVER8 if possible.
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user