remove unused code, deny warnings
This commit is contained in:
parent
c52172f753
commit
0b4f7c9201
|
@ -8,16 +8,3 @@ pub fn read_eui48<'a>(i2c: &pac::I2C2) -> Result<[u8; 6], i2c::Error> {
|
||||||
i2c::write_read(i2c, I2C_ADDR, &[0xFAu8], &mut buffer)?;
|
i2c::write_read(i2c, I2C_ADDR, &[0xFAu8], &mut buffer)?;
|
||||||
Ok(buffer)
|
Ok(buffer)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn read(i2c: &pac::I2C2, addr: u8, mut buffer: &mut [u8]) -> Result<(), i2c::Error> {
|
|
||||||
i2c::write_read(i2c, I2C_ADDR, &[addr], &mut buffer)?;
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn write(i2c: &pac::I2C2, addr: u8, buffer: &[u8]) -> Result<(), i2c::Error> {
|
|
||||||
for (i, &byte) in buffer.iter().enumerate() {
|
|
||||||
i2c::write(i2c, I2C_ADDR, &[addr+i as u8, byte])?;
|
|
||||||
}
|
|
||||||
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
18
src/eth.rs
18
src/eth.rs
|
@ -557,21 +557,3 @@ impl<'a> phy::TxToken for TxToken<'a> {
|
||||||
result
|
result
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub unsafe fn interrupt_handler(eth_dma: &pac::ETHERNET_DMA) {
|
|
||||||
eth_dma.dmacsr.write(|w|
|
|
||||||
w
|
|
||||||
.nis().set_bit()
|
|
||||||
.ri().set_bit()
|
|
||||||
.ti().set_bit()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
pub unsafe fn enable_interrupt(eth_dma: &pac::ETHERNET_DMA) {
|
|
||||||
eth_dma.dmacier.modify(|_, w|
|
|
||||||
w
|
|
||||||
.nie().set_bit()
|
|
||||||
.rie().set_bit()
|
|
||||||
.tie().set_bit()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
39
src/i2c.rs
39
src/i2c.rs
|
@ -109,25 +109,6 @@ fn poll_for_start_ack(
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
pub fn write(
|
|
||||||
i2c: &pac::I2C2,
|
|
||||||
addr: u8,
|
|
||||||
bytes: &[u8]
|
|
||||||
) -> Result<(), Error> {
|
|
||||||
assert!(bytes.len() < 256 && bytes.len() > 0);
|
|
||||||
|
|
||||||
poll_for_start_ack(i2c, addr|0, false, bytes.len(), true, true)?;
|
|
||||||
|
|
||||||
for byte in bytes {
|
|
||||||
busy_wait_errors!(i2c, txis);
|
|
||||||
i2c.txdr.write(|w| w.txdata().bits(*byte));
|
|
||||||
}
|
|
||||||
// automatic STOP
|
|
||||||
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
pub fn write_read(
|
pub fn write_read(
|
||||||
i2c: &pac::I2C2,
|
i2c: &pac::I2C2,
|
||||||
addr: u8,
|
addr: u8,
|
||||||
|
@ -160,23 +141,3 @@ pub fn write_read(
|
||||||
// automatic STOP
|
// automatic STOP
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
pub fn read(
|
|
||||||
i2c: &pac::I2C2,
|
|
||||||
addr: u8,
|
|
||||||
buffer: &mut [u8],
|
|
||||||
) -> Result<(), Error> {
|
|
||||||
assert!(buffer.len() < 256 && buffer.len() > 0);
|
|
||||||
|
|
||||||
poll_for_start_ack(i2c, addr|0, true, buffer.len(), true, true)?;
|
|
||||||
|
|
||||||
for byte in buffer {
|
|
||||||
// Wait until we have received something
|
|
||||||
busy_wait_errors!(i2c, rxne);
|
|
||||||
*byte = i2c.rxdr.read().rxdata().bits();
|
|
||||||
}
|
|
||||||
|
|
||||||
// automatic STOP
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
|
@ -39,7 +39,6 @@ fn macc<T>(y0: T, x: &[T], a: &[T]) -> T
|
||||||
x.iter().zip(a.iter()).map(|(&i, &j)| i * j).fold(y0, |y, xa| y + xa)
|
x.iter().zip(a.iter()).map(|(&i, &j)| i * j).fold(y0, |y, xa| y + xa)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unused)]
|
|
||||||
impl IIR {
|
impl IIR {
|
||||||
pub fn set_pi(&mut self, kp: f32, ki: f32, g: f32) -> Result<(), &str> {
|
pub fn set_pi(&mut self, kp: f32, ki: f32, g: f32) -> Result<(), &str> {
|
||||||
let ki = copysign(ki, kp);
|
let ki = copysign(ki, kp);
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
#![deny(warnings)]
|
||||||
|
|
||||||
#![no_std]
|
#![no_std]
|
||||||
#![no_main]
|
#![no_main]
|
||||||
#![cfg_attr(feature = "nightly", feature(asm))]
|
#![cfg_attr(feature = "nightly", feature(asm))]
|
||||||
|
@ -41,7 +43,7 @@ mod eth;
|
||||||
mod iir;
|
mod iir;
|
||||||
use iir::*;
|
use iir::*;
|
||||||
|
|
||||||
pub mod i2c;
|
mod i2c;
|
||||||
mod eeprom;
|
mod eeprom;
|
||||||
|
|
||||||
#[cfg(not(feature = "semihosting"))]
|
#[cfg(not(feature = "semihosting"))]
|
||||||
|
|
Loading…
Reference in New Issue