#[doc = "Reader of register MR"]
pub type R = crate::R<u32, super::MR>;
#[doc = "Writer for register MR"]
pub type W = crate::W<u32, super::MR>;
#[doc = "Possible values of the field `USART_MODE`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum USART_MODE_A {
#[doc = "Normal mode"]
NORMAL,
#[doc = "RS485"]
RS485,
#[doc = "Hardware Handshaking"]
HW_HANDSHAKING,
#[doc = "IS07816 Protocol: T = 0"]
IS07816_T_0,
#[doc = "IS07816 Protocol: T = 1"]
IS07816_T_1,
#[doc = "IrDA"]
IRDA,
#[doc = "LIN master"]
LIN_MASTER,
#[doc = "LIN Slave"]
LIN_SLAVE,
#[doc = "SPI master"]
SPI_MASTER,
#[doc = "SPI Slave"]
SPI_SLAVE,
}
impl crate::ToBits<u8> for USART_MODE_A {
#[inline(always)]
fn _bits(&self) -> u8 {
match *self {
USART_MODE_A::NORMAL => 0,
USART_MODE_A::RS485 => 1,
USART_MODE_A::HW_HANDSHAKING => 2,
USART_MODE_A::IS07816_T_0 => 4,
USART_MODE_A::IS07816_T_1 => 6,
USART_MODE_A::IRDA => 8,
USART_MODE_A::LIN_MASTER => 10,
USART_MODE_A::LIN_SLAVE => 11,
USART_MODE_A::SPI_MASTER => 14,
USART_MODE_A::SPI_SLAVE => 15,
}
}
}
#[doc = "Reader of field `USART_MODE`"]
pub type USART_MODE_R = crate::R<u8, USART_MODE_A>;
impl USART_MODE_R {
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> crate::Variant<u8, USART_MODE_A> {
use crate::Variant::*;
match self.bits {
0 => Val(USART_MODE_A::NORMAL),
1 => Val(USART_MODE_A::RS485),
2 => Val(USART_MODE_A::HW_HANDSHAKING),
4 => Val(USART_MODE_A::IS07816_T_0),
6 => Val(USART_MODE_A::IS07816_T_1),
8 => Val(USART_MODE_A::IRDA),
10 => Val(USART_MODE_A::LIN_MASTER),
11 => Val(USART_MODE_A::LIN_SLAVE),
14 => Val(USART_MODE_A::SPI_MASTER),
15 => Val(USART_MODE_A::SPI_SLAVE),
i => Res(i),
}
}
#[doc = "Checks if the value of the field is `NORMAL`"]
#[inline(always)]
pub fn is_normal(&self) -> bool {
*self == USART_MODE_A::NORMAL
}
#[doc = "Checks if the value of the field is `RS485`"]
#[inline(always)]
pub fn is_rs485(&self) -> bool {
*self == USART_MODE_A::RS485
}
#[doc = "Checks if the value of the field is `HW_HANDSHAKING`"]
#[inline(always)]
pub fn is_hw_handshaking(&self) -> bool {
*self == USART_MODE_A::HW_HANDSHAKING
}
#[doc = "Checks if the value of the field is `IS07816_T_0`"]
#[inline(always)]
pub fn is_is07816_t_0(&self) -> bool {
*self == USART_MODE_A::IS07816_T_0
}
#[doc = "Checks if the value of the field is `IS07816_T_1`"]
#[inline(always)]
pub fn is_is07816_t_1(&self) -> bool {
*self == USART_MODE_A::IS07816_T_1
}
#[doc = "Checks if the value of the field is `IRDA`"]
#[inline(always)]
pub fn is_irda(&self) -> bool {
*self == USART_MODE_A::IRDA
}
#[doc = "Checks if the value of the field is `LIN_MASTER`"]
#[inline(always)]
pub fn is_lin_master(&self) -> bool {
*self == USART_MODE_A::LIN_MASTER
}
#[doc = "Checks if the value of the field is `LIN_SLAVE`"]
#[inline(always)]
pub fn is_lin_slave(&self) -> bool {
*self == USART_MODE_A::LIN_SLAVE
}
#[doc = "Checks if the value of the field is `SPI_MASTER`"]
#[inline(always)]
pub fn is_spi_master(&self) -> bool {
*self == USART_MODE_A::SPI_MASTER
}
#[doc = "Checks if the value of the field is `SPI_SLAVE`"]
#[inline(always)]
pub fn is_spi_slave(&self) -> bool {
*self == USART_MODE_A::SPI_SLAVE
}
}
#[doc = "Write proxy for field `USART_MODE`"]
pub struct USART_MODE_W<'a> {
w: &'a mut W,
}
impl<'a> USART_MODE_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: USART_MODE_A) -> &'a mut W {
use crate::ToBits;
unsafe { self.bits(variant._bits()) }
}
#[doc = "Normal mode"]
#[inline(always)]
pub fn normal(self) -> &'a mut W {
self.variant(USART_MODE_A::NORMAL)
}
#[doc = "RS485"]
#[inline(always)]
pub fn rs485(self) -> &'a mut W {
self.variant(USART_MODE_A::RS485)
}
#[doc = "Hardware Handshaking"]
#[inline(always)]
pub fn hw_handshaking(self) -> &'a mut W {
self.variant(USART_MODE_A::HW_HANDSHAKING)
}
#[doc = "IS07816 Protocol: T = 0"]
#[inline(always)]
pub fn is07816_t_0(self) -> &'a mut W {
self.variant(USART_MODE_A::IS07816_T_0)
}
#[doc = "IS07816 Protocol: T = 1"]
#[inline(always)]
pub fn is07816_t_1(self) -> &'a mut W {
self.variant(USART_MODE_A::IS07816_T_1)
}
#[doc = "IrDA"]
#[inline(always)]
pub fn irda(self) -> &'a mut W {
self.variant(USART_MODE_A::IRDA)
}
#[doc = "LIN master"]
#[inline(always)]
pub fn lin_master(self) -> &'a mut W {
self.variant(USART_MODE_A::LIN_MASTER)
}
#[doc = "LIN Slave"]
#[inline(always)]
pub fn lin_slave(self) -> &'a mut W {
self.variant(USART_MODE_A::LIN_SLAVE)
}
#[doc = "SPI master"]
#[inline(always)]
pub fn spi_master(self) -> &'a mut W {
self.variant(USART_MODE_A::SPI_MASTER)
}
#[doc = "SPI Slave"]
#[inline(always)]
pub fn spi_slave(self) -> &'a mut W {
self.variant(USART_MODE_A::SPI_SLAVE)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub unsafe fn bits(self, value: u8) -> &'a mut W {
self.w.bits = (self.w.bits & !0x0f) | ((value as u32) & 0x0f);
self.w
}
}
#[doc = "Possible values of the field `USCLKS`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum USCLKS_A {
#[doc = "master Clock MCK is selected"]
MCK,
#[doc = "Internal Clock Divided MCK/DIV (DIV=8) is selected"]
DIV,
#[doc = "Serial Clock SLK is selected"]
SCK,
}
impl crate::ToBits<u8> for USCLKS_A {
#[inline(always)]
fn _bits(&self) -> u8 {
match *self {
USCLKS_A::MCK => 0,
USCLKS_A::DIV => 1,
USCLKS_A::SCK => 3,
}
}
}
#[doc = "Reader of field `USCLKS`"]
pub type USCLKS_R = crate::R<u8, USCLKS_A>;
impl USCLKS_R {
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> crate::Variant<u8, USCLKS_A> {
use crate::Variant::*;
match self.bits {
0 => Val(USCLKS_A::MCK),
1 => Val(USCLKS_A::DIV),
3 => Val(USCLKS_A::SCK),
i => Res(i),
}
}
#[doc = "Checks if the value of the field is `MCK`"]
#[inline(always)]
pub fn is_mck(&self) -> bool {
*self == USCLKS_A::MCK
}
#[doc = "Checks if the value of the field is `DIV`"]
#[inline(always)]
pub fn is_div(&self) -> bool {
*self == USCLKS_A::DIV
}
#[doc = "Checks if the value of the field is `SCK`"]
#[inline(always)]
pub fn is_sck(&self) -> bool {
*self == USCLKS_A::SCK
}
}
#[doc = "Write proxy for field `USCLKS`"]
pub struct USCLKS_W<'a> {
w: &'a mut W,
}
impl<'a> USCLKS_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: USCLKS_A) -> &'a mut W {
use crate::ToBits;
unsafe { self.bits(variant._bits()) }
}
#[doc = "master Clock MCK is selected"]
#[inline(always)]
pub fn mck(self) -> &'a mut W {
self.variant(USCLKS_A::MCK)
}
#[doc = "Internal Clock Divided MCK/DIV (DIV=8) is selected"]
#[inline(always)]
pub fn div(self) -> &'a mut W {
self.variant(USCLKS_A::DIV)
}
#[doc = "Serial Clock SLK is selected"]
#[inline(always)]
pub fn sck(self) -> &'a mut W {
self.variant(USCLKS_A::SCK)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub unsafe fn bits(self, value: u8) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x03 << 4)) | (((value as u32) & 0x03) << 4);
self.w
}
}
#[doc = "Possible values of the field `CHRL`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum CHRL_A {
#[doc = "Character length is 5 bits"]
_5_BIT,
#[doc = "Character length is 6 bits"]
_6_BIT,
#[doc = "Character length is 7 bits"]
_7_BIT,
#[doc = "Character length is 8 bits"]
_8_BIT,
}
impl crate::ToBits<u8> for CHRL_A {
#[inline(always)]
fn _bits(&self) -> u8 {
match *self {
CHRL_A::_5_BIT => 0,
CHRL_A::_6_BIT => 1,
CHRL_A::_7_BIT => 2,
CHRL_A::_8_BIT => 3,
}
}
}
#[doc = "Reader of field `CHRL`"]
pub type CHRL_R = crate::R<u8, CHRL_A>;
impl CHRL_R {
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> CHRL_A {
match self.bits {
0 => CHRL_A::_5_BIT,
1 => CHRL_A::_6_BIT,
2 => CHRL_A::_7_BIT,
3 => CHRL_A::_8_BIT,
_ => unreachable!(),
}
}
#[doc = "Checks if the value of the field is `_5_BIT`"]
#[inline(always)]
pub fn is_5_bit(&self) -> bool {
*self == CHRL_A::_5_BIT
}
#[doc = "Checks if the value of the field is `_6_BIT`"]
#[inline(always)]
pub fn is_6_bit(&self) -> bool {
*self == CHRL_A::_6_BIT
}
#[doc = "Checks if the value of the field is `_7_BIT`"]
#[inline(always)]
pub fn is_7_bit(&self) -> bool {
*self == CHRL_A::_7_BIT
}
#[doc = "Checks if the value of the field is `_8_BIT`"]
#[inline(always)]
pub fn is_8_bit(&self) -> bool {
*self == CHRL_A::_8_BIT
}
}
#[doc = "Write proxy for field `CHRL`"]
pub struct CHRL_W<'a> {
w: &'a mut W,
}
impl<'a> CHRL_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: CHRL_A) -> &'a mut W {
use crate::ToBits;
{
self.bits(variant._bits())
}
}
#[doc = "Character length is 5 bits"]
#[inline(always)]
pub fn _5_bit(self) -> &'a mut W {
self.variant(CHRL_A::_5_BIT)
}
#[doc = "Character length is 6 bits"]
#[inline(always)]
pub fn _6_bit(self) -> &'a mut W {
self.variant(CHRL_A::_6_BIT)
}
#[doc = "Character length is 7 bits"]
#[inline(always)]
pub fn _7_bit(self) -> &'a mut W {
self.variant(CHRL_A::_7_BIT)
}
#[doc = "Character length is 8 bits"]
#[inline(always)]
pub fn _8_bit(self) -> &'a mut W {
self.variant(CHRL_A::_8_BIT)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bits(self, value: u8) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x03 << 6)) | (((value as u32) & 0x03) << 6);
self.w
}
}
#[doc = "Reader of field `SYNC`"]
pub type SYNC_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `SYNC`"]
pub struct SYNC_W<'a> {
w: &'a mut W,
}
impl<'a> SYNC_W<'a> {
#[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 = "Possible values of the field `PAR`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum PAR_A {
#[doc = "Even parity"]
EVEN,
#[doc = "Odd parity"]
ODD,
#[doc = "Parity forced to 0 (Space)"]
SPACE,
#[doc = "Parity forced to 1 (Mark)"]
MARK,
#[doc = "No parity"]
NO,
#[doc = "Multidrop mode"]
MULTIDROP,
}
impl crate::ToBits<u8> for PAR_A {
#[inline(always)]
fn _bits(&self) -> u8 {
match *self {
PAR_A::EVEN => 0,
PAR_A::ODD => 1,
PAR_A::SPACE => 2,
PAR_A::MARK => 3,
PAR_A::NO => 4,
PAR_A::MULTIDROP => 6,
}
}
}
#[doc = "Reader of field `PAR`"]
pub type PAR_R = crate::R<u8, PAR_A>;
impl PAR_R {
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> crate::Variant<u8, PAR_A> {
use crate::Variant::*;
match self.bits {
0 => Val(PAR_A::EVEN),
1 => Val(PAR_A::ODD),
2 => Val(PAR_A::SPACE),
3 => Val(PAR_A::MARK),
4 => Val(PAR_A::NO),
6 => Val(PAR_A::MULTIDROP),
i => Res(i),
}
}
#[doc = "Checks if the value of the field is `EVEN`"]
#[inline(always)]
pub fn is_even(&self) -> bool {
*self == PAR_A::EVEN
}
#[doc = "Checks if the value of the field is `ODD`"]
#[inline(always)]
pub fn is_odd(&self) -> bool {
*self == PAR_A::ODD
}
#[doc = "Checks if the value of the field is `SPACE`"]
#[inline(always)]
pub fn is_space(&self) -> bool {
*self == PAR_A::SPACE
}
#[doc = "Checks if the value of the field is `MARK`"]
#[inline(always)]
pub fn is_mark(&self) -> bool {
*self == PAR_A::MARK
}
#[doc = "Checks if the value of the field is `NO`"]
#[inline(always)]
pub fn is_no(&self) -> bool {
*self == PAR_A::NO
}
#[doc = "Checks if the value of the field is `MULTIDROP`"]
#[inline(always)]
pub fn is_multidrop(&self) -> bool {
*self == PAR_A::MULTIDROP
}
}
#[doc = "Write proxy for field `PAR`"]
pub struct PAR_W<'a> {
w: &'a mut W,
}
impl<'a> PAR_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: PAR_A) -> &'a mut W {
use crate::ToBits;
unsafe { self.bits(variant._bits()) }
}
#[doc = "Even parity"]
#[inline(always)]
pub fn even(self) -> &'a mut W {
self.variant(PAR_A::EVEN)
}
#[doc = "Odd parity"]
#[inline(always)]
pub fn odd(self) -> &'a mut W {
self.variant(PAR_A::ODD)
}
#[doc = "Parity forced to 0 (Space)"]
#[inline(always)]
pub fn space(self) -> &'a mut W {
self.variant(PAR_A::SPACE)
}
#[doc = "Parity forced to 1 (Mark)"]
#[inline(always)]
pub fn mark(self) -> &'a mut W {
self.variant(PAR_A::MARK)
}
#[doc = "No parity"]
#[inline(always)]
pub fn no(self) -> &'a mut W {
self.variant(PAR_A::NO)
}
#[doc = "Multidrop mode"]
#[inline(always)]
pub fn multidrop(self) -> &'a mut W {
self.variant(PAR_A::MULTIDROP)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub unsafe fn bits(self, value: u8) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x07 << 9)) | (((value as u32) & 0x07) << 9);
self.w
}
}
#[doc = "Possible values of the field `NBSTOP`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum NBSTOP_A {
#[doc = "1 stop bit"]
_1_BIT,
#[doc = "1.5 stop bit (SYNC = 0) or reserved (SYNC = 1)"]
_1_5_BIT,
#[doc = "2 stop bits"]
_2_BIT,
}
impl crate::ToBits<u8> for NBSTOP_A {
#[inline(always)]
fn _bits(&self) -> u8 {
match *self {
NBSTOP_A::_1_BIT => 0,
NBSTOP_A::_1_5_BIT => 1,
NBSTOP_A::_2_BIT => 2,
}
}
}
#[doc = "Reader of field `NBSTOP`"]
pub type NBSTOP_R = crate::R<u8, NBSTOP_A>;
impl NBSTOP_R {
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> crate::Variant<u8, NBSTOP_A> {
use crate::Variant::*;
match self.bits {
0 => Val(NBSTOP_A::_1_BIT),
1 => Val(NBSTOP_A::_1_5_BIT),
2 => Val(NBSTOP_A::_2_BIT),
i => Res(i),
}
}
#[doc = "Checks if the value of the field is `_1_BIT`"]
#[inline(always)]
pub fn is_1_bit(&self) -> bool {
*self == NBSTOP_A::_1_BIT
}
#[doc = "Checks if the value of the field is `_1_5_BIT`"]
#[inline(always)]
pub fn is_1_5_bit(&self) -> bool {
*self == NBSTOP_A::_1_5_BIT
}
#[doc = "Checks if the value of the field is `_2_BIT`"]
#[inline(always)]
pub fn is_2_bit(&self) -> bool {
*self == NBSTOP_A::_2_BIT
}
}
#[doc = "Write proxy for field `NBSTOP`"]
pub struct NBSTOP_W<'a> {
w: &'a mut W,
}
impl<'a> NBSTOP_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: NBSTOP_A) -> &'a mut W {
use crate::ToBits;
unsafe { self.bits(variant._bits()) }
}
#[doc = "1 stop bit"]
#[inline(always)]
pub fn _1_bit(self) -> &'a mut W {
self.variant(NBSTOP_A::_1_BIT)
}
#[doc = "1.5 stop bit (SYNC = 0) or reserved (SYNC = 1)"]
#[inline(always)]
pub fn _1_5_bit(self) -> &'a mut W {
self.variant(NBSTOP_A::_1_5_BIT)
}
#[doc = "2 stop bits"]
#[inline(always)]
pub fn _2_bit(self) -> &'a mut W {
self.variant(NBSTOP_A::_2_BIT)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub unsafe fn bits(self, value: u8) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x03 << 12)) | (((value as u32) & 0x03) << 12);
self.w
}
}
#[doc = "Possible values of the field `CHMODE`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum CHMODE_A {
#[doc = "Normal mode"]
NORMAL,
#[doc = "Automatic Echo. Receiver input is connected to the TXD pin."]
AUTOMATIC,
#[doc = "Local Loopback. Transmitter output is connected to the Receiver Input."]
LOCAL_LOOPBACK,
#[doc = "Remote Loopback. RXD pin is internally connected to the TXD pin."]
REMOTE_LOOPBACK,
}
impl crate::ToBits<u8> for CHMODE_A {
#[inline(always)]
fn _bits(&self) -> u8 {
match *self {
CHMODE_A::NORMAL => 0,
CHMODE_A::AUTOMATIC => 1,
CHMODE_A::LOCAL_LOOPBACK => 2,
CHMODE_A::REMOTE_LOOPBACK => 3,
}
}
}
#[doc = "Reader of field `CHMODE`"]
pub type CHMODE_R = crate::R<u8, CHMODE_A>;
impl CHMODE_R {
#[doc = r"Get enumerated values variant"]
#[inline(always)]
pub fn variant(&self) -> CHMODE_A {
match self.bits {
0 => CHMODE_A::NORMAL,
1 => CHMODE_A::AUTOMATIC,
2 => CHMODE_A::LOCAL_LOOPBACK,
3 => CHMODE_A::REMOTE_LOOPBACK,
_ => unreachable!(),
}
}
#[doc = "Checks if the value of the field is `NORMAL`"]
#[inline(always)]
pub fn is_normal(&self) -> bool {
*self == CHMODE_A::NORMAL
}
#[doc = "Checks if the value of the field is `AUTOMATIC`"]
#[inline(always)]
pub fn is_automatic(&self) -> bool {
*self == CHMODE_A::AUTOMATIC
}
#[doc = "Checks if the value of the field is `LOCAL_LOOPBACK`"]
#[inline(always)]
pub fn is_local_loopback(&self) -> bool {
*self == CHMODE_A::LOCAL_LOOPBACK
}
#[doc = "Checks if the value of the field is `REMOTE_LOOPBACK`"]
#[inline(always)]
pub fn is_remote_loopback(&self) -> bool {
*self == CHMODE_A::REMOTE_LOOPBACK
}
}
#[doc = "Write proxy for field `CHMODE`"]
pub struct CHMODE_W<'a> {
w: &'a mut W,
}
impl<'a> CHMODE_W<'a> {
#[doc = r"Writes `variant` to the field"]
#[inline(always)]
pub fn variant(self, variant: CHMODE_A) -> &'a mut W {
use crate::ToBits;
{
self.bits(variant._bits())
}
}
#[doc = "Normal mode"]
#[inline(always)]
pub fn normal(self) -> &'a mut W {
self.variant(CHMODE_A::NORMAL)
}
#[doc = "Automatic Echo. Receiver input is connected to the TXD pin."]
#[inline(always)]
pub fn automatic(self) -> &'a mut W {
self.variant(CHMODE_A::AUTOMATIC)
}
#[doc = "Local Loopback. Transmitter output is connected to the Receiver Input."]
#[inline(always)]
pub fn local_loopback(self) -> &'a mut W {
self.variant(CHMODE_A::LOCAL_LOOPBACK)
}
#[doc = "Remote Loopback. RXD pin is internally connected to the TXD pin."]
#[inline(always)]
pub fn remote_loopback(self) -> &'a mut W {
self.variant(CHMODE_A::REMOTE_LOOPBACK)
}
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub fn bits(self, value: u8) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x03 << 14)) | (((value as u32) & 0x03) << 14);
self.w
}
}
#[doc = "Reader of field `MSBF`"]
pub type MSBF_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `MSBF`"]
pub struct MSBF_W<'a> {
w: &'a mut W,
}
impl<'a> MSBF_W<'a> {
#[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 << 16)) | (((value as u32) & 0x01) << 16);
self.w
}
}
#[doc = "Reader of field `MODE9`"]
pub type MODE9_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `MODE9`"]
pub struct MODE9_W<'a> {
w: &'a mut W,
}
impl<'a> MODE9_W<'a> {
#[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 << 17)) | (((value as u32) & 0x01) << 17);
self.w
}
}
#[doc = "Reader of field `CLKO`"]
pub type CLKO_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `CLKO`"]
pub struct CLKO_W<'a> {
w: &'a mut W,
}
impl<'a> CLKO_W<'a> {
#[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 << 18)) | (((value as u32) & 0x01) << 18);
self.w
}
}
#[doc = "Reader of field `OVER`"]
pub type OVER_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `OVER`"]
pub struct OVER_W<'a> {
w: &'a mut W,
}
impl<'a> OVER_W<'a> {
#[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 << 19)) | (((value as u32) & 0x01) << 19);
self.w
}
}
#[doc = "Reader of field `INACK`"]
pub type INACK_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `INACK`"]
pub struct INACK_W<'a> {
w: &'a mut W,
}
impl<'a> INACK_W<'a> {
#[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 << 20)) | (((value as u32) & 0x01) << 20);
self.w
}
}
#[doc = "Reader of field `DSNACK`"]
pub type DSNACK_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `DSNACK`"]
pub struct DSNACK_W<'a> {
w: &'a mut W,
}
impl<'a> DSNACK_W<'a> {
#[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 << 21)) | (((value as u32) & 0x01) << 21);
self.w
}
}
#[doc = "Reader of field `VAR_SYNC`"]
pub type VAR_SYNC_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `VAR_SYNC`"]
pub struct VAR_SYNC_W<'a> {
w: &'a mut W,
}
impl<'a> VAR_SYNC_W<'a> {
#[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 << 22)) | (((value as u32) & 0x01) << 22);
self.w
}
}
#[doc = "Reader of field `INVDATA`"]
pub type INVDATA_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `INVDATA`"]
pub struct INVDATA_W<'a> {
w: &'a mut W,
}
impl<'a> INVDATA_W<'a> {
#[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 << 23)) | (((value as u32) & 0x01) << 23);
self.w
}
}
#[doc = "Reader of field `MAX_ITERATION`"]
pub type MAX_ITERATION_R = crate::R<u8, u8>;
#[doc = "Write proxy for field `MAX_ITERATION`"]
pub struct MAX_ITERATION_W<'a> {
w: &'a mut W,
}
impl<'a> MAX_ITERATION_W<'a> {
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub unsafe fn bits(self, value: u8) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x07 << 24)) | (((value as u32) & 0x07) << 24);
self.w
}
}
#[doc = "Reader of field `FILTER`"]
pub type FILTER_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `FILTER`"]
pub struct FILTER_W<'a> {
w: &'a mut W,
}
impl<'a> FILTER_W<'a> {
#[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 << 28)) | (((value as u32) & 0x01) << 28);
self.w
}
}
#[doc = "Reader of field `MAN`"]
pub type MAN_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `MAN`"]
pub struct MAN_W<'a> {
w: &'a mut W,
}
impl<'a> MAN_W<'a> {
#[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 << 29)) | (((value as u32) & 0x01) << 29);
self.w
}
}
#[doc = "Reader of field `MODSYNC`"]
pub type MODSYNC_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `MODSYNC`"]
pub struct MODSYNC_W<'a> {
w: &'a mut W,
}
impl<'a> MODSYNC_W<'a> {
#[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 << 30)) | (((value as u32) & 0x01) << 30);
self.w
}
}
#[doc = "Reader of field `ONEBIT`"]
pub type ONEBIT_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `ONEBIT`"]
pub struct ONEBIT_W<'a> {
w: &'a mut W,
}
impl<'a> ONEBIT_W<'a> {
#[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 << 31)) | (((value as u32) & 0x01) << 31);
self.w
}
}
impl R {
#[doc = "Bits 0:3 - USART Mode of Operation"]
#[inline(always)]
pub fn usart_mode(&self) -> USART_MODE_R {
USART_MODE_R::new((self.bits & 0x0f) as u8)
}
#[doc = "Bits 4:5 - Clock Selection"]
#[inline(always)]
pub fn usclks(&self) -> USCLKS_R {
USCLKS_R::new(((self.bits >> 4) & 0x03) as u8)
}
#[doc = "Bits 6:7 - Character Length"]
#[inline(always)]
pub fn chrl(&self) -> CHRL_R {
CHRL_R::new(((self.bits >> 6) & 0x03) as u8)
}
#[doc = "Bit 8 - Synchronous Mode Select"]
#[inline(always)]
pub fn sync(&self) -> SYNC_R {
SYNC_R::new(((self.bits >> 8) & 0x01) != 0)
}
#[doc = "Bits 9:11 - Parity Type"]
#[inline(always)]
pub fn par(&self) -> PAR_R {
PAR_R::new(((self.bits >> 9) & 0x07) as u8)
}
#[doc = "Bits 12:13 - Number of Stop Bits"]
#[inline(always)]
pub fn nbstop(&self) -> NBSTOP_R {
NBSTOP_R::new(((self.bits >> 12) & 0x03) as u8)
}
#[doc = "Bits 14:15 - Channel Mode"]
#[inline(always)]
pub fn chmode(&self) -> CHMODE_R {
CHMODE_R::new(((self.bits >> 14) & 0x03) as u8)
}
#[doc = "Bit 16 - Bit Order"]
#[inline(always)]
pub fn msbf(&self) -> MSBF_R {
MSBF_R::new(((self.bits >> 16) & 0x01) != 0)
}
#[doc = "Bit 17 - 9-bit Character Length"]
#[inline(always)]
pub fn mode9(&self) -> MODE9_R {
MODE9_R::new(((self.bits >> 17) & 0x01) != 0)
}
#[doc = "Bit 18 - Clock Output Select"]
#[inline(always)]
pub fn clko(&self) -> CLKO_R {
CLKO_R::new(((self.bits >> 18) & 0x01) != 0)
}
#[doc = "Bit 19 - Oversampling Mode"]
#[inline(always)]
pub fn over(&self) -> OVER_R {
OVER_R::new(((self.bits >> 19) & 0x01) != 0)
}
#[doc = "Bit 20 - Inhibit Non Acknowledge"]
#[inline(always)]
pub fn inack(&self) -> INACK_R {
INACK_R::new(((self.bits >> 20) & 0x01) != 0)
}
#[doc = "Bit 21 - Disable Successive NACK"]
#[inline(always)]
pub fn dsnack(&self) -> DSNACK_R {
DSNACK_R::new(((self.bits >> 21) & 0x01) != 0)
}
#[doc = "Bit 22 - Variable Synchronization of Command/Data Sync Start Frame Delimiter"]
#[inline(always)]
pub fn var_sync(&self) -> VAR_SYNC_R {
VAR_SYNC_R::new(((self.bits >> 22) & 0x01) != 0)
}
#[doc = "Bit 23 - Inverted Data"]
#[inline(always)]
pub fn invdata(&self) -> INVDATA_R {
INVDATA_R::new(((self.bits >> 23) & 0x01) != 0)
}
#[doc = "Bits 24:26 - Maximum Number of Automatic Iteration"]
#[inline(always)]
pub fn max_iteration(&self) -> MAX_ITERATION_R {
MAX_ITERATION_R::new(((self.bits >> 24) & 0x07) as u8)
}
#[doc = "Bit 28 - Infrared Receive Line Filter"]
#[inline(always)]
pub fn filter(&self) -> FILTER_R {
FILTER_R::new(((self.bits >> 28) & 0x01) != 0)
}
#[doc = "Bit 29 - Manchester Encoder/Decoder Enable"]
#[inline(always)]
pub fn man(&self) -> MAN_R {
MAN_R::new(((self.bits >> 29) & 0x01) != 0)
}
#[doc = "Bit 30 - Manchester Synchronization Mode"]
#[inline(always)]
pub fn modsync(&self) -> MODSYNC_R {
MODSYNC_R::new(((self.bits >> 30) & 0x01) != 0)
}
#[doc = "Bit 31 - Start Frame Delimiter Selector"]
#[inline(always)]
pub fn onebit(&self) -> ONEBIT_R {
ONEBIT_R::new(((self.bits >> 31) & 0x01) != 0)
}
}
impl W {
#[doc = "Bits 0:3 - USART Mode of Operation"]
#[inline(always)]
pub fn usart_mode(&mut self) -> USART_MODE_W {
USART_MODE_W { w: self }
}
#[doc = "Bits 4:5 - Clock Selection"]
#[inline(always)]
pub fn usclks(&mut self) -> USCLKS_W {
USCLKS_W { w: self }
}
#[doc = "Bits 6:7 - Character Length"]
#[inline(always)]
pub fn chrl(&mut self) -> CHRL_W {
CHRL_W { w: self }
}
#[doc = "Bit 8 - Synchronous Mode Select"]
#[inline(always)]
pub fn sync(&mut self) -> SYNC_W {
SYNC_W { w: self }
}
#[doc = "Bits 9:11 - Parity Type"]
#[inline(always)]
pub fn par(&mut self) -> PAR_W {
PAR_W { w: self }
}
#[doc = "Bits 12:13 - Number of Stop Bits"]
#[inline(always)]
pub fn nbstop(&mut self) -> NBSTOP_W {
NBSTOP_W { w: self }
}
#[doc = "Bits 14:15 - Channel Mode"]
#[inline(always)]
pub fn chmode(&mut self) -> CHMODE_W {
CHMODE_W { w: self }
}
#[doc = "Bit 16 - Bit Order"]
#[inline(always)]
pub fn msbf(&mut self) -> MSBF_W {
MSBF_W { w: self }
}
#[doc = "Bit 17 - 9-bit Character Length"]
#[inline(always)]
pub fn mode9(&mut self) -> MODE9_W {
MODE9_W { w: self }
}
#[doc = "Bit 18 - Clock Output Select"]
#[inline(always)]
pub fn clko(&mut self) -> CLKO_W {
CLKO_W { w: self }
}
#[doc = "Bit 19 - Oversampling Mode"]
#[inline(always)]
pub fn over(&mut self) -> OVER_W {
OVER_W { w: self }
}
#[doc = "Bit 20 - Inhibit Non Acknowledge"]
#[inline(always)]
pub fn inack(&mut self) -> INACK_W {
INACK_W { w: self }
}
#[doc = "Bit 21 - Disable Successive NACK"]
#[inline(always)]
pub fn dsnack(&mut self) -> DSNACK_W {
DSNACK_W { w: self }
}
#[doc = "Bit 22 - Variable Synchronization of Command/Data Sync Start Frame Delimiter"]
#[inline(always)]
pub fn var_sync(&mut self) -> VAR_SYNC_W {
VAR_SYNC_W { w: self }
}
#[doc = "Bit 23 - Inverted Data"]
#[inline(always)]
pub fn invdata(&mut self) -> INVDATA_W {
INVDATA_W { w: self }
}
#[doc = "Bits 24:26 - Maximum Number of Automatic Iteration"]
#[inline(always)]
pub fn max_iteration(&mut self) -> MAX_ITERATION_W {
MAX_ITERATION_W { w: self }
}
#[doc = "Bit 28 - Infrared Receive Line Filter"]
#[inline(always)]
pub fn filter(&mut self) -> FILTER_W {
FILTER_W { w: self }
}
#[doc = "Bit 29 - Manchester Encoder/Decoder Enable"]
#[inline(always)]
pub fn man(&mut self) -> MAN_W {
MAN_W { w: self }
}
#[doc = "Bit 30 - Manchester Synchronization Mode"]
#[inline(always)]
pub fn modsync(&mut self) -> MODSYNC_W {
MODSYNC_W { w: self }
}
#[doc = "Bit 31 - Start Frame Delimiter Selector"]
#[inline(always)]
pub fn onebit(&mut self) -> ONEBIT_W {
ONEBIT_W { w: self }
}
}