Skip to content

Commit

Permalink
Clarify the exact behavior of RW1C setters (#160)
Browse files Browse the repository at this point in the history
  • Loading branch information
paulsohn authored Dec 3, 2023
1 parent c167ee6 commit 94ae091
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,18 +113,18 @@ macro_rules! rw1c_bit {
([$offset:literal]($bit:literal),$method:ident,$name:literal) => {
bit_getter!([$offset]($bit), $method, $name);
paste::paste! {
#[doc = "Clears the"]
#[doc = "Assigns 1 to the"]
#[doc = $name]
#[doc = "bit."]
#[doc = "bit. On register write, this results in clearing the bit."]
pub fn [<clear_ $method>](&mut self)->&mut Self{
use bit_field::BitField;
self.0[$offset].set_bit($bit,true);
self
}

#[doc = "Set the "]
#[doc = "Assigns 0 to the"]
#[doc = $name]
#[doc = " bit to 0, preventing the bit from being cleared on write."]
#[doc = "bit, preventing the bit from being cleared on write."]
pub fn [<set_0_ $method>](&mut self) -> &mut Self {
use bit_field::BitField;
self.0[$offset].set_bit($bit,false);
Expand All @@ -135,18 +135,18 @@ macro_rules! rw1c_bit {
($bit:literal,$method:ident,$name:literal) => {
bit_getter!($bit, $method, $name);
paste::paste! {
#[doc = "Clears the"]
#[doc = "Assigns 1 to the"]
#[doc = $name]
#[doc = "bit."]
#[doc = "bit. On register write, this results in clearing the bit."]
pub fn [<clear_ $method>](&mut self)->&mut Self{
use bit_field::BitField;
self.0.set_bit($bit,true);
self
}

#[doc = "Set the "]
#[doc = "Assigns 0 to the"]
#[doc = $name]
#[doc = " bit to 0, preventing the bit from being cleared on write."]
#[doc = "bit, preventing the bit from being cleared on write."]
pub fn [<set_0_ $method>](&mut self) -> &mut Self {
use bit_field::BitField;
self.0.set_bit($bit,false);
Expand Down

0 comments on commit 94ae091

Please sign in to comment.