mirror of
https://github.com/embassy-rs/embassy.git
synced 2024-11-22 06:42:32 +00:00
Merge branch 'main' into nrf9151
This commit is contained in:
commit
2c3de1eeec
@ -236,10 +236,10 @@ impl<ACTIVE: NorFlash, DFU: NorFlash, STATE: NorFlash> BootLoader<ACTIVE, DFU, S
|
|||||||
///
|
///
|
||||||
pub fn prepare_boot(&mut self, aligned_buf: &mut [u8]) -> Result<State, BootError> {
|
pub fn prepare_boot(&mut self, aligned_buf: &mut [u8]) -> Result<State, BootError> {
|
||||||
const {
|
const {
|
||||||
assert!(Self::PAGE_SIZE % ACTIVE::WRITE_SIZE as u32 == 0);
|
core::assert!(Self::PAGE_SIZE % ACTIVE::WRITE_SIZE as u32 == 0);
|
||||||
assert!(Self::PAGE_SIZE % ACTIVE::ERASE_SIZE as u32 == 0);
|
core::assert!(Self::PAGE_SIZE % ACTIVE::ERASE_SIZE as u32 == 0);
|
||||||
assert!(Self::PAGE_SIZE % DFU::WRITE_SIZE as u32 == 0);
|
core::assert!(Self::PAGE_SIZE % DFU::WRITE_SIZE as u32 == 0);
|
||||||
assert!(Self::PAGE_SIZE % DFU::ERASE_SIZE as u32 == 0);
|
core::assert!(Self::PAGE_SIZE % DFU::ERASE_SIZE as u32 == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ensure we have enough progress pages to store copy progress
|
// Ensure we have enough progress pages to store copy progress
|
||||||
|
@ -766,6 +766,12 @@ impl<'d, U: UarteInstance, T: TimerInstance> BufferedUarteRx<'d, U, T> {
|
|||||||
rx.pop_done(amt);
|
rx.pop_done(amt);
|
||||||
U::regs().intenset.write(|w| w.rxstarted().set());
|
U::regs().intenset.write(|w| w.rxstarted().set());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// we are ready to read if there is data in the buffer
|
||||||
|
fn read_ready() -> Result<bool, Error> {
|
||||||
|
let state = U::buffered_state();
|
||||||
|
Ok(!state.rx_buf.is_empty())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, U: UarteInstance, T: TimerInstance> Drop for BufferedUarteRx<'a, U, T> {
|
impl<'a, U: UarteInstance, T: TimerInstance> Drop for BufferedUarteRx<'a, U, T> {
|
||||||
@ -827,6 +833,18 @@ mod _embedded_io {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<'d, U: UarteInstance, T: TimerInstance + 'd> embedded_io_async::ReadReady for BufferedUarte<'d, U, T> {
|
||||||
|
fn read_ready(&mut self) -> Result<bool, Self::Error> {
|
||||||
|
BufferedUarteRx::<'d, U, T>::read_ready()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<'d, U: UarteInstance, T: TimerInstance + 'd> embedded_io_async::ReadReady for BufferedUarteRx<'d, U, T> {
|
||||||
|
fn read_ready(&mut self) -> Result<bool, Self::Error> {
|
||||||
|
Self::read_ready()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl<'d, U: UarteInstance, T: TimerInstance> embedded_io_async::BufRead for BufferedUarte<'d, U, T> {
|
impl<'d, U: UarteInstance, T: TimerInstance> embedded_io_async::BufRead for BufferedUarte<'d, U, T> {
|
||||||
async fn fill_buf(&mut self) -> Result<&[u8], Self::Error> {
|
async fn fill_buf(&mut self) -> Result<&[u8], Self::Error> {
|
||||||
self.fill_buf().await
|
self.fill_buf().await
|
||||||
|
@ -436,6 +436,12 @@ impl<'d> BufferedUartRx<'d> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// we are ready to read if there is data in the buffer
|
||||||
|
fn read_ready(&mut self) -> Result<bool, Error> {
|
||||||
|
let state = self.state;
|
||||||
|
Ok(!state.rx_buf.is_empty())
|
||||||
|
}
|
||||||
|
|
||||||
/// Reconfigure the driver
|
/// Reconfigure the driver
|
||||||
pub fn set_config(&mut self, config: &Config) -> Result<(), ConfigError> {
|
pub fn set_config(&mut self, config: &Config) -> Result<(), ConfigError> {
|
||||||
reconfigure(self.info, self.kernel_clock, config)?;
|
reconfigure(self.info, self.kernel_clock, config)?;
|
||||||
@ -610,6 +616,18 @@ impl<'d> embedded_io_async::Read for BufferedUartRx<'d> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<'d> embedded_io_async::ReadReady for BufferedUart<'d> {
|
||||||
|
fn read_ready(&mut self) -> Result<bool, Self::Error> {
|
||||||
|
BufferedUartRx::<'d>::read_ready(&mut self.rx)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<'d> embedded_io_async::ReadReady for BufferedUartRx<'d> {
|
||||||
|
fn read_ready(&mut self) -> Result<bool, Self::Error> {
|
||||||
|
Self::read_ready(self)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl<'d> embedded_io_async::BufRead for BufferedUart<'d> {
|
impl<'d> embedded_io_async::BufRead for BufferedUart<'d> {
|
||||||
async fn fill_buf(&mut self) -> Result<&[u8], Self::Error> {
|
async fn fill_buf(&mut self) -> Result<&[u8], Self::Error> {
|
||||||
self.rx.fill_buf().await
|
self.rx.fill_buf().await
|
||||||
|
Loading…
Reference in New Issue
Block a user