From 79dd2543a1915532e51a80e8e39bcc57ecbb7ca3 Mon Sep 17 00:00:00 2001 From: Dylan McKay Date: Fri, 30 Oct 2020 01:04:47 +1300 Subject: [PATCH] Use volatile write operation for 'set_mask_raw' function The other methods had previously been updated to use volatile memops, but due to an oversight this method was missed. Fixes avr-rust/ruduino#31. Thanks to @MalteT for reporting this issue. --- src/register.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/register.rs b/src/register.rs index 4491c1b..f97933c 100644 --- a/src/register.rs +++ b/src/register.rs @@ -52,7 +52,7 @@ pub trait Register : Sized { #[inline(always)] fn set_mask_raw(mask: Self::T) { unsafe { - *Self::ADDRESS |= mask; + core::ptr::write_volatile(Self::ADDRESS, core::ptr::read_volatile(Self::ADDRESS) | mask); } }