Advertisement
Guest User

Untitled

a guest
Jul 19th, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. pub mod gpio {
  2. //! GPIO Pin mapping macros crate
  3.  
  4. macro_rules! pin_name {
  5. ($gpio:ident, spi_sck) => { $gpio.pin5 };
  6. ($gpio:ident, spi_mosi) => { $gpio.pin3 };
  7. ($gpio:ident, spi_miso) => { $gpio.pin4 };
  8. ($gpio:ident, spi_ss0) => { $gpio.pin2 };
  9. }
  10.  
  11. #[macro_export(local_inner_macros)]
  12. macro_rules! pin {
  13. ($gpio:ident.$name:ident) => {
  14. pin_name!($gpio, $name)
  15. }
  16. }
  17.  
  18. #[macro_export(local_inner_macros)]
  19. macro_rules! pins {
  20. ( $gpio:ident, ($($name:ident),+) ) => {
  21. ($(pin_name!($gpio, $name)),+)
  22. }
  23. }
  24.  
  25. }
  26.  
  27. fn main() {
  28.  
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement