More MSC work

This commit is contained in:
chemicstry
2023-02-17 01:30:45 +02:00
parent ab7e26a777
commit 9be45c3be9
14 changed files with 831 additions and 86 deletions

View File

@ -1,5 +1,7 @@
use embassy_hal_common::{into_ref, PeripheralRef};
use embedded_storage::nor_flash::{ErrorType, NorFlash, NorFlashError, NorFlashErrorKind, ReadNorFlash};
use embedded_storage::nor_flash::{
ErrorType, MultiwriteNorFlash, NorFlash, NorFlashError, NorFlashErrorKind, ReadNorFlash,
};
pub use crate::pac::{ERASE_SIZE, ERASE_VALUE, FLASH_BASE, FLASH_SIZE, WRITE_SIZE};
use crate::peripherals::FLASH;
@ -136,6 +138,8 @@ impl<'d> NorFlash for Flash<'d> {
}
}
impl<'d> MultiwriteNorFlash for Flash<'d> {}
/*
cfg_if::cfg_if! {
if #[cfg(feature = "nightly")]

View File

@ -1127,6 +1127,7 @@ impl<'d, T: Instance> embassy_usb_driver::EndpointOut for Endpoint<'d, T, Out> {
impl<'d, T: Instance> embassy_usb_driver::EndpointIn for Endpoint<'d, T, In> {
async fn write(&mut self, buf: &[u8]) -> Result<(), EndpointError> {
trace!("write ep={:?} data={:?}", self.info.addr, buf);
// info!("w:{}", self.info.addr.index());
if buf.len() > self.info.max_packet_size as usize {
return Err(EndpointError::BufferOverflow);
@ -1152,6 +1153,8 @@ impl<'d, T: Instance> embassy_usb_driver::EndpointIn for Endpoint<'d, T, In> {
})
.await?;
info!("ww");
if buf.len() > 0 {
poll_fn(|cx| {
state.ep_in_wakers[index].register(cx.waker());
@ -1206,6 +1209,7 @@ impl<'d, T: Instance> embassy_usb_driver::EndpointIn for Endpoint<'d, T, In> {
unsafe { r.fifo(index).write_value(regs::Fifo(u32::from_ne_bytes(tmp))) };
}
info!("wd");
trace!("write done ep={:?}", self.info.addr);
Ok(())