aboutsummaryrefslogtreecommitdiff
path: root/src/lib.rs
diff options
context:
space:
mode:
authorAdam Greig <adam@adamgreig.com>2023-06-18 16:27:13 +0100
committerGitHub <noreply@github.com>2023-06-18 16:27:13 +0100
commit301dff58b1684bca10983fe8c524aa278a09b4c2 (patch)
tree40a9a8a67e14a6a99e0716061c8faf74008c600e /src/lib.rs
parent1b5e99297f6303fc20da2622ae815b3a4987dbb1 (diff)
parentd49fb1ec06bcd89fee1fe20cb20ab82da91ce434 (diff)
Merge pull request #7 from Finomnis/trailing_commas
Allow trailing commas at register macros
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/lib.rs b/src/lib.rs
index bcf0370..70cedf7 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -280,7 +280,7 @@ impl<T: Copy> UnsafeWORegister<T> {
/// and the macro brings such constants into scope and then dereferences the provided reference.
#[macro_export]
macro_rules! write_reg {
- ( $periph:path, $instance:expr, $reg:ident $([$offset:expr])*, $( $field:ident : $value:expr ),+ ) => {{
+ ( $periph:path, $instance:expr, $reg:ident $([$offset:expr])*, $( $field:ident : $value:expr ),+ $(,)? ) => {{
#[allow(unused_imports)]
use $periph::{*};
#[allow(unused_imports)]
@@ -418,7 +418,7 @@ macro_rules! write_reg {
/// and the macro brings such constants into scope and then dereferences the provided reference.
#[macro_export]
macro_rules! modify_reg {
- ( $periph:path, $instance:expr, $reg:ident $([$offset:expr])*, $( $field:ident : $value:expr ),+ ) => {{
+ ( $periph:path, $instance:expr, $reg:ident $([$offset:expr])*, $( $field:ident : $value:expr ),+ $(,)? ) => {{
#[allow(unused_imports)]
use $periph::{*};
#[allow(unused_imports)]
@@ -542,7 +542,7 @@ macro_rules! modify_reg {
/// and the macro brings such constants into scope and then dereferences the provided reference.
#[macro_export]
macro_rules! read_reg {
- ( $periph:path, $instance:expr, $reg:ident $([$offset:expr])*, $( $field:ident ),+ ) => {{
+ ( $periph:path, $instance:expr, $reg:ident $([$offset:expr])*, $( $field:ident ),+ $(,)? ) => {{
#[allow(unused_imports)]
use $periph::{*};
let val = ((*$instance).$reg $([$offset])*.read());
@@ -644,7 +644,7 @@ macro_rules! read_reg {
/// `GPIOA` they are not the same thing.
#[macro_export]
macro_rules! reset_reg {
- ( $periph:path, $instance:expr, $instancemod:path, $reg:ident $([$offset:expr])*, $( $field:ident ),+ ) => {{
+ ( $periph:path, $instance:expr, $instancemod:path, $reg:ident $([$offset:expr])*, $( $field:ident ),+ $(,)? ) => {{
#[allow(unused_imports)]
use $periph::{*};
use $periph::{$instancemod::{reset}};