cpld: fixed unwanted mut

This commit is contained in:
occheung 2020-08-10 17:22:46 +08:00
parent a406dea0c7
commit 429fbb7443
2 changed files with 6 additions and 5 deletions

View File

@ -21,7 +21,8 @@ use cortex_m::asm::nop;
use cortex_m_semihosting::hprintln;
use nb::block;
use super::{Parts};
use crate::spi_slave::Parts;
/*
* Enum for structuring error
@ -49,7 +50,7 @@ pub struct CPLD<SPI, CS0, CS1, CS2> {
pub trait SelectChip {
type Error;
fn select_chip(&mut self, channel: u8) -> Result<(), Self::Error>;
fn select_chip(&mut self, chip: u8) -> Result<(), Self::Error>;
}
impl<SPI, CS0, CS1, CS2, E> SelectChip for CPLDData<SPI, CS0, CS1, CS2>
@ -79,14 +80,14 @@ where
pub trait DoOnGetRefMutData<SPI, CS0, CS1, CS2> {
fn do_on_get_ref_mut_data<R, E>(
&mut self,
&self,
f: impl FnOnce(cell::RefMut<CPLDData<SPI, CS0, CS1, CS2>>) -> Result<R, Error<E>>,
) -> Result<R, Error<E>>;
}
impl<SPI, CS0, CS1, CS2> DoOnGetRefMutData<SPI, CS0, CS1, CS2> for CPLD<SPI, CS0, CS1, CS2> {
fn do_on_get_ref_mut_data<R, E>(
&mut self,
&self,
f: impl FnOnce(cell::RefMut<CPLDData<SPI, CS0, CS1, CS2>>) -> Result<R, Error<E>>,
) -> Result<R, Error<E>> {
let dev = self

View File

@ -1,7 +1,7 @@
#![no_std]
mod cpld;
pub use cpld::{CPLD, Error};
pub use cpld::{CPLDData, CPLD, Error};
mod spi_slave;
pub use spi_slave::{SPISlave, Parts};