Advertisement
Guest User

AVR Augmentation for io.h

a guest
Nov 10th, 2013
302
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 38.74 KB | None | 0 0
  1. // Generated @ Sun 10-11-2013 11:44PM 20sec
  2. /*
  3.     TITLE:   AVR Augmentation for io.h
  4.     Purpose: Increase portability, Readability, Save time
  5.     AUTHOR:  Brian Khuu
  6.     Version: V1.0
  7.  
  8.     Assumption:
  9.         That you are using io.h (For avr MCU) and
  10.         that it splits IOs into banks of Port letters each with an word sized of pin numbers
  11.             e.g. ( PA5 -> Port A pin 5 . Is a macro within io.h )
  12.         Port letters Supported: A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P
  13.         Pin numbers Supported: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 13, 14, 15, 16
  14.  
  15.     cite: initial inspiration from cinderblock "[CODE] [C] Simplifying PORT and DDR #defines for Portability
  16.            http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=73829
  17.     cite: "GET" and "SET" macros from David Jahshan's game_console Template
  18.  
  19.     Example blink code for the arduino UNO in C located in bottom of this header file
  20. */
  21.  
  22. // These accept letter + number reference only.
  23. //      e.g. for PA5 -> SET_PORT(A5,0xFF)
  24. // ( R_ was a cinderblock suggestion, to allow for nested concat operations)
  25.  
  26. #define SET_PORT(PIN,VALUE)     R_SET_PORT( PIN ,   VALUE   )
  27. #define SET_DDR(PIN,VALUE)      R_SET_DDR(  PIN ,   VALUE   )
  28. #define SET_PIN(PIN,VALUE)      R_SET_PIN(  PIN ,   VALUE   )
  29. #define GET_PORT(PIN)           R_GET_PORT( PIN )
  30. #define GET_DDR(PIN)            R_GET_DDR(  PIN )
  31. #define GET_PIN(PIN)            R_GET_PIN(  PIN )
  32.  
  33. #define R_SET_PORT(PIN,VALUE)       SET(    PORT_P##PIN ,   BITMASK_P##PIN  ,   VALUE   )
  34. #define R_SET_DDR(PIN,VALUE)        SET(    DDR_P##PIN  ,   BITMASK_P##PIN  ,   VALUE   )
  35. #define R_SET_PIN(PIN,VALUE)        SET(    PIN_P##PIN  ,   BITMASK_P##PIN  ,   VALUE   )
  36. #define R_GET_PORT(PIN)         GET(    PORT_P##PIN ,   BITMASK_P##PIN  )
  37. #define R_GET_DDR(PIN)          GET(    DDR_P##PIN  ,   BITMASK_P##PIN  )
  38. #define R_GET_PIN(PIN)          GET(    PIN_P##PIN  ,   BITMASK_P##PIN  )
  39.  
  40. //// From David Jahshan's SET and GET macro
  41. // This will not accept letter+number reference, must give PORT and MASK reference
  42. // e.g. SET_REGISTER( PORTA, _BV(PA6), 0xFF);
  43. #define SET(REGISTER,MASK,VALUE) REGISTER = ((MASK & VALUE) | (REGISTER & ~MASK))
  44. #define GET(REGISTER,MASK) REGISTER & MASK
  45.  
  46.  
  47. // ~~~~~~~~~~ PORT PIN DDR references ~~~~~~~~~~
  48.  
  49. //## PORT:A
  50.  
  51.     //PA1
  52.     #define BITMASK_PA1    _BV(PA1)
  53.     #define PORT_PA1       PORTA
  54.     #define DDR_PA1        DDRA
  55.     #define PIN_PA1        PINA
  56.  
  57.     //PA2
  58.     #define BITMASK_PA2    _BV(PA2)
  59.     #define PORT_PA2       PORTA
  60.     #define DDR_PA2        DDRA
  61.     #define PIN_PA2        PINA
  62.  
  63.     //PA3
  64.     #define BITMASK_PA3    _BV(PA3)
  65.     #define PORT_PA3       PORTA
  66.     #define DDR_PA3        DDRA
  67.     #define PIN_PA3        PINA
  68.  
  69.     //PA4
  70.     #define BITMASK_PA4    _BV(PA4)
  71.     #define PORT_PA4       PORTA
  72.     #define DDR_PA4        DDRA
  73.     #define PIN_PA4        PINA
  74.  
  75.     //PA5
  76.     #define BITMASK_PA5    _BV(PA5)
  77.     #define PORT_PA5       PORTA
  78.     #define DDR_PA5        DDRA
  79.     #define PIN_PA5        PINA
  80.  
  81.     //PA6
  82.     #define BITMASK_PA6    _BV(PA6)
  83.     #define PORT_PA6       PORTA
  84.     #define DDR_PA6        DDRA
  85.     #define PIN_PA6        PINA
  86.  
  87.     //PA7
  88.     #define BITMASK_PA7    _BV(PA7)
  89.     #define PORT_PA7       PORTA
  90.     #define DDR_PA7        DDRA
  91.     #define PIN_PA7        PINA
  92.  
  93.     //PA8
  94.     #define BITMASK_PA8    _BV(PA8)
  95.     #define PORT_PA8       PORTA
  96.     #define DDR_PA8        DDRA
  97.     #define PIN_PA8        PINA
  98.  
  99.     //PA9
  100.     #define BITMASK_PA9    _BV(PA9)
  101.     #define PORT_PA9       PORTA
  102.     #define DDR_PA9        DDRA
  103.     #define PIN_PA9        PINA
  104.  
  105.     //PA10
  106.     #define BITMASK_PA10    _BV(PA10)
  107.     #define PORT_PA10       PORTA
  108.     #define DDR_PA10        DDRA
  109.     #define PIN_PA10        PINA
  110.  
  111.     //PA12
  112.     #define BITMASK_PA12    _BV(PA12)
  113.     #define PORT_PA12       PORTA
  114.     #define DDR_PA12        DDRA
  115.     #define PIN_PA12        PINA
  116.  
  117.     //PA13
  118.     #define BITMASK_PA13    _BV(PA13)
  119.     #define PORT_PA13       PORTA
  120.     #define DDR_PA13        DDRA
  121.     #define PIN_PA13        PINA
  122.  
  123.     //PA14
  124.     #define BITMASK_PA14    _BV(PA14)
  125.     #define PORT_PA14       PORTA
  126.     #define DDR_PA14        DDRA
  127.     #define PIN_PA14        PINA
  128.  
  129.     //PA15
  130.     #define BITMASK_PA15    _BV(PA15)
  131.     #define PORT_PA15       PORTA
  132.     #define DDR_PA15        DDRA
  133.     #define PIN_PA15        PINA
  134.  
  135.     //PA16
  136.     #define BITMASK_PA16    _BV(PA16)
  137.     #define PORT_PA16       PORTA
  138.     #define DDR_PA16        DDRA
  139.     #define PIN_PA16        PINA
  140.  
  141.  
  142. //## PORT:B
  143.  
  144.     //PB1
  145.     #define BITMASK_PB1    _BV(PB1)
  146.     #define PORT_PB1       PORTB
  147.     #define DDR_PB1        DDRB
  148.     #define PIN_PB1        PINB
  149.  
  150.     //PB2
  151.     #define BITMASK_PB2    _BV(PB2)
  152.     #define PORT_PB2       PORTB
  153.     #define DDR_PB2        DDRB
  154.     #define PIN_PB2        PINB
  155.  
  156.     //PB3
  157.     #define BITMASK_PB3    _BV(PB3)
  158.     #define PORT_PB3       PORTB
  159.     #define DDR_PB3        DDRB
  160.     #define PIN_PB3        PINB
  161.  
  162.     //PB4
  163.     #define BITMASK_PB4    _BV(PB4)
  164.     #define PORT_PB4       PORTB
  165.     #define DDR_PB4        DDRB
  166.     #define PIN_PB4        PINB
  167.  
  168.     //PB5
  169.     #define BITMASK_PB5    _BV(PB5)
  170.     #define PORT_PB5       PORTB
  171.     #define DDR_PB5        DDRB
  172.     #define PIN_PB5        PINB
  173.  
  174.     //PB6
  175.     #define BITMASK_PB6    _BV(PB6)
  176.     #define PORT_PB6       PORTB
  177.     #define DDR_PB6        DDRB
  178.     #define PIN_PB6        PINB
  179.  
  180.     //PB7
  181.     #define BITMASK_PB7    _BV(PB7)
  182.     #define PORT_PB7       PORTB
  183.     #define DDR_PB7        DDRB
  184.     #define PIN_PB7        PINB
  185.  
  186.     //PB8
  187.     #define BITMASK_PB8    _BV(PB8)
  188.     #define PORT_PB8       PORTB
  189.     #define DDR_PB8        DDRB
  190.     #define PIN_PB8        PINB
  191.  
  192.     //PB9
  193.     #define BITMASK_PB9    _BV(PB9)
  194.     #define PORT_PB9       PORTB
  195.     #define DDR_PB9        DDRB
  196.     #define PIN_PB9        PINB
  197.  
  198.     //PB10
  199.     #define BITMASK_PB10    _BV(PB10)
  200.     #define PORT_PB10       PORTB
  201.     #define DDR_PB10        DDRB
  202.     #define PIN_PB10        PINB
  203.  
  204.     //PB12
  205.     #define BITMASK_PB12    _BV(PB12)
  206.     #define PORT_PB12       PORTB
  207.     #define DDR_PB12        DDRB
  208.     #define PIN_PB12        PINB
  209.  
  210.     //PB13
  211.     #define BITMASK_PB13    _BV(PB13)
  212.     #define PORT_PB13       PORTB
  213.     #define DDR_PB13        DDRB
  214.     #define PIN_PB13        PINB
  215.  
  216.     //PB14
  217.     #define BITMASK_PB14    _BV(PB14)
  218.     #define PORT_PB14       PORTB
  219.     #define DDR_PB14        DDRB
  220.     #define PIN_PB14        PINB
  221.  
  222.     //PB15
  223.     #define BITMASK_PB15    _BV(PB15)
  224.     #define PORT_PB15       PORTB
  225.     #define DDR_PB15        DDRB
  226.     #define PIN_PB15        PINB
  227.  
  228.     //PB16
  229.     #define BITMASK_PB16    _BV(PB16)
  230.     #define PORT_PB16       PORTB
  231.     #define DDR_PB16        DDRB
  232.     #define PIN_PB16        PINB
  233.  
  234.  
  235. //## PORT:C
  236.  
  237.     //PC1
  238.     #define BITMASK_PC1    _BV(PC1)
  239.     #define PORT_PC1       PORTC
  240.     #define DDR_PC1        DDRC
  241.     #define PIN_PC1        PINC
  242.  
  243.     //PC2
  244.     #define BITMASK_PC2    _BV(PC2)
  245.     #define PORT_PC2       PORTC
  246.     #define DDR_PC2        DDRC
  247.     #define PIN_PC2        PINC
  248.  
  249.     //PC3
  250.     #define BITMASK_PC3    _BV(PC3)
  251.     #define PORT_PC3       PORTC
  252.     #define DDR_PC3        DDRC
  253.     #define PIN_PC3        PINC
  254.  
  255.     //PC4
  256.     #define BITMASK_PC4    _BV(PC4)
  257.     #define PORT_PC4       PORTC
  258.     #define DDR_PC4        DDRC
  259.     #define PIN_PC4        PINC
  260.  
  261.     //PC5
  262.     #define BITMASK_PC5    _BV(PC5)
  263.     #define PORT_PC5       PORTC
  264.     #define DDR_PC5        DDRC
  265.     #define PIN_PC5        PINC
  266.  
  267.     //PC6
  268.     #define BITMASK_PC6    _BV(PC6)
  269.     #define PORT_PC6       PORTC
  270.     #define DDR_PC6        DDRC
  271.     #define PIN_PC6        PINC
  272.  
  273.     //PC7
  274.     #define BITMASK_PC7    _BV(PC7)
  275.     #define PORT_PC7       PORTC
  276.     #define DDR_PC7        DDRC
  277.     #define PIN_PC7        PINC
  278.  
  279.     //PC8
  280.     #define BITMASK_PC8    _BV(PC8)
  281.     #define PORT_PC8       PORTC
  282.     #define DDR_PC8        DDRC
  283.     #define PIN_PC8        PINC
  284.  
  285.     //PC9
  286.     #define BITMASK_PC9    _BV(PC9)
  287.     #define PORT_PC9       PORTC
  288.     #define DDR_PC9        DDRC
  289.     #define PIN_PC9        PINC
  290.  
  291.     //PC10
  292.     #define BITMASK_PC10    _BV(PC10)
  293.     #define PORT_PC10       PORTC
  294.     #define DDR_PC10        DDRC
  295.     #define PIN_PC10        PINC
  296.  
  297.     //PC12
  298.     #define BITMASK_PC12    _BV(PC12)
  299.     #define PORT_PC12       PORTC
  300.     #define DDR_PC12        DDRC
  301.     #define PIN_PC12        PINC
  302.  
  303.     //PC13
  304.     #define BITMASK_PC13    _BV(PC13)
  305.     #define PORT_PC13       PORTC
  306.     #define DDR_PC13        DDRC
  307.     #define PIN_PC13        PINC
  308.  
  309.     //PC14
  310.     #define BITMASK_PC14    _BV(PC14)
  311.     #define PORT_PC14       PORTC
  312.     #define DDR_PC14        DDRC
  313.     #define PIN_PC14        PINC
  314.  
  315.     //PC15
  316.     #define BITMASK_PC15    _BV(PC15)
  317.     #define PORT_PC15       PORTC
  318.     #define DDR_PC15        DDRC
  319.     #define PIN_PC15        PINC
  320.  
  321.     //PC16
  322.     #define BITMASK_PC16    _BV(PC16)
  323.     #define PORT_PC16       PORTC
  324.     #define DDR_PC16        DDRC
  325.     #define PIN_PC16        PINC
  326.  
  327.  
  328. //## PORT:D
  329.  
  330.     //PD1
  331.     #define BITMASK_PD1    _BV(PD1)
  332.     #define PORT_PD1       PORTD
  333.     #define DDR_PD1        DDRD
  334.     #define PIN_PD1        PIND
  335.  
  336.     //PD2
  337.     #define BITMASK_PD2    _BV(PD2)
  338.     #define PORT_PD2       PORTD
  339.     #define DDR_PD2        DDRD
  340.     #define PIN_PD2        PIND
  341.  
  342.     //PD3
  343.     #define BITMASK_PD3    _BV(PD3)
  344.     #define PORT_PD3       PORTD
  345.     #define DDR_PD3        DDRD
  346.     #define PIN_PD3        PIND
  347.  
  348.     //PD4
  349.     #define BITMASK_PD4    _BV(PD4)
  350.     #define PORT_PD4       PORTD
  351.     #define DDR_PD4        DDRD
  352.     #define PIN_PD4        PIND
  353.  
  354.     //PD5
  355.     #define BITMASK_PD5    _BV(PD5)
  356.     #define PORT_PD5       PORTD
  357.     #define DDR_PD5        DDRD
  358.     #define PIN_PD5        PIND
  359.  
  360.     //PD6
  361.     #define BITMASK_PD6    _BV(PD6)
  362.     #define PORT_PD6       PORTD
  363.     #define DDR_PD6        DDRD
  364.     #define PIN_PD6        PIND
  365.  
  366.     //PD7
  367.     #define BITMASK_PD7    _BV(PD7)
  368.     #define PORT_PD7       PORTD
  369.     #define DDR_PD7        DDRD
  370.     #define PIN_PD7        PIND
  371.  
  372.     //PD8
  373.     #define BITMASK_PD8    _BV(PD8)
  374.     #define PORT_PD8       PORTD
  375.     #define DDR_PD8        DDRD
  376.     #define PIN_PD8        PIND
  377.  
  378.     //PD9
  379.     #define BITMASK_PD9    _BV(PD9)
  380.     #define PORT_PD9       PORTD
  381.     #define DDR_PD9        DDRD
  382.     #define PIN_PD9        PIND
  383.  
  384.     //PD10
  385.     #define BITMASK_PD10    _BV(PD10)
  386.     #define PORT_PD10       PORTD
  387.     #define DDR_PD10        DDRD
  388.     #define PIN_PD10        PIND
  389.  
  390.     //PD12
  391.     #define BITMASK_PD12    _BV(PD12)
  392.     #define PORT_PD12       PORTD
  393.     #define DDR_PD12        DDRD
  394.     #define PIN_PD12        PIND
  395.  
  396.     //PD13
  397.     #define BITMASK_PD13    _BV(PD13)
  398.     #define PORT_PD13       PORTD
  399.     #define DDR_PD13        DDRD
  400.     #define PIN_PD13        PIND
  401.  
  402.     //PD14
  403.     #define BITMASK_PD14    _BV(PD14)
  404.     #define PORT_PD14       PORTD
  405.     #define DDR_PD14        DDRD
  406.     #define PIN_PD14        PIND
  407.  
  408.     //PD15
  409.     #define BITMASK_PD15    _BV(PD15)
  410.     #define PORT_PD15       PORTD
  411.     #define DDR_PD15        DDRD
  412.     #define PIN_PD15        PIND
  413.  
  414.     //PD16
  415.     #define BITMASK_PD16    _BV(PD16)
  416.     #define PORT_PD16       PORTD
  417.     #define DDR_PD16        DDRD
  418.     #define PIN_PD16        PIND
  419.  
  420.  
  421. //## PORT:E
  422.  
  423.     //PE1
  424.     #define BITMASK_PE1    _BV(PE1)
  425.     #define PORT_PE1       PORTE
  426.     #define DDR_PE1        DDRE
  427.     #define PIN_PE1        PINE
  428.  
  429.     //PE2
  430.     #define BITMASK_PE2    _BV(PE2)
  431.     #define PORT_PE2       PORTE
  432.     #define DDR_PE2        DDRE
  433.     #define PIN_PE2        PINE
  434.  
  435.     //PE3
  436.     #define BITMASK_PE3    _BV(PE3)
  437.     #define PORT_PE3       PORTE
  438.     #define DDR_PE3        DDRE
  439.     #define PIN_PE3        PINE
  440.  
  441.     //PE4
  442.     #define BITMASK_PE4    _BV(PE4)
  443.     #define PORT_PE4       PORTE
  444.     #define DDR_PE4        DDRE
  445.     #define PIN_PE4        PINE
  446.  
  447.     //PE5
  448.     #define BITMASK_PE5    _BV(PE5)
  449.     #define PORT_PE5       PORTE
  450.     #define DDR_PE5        DDRE
  451.     #define PIN_PE5        PINE
  452.  
  453.     //PE6
  454.     #define BITMASK_PE6    _BV(PE6)
  455.     #define PORT_PE6       PORTE
  456.     #define DDR_PE6        DDRE
  457.     #define PIN_PE6        PINE
  458.  
  459.     //PE7
  460.     #define BITMASK_PE7    _BV(PE7)
  461.     #define PORT_PE7       PORTE
  462.     #define DDR_PE7        DDRE
  463.     #define PIN_PE7        PINE
  464.  
  465.     //PE8
  466.     #define BITMASK_PE8    _BV(PE8)
  467.     #define PORT_PE8       PORTE
  468.     #define DDR_PE8        DDRE
  469.     #define PIN_PE8        PINE
  470.  
  471.     //PE9
  472.     #define BITMASK_PE9    _BV(PE9)
  473.     #define PORT_PE9       PORTE
  474.     #define DDR_PE9        DDRE
  475.     #define PIN_PE9        PINE
  476.  
  477.     //PE10
  478.     #define BITMASK_PE10    _BV(PE10)
  479.     #define PORT_PE10       PORTE
  480.     #define DDR_PE10        DDRE
  481.     #define PIN_PE10        PINE
  482.  
  483.     //PE12
  484.     #define BITMASK_PE12    _BV(PE12)
  485.     #define PORT_PE12       PORTE
  486.     #define DDR_PE12        DDRE
  487.     #define PIN_PE12        PINE
  488.  
  489.     //PE13
  490.     #define BITMASK_PE13    _BV(PE13)
  491.     #define PORT_PE13       PORTE
  492.     #define DDR_PE13        DDRE
  493.     #define PIN_PE13        PINE
  494.  
  495.     //PE14
  496.     #define BITMASK_PE14    _BV(PE14)
  497.     #define PORT_PE14       PORTE
  498.     #define DDR_PE14        DDRE
  499.     #define PIN_PE14        PINE
  500.  
  501.     //PE15
  502.     #define BITMASK_PE15    _BV(PE15)
  503.     #define PORT_PE15       PORTE
  504.     #define DDR_PE15        DDRE
  505.     #define PIN_PE15        PINE
  506.  
  507.     //PE16
  508.     #define BITMASK_PE16    _BV(PE16)
  509.     #define PORT_PE16       PORTE
  510.     #define DDR_PE16        DDRE
  511.     #define PIN_PE16        PINE
  512.  
  513.  
  514. //## PORT:F
  515.  
  516.     //PF1
  517.     #define BITMASK_PF1    _BV(PF1)
  518.     #define PORT_PF1       PORTF
  519.     #define DDR_PF1        DDRF
  520.     #define PIN_PF1        PINF
  521.  
  522.     //PF2
  523.     #define BITMASK_PF2    _BV(PF2)
  524.     #define PORT_PF2       PORTF
  525.     #define DDR_PF2        DDRF
  526.     #define PIN_PF2        PINF
  527.  
  528.     //PF3
  529.     #define BITMASK_PF3    _BV(PF3)
  530.     #define PORT_PF3       PORTF
  531.     #define DDR_PF3        DDRF
  532.     #define PIN_PF3        PINF
  533.  
  534.     //PF4
  535.     #define BITMASK_PF4    _BV(PF4)
  536.     #define PORT_PF4       PORTF
  537.     #define DDR_PF4        DDRF
  538.     #define PIN_PF4        PINF
  539.  
  540.     //PF5
  541.     #define BITMASK_PF5    _BV(PF5)
  542.     #define PORT_PF5       PORTF
  543.     #define DDR_PF5        DDRF
  544.     #define PIN_PF5        PINF
  545.  
  546.     //PF6
  547.     #define BITMASK_PF6    _BV(PF6)
  548.     #define PORT_PF6       PORTF
  549.     #define DDR_PF6        DDRF
  550.     #define PIN_PF6        PINF
  551.  
  552.     //PF7
  553.     #define BITMASK_PF7    _BV(PF7)
  554.     #define PORT_PF7       PORTF
  555.     #define DDR_PF7        DDRF
  556.     #define PIN_PF7        PINF
  557.  
  558.     //PF8
  559.     #define BITMASK_PF8    _BV(PF8)
  560.     #define PORT_PF8       PORTF
  561.     #define DDR_PF8        DDRF
  562.     #define PIN_PF8        PINF
  563.  
  564.     //PF9
  565.     #define BITMASK_PF9    _BV(PF9)
  566.     #define PORT_PF9       PORTF
  567.     #define DDR_PF9        DDRF
  568.     #define PIN_PF9        PINF
  569.  
  570.     //PF10
  571.     #define BITMASK_PF10    _BV(PF10)
  572.     #define PORT_PF10       PORTF
  573.     #define DDR_PF10        DDRF
  574.     #define PIN_PF10        PINF
  575.  
  576.     //PF12
  577.     #define BITMASK_PF12    _BV(PF12)
  578.     #define PORT_PF12       PORTF
  579.     #define DDR_PF12        DDRF
  580.     #define PIN_PF12        PINF
  581.  
  582.     //PF13
  583.     #define BITMASK_PF13    _BV(PF13)
  584.     #define PORT_PF13       PORTF
  585.     #define DDR_PF13        DDRF
  586.     #define PIN_PF13        PINF
  587.  
  588.     //PF14
  589.     #define BITMASK_PF14    _BV(PF14)
  590.     #define PORT_PF14       PORTF
  591.     #define DDR_PF14        DDRF
  592.     #define PIN_PF14        PINF
  593.  
  594.     //PF15
  595.     #define BITMASK_PF15    _BV(PF15)
  596.     #define PORT_PF15       PORTF
  597.     #define DDR_PF15        DDRF
  598.     #define PIN_PF15        PINF
  599.  
  600.     //PF16
  601.     #define BITMASK_PF16    _BV(PF16)
  602.     #define PORT_PF16       PORTF
  603.     #define DDR_PF16        DDRF
  604.     #define PIN_PF16        PINF
  605.  
  606.  
  607. //## PORT:G
  608.  
  609.     //PG1
  610.     #define BITMASK_PG1    _BV(PG1)
  611.     #define PORT_PG1       PORTG
  612.     #define DDR_PG1        DDRG
  613.     #define PIN_PG1        PING
  614.  
  615.     //PG2
  616.     #define BITMASK_PG2    _BV(PG2)
  617.     #define PORT_PG2       PORTG
  618.     #define DDR_PG2        DDRG
  619.     #define PIN_PG2        PING
  620.  
  621.     //PG3
  622.     #define BITMASK_PG3    _BV(PG3)
  623.     #define PORT_PG3       PORTG
  624.     #define DDR_PG3        DDRG
  625.     #define PIN_PG3        PING
  626.  
  627.     //PG4
  628.     #define BITMASK_PG4    _BV(PG4)
  629.     #define PORT_PG4       PORTG
  630.     #define DDR_PG4        DDRG
  631.     #define PIN_PG4        PING
  632.  
  633.     //PG5
  634.     #define BITMASK_PG5    _BV(PG5)
  635.     #define PORT_PG5       PORTG
  636.     #define DDR_PG5        DDRG
  637.     #define PIN_PG5        PING
  638.  
  639.     //PG6
  640.     #define BITMASK_PG6    _BV(PG6)
  641.     #define PORT_PG6       PORTG
  642.     #define DDR_PG6        DDRG
  643.     #define PIN_PG6        PING
  644.  
  645.     //PG7
  646.     #define BITMASK_PG7    _BV(PG7)
  647.     #define PORT_PG7       PORTG
  648.     #define DDR_PG7        DDRG
  649.     #define PIN_PG7        PING
  650.  
  651.     //PG8
  652.     #define BITMASK_PG8    _BV(PG8)
  653.     #define PORT_PG8       PORTG
  654.     #define DDR_PG8        DDRG
  655.     #define PIN_PG8        PING
  656.  
  657.     //PG9
  658.     #define BITMASK_PG9    _BV(PG9)
  659.     #define PORT_PG9       PORTG
  660.     #define DDR_PG9        DDRG
  661.     #define PIN_PG9        PING
  662.  
  663.     //PG10
  664.     #define BITMASK_PG10    _BV(PG10)
  665.     #define PORT_PG10       PORTG
  666.     #define DDR_PG10        DDRG
  667.     #define PIN_PG10        PING
  668.  
  669.     //PG12
  670.     #define BITMASK_PG12    _BV(PG12)
  671.     #define PORT_PG12       PORTG
  672.     #define DDR_PG12        DDRG
  673.     #define PIN_PG12        PING
  674.  
  675.     //PG13
  676.     #define BITMASK_PG13    _BV(PG13)
  677.     #define PORT_PG13       PORTG
  678.     #define DDR_PG13        DDRG
  679.     #define PIN_PG13        PING
  680.  
  681.     //PG14
  682.     #define BITMASK_PG14    _BV(PG14)
  683.     #define PORT_PG14       PORTG
  684.     #define DDR_PG14        DDRG
  685.     #define PIN_PG14        PING
  686.  
  687.     //PG15
  688.     #define BITMASK_PG15    _BV(PG15)
  689.     #define PORT_PG15       PORTG
  690.     #define DDR_PG15        DDRG
  691.     #define PIN_PG15        PING
  692.  
  693.     //PG16
  694.     #define BITMASK_PG16    _BV(PG16)
  695.     #define PORT_PG16       PORTG
  696.     #define DDR_PG16        DDRG
  697.     #define PIN_PG16        PING
  698.  
  699.  
  700. //## PORT:H
  701.  
  702.     //PH1
  703.     #define BITMASK_PH1    _BV(PH1)
  704.     #define PORT_PH1       PORTH
  705.     #define DDR_PH1        DDRH
  706.     #define PIN_PH1        PINH
  707.  
  708.     //PH2
  709.     #define BITMASK_PH2    _BV(PH2)
  710.     #define PORT_PH2       PORTH
  711.     #define DDR_PH2        DDRH
  712.     #define PIN_PH2        PINH
  713.  
  714.     //PH3
  715.     #define BITMASK_PH3    _BV(PH3)
  716.     #define PORT_PH3       PORTH
  717.     #define DDR_PH3        DDRH
  718.     #define PIN_PH3        PINH
  719.  
  720.     //PH4
  721.     #define BITMASK_PH4    _BV(PH4)
  722.     #define PORT_PH4       PORTH
  723.     #define DDR_PH4        DDRH
  724.     #define PIN_PH4        PINH
  725.  
  726.     //PH5
  727.     #define BITMASK_PH5    _BV(PH5)
  728.     #define PORT_PH5       PORTH
  729.     #define DDR_PH5        DDRH
  730.     #define PIN_PH5        PINH
  731.  
  732.     //PH6
  733.     #define BITMASK_PH6    _BV(PH6)
  734.     #define PORT_PH6       PORTH
  735.     #define DDR_PH6        DDRH
  736.     #define PIN_PH6        PINH
  737.  
  738.     //PH7
  739.     #define BITMASK_PH7    _BV(PH7)
  740.     #define PORT_PH7       PORTH
  741.     #define DDR_PH7        DDRH
  742.     #define PIN_PH7        PINH
  743.  
  744.     //PH8
  745.     #define BITMASK_PH8    _BV(PH8)
  746.     #define PORT_PH8       PORTH
  747.     #define DDR_PH8        DDRH
  748.     #define PIN_PH8        PINH
  749.  
  750.     //PH9
  751.     #define BITMASK_PH9    _BV(PH9)
  752.     #define PORT_PH9       PORTH
  753.     #define DDR_PH9        DDRH
  754.     #define PIN_PH9        PINH
  755.  
  756.     //PH10
  757.     #define BITMASK_PH10    _BV(PH10)
  758.     #define PORT_PH10       PORTH
  759.     #define DDR_PH10        DDRH
  760.     #define PIN_PH10        PINH
  761.  
  762.     //PH12
  763.     #define BITMASK_PH12    _BV(PH12)
  764.     #define PORT_PH12       PORTH
  765.     #define DDR_PH12        DDRH
  766.     #define PIN_PH12        PINH
  767.  
  768.     //PH13
  769.     #define BITMASK_PH13    _BV(PH13)
  770.     #define PORT_PH13       PORTH
  771.     #define DDR_PH13        DDRH
  772.     #define PIN_PH13        PINH
  773.  
  774.     //PH14
  775.     #define BITMASK_PH14    _BV(PH14)
  776.     #define PORT_PH14       PORTH
  777.     #define DDR_PH14        DDRH
  778.     #define PIN_PH14        PINH
  779.  
  780.     //PH15
  781.     #define BITMASK_PH15    _BV(PH15)
  782.     #define PORT_PH15       PORTH
  783.     #define DDR_PH15        DDRH
  784.     #define PIN_PH15        PINH
  785.  
  786.     //PH16
  787.     #define BITMASK_PH16    _BV(PH16)
  788.     #define PORT_PH16       PORTH
  789.     #define DDR_PH16        DDRH
  790.     #define PIN_PH16        PINH
  791.  
  792.  
  793. //## PORT:I
  794.  
  795.     //PI1
  796.     #define BITMASK_PI1    _BV(PI1)
  797.     #define PORT_PI1       PORTI
  798.     #define DDR_PI1        DDRI
  799.     #define PIN_PI1        PINI
  800.  
  801.     //PI2
  802.     #define BITMASK_PI2    _BV(PI2)
  803.     #define PORT_PI2       PORTI
  804.     #define DDR_PI2        DDRI
  805.     #define PIN_PI2        PINI
  806.  
  807.     //PI3
  808.     #define BITMASK_PI3    _BV(PI3)
  809.     #define PORT_PI3       PORTI
  810.     #define DDR_PI3        DDRI
  811.     #define PIN_PI3        PINI
  812.  
  813.     //PI4
  814.     #define BITMASK_PI4    _BV(PI4)
  815.     #define PORT_PI4       PORTI
  816.     #define DDR_PI4        DDRI
  817.     #define PIN_PI4        PINI
  818.  
  819.     //PI5
  820.     #define BITMASK_PI5    _BV(PI5)
  821.     #define PORT_PI5       PORTI
  822.     #define DDR_PI5        DDRI
  823.     #define PIN_PI5        PINI
  824.  
  825.     //PI6
  826.     #define BITMASK_PI6    _BV(PI6)
  827.     #define PORT_PI6       PORTI
  828.     #define DDR_PI6        DDRI
  829.     #define PIN_PI6        PINI
  830.  
  831.     //PI7
  832.     #define BITMASK_PI7    _BV(PI7)
  833.     #define PORT_PI7       PORTI
  834.     #define DDR_PI7        DDRI
  835.     #define PIN_PI7        PINI
  836.  
  837.     //PI8
  838.     #define BITMASK_PI8    _BV(PI8)
  839.     #define PORT_PI8       PORTI
  840.     #define DDR_PI8        DDRI
  841.     #define PIN_PI8        PINI
  842.  
  843.     //PI9
  844.     #define BITMASK_PI9    _BV(PI9)
  845.     #define PORT_PI9       PORTI
  846.     #define DDR_PI9        DDRI
  847.     #define PIN_PI9        PINI
  848.  
  849.     //PI10
  850.     #define BITMASK_PI10    _BV(PI10)
  851.     #define PORT_PI10       PORTI
  852.     #define DDR_PI10        DDRI
  853.     #define PIN_PI10        PINI
  854.  
  855.     //PI12
  856.     #define BITMASK_PI12    _BV(PI12)
  857.     #define PORT_PI12       PORTI
  858.     #define DDR_PI12        DDRI
  859.     #define PIN_PI12        PINI
  860.  
  861.     //PI13
  862.     #define BITMASK_PI13    _BV(PI13)
  863.     #define PORT_PI13       PORTI
  864.     #define DDR_PI13        DDRI
  865.     #define PIN_PI13        PINI
  866.  
  867.     //PI14
  868.     #define BITMASK_PI14    _BV(PI14)
  869.     #define PORT_PI14       PORTI
  870.     #define DDR_PI14        DDRI
  871.     #define PIN_PI14        PINI
  872.  
  873.     //PI15
  874.     #define BITMASK_PI15    _BV(PI15)
  875.     #define PORT_PI15       PORTI
  876.     #define DDR_PI15        DDRI
  877.     #define PIN_PI15        PINI
  878.  
  879.     //PI16
  880.     #define BITMASK_PI16    _BV(PI16)
  881.     #define PORT_PI16       PORTI
  882.     #define DDR_PI16        DDRI
  883.     #define PIN_PI16        PINI
  884.  
  885.  
  886. //## PORT:J
  887.  
  888.     //PJ1
  889.     #define BITMASK_PJ1    _BV(PJ1)
  890.     #define PORT_PJ1       PORTJ
  891.     #define DDR_PJ1        DDRJ
  892.     #define PIN_PJ1        PINJ
  893.  
  894.     //PJ2
  895.     #define BITMASK_PJ2    _BV(PJ2)
  896.     #define PORT_PJ2       PORTJ
  897.     #define DDR_PJ2        DDRJ
  898.     #define PIN_PJ2        PINJ
  899.  
  900.     //PJ3
  901.     #define BITMASK_PJ3    _BV(PJ3)
  902.     #define PORT_PJ3       PORTJ
  903.     #define DDR_PJ3        DDRJ
  904.     #define PIN_PJ3        PINJ
  905.  
  906.     //PJ4
  907.     #define BITMASK_PJ4    _BV(PJ4)
  908.     #define PORT_PJ4       PORTJ
  909.     #define DDR_PJ4        DDRJ
  910.     #define PIN_PJ4        PINJ
  911.  
  912.     //PJ5
  913.     #define BITMASK_PJ5    _BV(PJ5)
  914.     #define PORT_PJ5       PORTJ
  915.     #define DDR_PJ5        DDRJ
  916.     #define PIN_PJ5        PINJ
  917.  
  918.     //PJ6
  919.     #define BITMASK_PJ6    _BV(PJ6)
  920.     #define PORT_PJ6       PORTJ
  921.     #define DDR_PJ6        DDRJ
  922.     #define PIN_PJ6        PINJ
  923.  
  924.     //PJ7
  925.     #define BITMASK_PJ7    _BV(PJ7)
  926.     #define PORT_PJ7       PORTJ
  927.     #define DDR_PJ7        DDRJ
  928.     #define PIN_PJ7        PINJ
  929.  
  930.     //PJ8
  931.     #define BITMASK_PJ8    _BV(PJ8)
  932.     #define PORT_PJ8       PORTJ
  933.     #define DDR_PJ8        DDRJ
  934.     #define PIN_PJ8        PINJ
  935.  
  936.     //PJ9
  937.     #define BITMASK_PJ9    _BV(PJ9)
  938.     #define PORT_PJ9       PORTJ
  939.     #define DDR_PJ9        DDRJ
  940.     #define PIN_PJ9        PINJ
  941.  
  942.     //PJ10
  943.     #define BITMASK_PJ10    _BV(PJ10)
  944.     #define PORT_PJ10       PORTJ
  945.     #define DDR_PJ10        DDRJ
  946.     #define PIN_PJ10        PINJ
  947.  
  948.     //PJ12
  949.     #define BITMASK_PJ12    _BV(PJ12)
  950.     #define PORT_PJ12       PORTJ
  951.     #define DDR_PJ12        DDRJ
  952.     #define PIN_PJ12        PINJ
  953.  
  954.     //PJ13
  955.     #define BITMASK_PJ13    _BV(PJ13)
  956.     #define PORT_PJ13       PORTJ
  957.     #define DDR_PJ13        DDRJ
  958.     #define PIN_PJ13        PINJ
  959.  
  960.     //PJ14
  961.     #define BITMASK_PJ14    _BV(PJ14)
  962.     #define PORT_PJ14       PORTJ
  963.     #define DDR_PJ14        DDRJ
  964.     #define PIN_PJ14        PINJ
  965.  
  966.     //PJ15
  967.     #define BITMASK_PJ15    _BV(PJ15)
  968.     #define PORT_PJ15       PORTJ
  969.     #define DDR_PJ15        DDRJ
  970.     #define PIN_PJ15        PINJ
  971.  
  972.     //PJ16
  973.     #define BITMASK_PJ16    _BV(PJ16)
  974.     #define PORT_PJ16       PORTJ
  975.     #define DDR_PJ16        DDRJ
  976.     #define PIN_PJ16        PINJ
  977.  
  978.  
  979. //## PORT:K
  980.  
  981.     //PK1
  982.     #define BITMASK_PK1    _BV(PK1)
  983.     #define PORT_PK1       PORTK
  984.     #define DDR_PK1        DDRK
  985.     #define PIN_PK1        PINK
  986.  
  987.     //PK2
  988.     #define BITMASK_PK2    _BV(PK2)
  989.     #define PORT_PK2       PORTK
  990.     #define DDR_PK2        DDRK
  991.     #define PIN_PK2        PINK
  992.  
  993.     //PK3
  994.     #define BITMASK_PK3    _BV(PK3)
  995.     #define PORT_PK3       PORTK
  996.     #define DDR_PK3        DDRK
  997.     #define PIN_PK3        PINK
  998.  
  999.     //PK4
  1000.     #define BITMASK_PK4    _BV(PK4)
  1001.     #define PORT_PK4       PORTK
  1002.     #define DDR_PK4        DDRK
  1003.     #define PIN_PK4        PINK
  1004.  
  1005.     //PK5
  1006.     #define BITMASK_PK5    _BV(PK5)
  1007.     #define PORT_PK5       PORTK
  1008.     #define DDR_PK5        DDRK
  1009.     #define PIN_PK5        PINK
  1010.  
  1011.     //PK6
  1012.     #define BITMASK_PK6    _BV(PK6)
  1013.     #define PORT_PK6       PORTK
  1014.     #define DDR_PK6        DDRK
  1015.     #define PIN_PK6        PINK
  1016.  
  1017.     //PK7
  1018.     #define BITMASK_PK7    _BV(PK7)
  1019.     #define PORT_PK7       PORTK
  1020.     #define DDR_PK7        DDRK
  1021.     #define PIN_PK7        PINK
  1022.  
  1023.     //PK8
  1024.     #define BITMASK_PK8    _BV(PK8)
  1025.     #define PORT_PK8       PORTK
  1026.     #define DDR_PK8        DDRK
  1027.     #define PIN_PK8        PINK
  1028.  
  1029.     //PK9
  1030.     #define BITMASK_PK9    _BV(PK9)
  1031.     #define PORT_PK9       PORTK
  1032.     #define DDR_PK9        DDRK
  1033.     #define PIN_PK9        PINK
  1034.  
  1035.     //PK10
  1036.     #define BITMASK_PK10    _BV(PK10)
  1037.     #define PORT_PK10       PORTK
  1038.     #define DDR_PK10        DDRK
  1039.     #define PIN_PK10        PINK
  1040.  
  1041.     //PK12
  1042.     #define BITMASK_PK12    _BV(PK12)
  1043.     #define PORT_PK12       PORTK
  1044.     #define DDR_PK12        DDRK
  1045.     #define PIN_PK12        PINK
  1046.  
  1047.     //PK13
  1048.     #define BITMASK_PK13    _BV(PK13)
  1049.     #define PORT_PK13       PORTK
  1050.     #define DDR_PK13        DDRK
  1051.     #define PIN_PK13        PINK
  1052.  
  1053.     //PK14
  1054.     #define BITMASK_PK14    _BV(PK14)
  1055.     #define PORT_PK14       PORTK
  1056.     #define DDR_PK14        DDRK
  1057.     #define PIN_PK14        PINK
  1058.  
  1059.     //PK15
  1060.     #define BITMASK_PK15    _BV(PK15)
  1061.     #define PORT_PK15       PORTK
  1062.     #define DDR_PK15        DDRK
  1063.     #define PIN_PK15        PINK
  1064.  
  1065.     //PK16
  1066.     #define BITMASK_PK16    _BV(PK16)
  1067.     #define PORT_PK16       PORTK
  1068.     #define DDR_PK16        DDRK
  1069.     #define PIN_PK16        PINK
  1070.  
  1071.  
  1072. //## PORT:L
  1073.  
  1074.     //PL1
  1075.     #define BITMASK_PL1    _BV(PL1)
  1076.     #define PORT_PL1       PORTL
  1077.     #define DDR_PL1        DDRL
  1078.     #define PIN_PL1        PINL
  1079.  
  1080.     //PL2
  1081.     #define BITMASK_PL2    _BV(PL2)
  1082.     #define PORT_PL2       PORTL
  1083.     #define DDR_PL2        DDRL
  1084.     #define PIN_PL2        PINL
  1085.  
  1086.     //PL3
  1087.     #define BITMASK_PL3    _BV(PL3)
  1088.     #define PORT_PL3       PORTL
  1089.     #define DDR_PL3        DDRL
  1090.     #define PIN_PL3        PINL
  1091.  
  1092.     //PL4
  1093.     #define BITMASK_PL4    _BV(PL4)
  1094.     #define PORT_PL4       PORTL
  1095.     #define DDR_PL4        DDRL
  1096.     #define PIN_PL4        PINL
  1097.  
  1098.     //PL5
  1099.     #define BITMASK_PL5    _BV(PL5)
  1100.     #define PORT_PL5       PORTL
  1101.     #define DDR_PL5        DDRL
  1102.     #define PIN_PL5        PINL
  1103.  
  1104.     //PL6
  1105.     #define BITMASK_PL6    _BV(PL6)
  1106.     #define PORT_PL6       PORTL
  1107.     #define DDR_PL6        DDRL
  1108.     #define PIN_PL6        PINL
  1109.  
  1110.     //PL7
  1111.     #define BITMASK_PL7    _BV(PL7)
  1112.     #define PORT_PL7       PORTL
  1113.     #define DDR_PL7        DDRL
  1114.     #define PIN_PL7        PINL
  1115.  
  1116.     //PL8
  1117.     #define BITMASK_PL8    _BV(PL8)
  1118.     #define PORT_PL8       PORTL
  1119.     #define DDR_PL8        DDRL
  1120.     #define PIN_PL8        PINL
  1121.  
  1122.     //PL9
  1123.     #define BITMASK_PL9    _BV(PL9)
  1124.     #define PORT_PL9       PORTL
  1125.     #define DDR_PL9        DDRL
  1126.     #define PIN_PL9        PINL
  1127.  
  1128.     //PL10
  1129.     #define BITMASK_PL10    _BV(PL10)
  1130.     #define PORT_PL10       PORTL
  1131.     #define DDR_PL10        DDRL
  1132.     #define PIN_PL10        PINL
  1133.  
  1134.     //PL12
  1135.     #define BITMASK_PL12    _BV(PL12)
  1136.     #define PORT_PL12       PORTL
  1137.     #define DDR_PL12        DDRL
  1138.     #define PIN_PL12        PINL
  1139.  
  1140.     //PL13
  1141.     #define BITMASK_PL13    _BV(PL13)
  1142.     #define PORT_PL13       PORTL
  1143.     #define DDR_PL13        DDRL
  1144.     #define PIN_PL13        PINL
  1145.  
  1146.     //PL14
  1147.     #define BITMASK_PL14    _BV(PL14)
  1148.     #define PORT_PL14       PORTL
  1149.     #define DDR_PL14        DDRL
  1150.     #define PIN_PL14        PINL
  1151.  
  1152.     //PL15
  1153.     #define BITMASK_PL15    _BV(PL15)
  1154.     #define PORT_PL15       PORTL
  1155.     #define DDR_PL15        DDRL
  1156.     #define PIN_PL15        PINL
  1157.  
  1158.     //PL16
  1159.     #define BITMASK_PL16    _BV(PL16)
  1160.     #define PORT_PL16       PORTL
  1161.     #define DDR_PL16        DDRL
  1162.     #define PIN_PL16        PINL
  1163.  
  1164.  
  1165. //## PORT:M
  1166.  
  1167.     //PM1
  1168.     #define BITMASK_PM1    _BV(PM1)
  1169.     #define PORT_PM1       PORTM
  1170.     #define DDR_PM1        DDRM
  1171.     #define PIN_PM1        PINM
  1172.  
  1173.     //PM2
  1174.     #define BITMASK_PM2    _BV(PM2)
  1175.     #define PORT_PM2       PORTM
  1176.     #define DDR_PM2        DDRM
  1177.     #define PIN_PM2        PINM
  1178.  
  1179.     //PM3
  1180.     #define BITMASK_PM3    _BV(PM3)
  1181.     #define PORT_PM3       PORTM
  1182.     #define DDR_PM3        DDRM
  1183.     #define PIN_PM3        PINM
  1184.  
  1185.     //PM4
  1186.     #define BITMASK_PM4    _BV(PM4)
  1187.     #define PORT_PM4       PORTM
  1188.     #define DDR_PM4        DDRM
  1189.     #define PIN_PM4        PINM
  1190.  
  1191.     //PM5
  1192.     #define BITMASK_PM5    _BV(PM5)
  1193.     #define PORT_PM5       PORTM
  1194.     #define DDR_PM5        DDRM
  1195.     #define PIN_PM5        PINM
  1196.  
  1197.     //PM6
  1198.     #define BITMASK_PM6    _BV(PM6)
  1199.     #define PORT_PM6       PORTM
  1200.     #define DDR_PM6        DDRM
  1201.     #define PIN_PM6        PINM
  1202.  
  1203.     //PM7
  1204.     #define BITMASK_PM7    _BV(PM7)
  1205.     #define PORT_PM7       PORTM
  1206.     #define DDR_PM7        DDRM
  1207.     #define PIN_PM7        PINM
  1208.  
  1209.     //PM8
  1210.     #define BITMASK_PM8    _BV(PM8)
  1211.     #define PORT_PM8       PORTM
  1212.     #define DDR_PM8        DDRM
  1213.     #define PIN_PM8        PINM
  1214.  
  1215.     //PM9
  1216.     #define BITMASK_PM9    _BV(PM9)
  1217.     #define PORT_PM9       PORTM
  1218.     #define DDR_PM9        DDRM
  1219.     #define PIN_PM9        PINM
  1220.  
  1221.     //PM10
  1222.     #define BITMASK_PM10    _BV(PM10)
  1223.     #define PORT_PM10       PORTM
  1224.     #define DDR_PM10        DDRM
  1225.     #define PIN_PM10        PINM
  1226.  
  1227.     //PM12
  1228.     #define BITMASK_PM12    _BV(PM12)
  1229.     #define PORT_PM12       PORTM
  1230.     #define DDR_PM12        DDRM
  1231.     #define PIN_PM12        PINM
  1232.  
  1233.     //PM13
  1234.     #define BITMASK_PM13    _BV(PM13)
  1235.     #define PORT_PM13       PORTM
  1236.     #define DDR_PM13        DDRM
  1237.     #define PIN_PM13        PINM
  1238.  
  1239.     //PM14
  1240.     #define BITMASK_PM14    _BV(PM14)
  1241.     #define PORT_PM14       PORTM
  1242.     #define DDR_PM14        DDRM
  1243.     #define PIN_PM14        PINM
  1244.  
  1245.     //PM15
  1246.     #define BITMASK_PM15    _BV(PM15)
  1247.     #define PORT_PM15       PORTM
  1248.     #define DDR_PM15        DDRM
  1249.     #define PIN_PM15        PINM
  1250.  
  1251.     //PM16
  1252.     #define BITMASK_PM16    _BV(PM16)
  1253.     #define PORT_PM16       PORTM
  1254.     #define DDR_PM16        DDRM
  1255.     #define PIN_PM16        PINM
  1256.  
  1257.  
  1258. //## PORT:N
  1259.  
  1260.     //PN1
  1261.     #define BITMASK_PN1    _BV(PN1)
  1262.     #define PORT_PN1       PORTN
  1263.     #define DDR_PN1        DDRN
  1264.     #define PIN_PN1        PINN
  1265.  
  1266.     //PN2
  1267.     #define BITMASK_PN2    _BV(PN2)
  1268.     #define PORT_PN2       PORTN
  1269.     #define DDR_PN2        DDRN
  1270.     #define PIN_PN2        PINN
  1271.  
  1272.     //PN3
  1273.     #define BITMASK_PN3    _BV(PN3)
  1274.     #define PORT_PN3       PORTN
  1275.     #define DDR_PN3        DDRN
  1276.     #define PIN_PN3        PINN
  1277.  
  1278.     //PN4
  1279.     #define BITMASK_PN4    _BV(PN4)
  1280.     #define PORT_PN4       PORTN
  1281.     #define DDR_PN4        DDRN
  1282.     #define PIN_PN4        PINN
  1283.  
  1284.     //PN5
  1285.     #define BITMASK_PN5    _BV(PN5)
  1286.     #define PORT_PN5       PORTN
  1287.     #define DDR_PN5        DDRN
  1288.     #define PIN_PN5        PINN
  1289.  
  1290.     //PN6
  1291.     #define BITMASK_PN6    _BV(PN6)
  1292.     #define PORT_PN6       PORTN
  1293.     #define DDR_PN6        DDRN
  1294.     #define PIN_PN6        PINN
  1295.  
  1296.     //PN7
  1297.     #define BITMASK_PN7    _BV(PN7)
  1298.     #define PORT_PN7       PORTN
  1299.     #define DDR_PN7        DDRN
  1300.     #define PIN_PN7        PINN
  1301.  
  1302.     //PN8
  1303.     #define BITMASK_PN8    _BV(PN8)
  1304.     #define PORT_PN8       PORTN
  1305.     #define DDR_PN8        DDRN
  1306.     #define PIN_PN8        PINN
  1307.  
  1308.     //PN9
  1309.     #define BITMASK_PN9    _BV(PN9)
  1310.     #define PORT_PN9       PORTN
  1311.     #define DDR_PN9        DDRN
  1312.     #define PIN_PN9        PINN
  1313.  
  1314.     //PN10
  1315.     #define BITMASK_PN10    _BV(PN10)
  1316.     #define PORT_PN10       PORTN
  1317.     #define DDR_PN10        DDRN
  1318.     #define PIN_PN10        PINN
  1319.  
  1320.     //PN12
  1321.     #define BITMASK_PN12    _BV(PN12)
  1322.     #define PORT_PN12       PORTN
  1323.     #define DDR_PN12        DDRN
  1324.     #define PIN_PN12        PINN
  1325.  
  1326.     //PN13
  1327.     #define BITMASK_PN13    _BV(PN13)
  1328.     #define PORT_PN13       PORTN
  1329.     #define DDR_PN13        DDRN
  1330.     #define PIN_PN13        PINN
  1331.  
  1332.     //PN14
  1333.     #define BITMASK_PN14    _BV(PN14)
  1334.     #define PORT_PN14       PORTN
  1335.     #define DDR_PN14        DDRN
  1336.     #define PIN_PN14        PINN
  1337.  
  1338.     //PN15
  1339.     #define BITMASK_PN15    _BV(PN15)
  1340.     #define PORT_PN15       PORTN
  1341.     #define DDR_PN15        DDRN
  1342.     #define PIN_PN15        PINN
  1343.  
  1344.     //PN16
  1345.     #define BITMASK_PN16    _BV(PN16)
  1346.     #define PORT_PN16       PORTN
  1347.     #define DDR_PN16        DDRN
  1348.     #define PIN_PN16        PINN
  1349.  
  1350.  
  1351. //## PORT:O
  1352.  
  1353.     //PO1
  1354.     #define BITMASK_PO1    _BV(PO1)
  1355.     #define PORT_PO1       PORTO
  1356.     #define DDR_PO1        DDRO
  1357.     #define PIN_PO1        PINO
  1358.  
  1359.     //PO2
  1360.     #define BITMASK_PO2    _BV(PO2)
  1361.     #define PORT_PO2       PORTO
  1362.     #define DDR_PO2        DDRO
  1363.     #define PIN_PO2        PINO
  1364.  
  1365.     //PO3
  1366.     #define BITMASK_PO3    _BV(PO3)
  1367.     #define PORT_PO3       PORTO
  1368.     #define DDR_PO3        DDRO
  1369.     #define PIN_PO3        PINO
  1370.  
  1371.     //PO4
  1372.     #define BITMASK_PO4    _BV(PO4)
  1373.     #define PORT_PO4       PORTO
  1374.     #define DDR_PO4        DDRO
  1375.     #define PIN_PO4        PINO
  1376.  
  1377.     //PO5
  1378.     #define BITMASK_PO5    _BV(PO5)
  1379.     #define PORT_PO5       PORTO
  1380.     #define DDR_PO5        DDRO
  1381.     #define PIN_PO5        PINO
  1382.  
  1383.     //PO6
  1384.     #define BITMASK_PO6    _BV(PO6)
  1385.     #define PORT_PO6       PORTO
  1386.     #define DDR_PO6        DDRO
  1387.     #define PIN_PO6        PINO
  1388.  
  1389.     //PO7
  1390.     #define BITMASK_PO7    _BV(PO7)
  1391.     #define PORT_PO7       PORTO
  1392.     #define DDR_PO7        DDRO
  1393.     #define PIN_PO7        PINO
  1394.  
  1395.     //PO8
  1396.     #define BITMASK_PO8    _BV(PO8)
  1397.     #define PORT_PO8       PORTO
  1398.     #define DDR_PO8        DDRO
  1399.     #define PIN_PO8        PINO
  1400.  
  1401.     //PO9
  1402.     #define BITMASK_PO9    _BV(PO9)
  1403.     #define PORT_PO9       PORTO
  1404.     #define DDR_PO9        DDRO
  1405.     #define PIN_PO9        PINO
  1406.  
  1407.     //PO10
  1408.     #define BITMASK_PO10    _BV(PO10)
  1409.     #define PORT_PO10       PORTO
  1410.     #define DDR_PO10        DDRO
  1411.     #define PIN_PO10        PINO
  1412.  
  1413.     //PO12
  1414.     #define BITMASK_PO12    _BV(PO12)
  1415.     #define PORT_PO12       PORTO
  1416.     #define DDR_PO12        DDRO
  1417.     #define PIN_PO12        PINO
  1418.  
  1419.     //PO13
  1420.     #define BITMASK_PO13    _BV(PO13)
  1421.     #define PORT_PO13       PORTO
  1422.     #define DDR_PO13        DDRO
  1423.     #define PIN_PO13        PINO
  1424.  
  1425.     //PO14
  1426.     #define BITMASK_PO14    _BV(PO14)
  1427.     #define PORT_PO14       PORTO
  1428.     #define DDR_PO14        DDRO
  1429.     #define PIN_PO14        PINO
  1430.  
  1431.     //PO15
  1432.     #define BITMASK_PO15    _BV(PO15)
  1433.     #define PORT_PO15       PORTO
  1434.     #define DDR_PO15        DDRO
  1435.     #define PIN_PO15        PINO
  1436.  
  1437.     //PO16
  1438.     #define BITMASK_PO16    _BV(PO16)
  1439.     #define PORT_PO16       PORTO
  1440.     #define DDR_PO16        DDRO
  1441.     #define PIN_PO16        PINO
  1442.  
  1443.  
  1444. //## PORT:P
  1445.  
  1446.     //PP1
  1447.     #define BITMASK_PP1    _BV(PP1)
  1448.     #define PORT_PP1       PORTP
  1449.     #define DDR_PP1        DDRP
  1450.     #define PIN_PP1        PINP
  1451.  
  1452.     //PP2
  1453.     #define BITMASK_PP2    _BV(PP2)
  1454.     #define PORT_PP2       PORTP
  1455.     #define DDR_PP2        DDRP
  1456.     #define PIN_PP2        PINP
  1457.  
  1458.     //PP3
  1459.     #define BITMASK_PP3    _BV(PP3)
  1460.     #define PORT_PP3       PORTP
  1461.     #define DDR_PP3        DDRP
  1462.     #define PIN_PP3        PINP
  1463.  
  1464.     //PP4
  1465.     #define BITMASK_PP4    _BV(PP4)
  1466.     #define PORT_PP4       PORTP
  1467.     #define DDR_PP4        DDRP
  1468.     #define PIN_PP4        PINP
  1469.  
  1470.     //PP5
  1471.     #define BITMASK_PP5    _BV(PP5)
  1472.     #define PORT_PP5       PORTP
  1473.     #define DDR_PP5        DDRP
  1474.     #define PIN_PP5        PINP
  1475.  
  1476.     //PP6
  1477.     #define BITMASK_PP6    _BV(PP6)
  1478.     #define PORT_PP6       PORTP
  1479.     #define DDR_PP6        DDRP
  1480.     #define PIN_PP6        PINP
  1481.  
  1482.     //PP7
  1483.     #define BITMASK_PP7    _BV(PP7)
  1484.     #define PORT_PP7       PORTP
  1485.     #define DDR_PP7        DDRP
  1486.     #define PIN_PP7        PINP
  1487.  
  1488.     //PP8
  1489.     #define BITMASK_PP8    _BV(PP8)
  1490.     #define PORT_PP8       PORTP
  1491.     #define DDR_PP8        DDRP
  1492.     #define PIN_PP8        PINP
  1493.  
  1494.     //PP9
  1495.     #define BITMASK_PP9    _BV(PP9)
  1496.     #define PORT_PP9       PORTP
  1497.     #define DDR_PP9        DDRP
  1498.     #define PIN_PP9        PINP
  1499.  
  1500.     //PP10
  1501.     #define BITMASK_PP10    _BV(PP10)
  1502.     #define PORT_PP10       PORTP
  1503.     #define DDR_PP10        DDRP
  1504.     #define PIN_PP10        PINP
  1505.  
  1506.     //PP12
  1507.     #define BITMASK_PP12    _BV(PP12)
  1508.     #define PORT_PP12       PORTP
  1509.     #define DDR_PP12        DDRP
  1510.     #define PIN_PP12        PINP
  1511.  
  1512.     //PP13
  1513.     #define BITMASK_PP13    _BV(PP13)
  1514.     #define PORT_PP13       PORTP
  1515.     #define DDR_PP13        DDRP
  1516.     #define PIN_PP13        PINP
  1517.  
  1518.     //PP14
  1519.     #define BITMASK_PP14    _BV(PP14)
  1520.     #define PORT_PP14       PORTP
  1521.     #define DDR_PP14        DDRP
  1522.     #define PIN_PP14        PINP
  1523.  
  1524.     //PP15
  1525.     #define BITMASK_PP15    _BV(PP15)
  1526.     #define PORT_PP15       PORTP
  1527.     #define DDR_PP15        DDRP
  1528.     #define PIN_PP15        PINP
  1529.  
  1530.     //PP16
  1531.     #define BITMASK_PP16    _BV(PP16)
  1532.     #define PORT_PP16       PORTP
  1533.     #define DDR_PP16        DDRP
  1534.     #define PIN_PP16        PINP
  1535.  
  1536.  
  1537.  
  1538.  
  1539. // ~~~~~~~~~ EXAMPLE ~~~~~~~~~~~
  1540. /*
  1541.  
  1542.  
  1543. // Example blink code for Arduino UNO 16MHz
  1544. #define F_CPU 16000000UL // For delay.h to function
  1545. #include <avr/io.h> // PIN, DDR, PORT defs
  1546. #include <util/delay.h> //_delay_ms()
  1547. #include "./AVRAugment_io.h"
  1548. #define LED13 B5 // Only need to change this to swap pins
  1549. #define DDR_13  SET_DDR( LED13, 0xFF ) //IN=0x00, OUT=0xFF
  1550. #define ON_13   SET_PORT( LED13, 0xFF ) //LOW=0x00, HIGH=0xFF
  1551. #define OFF_13  SET_PORT( LED13, 0x00 ) //LOW=0x00, HIGH=0xFF
  1552. int main(void)
  1553. {
  1554.     DDR_13;
  1555.     ON_13;
  1556.     while(1)
  1557.     {
  1558.         _delay_ms(2000);
  1559.         OFF_13;
  1560.         _delay_ms(2000);
  1561.         ON_13;
  1562.     }
  1563. }
  1564.  
  1565.  
  1566. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement