bl61x_pac/uart/
bus_state.rs

1#[doc = "Register `bus_state` reader"]
2pub type R = crate::R<BUS_STATE_SPEC>;
3#[doc = "Field `transmit_busy` reader - Indicates that UART transmit bus is busy"]
4pub use RECEIVE_BUSY_R as TRANSMIT_BUSY_R;
5#[doc = "Field `receive_busy` reader - Indicates that UART receive bus is busy"]
6pub type RECEIVE_BUSY_R = crate::BitReader<BUS_BUSY_A>;
7#[doc = "Indicates that UART receive bus is busy\n\nValue on reset: 0"]
8#[derive(Clone, Copy, Debug, PartialEq, Eq)]
9pub enum BUS_BUSY_A {
10    #[doc = "1: Bus is busy"]
11    BUSY = 1,
12    #[doc = "0: Bus is not busy"]
13    IDLE = 0,
14}
15impl From<BUS_BUSY_A> for bool {
16    #[inline(always)]
17    fn from(variant: BUS_BUSY_A) -> Self {
18        variant as u8 != 0
19    }
20}
21impl RECEIVE_BUSY_R {
22    #[doc = "Get enumerated values variant"]
23    #[inline(always)]
24    pub const fn variant(&self) -> BUS_BUSY_A {
25        match self.bits {
26            true => BUS_BUSY_A::BUSY,
27            false => BUS_BUSY_A::IDLE,
28        }
29    }
30    #[doc = "Bus is busy"]
31    #[inline(always)]
32    pub fn is_busy(&self) -> bool {
33        *self == BUS_BUSY_A::BUSY
34    }
35    #[doc = "Bus is not busy"]
36    #[inline(always)]
37    pub fn is_idle(&self) -> bool {
38        *self == BUS_BUSY_A::IDLE
39    }
40}
41impl R {
42    #[doc = "Bit 0 - Indicates that UART transmit bus is busy"]
43    #[inline(always)]
44    pub fn transmit_busy(&self) -> TRANSMIT_BUSY_R {
45        TRANSMIT_BUSY_R::new((self.bits & 1) != 0)
46    }
47    #[doc = "Bit 1 - Indicates that UART receive bus is busy"]
48    #[inline(always)]
49    pub fn receive_busy(&self) -> RECEIVE_BUSY_R {
50        RECEIVE_BUSY_R::new(((self.bits >> 1) & 1) != 0)
51    }
52}
53#[doc = "Bus state register\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`bus_state::R`](R).  See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
54pub struct BUS_STATE_SPEC;
55impl crate::RegisterSpec for BUS_STATE_SPEC {
56    type Ux = u32;
57}
58#[doc = "`read()` method returns [`bus_state::R`](R) reader structure"]
59impl crate::Readable for BUS_STATE_SPEC {}
60#[doc = "`reset()` method sets bus_state to value 0"]
61impl crate::Resettable for BUS_STATE_SPEC {
62    const RESET_VALUE: Self::Ux = 0;
63}