Advertisement
Guest User

Untitled

a guest
Sep 22nd, 2017
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.74 KB | None | 0 0
  1.  
  2. class IOPort
  3. {
  4. public:
  5.     IOPort(u16 a) { address = a; };
  6.     ~IOPort() {};
  7.  
  8.     operator=(u8 u) { u2s.WriteByte(address,u); return 0; };
  9.     operator|=(u8 u) { u2s.WriteBit(address,0xFF,u); return 0; };
  10.     operator&=(u8 u) { u2s.WriteBit(address,u,0); return 0; };
  11.  
  12.     u16 address;
  13. };
  14.  
  15.  
  16.  
  17. IOPort PINB(0x23);
  18. #define PINB7 7
  19. #define PINB6 6
  20. #define PINB5 5
  21. #define PINB4 4
  22. #define PINB3 3
  23. #define PINB2 2
  24. #define PINB1 1
  25. #define PINB0 0
  26.  
  27. IOPort DDRB(0x24);
  28. #define DDB7 7
  29. #define DDB6 6
  30. #define DDB5 5
  31. #define DDB4 4
  32. #define DDB3 3
  33. #define DDB2 2
  34. #define DDB1 1
  35. #define DDB0 0
  36.  
  37. IOPort PORTB(0x25);
  38. #define PORTB7 7
  39. #define PORTB6 6
  40. #define PORTB5 5
  41. #define PORTB4 4
  42. #define PORTB3 3
  43. #define PORTB2 2
  44. #define PORTB1 1
  45. #define PORTB0 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement