Merge #67
67: Clippy lint r=jordens a=jordens bors r+ Co-authored-by: Robert Jördens <rj@quartiq.de>
This commit is contained in:
commit
501b3c11d3
|
@ -3,7 +3,7 @@ use super::i2c;
|
|||
|
||||
const I2C_ADDR: u8 = 0xa0;
|
||||
|
||||
pub fn read_eui48<'a>(i2c: &pac::I2C2) -> Result<[u8; 6], i2c::Error> {
|
||||
pub fn read_eui48(i2c: &pac::I2C2) -> Result<[u8; 6], i2c::Error> {
|
||||
let mut buffer = [0u8; 6];
|
||||
i2c::write_read(i2c, I2C_ADDR, &[0xFAu8], &mut buffer)?;
|
||||
Ok(buffer)
|
||||
|
|
|
@ -328,6 +328,14 @@ impl Device {
|
|||
Self{ rx: RxRing::new(), tx: TxRing::new() }
|
||||
}
|
||||
|
||||
// Initialize the ethernet peripherals
|
||||
//
|
||||
// # Safety
|
||||
//
|
||||
// This iis transitively unsafe since it sets potentially
|
||||
// unsafe register values. Might ultimately be safe if the values
|
||||
// are correct.
|
||||
//
|
||||
// After `init` is called, `Device` shall not be moved.
|
||||
pub unsafe fn init(&mut self, mac: EthernetAddress,
|
||||
eth_mac: &pac::ETHERNET_MAC,
|
||||
|
|
|
@ -101,7 +101,7 @@ fn poll_for_start_ack(
|
|||
}
|
||||
}
|
||||
|
||||
return Err(Error::Timeout);
|
||||
Err(Error::Timeout)
|
||||
}
|
||||
|
||||
|
||||
|
@ -111,10 +111,10 @@ pub fn write_read(
|
|||
bytes: &[u8],
|
||||
buffer: &mut [u8],
|
||||
) -> Result<(), Error> {
|
||||
assert!(bytes.len() < 256 && bytes.len() > 0);
|
||||
assert!(buffer.len() < 256 && buffer.len() > 0);
|
||||
assert!(bytes.len() < 256 && !bytes.is_empty());
|
||||
assert!(buffer.len() < 256 && !buffer.is_empty());
|
||||
|
||||
poll_for_start_ack(i2c, addr|0, false, bytes.len(), false, true)?;
|
||||
poll_for_start_ack(i2c, addr, false, bytes.len(), false, true)?;
|
||||
|
||||
for byte in bytes {
|
||||
// Wait until we are allowed to send data (START has been ACKed or last
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#![deny(warnings)]
|
||||
#![allow(clippy::missing_safety_doc)]
|
||||
|
||||
#![no_std]
|
||||
#![no_main]
|
||||
|
|
Loading…
Reference in New Issue