#[doc = "Reader of register CR1"]
pub type R = crate::R<u32, super::CR1>;
#[doc = "Writer for register CR1"]
pub type W = crate::W<u32, super::CR1>;
#[doc = "Register CR1 `reset()`'s with value 0"]
impl crate::ResetValue for super::CR1 {
type Type = u32;
#[inline(always)]
fn reset_value() -> Self::Type {
0
}
}
#[doc = "Oversampling mode\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum OVER8_A {
#[doc = "0: Oversampling by 16"]
OVERSAMPLE16 = 0,
#[doc = "1: Oversampling by 8"]
OVERSAMPLE8 = 1,
}
impl From<OVER8_A> for bool {
#[inline(always)]
fn from(variant: OVER8_A) -> Self {
variant as u8 != 0
}
}
#[doc = "Reader of field `OVER8`"]
pub type OVER8_R = crate::R<bool, OVER8_A>;
impl OVER8_R {
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> OVER8_A {
match self.bits {
false => OVER8_A::OVERSAMPLE16,
true => OVER8_A::OVERSAMPLE8,
}
}
#[doc = "Checks if the value of the field is `OVERSAMPLE16`"]
#[inline(always)]
pub fn is_oversample16(&self) -> bool {
*self == OVER8_A::OVERSAMPLE16
}
#[doc = "Checks if the value of the field is `OVERSAMPLE8`"]
#[inline(always)]
pub fn is_oversample8(&self) -> bool {
*self == OVER8_A::OVERSAMPLE8
}
}
#[doc = "Write proxy for field `OVER8`"]
pub struct OVER8_W<'a> {
w: &'a mut W,
}
impl<'a> OVER8_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: OVER8_A) -> &'a mut W {
{
self.bit(variant.into())
}
}
#[doc = "Oversampling by 16"]
#[inline(always)]
pub fn oversample16(self) -> &'a mut W {
self.variant(OVER8_A::OVERSAMPLE16)
}
#[doc = "Oversampling by 8"]
#[inline(always)]
pub fn oversample8(self) -> &'a mut W {
self.variant(OVER8_A::OVERSAMPLE8)
}
#[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 << 15)) | (((value as u32) & 0x01) << 15);
self.w
}
}
#[doc = "USART enable\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum UE_A {
#[doc = "0: USART prescaler and outputs disabled"]
DISABLED = 0,
#[doc = "1: USART enabled"]
ENABLED = 1,
}
impl From<UE_A> for bool {
#[inline(always)]
fn from(variant: UE_A) -> Self {
variant as u8 != 0
}
}
#[doc = "Reader of field `UE`"]
pub type UE_R = crate::R<bool, UE_A>;
impl UE_R {
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> UE_A {
match self.bits {
false => UE_A::DISABLED,
true => UE_A::ENABLED,
}
}
#[doc = "Checks if the value of the field is `DISABLED`"]
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == UE_A::DISABLED
}
#[doc = "Checks if the value of the field is `ENABLED`"]
#[inline(always)]
pub fn is_enabled(&self) -> bool {
*self == UE_A::ENABLED
}
}
#[doc = "Write proxy for field `UE`"]
pub struct UE_W<'a> {
w: &'a mut W,
}
impl<'a> UE_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: UE_A) -> &'a mut W {
{
self.bit(variant.into())
}
}
#[doc = "USART prescaler and outputs disabled"]
#[inline(always)]
pub fn disabled(self) -> &'a mut W {
self.variant(UE_A::DISABLED)
}
#[doc = "USART enabled"]
#[inline(always)]
pub fn enabled(self) -> &'a mut W {
self.variant(UE_A::ENABLED)
}
#[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 << 13)) | (((value as u32) & 0x01) << 13);
self.w
}
}
#[doc = "Word length\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum M_A {
#[doc = "0: 8 data bits"]
M8 = 0,
#[doc = "1: 9 data bits"]
M9 = 1,
}
impl From<M_A> for bool {
#[inline(always)]
fn from(variant: M_A) -> Self {
variant as u8 != 0
}
}
#[doc = "Reader of field `M`"]
pub type M_R = crate::R<bool, M_A>;
impl M_R {
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> M_A {
match self.bits {
false => M_A::M8,
true => M_A::M9,
}
}
#[doc = "Checks if the value of the field is `M8`"]
#[inline(always)]
pub fn is_m8(&self) -> bool {
*self == M_A::M8
}
#[doc = "Checks if the value of the field is `M9`"]
#[inline(always)]
pub fn is_m9(&self) -> bool {
*self == M_A::M9
}
}
#[doc = "Write proxy for field `M`"]
pub struct M_W<'a> {
w: &'a mut W,
}
impl<'a> M_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: M_A) -> &'a mut W {
{
self.bit(variant.into())
}
}
#[doc = "8 data bits"]
#[inline(always)]
pub fn m8(self) -> &'a mut W {
self.variant(M_A::M8)
}
#[doc = "9 data bits"]
#[inline(always)]
pub fn m9(self) -> &'a mut W {
self.variant(M_A::M9)
}
#[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 << 12)) | (((value as u32) & 0x01) << 12);
self.w
}
}
#[doc = "Wakeup method\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum WAKE_A {
#[doc = "0: USART wakeup on idle line"]
IDLELINE = 0,
#[doc = "1: USART wakeup on address mark"]
ADDRESSMARK = 1,
}
impl From<WAKE_A> for bool {
#[inline(always)]
fn from(variant: WAKE_A) -> Self {
variant as u8 != 0
}
}
#[doc = "Reader of field `WAKE`"]
pub type WAKE_R = crate::R<bool, WAKE_A>;
impl WAKE_R {
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> WAKE_A {
match self.bits {
false => WAKE_A::IDLELINE,
true => WAKE_A::ADDRESSMARK,
}
}
#[doc = "Checks if the value of the field is `IDLELINE`"]
#[inline(always)]
pub fn is_idle_line(&self) -> bool {
*self == WAKE_A::IDLELINE
}
#[doc = "Checks if the value of the field is `ADDRESSMARK`"]
#[inline(always)]
pub fn is_address_mark(&self) -> bool {
*self == WAKE_A::ADDRESSMARK
}
}
#[doc = "Write proxy for field `WAKE`"]
pub struct WAKE_W<'a> {
w: &'a mut W,
}
impl<'a> WAKE_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: WAKE_A) -> &'a mut W {
{
self.bit(variant.into())
}
}
#[doc = "USART wakeup on idle line"]
#[inline(always)]
pub fn idle_line(self) -> &'a mut W {
self.variant(WAKE_A::IDLELINE)
}
#[doc = "USART wakeup on address mark"]
#[inline(always)]
pub fn address_mark(self) -> &'a mut W {
self.variant(WAKE_A::ADDRESSMARK)
}
#[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 << 11)) | (((value as u32) & 0x01) << 11);
self.w
}
}
#[doc = "Parity control enable\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum PCE_A {
#[doc = "0: Parity control disabled"]
DISABLED = 0,
#[doc = "1: Parity control enabled"]
ENABLED = 1,
}
impl From<PCE_A> for bool {
#[inline(always)]
fn from(variant: PCE_A) -> Self {
variant as u8 != 0
}
}
#[doc = "Reader of field `PCE`"]
pub type PCE_R = crate::R<bool, PCE_A>;
impl PCE_R {
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> PCE_A {
match self.bits {
false => PCE_A::DISABLED,
true => PCE_A::ENABLED,
}
}
#[doc = "Checks if the value of the field is `DISABLED`"]
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == PCE_A::DISABLED
}
#[doc = "Checks if the value of the field is `ENABLED`"]
#[inline(always)]
pub fn is_enabled(&self) -> bool {
*self == PCE_A::ENABLED
}
}
#[doc = "Write proxy for field `PCE`"]
pub struct PCE_W<'a> {
w: &'a mut W,
}
impl<'a> PCE_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: PCE_A) -> &'a mut W {
{
self.bit(variant.into())
}
}
#[doc = "Parity control disabled"]
#[inline(always)]
pub fn disabled(self) -> &'a mut W {
self.variant(PCE_A::DISABLED)
}
#[doc = "Parity control enabled"]
#[inline(always)]
pub fn enabled(self) -> &'a mut W {
self.variant(PCE_A::ENABLED)
}
#[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 << 10)) | (((value as u32) & 0x01) << 10);
self.w
}
}
#[doc = "Parity selection\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum PS_A {
#[doc = "0: Even parity"]
EVEN = 0,
#[doc = "1: Odd parity"]
ODD = 1,
}
impl From<PS_A> for bool {
#[inline(always)]
fn from(variant: PS_A) -> Self {
variant as u8 != 0
}
}
#[doc = "Reader of field `PS`"]
pub type PS_R = crate::R<bool, PS_A>;
impl PS_R {
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> PS_A {
match self.bits {
false => PS_A::EVEN,
true => PS_A::ODD,
}
}
#[doc = "Checks if the value of the field is `EVEN`"]
#[inline(always)]
pub fn is_even(&self) -> bool {
*self == PS_A::EVEN
}
#[doc = "Checks if the value of the field is `ODD`"]
#[inline(always)]
pub fn is_odd(&self) -> bool {
*self == PS_A::ODD
}
}
#[doc = "Write proxy for field `PS`"]
pub struct PS_W<'a> {
w: &'a mut W,
}
impl<'a> PS_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: PS_A) -> &'a mut W {
{
self.bit(variant.into())
}
}
#[doc = "Even parity"]
#[inline(always)]
pub fn even(self) -> &'a mut W {
self.variant(PS_A::EVEN)
}
#[doc = "Odd parity"]
#[inline(always)]
pub fn odd(self) -> &'a mut W {
self.variant(PS_A::ODD)
}
#[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 << 9)) | (((value as u32) & 0x01) << 9);
self.w
}
}
#[doc = "PE interrupt enable\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum PEIE_A {
#[doc = "0: PE interrupt disabled"]
DISABLED = 0,
#[doc = "1: PE interrupt enabled"]
ENABLED = 1,
}
impl From<PEIE_A> for bool {
#[inline(always)]
fn from(variant: PEIE_A) -> Self {
variant as u8 != 0
}
}
#[doc = "Reader of field `PEIE`"]
pub type PEIE_R = crate::R<bool, PEIE_A>;
impl PEIE_R {
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> PEIE_A {
match self.bits {
false => PEIE_A::DISABLED,
true => PEIE_A::ENABLED,
}
}
#[doc = "Checks if the value of the field is `DISABLED`"]
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == PEIE_A::DISABLED
}
#[doc = "Checks if the value of the field is `ENABLED`"]
#[inline(always)]
pub fn is_enabled(&self) -> bool {
*self == PEIE_A::ENABLED
}
}
#[doc = "Write proxy for field `PEIE`"]
pub struct PEIE_W<'a> {
w: &'a mut W,
}
impl<'a> PEIE_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: PEIE_A) -> &'a mut W {
{
self.bit(variant.into())
}
}
#[doc = "PE interrupt disabled"]
#[inline(always)]
pub fn disabled(self) -> &'a mut W {
self.variant(PEIE_A::DISABLED)
}
#[doc = "PE interrupt enabled"]
#[inline(always)]
pub fn enabled(self) -> &'a mut W {
self.variant(PEIE_A::ENABLED)
}
#[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 << 8)) | (((value as u32) & 0x01) << 8);
self.w
}
}
#[doc = "TXE interrupt enable\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum TXEIE_A {
#[doc = "0: TXE interrupt disabled"]
DISABLED = 0,
#[doc = "1: TXE interrupt enabled"]
ENABLED = 1,
}
impl From<TXEIE_A> for bool {
#[inline(always)]
fn from(variant: TXEIE_A) -> Self {
variant as u8 != 0
}
}
#[doc = "Reader of field `TXEIE`"]
pub type TXEIE_R = crate::R<bool, TXEIE_A>;
impl TXEIE_R {
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> TXEIE_A {
match self.bits {
false => TXEIE_A::DISABLED,
true => TXEIE_A::ENABLED,
}
}
#[doc = "Checks if the value of the field is `DISABLED`"]
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == TXEIE_A::DISABLED
}
#[doc = "Checks if the value of the field is `ENABLED`"]
#[inline(always)]
pub fn is_enabled(&self) -> bool {
*self == TXEIE_A::ENABLED
}
}
#[doc = "Write proxy for field `TXEIE`"]
pub struct TXEIE_W<'a> {
w: &'a mut W,
}
impl<'a> TXEIE_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: TXEIE_A) -> &'a mut W {
{
self.bit(variant.into())
}
}
#[doc = "TXE interrupt disabled"]
#[inline(always)]
pub fn disabled(self) -> &'a mut W {
self.variant(TXEIE_A::DISABLED)
}
#[doc = "TXE interrupt enabled"]
#[inline(always)]
pub fn enabled(self) -> &'a mut W {
self.variant(TXEIE_A::ENABLED)
}
#[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 u32) & 0x01) << 7);
self.w
}
}
#[doc = "Transmission complete interrupt enable\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum TCIE_A {
#[doc = "0: TC interrupt disabled"]
DISABLED = 0,
#[doc = "1: TC interrupt enabled"]
ENABLED = 1,
}
impl From<TCIE_A> for bool {
#[inline(always)]
fn from(variant: TCIE_A) -> Self {
variant as u8 != 0
}
}
#[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::DISABLED,
true => TCIE_A::ENABLED,
}
}
#[doc = "Checks if the value of the field is `DISABLED`"]
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == TCIE_A::DISABLED
}
#[doc = "Checks if the value of the field is `ENABLED`"]
#[inline(always)]
pub fn is_enabled(&self) -> bool {
*self == TCIE_A::ENABLED
}
}
#[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 {
{
self.bit(variant.into())
}
}
#[doc = "TC interrupt disabled"]
#[inline(always)]
pub fn disabled(self) -> &'a mut W {
self.variant(TCIE_A::DISABLED)
}
#[doc = "TC interrupt enabled"]
#[inline(always)]
pub fn enabled(self) -> &'a mut W {
self.variant(TCIE_A::ENABLED)
}
#[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 u32) & 0x01) << 6);
self.w
}
}
#[doc = "RXNE interrupt enable\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum RXNEIE_A {
#[doc = "0: RXNE interrupt disabled"]
DISABLED = 0,
#[doc = "1: RXNE interrupt enabled"]
ENABLED = 1,
}
impl From<RXNEIE_A> for bool {
#[inline(always)]
fn from(variant: RXNEIE_A) -> Self {
variant as u8 != 0
}
}
#[doc = "Reader of field `RXNEIE`"]
pub type RXNEIE_R = crate::R<bool, RXNEIE_A>;
impl RXNEIE_R {
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> RXNEIE_A {
match self.bits {
false => RXNEIE_A::DISABLED,
true => RXNEIE_A::ENABLED,
}
}
#[doc = "Checks if the value of the field is `DISABLED`"]
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == RXNEIE_A::DISABLED
}
#[doc = "Checks if the value of the field is `ENABLED`"]
#[inline(always)]
pub fn is_enabled(&self) -> bool {
*self == RXNEIE_A::ENABLED
}
}
#[doc = "Write proxy for field `RXNEIE`"]
pub struct RXNEIE_W<'a> {
w: &'a mut W,
}
impl<'a> RXNEIE_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: RXNEIE_A) -> &'a mut W {
{
self.bit(variant.into())
}
}
#[doc = "RXNE interrupt disabled"]
#[inline(always)]
pub fn disabled(self) -> &'a mut W {
self.variant(RXNEIE_A::DISABLED)
}
#[doc = "RXNE interrupt enabled"]
#[inline(always)]
pub fn enabled(self) -> &'a mut W {
self.variant(RXNEIE_A::ENABLED)
}
#[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 u32) & 0x01) << 5);
self.w
}
}
#[doc = "IDLE interrupt enable\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum IDLEIE_A {
#[doc = "0: IDLE interrupt disabled"]
DISABLED = 0,
#[doc = "1: IDLE interrupt enabled"]
ENABLED = 1,
}
impl From<IDLEIE_A> for bool {
#[inline(always)]
fn from(variant: IDLEIE_A) -> Self {
variant as u8 != 0
}
}
#[doc = "Reader of field `IDLEIE`"]
pub type IDLEIE_R = crate::R<bool, IDLEIE_A>;
impl IDLEIE_R {
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> IDLEIE_A {
match self.bits {
false => IDLEIE_A::DISABLED,
true => IDLEIE_A::ENABLED,
}
}
#[doc = "Checks if the value of the field is `DISABLED`"]
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == IDLEIE_A::DISABLED
}
#[doc = "Checks if the value of the field is `ENABLED`"]
#[inline(always)]
pub fn is_enabled(&self) -> bool {
*self == IDLEIE_A::ENABLED
}
}
#[doc = "Write proxy for field `IDLEIE`"]
pub struct IDLEIE_W<'a> {
w: &'a mut W,
}
impl<'a> IDLEIE_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: IDLEIE_A) -> &'a mut W {
{
self.bit(variant.into())
}
}
#[doc = "IDLE interrupt disabled"]
#[inline(always)]
pub fn disabled(self) -> &'a mut W {
self.variant(IDLEIE_A::DISABLED)
}
#[doc = "IDLE interrupt enabled"]
#[inline(always)]
pub fn enabled(self) -> &'a mut W {
self.variant(IDLEIE_A::ENABLED)
}
#[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 u32) & 0x01) << 4);
self.w
}
}
#[doc = "Transmitter enable\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum TE_A {
#[doc = "0: Transmitter disabled"]
DISABLED = 0,
#[doc = "1: Transmitter enabled"]
ENABLED = 1,
}
impl From<TE_A> for bool {
#[inline(always)]
fn from(variant: TE_A) -> Self {
variant as u8 != 0
}
}
#[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::DISABLED,
true => TE_A::ENABLED,
}
}
#[doc = "Checks if the value of the field is `DISABLED`"]
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == TE_A::DISABLED
}
#[doc = "Checks if the value of the field is `ENABLED`"]
#[inline(always)]
pub fn is_enabled(&self) -> bool {
*self == TE_A::ENABLED
}
}
#[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 {
{
self.bit(variant.into())
}
}
#[doc = "Transmitter disabled"]
#[inline(always)]
pub fn disabled(self) -> &'a mut W {
self.variant(TE_A::DISABLED)
}
#[doc = "Transmitter enabled"]
#[inline(always)]
pub fn enabled(self) -> &'a mut W {
self.variant(TE_A::ENABLED)
}
#[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 u32) & 0x01) << 3);
self.w
}
}
#[doc = "Receiver enable\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum RE_A {
#[doc = "0: Receiver disabled"]
DISABLED = 0,
#[doc = "1: Receiver enabled"]
ENABLED = 1,
}
impl From<RE_A> for bool {
#[inline(always)]
fn from(variant: RE_A) -> Self {
variant as u8 != 0
}
}
#[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::DISABLED,
true => RE_A::ENABLED,
}
}
#[doc = "Checks if the value of the field is `DISABLED`"]
#[inline(always)]
pub fn is_disabled(&self) -> bool {
*self == RE_A::DISABLED
}
#[doc = "Checks if the value of the field is `ENABLED`"]
#[inline(always)]
pub fn is_enabled(&self) -> bool {
*self == RE_A::ENABLED
}
}
#[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 {
{
self.bit(variant.into())
}
}
#[doc = "Receiver disabled"]
#[inline(always)]
pub fn disabled(self) -> &'a mut W {
self.variant(RE_A::DISABLED)
}
#[doc = "Receiver enabled"]
#[inline(always)]
pub fn enabled(self) -> &'a mut W {
self.variant(RE_A::ENABLED)
}
#[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 u32) & 0x01) << 2);
self.w
}
}
#[doc = "Receiver wakeup\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum RWU_A {
#[doc = "0: Receiver in active mode"]
ACTIVE = 0,
#[doc = "1: Receiver in mute mode"]
MUTE = 1,
}
impl From<RWU_A> for bool {
#[inline(always)]
fn from(variant: RWU_A) -> Self {
variant as u8 != 0
}
}
#[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::ACTIVE,
true => RWU_A::MUTE,
}
}
#[doc = "Checks if the value of the field is `ACTIVE`"]
#[inline(always)]
pub fn is_active(&self) -> bool {
*self == RWU_A::ACTIVE
}
#[doc = "Checks if the value of the field is `MUTE`"]
#[inline(always)]
pub fn is_mute(&self) -> bool {
*self == RWU_A::MUTE
}
}
#[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 {
{
self.bit(variant.into())
}
}
#[doc = "Receiver in active mode"]
#[inline(always)]
pub fn active(self) -> &'a mut W {
self.variant(RWU_A::ACTIVE)
}
#[doc = "Receiver in mute mode"]
#[inline(always)]
pub fn mute(self) -> &'a mut W {
self.variant(RWU_A::MUTE)
}
#[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 u32) & 0x01) << 1);
self.w
}
}
#[doc = "Send break\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum SBK_A {
#[doc = "0: No break character is transmitted"]
NOBREAK = 0,
#[doc = "1: Break character transmitted"]
BREAK = 1,
}
impl From<SBK_A> for bool {
#[inline(always)]
fn from(variant: SBK_A) -> Self {
variant as u8 != 0
}
}
#[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::NOBREAK,
true => SBK_A::BREAK,
}
}
#[doc = "Checks if the value of the field is `NOBREAK`"]
#[inline(always)]
pub fn is_no_break(&self) -> bool {
*self == SBK_A::NOBREAK
}
#[doc = "Checks if the value of the field is `BREAK`"]
#[inline(always)]
pub fn is_break_(&self) -> bool {
*self == SBK_A::BREAK
}
}
#[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 {
{
self.bit(variant.into())
}
}
#[doc = "No break character is transmitted"]
#[inline(always)]
pub fn no_break(self) -> &'a mut W {
self.variant(SBK_A::NOBREAK)
}
#[doc = "Break character transmitted"]
#[inline(always)]
pub fn break_(self) -> &'a mut W {
self.variant(SBK_A::BREAK)
}
#[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 u32) & 0x01);
self.w
}
}
impl R {
#[doc = "Bit 15 - Oversampling mode"]
#[inline(always)]
pub fn over8(&self) -> OVER8_R {
OVER8_R::new(((self.bits >> 15) & 0x01) != 0)
}
#[doc = "Bit 13 - USART enable"]
#[inline(always)]
pub fn ue(&self) -> UE_R {
UE_R::new(((self.bits >> 13) & 0x01) != 0)
}
#[doc = "Bit 12 - Word length"]
#[inline(always)]
pub fn m(&self) -> M_R {
M_R::new(((self.bits >> 12) & 0x01) != 0)
}
#[doc = "Bit 11 - Wakeup method"]
#[inline(always)]
pub fn wake(&self) -> WAKE_R {
WAKE_R::new(((self.bits >> 11) & 0x01) != 0)
}
#[doc = "Bit 10 - Parity control enable"]
#[inline(always)]
pub fn pce(&self) -> PCE_R {
PCE_R::new(((self.bits >> 10) & 0x01) != 0)
}
#[doc = "Bit 9 - Parity selection"]
#[inline(always)]
pub fn ps(&self) -> PS_R {
PS_R::new(((self.bits >> 9) & 0x01) != 0)
}
#[doc = "Bit 8 - PE interrupt enable"]
#[inline(always)]
pub fn peie(&self) -> PEIE_R {
PEIE_R::new(((self.bits >> 8) & 0x01) != 0)
}
#[doc = "Bit 7 - TXE interrupt enable"]
#[inline(always)]
pub fn txeie(&self) -> TXEIE_R {
TXEIE_R::new(((self.bits >> 7) & 0x01) != 0)
}
#[doc = "Bit 6 - Transmission complete interrupt enable"]
#[inline(always)]
pub fn tcie(&self) -> TCIE_R {
TCIE_R::new(((self.bits >> 6) & 0x01) != 0)
}
#[doc = "Bit 5 - RXNE interrupt enable"]
#[inline(always)]
pub fn rxneie(&self) -> RXNEIE_R {
RXNEIE_R::new(((self.bits >> 5) & 0x01) != 0)
}
#[doc = "Bit 4 - IDLE interrupt enable"]
#[inline(always)]
pub fn idleie(&self) -> IDLEIE_R {
IDLEIE_R::new(((self.bits >> 4) & 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 2 - Receiver enable"]
#[inline(always)]
pub fn re(&self) -> RE_R {
RE_R::new(((self.bits >> 2) & 0x01) != 0)
}
#[doc = "Bit 1 - Receiver wakeup"]
#[inline(always)]
pub fn rwu(&self) -> RWU_R {
RWU_R::new(((self.bits >> 1) & 0x01) != 0)
}
#[doc = "Bit 0 - Send break"]
#[inline(always)]
pub fn sbk(&self) -> SBK_R {
SBK_R::new((self.bits & 0x01) != 0)
}
}
impl W {
#[doc = "Bit 15 - Oversampling mode"]
#[inline(always)]
pub fn over8(&mut self) -> OVER8_W {
OVER8_W { w: self }
}
#[doc = "Bit 13 - USART enable"]
#[inline(always)]
pub fn ue(&mut self) -> UE_W {
UE_W { w: self }
}
#[doc = "Bit 12 - Word length"]
#[inline(always)]
pub fn m(&mut self) -> M_W {
M_W { w: self }
}
#[doc = "Bit 11 - Wakeup method"]
#[inline(always)]
pub fn wake(&mut self) -> WAKE_W {
WAKE_W { w: self }
}
#[doc = "Bit 10 - Parity control enable"]
#[inline(always)]
pub fn pce(&mut self) -> PCE_W {
PCE_W { w: self }
}
#[doc = "Bit 9 - Parity selection"]
#[inline(always)]
pub fn ps(&mut self) -> PS_W {
PS_W { w: self }
}
#[doc = "Bit 8 - PE interrupt enable"]
#[inline(always)]
pub fn peie(&mut self) -> PEIE_W {
PEIE_W { w: self }
}
#[doc = "Bit 7 - TXE interrupt enable"]
#[inline(always)]
pub fn txeie(&mut self) -> TXEIE_W {
TXEIE_W { w: self }
}
#[doc = "Bit 6 - Transmission complete interrupt enable"]
#[inline(always)]
pub fn tcie(&mut self) -> TCIE_W {
TCIE_W { w: self }
}
#[doc = "Bit 5 - RXNE interrupt enable"]
#[inline(always)]
pub fn rxneie(&mut self) -> RXNEIE_W {
RXNEIE_W { w: self }
}
#[doc = "Bit 4 - IDLE interrupt enable"]
#[inline(always)]
pub fn idleie(&mut self) -> IDLEIE_W {
IDLEIE_W { w: self }
}
#[doc = "Bit 3 - Transmitter enable"]
#[inline(always)]
pub fn te(&mut self) -> TE_W {
TE_W { w: self }
}
#[doc = "Bit 2 - Receiver enable"]
#[inline(always)]
pub fn re(&mut self) -> RE_W {
RE_W { w: self }
}
#[doc = "Bit 1 - Receiver wakeup"]
#[inline(always)]
pub fn rwu(&mut self) -> RWU_W {
RWU_W { w: self }
}
#[doc = "Bit 0 - Send break"]
#[inline(always)]
pub fn sbk(&mut self) -> SBK_W {
SBK_W { w: self }
}
}