2017-09-23 18:09:53 +00:00
|
|
|
#[doc = r" Value read from the register"]
|
|
|
|
pub struct R {
|
|
|
|
bits: u32,
|
|
|
|
}
|
|
|
|
impl super::SRDR {
|
|
|
|
#[doc = r" Reads the contents of the register"]
|
|
|
|
#[inline]
|
|
|
|
pub fn read(&self) -> R {
|
2017-09-23 18:31:10 +00:00
|
|
|
R {
|
|
|
|
bits: self.register.get(),
|
|
|
|
}
|
2017-09-23 18:09:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
#[doc = r" Value of the field"]
|
|
|
|
pub struct DATAR {
|
|
|
|
bits: u8,
|
|
|
|
}
|
|
|
|
impl DATAR {
|
|
|
|
#[doc = r" Value of the field as raw bits"]
|
|
|
|
#[inline]
|
|
|
|
pub fn bits(&self) -> u8 {
|
|
|
|
self.bits
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#[doc = "Possible values of the field `RXEMPTY`"]
|
|
|
|
#[derive(Clone, Copy, Debug, PartialEq)]
|
|
|
|
pub enum RXEMPTYR {
|
2017-09-23 18:31:10 +00:00
|
|
|
#[doc = "The Receive Data Register is not empty."] _0,
|
|
|
|
#[doc = "The Receive Data Register is empty."] _1,
|
2017-09-23 18:09:53 +00:00
|
|
|
}
|
|
|
|
impl RXEMPTYR {
|
|
|
|
#[doc = r" Returns `true` if the bit is clear (0)"]
|
|
|
|
#[inline]
|
|
|
|
pub fn bit_is_clear(&self) -> bool {
|
|
|
|
!self.bit()
|
|
|
|
}
|
|
|
|
#[doc = r" Returns `true` if the bit is set (1)"]
|
|
|
|
#[inline]
|
|
|
|
pub fn bit_is_set(&self) -> bool {
|
|
|
|
self.bit()
|
|
|
|
}
|
|
|
|
#[doc = r" Value of the field as raw bits"]
|
|
|
|
#[inline]
|
|
|
|
pub fn bit(&self) -> bool {
|
|
|
|
match *self {
|
|
|
|
RXEMPTYR::_0 => false,
|
|
|
|
RXEMPTYR::_1 => true,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#[allow(missing_docs)]
|
|
|
|
#[doc(hidden)]
|
|
|
|
#[inline]
|
|
|
|
pub fn _from(value: bool) -> RXEMPTYR {
|
|
|
|
match value {
|
|
|
|
false => RXEMPTYR::_0,
|
|
|
|
true => RXEMPTYR::_1,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#[doc = "Checks if the value of the field is `_0`"]
|
|
|
|
#[inline]
|
|
|
|
pub fn is_0(&self) -> bool {
|
|
|
|
*self == RXEMPTYR::_0
|
|
|
|
}
|
|
|
|
#[doc = "Checks if the value of the field is `_1`"]
|
|
|
|
#[inline]
|
|
|
|
pub fn is_1(&self) -> bool {
|
|
|
|
*self == RXEMPTYR::_1
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#[doc = "Possible values of the field `SOF`"]
|
|
|
|
#[derive(Clone, Copy, Debug, PartialEq)]
|
|
|
|
pub enum SOFR {
|
|
|
|
#[doc = "Indicates this is not the first data word since a (repeated) START or STOP condition."]
|
|
|
|
_0,
|
2017-09-23 18:31:10 +00:00
|
|
|
#[doc = "Indicates this is the first data word since a (repeated) START or STOP condition."] _1,
|
2017-09-23 18:09:53 +00:00
|
|
|
}
|
|
|
|
impl SOFR {
|
|
|
|
#[doc = r" Returns `true` if the bit is clear (0)"]
|
|
|
|
#[inline]
|
|
|
|
pub fn bit_is_clear(&self) -> bool {
|
|
|
|
!self.bit()
|
|
|
|
}
|
|
|
|
#[doc = r" Returns `true` if the bit is set (1)"]
|
|
|
|
#[inline]
|
|
|
|
pub fn bit_is_set(&self) -> bool {
|
|
|
|
self.bit()
|
|
|
|
}
|
|
|
|
#[doc = r" Value of the field as raw bits"]
|
|
|
|
#[inline]
|
|
|
|
pub fn bit(&self) -> bool {
|
|
|
|
match *self {
|
|
|
|
SOFR::_0 => false,
|
|
|
|
SOFR::_1 => true,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#[allow(missing_docs)]
|
|
|
|
#[doc(hidden)]
|
|
|
|
#[inline]
|
|
|
|
pub fn _from(value: bool) -> SOFR {
|
|
|
|
match value {
|
|
|
|
false => SOFR::_0,
|
|
|
|
true => SOFR::_1,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#[doc = "Checks if the value of the field is `_0`"]
|
|
|
|
#[inline]
|
|
|
|
pub fn is_0(&self) -> bool {
|
|
|
|
*self == SOFR::_0
|
|
|
|
}
|
|
|
|
#[doc = "Checks if the value of the field is `_1`"]
|
|
|
|
#[inline]
|
|
|
|
pub fn is_1(&self) -> bool {
|
|
|
|
*self == SOFR::_1
|
|
|
|
}
|
|
|
|
}
|
|
|
|
impl R {
|
|
|
|
#[doc = r" Value of the register as raw bits"]
|
|
|
|
#[inline]
|
|
|
|
pub fn bits(&self) -> u32 {
|
|
|
|
self.bits
|
|
|
|
}
|
|
|
|
#[doc = "Bits 0:7 - Receive Data"]
|
|
|
|
#[inline]
|
|
|
|
pub fn data(&self) -> DATAR {
|
|
|
|
let bits = {
|
|
|
|
const MASK: u8 = 255;
|
|
|
|
const OFFSET: u8 = 0;
|
|
|
|
((self.bits >> OFFSET) & MASK as u32) as u8
|
|
|
|
};
|
|
|
|
DATAR { bits }
|
|
|
|
}
|
|
|
|
#[doc = "Bit 14 - RX Empty"]
|
|
|
|
#[inline]
|
|
|
|
pub fn rxempty(&self) -> RXEMPTYR {
|
|
|
|
RXEMPTYR::_from({
|
|
|
|
const MASK: bool = true;
|
|
|
|
const OFFSET: u8 = 14;
|
|
|
|
((self.bits >> OFFSET) & MASK as u32) != 0
|
|
|
|
})
|
|
|
|
}
|
|
|
|
#[doc = "Bit 15 - Start Of Frame"]
|
|
|
|
#[inline]
|
|
|
|
pub fn sof(&self) -> SOFR {
|
|
|
|
SOFR::_from({
|
|
|
|
const MASK: bool = true;
|
|
|
|
const OFFSET: u8 = 15;
|
|
|
|
((self.bits >> OFFSET) & MASK as u32) != 0
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|