Removed more redundent generics
This commit is contained in:
parent
e8e44413d3
commit
020272b9f9
1 changed files with 7 additions and 12 deletions
19
src/lib.rs
19
src/lib.rs
|
|
@ -122,14 +122,14 @@ impl<'b, 'a: 'b, ChipSelectError, ChipSelect: OutputPin<Error = ChipSelectError>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn with_initialisation<'c, SpiError, Spi: FullDuplex<u8, Error = SpiError>>(
|
pub fn with_initialisation<'c, Spi: FullDuplex<u8>>(
|
||||||
chip_select: &'a mut ChipSelect,
|
chip_select: &'a mut ChipSelect,
|
||||||
spi: &'c mut Spi,
|
spi: &'c mut Spi,
|
||||||
wol: OnWakeOnLan,
|
wol: OnWakeOnLan,
|
||||||
ping: OnPingRequest,
|
ping: OnPingRequest,
|
||||||
mode: ConnectionType,
|
mode: ConnectionType,
|
||||||
arp: ArpResponses,
|
arp: ArpResponses,
|
||||||
) -> Result<Self, TransferError<SpiError, ChipSelectError>> {
|
) -> Result<Self, TransferError<Spi::Error, ChipSelectError>> {
|
||||||
let mut w5500 = Self::new(chip_select);
|
let mut w5500 = Self::new(chip_select);
|
||||||
{
|
{
|
||||||
let mut w5500_active = w5500.activate(spi)?;
|
let mut w5500_active = w5500.activate(spi)?;
|
||||||
|
|
@ -151,10 +151,10 @@ impl<'b, 'a: 'b, ChipSelectError, ChipSelect: OutputPin<Error = ChipSelectError>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn activate<'c, SpiError, Spi: FullDuplex<u8, Error = SpiError>>(
|
pub fn activate<'c, Spi: FullDuplex<u8>>(
|
||||||
&'b mut self,
|
&'b mut self,
|
||||||
spi: &'c mut Spi,
|
spi: &'c mut Spi,
|
||||||
) -> Result<ActiveW5500<'b, 'a, 'c, ChipSelect, Spi>, TransferError<SpiError, ChipSelectError>>
|
) -> Result<ActiveW5500<'b, 'a, 'c, ChipSelect, Spi>, TransferError<Spi::Error, ChipSelectError>>
|
||||||
{
|
{
|
||||||
Ok(ActiveW5500(self, spi))
|
Ok(ActiveW5500(self, spi))
|
||||||
}
|
}
|
||||||
|
|
@ -443,18 +443,13 @@ pub trait Udp<SpiError, ChipSelectError> {
|
||||||
) -> Result<(), TransferError<SpiError, ChipSelectError>>;
|
) -> Result<(), TransferError<SpiError, ChipSelectError>>;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<
|
impl<ChipSelect: OutputPin, Spi: FullDuplex<u8>> Udp<Spi::Error, ChipSelect::Error>
|
||||||
SpiError,
|
|
||||||
ChipSelectError,
|
|
||||||
ChipSelect: OutputPin<Error = ChipSelectError>,
|
|
||||||
Spi: FullDuplex<u8, Error = SpiError>,
|
|
||||||
> Udp<SpiError, ChipSelectError>
|
|
||||||
for (&mut ActiveW5500<'_, '_, '_, ChipSelect, Spi>, &UdpSocket)
|
for (&mut ActiveW5500<'_, '_, '_, ChipSelect, Spi>, &UdpSocket)
|
||||||
{
|
{
|
||||||
fn receive(
|
fn receive(
|
||||||
&mut self,
|
&mut self,
|
||||||
destination: &mut [u8],
|
destination: &mut [u8],
|
||||||
) -> Result<Option<(IpAddress, u16, usize)>, TransferError<SpiError, ChipSelectError>> {
|
) -> Result<Option<(IpAddress, u16, usize)>, TransferError<Spi::Error, ChipSelect::Error>> {
|
||||||
let (w5500, UdpSocket(socket)) = self;
|
let (w5500, UdpSocket(socket)) = self;
|
||||||
|
|
||||||
if w5500.read_u8(socket.at(SocketRegister::InterruptMask))? & 0x04 == 0 {
|
if w5500.read_u8(socket.at(SocketRegister::InterruptMask))? & 0x04 == 0 {
|
||||||
|
|
@ -510,7 +505,7 @@ impl<
|
||||||
host: &IpAddress,
|
host: &IpAddress,
|
||||||
host_port: u16,
|
host_port: u16,
|
||||||
data: &[u8],
|
data: &[u8],
|
||||||
) -> Result<(), TransferError<SpiError, ChipSelectError>> {
|
) -> Result<(), TransferError<Spi::Error, ChipSelect::Error>> {
|
||||||
let (w5500, UdpSocket(socket)) = self;
|
let (w5500, UdpSocket(socket)) = self;
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue