#[doc = "Reader of register C2"]
pub type R = crate::R<u8, super::C2>;
#[doc = "Writer for register C2"]
pub type W = crate::W<u8, super::C2>;
#[doc = "Register C2 `reset()`'s with value 0"]
impl crate::ResetValue for super::C2 {
type Type = u8;
#[inline(always)]
fn reset_value() -> Self::Type {
0
}
}
#[doc = "Possible values of the field `SBK`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum SBK_A {
#[doc = "Normal transmitter operation."]
_0,
#[doc = "Queue break character(s) to be sent."]
_1,
}
impl crate::ToBits<bool> for SBK_A {
#[inline(always)]
fn _bits(&self) -> bool {
match *self {
SBK_A::_0 => false,
SBK_A::_1 => true,
}
}
}
#[doc = "Reader of field `SBK`"]
pub type SBK_R = crate::R<bool, SBK_A>;
impl SBK_R {
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> SBK_A {
match self.bits {
false => SBK_A::_0,
true => SBK_A::_1,
}
}
#[doc = "Checks if the value of the field is `_0`"]
#[inline(always)]
pub fn is_0(&self) -> bool {
*self == SBK_A::_0
}
#[doc = "Checks if the value of the field is `_1`"]
#[inline(always)]
pub fn is_1(&self) -> bool {
*self == SBK_A::_1
}
}
#[doc = "Write proxy for field `SBK`"]
pub struct SBK_W<'a> {
w: &'a mut W,
}
impl<'a> SBK_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: SBK_A) -> &'a mut W {
use crate::ToBits;
{
self.bit(variant._bits())
}
}
#[doc = "Normal transmitter operation."]
#[inline(always)]
pub fn _0(self) -> &'a mut W {
self.variant(SBK_A::_0)
}
#[doc = "Queue break character(s) to be sent."]
#[inline(always)]
pub fn _1(self) -> &'a mut W {
self.variant(SBK_A::_1)
}
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !0x01) | ((value as u8) & 0x01);
self.w
}
}
#[doc = "Possible values of the field `RWU`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum RWU_A {
#[doc = "Normal UART receiver operation."]
_0,
#[doc = "UART receiver in standby waiting for wake-up condition."]
_1,
}
impl crate::ToBits<bool> for RWU_A {
#[inline(always)]
fn _bits(&self) -> bool {
match *self {
RWU_A::_0 => false,
RWU_A::_1 => true,
}
}
}
#[doc = "Reader of field `RWU`"]
pub type RWU_R = crate::R<bool, RWU_A>;
impl RWU_R {
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> RWU_A {
match self.bits {
false => RWU_A::_0,
true => RWU_A::_1,
}
}
#[doc = "Checks if the value of the field is `_0`"]
#[inline(always)]
pub fn is_0(&self) -> bool {
*self == RWU_A::_0
}
#[doc = "Checks if the value of the field is `_1`"]
#[inline(always)]
pub fn is_1(&self) -> bool {
*self == RWU_A::_1
}
}
#[doc = "Write proxy for field `RWU`"]
pub struct RWU_W<'a> {
w: &'a mut W,
}
impl<'a> RWU_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: RWU_A) -> &'a mut W {
use crate::ToBits;
{
self.bit(variant._bits())
}
}
#[doc = "Normal UART receiver operation."]
#[inline(always)]
pub fn _0(self) -> &'a mut W {
self.variant(RWU_A::_0)
}
#[doc = "UART receiver in standby waiting for wake-up condition."]
#[inline(always)]
pub fn _1(self) -> &'a mut W {
self.variant(RWU_A::_1)
}
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x01 << 1)) | (((value as u8) & 0x01) << 1);
self.w
}
}
#[doc = "Possible values of the field `RE`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum RE_A {
#[doc = "Receiver off."]
_0,
#[doc = "Receiver on."]
_1,
}
impl crate::ToBits<bool> for RE_A {
#[inline(always)]
fn _bits(&self) -> bool {
match *self {
RE_A::_0 => false,
RE_A::_1 => true,
}
}
}
#[doc = "Reader of field `RE`"]
pub type RE_R = crate::R<bool, RE_A>;
impl RE_R {
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> RE_A {
match self.bits {
false => RE_A::_0,
true => RE_A::_1,
}
}
#[doc = "Checks if the value of the field is `_0`"]
#[inline(always)]
pub fn is_0(&self) -> bool {
*self == RE_A::_0
}
#[doc = "Checks if the value of the field is `_1`"]
#[inline(always)]
pub fn is_1(&self) -> bool {
*self == RE_A::_1
}
}
#[doc = "Write proxy for field `RE`"]
pub struct RE_W<'a> {
w: &'a mut W,
}
impl<'a> RE_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: RE_A) -> &'a mut W {
use crate::ToBits;
{
self.bit(variant._bits())
}
}
#[doc = "Receiver off."]
#[inline(always)]
pub fn _0(self) -> &'a mut W {
self.variant(RE_A::_0)
}
#[doc = "Receiver on."]
#[inline(always)]
pub fn _1(self) -> &'a mut W {
self.variant(RE_A::_1)
}
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x01 << 2)) | (((value as u8) & 0x01) << 2);
self.w
}
}
#[doc = "Possible values of the field `TE`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum TE_A {
#[doc = "Transmitter off."]
_0,
#[doc = "Transmitter on."]
_1,
}
impl crate::ToBits<bool> for TE_A {
#[inline(always)]
fn _bits(&self) -> bool {
match *self {
TE_A::_0 => false,
TE_A::_1 => true,
}
}
}
#[doc = "Reader of field `TE`"]
pub type TE_R = crate::R<bool, TE_A>;
impl TE_R {
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> TE_A {
match self.bits {
false => TE_A::_0,
true => TE_A::_1,
}
}
#[doc = "Checks if the value of the field is `_0`"]
#[inline(always)]
pub fn is_0(&self) -> bool {
*self == TE_A::_0
}
#[doc = "Checks if the value of the field is `_1`"]
#[inline(always)]
pub fn is_1(&self) -> bool {
*self == TE_A::_1
}
}
#[doc = "Write proxy for field `TE`"]
pub struct TE_W<'a> {
w: &'a mut W,
}
impl<'a> TE_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: TE_A) -> &'a mut W {
use crate::ToBits;
{
self.bit(variant._bits())
}
}
#[doc = "Transmitter off."]
#[inline(always)]
pub fn _0(self) -> &'a mut W {
self.variant(TE_A::_0)
}
#[doc = "Transmitter on."]
#[inline(always)]
pub fn _1(self) -> &'a mut W {
self.variant(TE_A::_1)
}
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x01 << 3)) | (((value as u8) & 0x01) << 3);
self.w
}
}
#[doc = "Possible values of the field `ILIE`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum ILIE_A {
#[doc = "Hardware interrupts from S1\\[IDLE\\] disabled; use polling."]
_0,
#[doc = "Hardware interrupt requested when S1\\[IDLE\\] flag is 1."]
_1,
}
impl crate::ToBits<bool> for ILIE_A {
#[inline(always)]
fn _bits(&self) -> bool {
match *self {
ILIE_A::_0 => false,
ILIE_A::_1 => true,
}
}
}
#[doc = "Reader of field `ILIE`"]
pub type ILIE_R = crate::R<bool, ILIE_A>;
impl ILIE_R {
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> ILIE_A {
match self.bits {
false => ILIE_A::_0,
true => ILIE_A::_1,
}
}
#[doc = "Checks if the value of the field is `_0`"]
#[inline(always)]
pub fn is_0(&self) -> bool {
*self == ILIE_A::_0
}
#[doc = "Checks if the value of the field is `_1`"]
#[inline(always)]
pub fn is_1(&self) -> bool {
*self == ILIE_A::_1
}
}
#[doc = "Write proxy for field `ILIE`"]
pub struct ILIE_W<'a> {
w: &'a mut W,
}
impl<'a> ILIE_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: ILIE_A) -> &'a mut W {
use crate::ToBits;
{
self.bit(variant._bits())
}
}
#[doc = "Hardware interrupts from S1\\[IDLE\\] disabled; use polling."]
#[inline(always)]
pub fn _0(self) -> &'a mut W {
self.variant(ILIE_A::_0)
}
#[doc = "Hardware interrupt requested when S1\\[IDLE\\] flag is 1."]
#[inline(always)]
pub fn _1(self) -> &'a mut W {
self.variant(ILIE_A::_1)
}
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x01 << 4)) | (((value as u8) & 0x01) << 4);
self.w
}
}
#[doc = "Possible values of the field `RIE`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum RIE_A {
#[doc = "Hardware interrupts from S1\\[RDRF\\] disabled; use polling."]
_0,
#[doc = "Hardware interrupt requested when S1\\[RDRF\\] flag is 1."]
_1,
}
impl crate::ToBits<bool> for RIE_A {
#[inline(always)]
fn _bits(&self) -> bool {
match *self {
RIE_A::_0 => false,
RIE_A::_1 => true,
}
}
}
#[doc = "Reader of field `RIE`"]
pub type RIE_R = crate::R<bool, RIE_A>;
impl RIE_R {
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> RIE_A {
match self.bits {
false => RIE_A::_0,
true => RIE_A::_1,
}
}
#[doc = "Checks if the value of the field is `_0`"]
#[inline(always)]
pub fn is_0(&self) -> bool {
*self == RIE_A::_0
}
#[doc = "Checks if the value of the field is `_1`"]
#[inline(always)]
pub fn is_1(&self) -> bool {
*self == RIE_A::_1
}
}
#[doc = "Write proxy for field `RIE`"]
pub struct RIE_W<'a> {
w: &'a mut W,
}
impl<'a> RIE_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: RIE_A) -> &'a mut W {
use crate::ToBits;
{
self.bit(variant._bits())
}
}
#[doc = "Hardware interrupts from S1\\[RDRF\\] disabled; use polling."]
#[inline(always)]
pub fn _0(self) -> &'a mut W {
self.variant(RIE_A::_0)
}
#[doc = "Hardware interrupt requested when S1\\[RDRF\\] flag is 1."]
#[inline(always)]
pub fn _1(self) -> &'a mut W {
self.variant(RIE_A::_1)
}
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x01 << 5)) | (((value as u8) & 0x01) << 5);
self.w
}
}
#[doc = "Possible values of the field `TCIE`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum TCIE_A {
#[doc = "Hardware interrupts from TC disabled; use polling."]
_0,
#[doc = "Hardware interrupt requested when TC flag is 1."]
_1,
}
impl crate::ToBits<bool> for TCIE_A {
#[inline(always)]
fn _bits(&self) -> bool {
match *self {
TCIE_A::_0 => false,
TCIE_A::_1 => true,
}
}
}
#[doc = "Reader of field `TCIE`"]
pub type TCIE_R = crate::R<bool, TCIE_A>;
impl TCIE_R {
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> TCIE_A {
match self.bits {
false => TCIE_A::_0,
true => TCIE_A::_1,
}
}
#[doc = "Checks if the value of the field is `_0`"]
#[inline(always)]
pub fn is_0(&self) -> bool {
*self == TCIE_A::_0
}
#[doc = "Checks if the value of the field is `_1`"]
#[inline(always)]
pub fn is_1(&self) -> bool {
*self == TCIE_A::_1
}
}
#[doc = "Write proxy for field `TCIE`"]
pub struct TCIE_W<'a> {
w: &'a mut W,
}
impl<'a> TCIE_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: TCIE_A) -> &'a mut W {
use crate::ToBits;
{
self.bit(variant._bits())
}
}
#[doc = "Hardware interrupts from TC disabled; use polling."]
#[inline(always)]
pub fn _0(self) -> &'a mut W {
self.variant(TCIE_A::_0)
}
#[doc = "Hardware interrupt requested when TC flag is 1."]
#[inline(always)]
pub fn _1(self) -> &'a mut W {
self.variant(TCIE_A::_1)
}
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x01 << 6)) | (((value as u8) & 0x01) << 6);
self.w
}
}
#[doc = "Possible values of the field `TIE`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum TIE_A {
#[doc = "Hardware interrupts from TDRE disabled; use polling."]
_0,
#[doc = "Hardware interrupt requested when TDRE flag is 1."]
_1,
}
impl crate::ToBits<bool> for TIE_A {
#[inline(always)]
fn _bits(&self) -> bool {
match *self {
TIE_A::_0 => false,
TIE_A::_1 => true,
}
}
}
#[doc = "Reader of field `TIE`"]
pub type TIE_R = crate::R<bool, TIE_A>;
impl TIE_R {
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> TIE_A {
match self.bits {
false => TIE_A::_0,
true => TIE_A::_1,
}
}
#[doc = "Checks if the value of the field is `_0`"]
#[inline(always)]
pub fn is_0(&self) -> bool {
*self == TIE_A::_0
}
#[doc = "Checks if the value of the field is `_1`"]
#[inline(always)]
pub fn is_1(&self) -> bool {
*self == TIE_A::_1
}
}
#[doc = "Write proxy for field `TIE`"]
pub struct TIE_W<'a> {
w: &'a mut W,
}
impl<'a> TIE_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: TIE_A) -> &'a mut W {
use crate::ToBits;
{
self.bit(variant._bits())
}
}
#[doc = "Hardware interrupts from TDRE disabled; use polling."]
#[inline(always)]
pub fn _0(self) -> &'a mut W {
self.variant(TIE_A::_0)
}
#[doc = "Hardware interrupt requested when TDRE flag is 1."]
#[inline(always)]
pub fn _1(self) -> &'a mut W {
self.variant(TIE_A::_1)
}
#[doc = r"Sets the field bit"]
#[inline(always)]
pub fn set_bit(self) -> &'a mut W {
self.bit(true)
}
#[doc = r"Clears the field bit"]
#[inline(always)]
pub fn clear_bit(self) -> &'a mut W {
self.bit(false)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bit(self, value: bool) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x01 << 7)) | (((value as u8) & 0x01) << 7);
self.w
}
}
impl R {
#[doc = "Bit 0 - Send Break"]
#[inline(always)]
pub fn sbk(&self) -> SBK_R {
SBK_R::new((self.bits & 0x01) != 0)
}
#[doc = "Bit 1 - Receiver Wakeup Control"]
#[inline(always)]
pub fn rwu(&self) -> RWU_R {
RWU_R::new(((self.bits >> 1) & 0x01) != 0)
}
#[doc = "Bit 2 - Receiver Enable"]
#[inline(always)]
pub fn re(&self) -> RE_R {
RE_R::new(((self.bits >> 2) & 0x01) != 0)
}
#[doc = "Bit 3 - Transmitter Enable"]
#[inline(always)]
pub fn te(&self) -> TE_R {
TE_R::new(((self.bits >> 3) & 0x01) != 0)
}
#[doc = "Bit 4 - Idle Line Interrupt Enable for IDLE"]
#[inline(always)]
pub fn ilie(&self) -> ILIE_R {
ILIE_R::new(((self.bits >> 4) & 0x01) != 0)
}
#[doc = "Bit 5 - Receiver Interrupt Enable for RDRF"]
#[inline(always)]
pub fn rie(&self) -> RIE_R {
RIE_R::new(((self.bits >> 5) & 0x01) != 0)
}
#[doc = "Bit 6 - Transmission Complete Interrupt Enable for TC"]
#[inline(always)]
pub fn tcie(&self) -> TCIE_R {
TCIE_R::new(((self.bits >> 6) & 0x01) != 0)
}
#[doc = "Bit 7 - Transmit Interrupt Enable for TDRE"]
#[inline(always)]
pub fn tie(&self) -> TIE_R {
TIE_R::new(((self.bits >> 7) & 0x01) != 0)
}
}
impl W {
#[doc = "Bit 0 - Send Break"]
#[inline(always)]
pub fn sbk(&mut self) -> SBK_W {
SBK_W { w: self }
}
#[doc = "Bit 1 - Receiver Wakeup Control"]
#[inline(always)]
pub fn rwu(&mut self) -> RWU_W {
RWU_W { w: self }
}
#[doc = "Bit 2 - Receiver Enable"]
#[inline(always)]
pub fn re(&mut self) -> RE_W {
RE_W { w: self }
}
#[doc = "Bit 3 - Transmitter Enable"]
#[inline(always)]
pub fn te(&mut self) -> TE_W {
TE_W { w: self }
}
#[doc = "Bit 4 - Idle Line Interrupt Enable for IDLE"]
#[inline(always)]
pub fn ilie(&mut self) -> ILIE_W {
ILIE_W { w: self }
}
#[doc = "Bit 5 - Receiver Interrupt Enable for RDRF"]
#[inline(always)]
pub fn rie(&mut self) -> RIE_W {
RIE_W { w: self }
}
#[doc = "Bit 6 - Transmission Complete Interrupt Enable for TC"]
#[inline(always)]
pub fn tcie(&mut self) -> TCIE_W {
TCIE_W { w: self }
}
#[doc = "Bit 7 - Transmit Interrupt Enable for TDRE"]
#[inline(always)]
pub fn tie(&mut self) -> TIE_W {
TIE_W { w: self }
}
}