Advertisement
Guest User

Untitled

a guest
Feb 13th, 2016
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. struct MuxRegister {
  2. Uint16 PIN1:2;
  3. Uint16 PIN2:2;
  4. ...
  5. }
  6.  
  7. #define LED PIN1 (in a different file of course)
  8. #define PWM PIN2
  9. #define Mux_GPIO 1 (value from 0-3 selects different options)
  10. #define Mux_PWM 3
  11. MuxRegister.LED = Mux_GPIO;
  12. MuxRegister.PWM = Mux_PWM;
  13. ...
  14.  
  15. #define BIT1 0x00000001
  16. #define BIT2 0x00000002
  17. #define BIT1 0x00000004
  18. #define BIT2 0x00000008
  19. #define LED (BIT1&&BIT2)
  20. #define PWM (BIT3&&BIT4)
  21. MuxRegister |= ((Mux_GPIO && LED) || (Mux_PWM && PWM) || ... ;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement