#[doc = "Reader of register GPIO_PIN4"]
pub type R = crate::R<u32, super::GPIO_PIN4>;
#[doc = "Writer for register GPIO_PIN4"]
pub type W = crate::W<u32, super::GPIO_PIN4>;
#[doc = "Register GPIO_PIN4 `reset()`'s with value 0"]
impl crate::ResetValue for super::GPIO_PIN4 {
type Type = u32;
#[inline(always)]
fn reset_value() -> Self::Type {
0
}
}
#[doc = "Reader of field `GPIO_PIN4_CONFIG`"]
pub type GPIO_PIN4_CONFIG_R = crate::R<u8, u8>;
#[doc = "Write proxy for field `GPIO_PIN4_CONFIG`"]
pub struct GPIO_PIN4_CONFIG_W<'a> {
w: &'a mut W,
}
impl<'a> GPIO_PIN4_CONFIG_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 & !(0x03 << 11)) | (((value as u32) & 0x03) << 11);
self.w
}
}
#[doc = "Reader of field `GPIO_PIN4_WAKEUP_ENABLE`"]
pub type GPIO_PIN4_WAKEUP_ENABLE_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `GPIO_PIN4_WAKEUP_ENABLE`"]
pub struct GPIO_PIN4_WAKEUP_ENABLE_W<'a> {
w: &'a mut W,
}
impl<'a> GPIO_PIN4_WAKEUP_ENABLE_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 << 10)) | (((value as u32) & 0x01) << 10);
self.w
}
}
#[doc = "Reader of field `GPIO_PIN4_INT_TYPE`"]
pub type GPIO_PIN4_INT_TYPE_R = crate::R<u8, u8>;
#[doc = "Write proxy for field `GPIO_PIN4_INT_TYPE`"]
pub struct GPIO_PIN4_INT_TYPE_W<'a> {
w: &'a mut W,
}
impl<'a> GPIO_PIN4_INT_TYPE_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 << 7)) | (((value as u32) & 0x07) << 7);
self.w
}
}
#[doc = "Reader of field `GPIO_PIN4_DRIVER`"]
pub type GPIO_PIN4_DRIVER_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `GPIO_PIN4_DRIVER`"]
pub struct GPIO_PIN4_DRIVER_W<'a> {
w: &'a mut W,
}
impl<'a> GPIO_PIN4_DRIVER_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 << 2)) | (((value as u32) & 0x01) << 2);
self.w
}
}
#[doc = "Reader of field `GPIO_PIN4_SOURCE`"]
pub type GPIO_PIN4_SOURCE_R = crate::R<bool, bool>;
#[doc = "Write proxy for field `GPIO_PIN4_SOURCE`"]
pub struct GPIO_PIN4_SOURCE_W<'a> {
w: &'a mut W,
}
impl<'a> GPIO_PIN4_SOURCE_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) | ((value as u32) & 0x01);
self.w
}
}
impl R {
#[doc = "Bits 11:12"]
#[inline(always)]
pub fn gpio_pin4_config(&self) -> GPIO_PIN4_CONFIG_R {
GPIO_PIN4_CONFIG_R::new(((self.bits >> 11) & 0x03) as u8)
}
#[doc = "Bit 10"]
#[inline(always)]
pub fn gpio_pin4_wakeup_enable(&self) -> GPIO_PIN4_WAKEUP_ENABLE_R {
GPIO_PIN4_WAKEUP_ENABLE_R::new(((self.bits >> 10) & 0x01) != 0)
}
#[doc = "Bits 7:9"]
#[inline(always)]
pub fn gpio_pin4_int_type(&self) -> GPIO_PIN4_INT_TYPE_R {
GPIO_PIN4_INT_TYPE_R::new(((self.bits >> 7) & 0x07) as u8)
}
#[doc = "Bit 2"]
#[inline(always)]
pub fn gpio_pin4_driver(&self) -> GPIO_PIN4_DRIVER_R {
GPIO_PIN4_DRIVER_R::new(((self.bits >> 2) & 0x01) != 0)
}
#[doc = "Bit 0"]
#[inline(always)]
pub fn gpio_pin4_source(&self) -> GPIO_PIN4_SOURCE_R {
GPIO_PIN4_SOURCE_R::new((self.bits & 0x01) != 0)
}
}
impl W {
#[doc = "Bits 11:12"]
#[inline(always)]
pub fn gpio_pin4_config(&mut self) -> GPIO_PIN4_CONFIG_W {
GPIO_PIN4_CONFIG_W { w: self }
}
#[doc = "Bit 10"]
#[inline(always)]
pub fn gpio_pin4_wakeup_enable(&mut self) -> GPIO_PIN4_WAKEUP_ENABLE_W {
GPIO_PIN4_WAKEUP_ENABLE_W { w: self }
}
#[doc = "Bits 7:9"]
#[inline(always)]
pub fn gpio_pin4_int_type(&mut self) -> GPIO_PIN4_INT_TYPE_W {
GPIO_PIN4_INT_TYPE_W { w: self }
}
#[doc = "Bit 2"]
#[inline(always)]
pub fn gpio_pin4_driver(&mut self) -> GPIO_PIN4_DRIVER_W {
GPIO_PIN4_DRIVER_W { w: self }
}
#[doc = "Bit 0"]
#[inline(always)]
pub fn gpio_pin4_source(&mut self) -> GPIO_PIN4_SOURCE_W {
GPIO_PIN4_SOURCE_W { w: self }
}
}