diff options
| author | Adam Greig <adam@adamgreig.com> | 2023-06-18 16:27:13 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-06-18 16:27:13 +0100 |
| commit | 301dff58b1684bca10983fe8c524aa278a09b4c2 (patch) | |
| tree | 40a9a8a67e14a6a99e0716061c8faf74008c600e /src | |
| parent | 1b5e99297f6303fc20da2622ae815b3a4987dbb1 (diff) | |
| parent | d49fb1ec06bcd89fee1fe20cb20ab82da91ce434 (diff) | |
Merge pull request #7 from Finomnis/trailing_commas
Allow trailing commas at register macros
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib.rs | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -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}}; |
