atsam4ls2a_pac/usart0/
rhr.rs

1#[doc = "Register `RHR` reader"]
2pub struct R(crate::R<RHR_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<RHR_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<RHR_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<RHR_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Field `RXCHR` reader - Received Character"]
17pub type RXCHR_R = crate::FieldReader<u16, u16>;
18#[doc = "Field `RXSYNH` reader - Received Sync"]
19pub type RXSYNH_R = crate::BitReader<RXSYNHSELECT_A>;
20#[doc = "Received Sync\n\nValue on reset: 0"]
21#[derive(Clone, Copy, Debug, PartialEq, Eq)]
22pub enum RXSYNHSELECT_A {
23    #[doc = "0: Last character received is a Data"]
24    _0 = 0,
25    #[doc = "1: Last character received is a Command"]
26    _1 = 1,
27}
28impl From<RXSYNHSELECT_A> for bool {
29    #[inline(always)]
30    fn from(variant: RXSYNHSELECT_A) -> Self {
31        variant as u8 != 0
32    }
33}
34impl RXSYNH_R {
35    #[doc = "Get enumerated values variant"]
36    #[inline(always)]
37    pub fn variant(&self) -> RXSYNHSELECT_A {
38        match self.bits {
39            false => RXSYNHSELECT_A::_0,
40            true => RXSYNHSELECT_A::_1,
41        }
42    }
43    #[doc = "Checks if the value of the field is `_0`"]
44    #[inline(always)]
45    pub fn is_0(&self) -> bool {
46        *self == RXSYNHSELECT_A::_0
47    }
48    #[doc = "Checks if the value of the field is `_1`"]
49    #[inline(always)]
50    pub fn is_1(&self) -> bool {
51        *self == RXSYNHSELECT_A::_1
52    }
53}
54impl R {
55    #[doc = "Bits 0:8 - Received Character"]
56    #[inline(always)]
57    pub fn rxchr(&self) -> RXCHR_R {
58        RXCHR_R::new((self.bits & 0x01ff) as u16)
59    }
60    #[doc = "Bit 15 - Received Sync"]
61    #[inline(always)]
62    pub fn rxsynh(&self) -> RXSYNH_R {
63        RXSYNH_R::new(((self.bits >> 15) & 1) != 0)
64    }
65}
66#[doc = "Receiver Holding Register\n\nThis register you can [`read`](crate::generic::Reg::read). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [rhr](index.html) module"]
67pub struct RHR_SPEC;
68impl crate::RegisterSpec for RHR_SPEC {
69    type Ux = u32;
70}
71#[doc = "`read()` method returns [rhr::R](R) reader structure"]
72impl crate::Readable for RHR_SPEC {
73    type Reader = R;
74}
75#[doc = "`reset()` method sets RHR to value 0"]
76impl crate::Resettable for RHR_SPEC {
77    const RESET_VALUE: Self::Ux = 0;
78}