Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
dstric-aqueduct committed Nov 30, 2022
1 parent a12871c commit 687af5b
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 161 deletions.
2 changes: 1 addition & 1 deletion imxrt1060-hal/src/can/embedded_hal.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! `embedded_hal` trait impls.

use super::{Data, ExtendedId, Frame, Id, IdReg, OverrunError, StandardId, CAN};
use super::{Data, ExtendedId, Frame, Id, OverrunError, StandardId, CAN};

use crate::iomuxc::consts::Unsigned;
use embedded_hal::can;
Expand Down
6 changes: 2 additions & 4 deletions imxrt1060-hal/src/can/filter.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
//! Filter bank API.

use core::marker::PhantomData;

use super::{ExtendedId, Fifo, Id, StandardId};
use super::{ExtendedId, Id, StandardId};

const F32_RTR: u32 = 0b010; // set the RTR bit to match remote frames
const F32_IDE: u32 = 0b100; // set the IDE bit to match extended identifiers
Expand Down Expand Up @@ -207,5 +205,5 @@ impl From<Mask32> for BankConfig {

#[cfg(test)]
mod tests {
use super::*;
// use super::*;
}
10 changes: 0 additions & 10 deletions imxrt1060-hal/src/can/id.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
use crate::ccm;
use crate::iomuxc::consts::{Unsigned, U1, U2};
use crate::ral;

use core::cmp::{Ord, Ordering};
use core::marker::PhantomData;
use core::ptr::NonNull;

/// Identifier of a CAN message.
///
Expand Down Expand Up @@ -43,10 +37,6 @@ impl IdReg {
Self(id.as_raw() << Self::EXTENDED_SHIFT | Self::IDE_MASK)
}

fn from_register(reg: u32) -> IdReg {
Self(reg & 0xFFFF_FFFE)
}

/// Sets the remote transmission (RTR) flag. This marks the identifier as
/// being part of a remote frame.
#[must_use = "returns a new IdReg without modifying `self`"]
Expand Down
93 changes: 0 additions & 93 deletions imxrt1060-hal/src/can/isotp.rs

This file was deleted.

53 changes: 0 additions & 53 deletions imxrt1060-hal/src/can/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,15 @@ pub mod filter;
mod frame;
mod id;
mod interrupt;
mod isotp;

pub use frame::{Data, Frame, FramePriority};
pub use id::{ExtendedId, Id, IdReg, StandardId};
pub use isotp::{IsoTPBuilder, IsoTP};
use ral::{modify_reg, read_reg, write_reg};

use crate::ccm;
use crate::iomuxc::consts::{Unsigned, U1, U2};
use crate::ral;

use core::cmp::Ord;
use core::convert::Infallible;
use core::marker::PhantomData;

Expand Down Expand Up @@ -1009,53 +1006,3 @@ pub struct Tx<I> {
_can: PhantomData<I>,
}

#[inline]
const fn ok_mask(idx: usize) -> u32 {
0x02 << (8 * idx)
}

#[inline]
const fn abort_mask(idx: usize) -> u32 {
0x80 << (8 * idx)
}

/// Identifies one of the two receive FIFOs.
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
#[cfg_attr(feature = "unstable-defmt", derive(defmt::Format))]
pub enum Fifo {
Fifo0 = 0,
Fifo1 = 1,
}

/// Identifies one of the three transmit mailboxes.
#[derive(Debug, Copy, Clone, Ord, PartialOrd, Eq, PartialEq)]
#[cfg_attr(feature = "unstable-defmt", derive(defmt::Format))]
pub enum Mailbox {
/// Transmit mailbox 0
Mailbox0 = 0,
/// Transmit mailbox 1
Mailbox1 = 1,
/// Transmit mailbox 2
Mailbox2 = 2,
}

/// Contains information about a frame enqueued for transmission via [`Can::transmit`] or
/// [`Tx::transmit`].
pub struct TransmitStatus {
dequeued_frame: Option<Frame>,
mailbox: Mailbox,
}

impl TransmitStatus {
/// Returns the lower-priority frame that was dequeued to make space for the new frame.
#[inline]
pub fn dequeued_frame(&self) -> Option<&Frame> {
self.dequeued_frame.as_ref()
}

/// Returns the [`Mailbox`] the frame was enqueued in.
#[inline]
pub fn mailbox(&self) -> Mailbox {
self.mailbox
}
}

0 comments on commit 687af5b

Please sign in to comment.