stm32 uart: use ConfigError instead of () as error
This commit is contained in:
		
							parent
							
								
									7f72dbdaf2
								
							
						
					
					
						commit
						1e362c750b
					
				@ -116,28 +116,28 @@ pub struct BufferedUartRx<'d, T: BasicInstance> {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
impl<'d, T: BasicInstance> SetConfig for BufferedUart<'d, T> {
 | 
					impl<'d, T: BasicInstance> SetConfig for BufferedUart<'d, T> {
 | 
				
			||||||
    type Config = Config;
 | 
					    type Config = Config;
 | 
				
			||||||
    type ConfigError = ();
 | 
					    type ConfigError = ConfigError;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    fn set_config(&mut self, config: &Self::Config) -> Result<(), ()> {
 | 
					    fn set_config(&mut self, config: &Self::Config) -> Result<(), Self::ConfigError> {
 | 
				
			||||||
        self.set_config(config).map_err(|_| ())
 | 
					        self.set_config(config)
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
impl<'d, T: BasicInstance> SetConfig for BufferedUartRx<'d, T> {
 | 
					impl<'d, T: BasicInstance> SetConfig for BufferedUartRx<'d, T> {
 | 
				
			||||||
    type Config = Config;
 | 
					    type Config = Config;
 | 
				
			||||||
    type ConfigError = ();
 | 
					    type ConfigError = ConfigError;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    fn set_config(&mut self, config: &Self::Config) -> Result<(), ()> {
 | 
					    fn set_config(&mut self, config: &Self::Config) -> Result<(), Self::ConfigError> {
 | 
				
			||||||
        self.set_config(config).map_err(|_| ())
 | 
					        self.set_config(config)
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
impl<'d, T: BasicInstance> SetConfig for BufferedUartTx<'d, T> {
 | 
					impl<'d, T: BasicInstance> SetConfig for BufferedUartTx<'d, T> {
 | 
				
			||||||
    type Config = Config;
 | 
					    type Config = Config;
 | 
				
			||||||
    type ConfigError = ();
 | 
					    type ConfigError = ConfigError;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    fn set_config(&mut self, config: &Self::Config) -> Result<(), ()> {
 | 
					    fn set_config(&mut self, config: &Self::Config) -> Result<(), Self::ConfigError> {
 | 
				
			||||||
        self.set_config(config).map_err(|_| ())
 | 
					        self.set_config(config)
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -182,11 +182,11 @@ pub struct Uart<'d, T: BasicInstance, TxDma = NoDma, RxDma = NoDma> {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
impl<'d, T: BasicInstance, TxDma, RxDma> SetConfig for Uart<'d, T, TxDma, RxDma> {
 | 
					impl<'d, T: BasicInstance, TxDma, RxDma> SetConfig for Uart<'d, T, TxDma, RxDma> {
 | 
				
			||||||
    type Config = Config;
 | 
					    type Config = Config;
 | 
				
			||||||
    type ConfigError = ();
 | 
					    type ConfigError = ConfigError;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    fn set_config(&mut self, config: &Self::Config) -> Result<(), ()> {
 | 
					    fn set_config(&mut self, config: &Self::Config) -> Result<(), Self::ConfigError> {
 | 
				
			||||||
        self.tx.set_config(config).map_err(|_| ())?;
 | 
					        self.tx.set_config(config)?;
 | 
				
			||||||
        self.rx.set_config(config).map_err(|_| ())
 | 
					        self.rx.set_config(config)
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -197,10 +197,10 @@ pub struct UartTx<'d, T: BasicInstance, TxDma = NoDma> {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
impl<'d, T: BasicInstance, TxDma> SetConfig for UartTx<'d, T, TxDma> {
 | 
					impl<'d, T: BasicInstance, TxDma> SetConfig for UartTx<'d, T, TxDma> {
 | 
				
			||||||
    type Config = Config;
 | 
					    type Config = Config;
 | 
				
			||||||
    type ConfigError = ();
 | 
					    type ConfigError = ConfigError;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    fn set_config(&mut self, config: &Self::Config) -> Result<(), ()> {
 | 
					    fn set_config(&mut self, config: &Self::Config) -> Result<(), Self::ConfigError> {
 | 
				
			||||||
        self.set_config(config).map_err(|_| ())
 | 
					        self.set_config(config)
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -214,10 +214,10 @@ pub struct UartRx<'d, T: BasicInstance, RxDma = NoDma> {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
impl<'d, T: BasicInstance, RxDma> SetConfig for UartRx<'d, T, RxDma> {
 | 
					impl<'d, T: BasicInstance, RxDma> SetConfig for UartRx<'d, T, RxDma> {
 | 
				
			||||||
    type Config = Config;
 | 
					    type Config = Config;
 | 
				
			||||||
    type ConfigError = ();
 | 
					    type ConfigError = ConfigError;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    fn set_config(&mut self, config: &Self::Config) -> Result<(), ()> {
 | 
					    fn set_config(&mut self, config: &Self::Config) -> Result<(), Self::ConfigError> {
 | 
				
			||||||
        self.set_config(config).map_err(|_| ())
 | 
					        self.set_config(config)
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -18,10 +18,10 @@ pub struct RingBufferedUartRx<'d, T: BasicInstance, RxDma: super::RxDma<T>> {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
impl<'d, T: BasicInstance, RxDma: super::RxDma<T>> SetConfig for RingBufferedUartRx<'d, T, RxDma> {
 | 
					impl<'d, T: BasicInstance, RxDma: super::RxDma<T>> SetConfig for RingBufferedUartRx<'d, T, RxDma> {
 | 
				
			||||||
    type Config = Config;
 | 
					    type Config = Config;
 | 
				
			||||||
    type ConfigError = ();
 | 
					    type ConfigError = ConfigError;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    fn set_config(&mut self, config: &Self::Config) -> Result<(), ()> {
 | 
					    fn set_config(&mut self, config: &Self::Config) -> Result<(), Self::ConfigError> {
 | 
				
			||||||
        self.set_config(config).map_err(|_| ())
 | 
					        self.set_config(config)
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user