-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathatm32u4_pins.h
116 lines (103 loc) · 2.71 KB
/
atm32u4_pins.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
/**********************************************************
** atm328_pins.h
**
** Abstract pin names and definitions for ATMega 328 family
**
*/
#ifndef _CONFIG_H_
# error "Include config.h instead of this file"
#endif
#ifndef _HW_ARDUINO_H_
#define _HW_ARDUINO_H_
#include <avr/io.h>
// SPI port defs
#define SPI_PORT PORTB
#define SPI_PIN PINB
#define SPI_DDR DDRB
#define SPI_SS CCSEL
#define SPI_MOSI 2
#define SPI_MISO 3
#define SPI_SCLK 1
// GDO0 connection
#if( GDO0==INT2 )
#define GDO0_DDR DDRD
#define GDO0_PORT PORTD
#define GDO0_PIN PIND
#define GDO0_IN ( 1 << PD2 )
#elif( GDO0==INT3 )
#define GDO0_DDR DDRD
#define GDO0_PORT PORTD
#define GDO0_PIN PIND
#define GDO0_IN ( 1 << PD3 )
#else
#error "GDO0 not mapped"
#endif
// GDO2 connection
#if( GDO2==INT3 )
#define GDO2_DDR DDRD
#define GDO2_PORT PORTD
#define GDO2_PIN PIND
#define GDO2_IN ( 1 << PD3 )
#elif( GDO2==INT2 )
#define GDO2_DDR DDRD
#define GDO2_PORT PORTD
#define GDO2_PIN PIND
#define GDO2_IN ( 1 << PD2 )
#else
#error "GDO2 not mapped"
#endif
// GDO0 interrupt
#if( GDO0==INT2 )
#define GDO0_INT_MASK ( 1 << INT2 )
#define GDO0_INT_VECT INT2_vect
#define GDO0_INT_ISCn0 ( 1 << ISC20 )
#define GDO0_INT_ISCn1 ( 1 << ISC21 )
#elif( GDO0==INT3 )
#define GDO0_INT_MASK ( 1 << INT3 )
#define GDO0_INT_VECT INT3_vect
#define GDO0_INT_ISCn0 ( 1 << ISC30 )
#define GDO0_INT_ISCn1 ( 1 << ISC31 )
#else
#error "GDO2 not mapped"
#endif
// GDO2 interrupt
#if( GDO2==INT3 )
#define GDO2_INT_MASK ( 1 << INT3 )
#define GDO2_INT_VECT INT3_vect
#define GDO2_INT_ISCn0 ( 1 << ISC30 )
#define GDO2_INT_ISCn1 ( 1 << ISC31 )
#elif( GDO2==INT2 )
#define GDO2_INT_MASK ( 1 << INT2 )
#define GDO2_INT_VECT INT2_vect
#define GDO2_INT_ISCn0 ( 1 << ISC20 )
#define GDO2_INT_ISCn1 ( 1 << ISC21 )
#else
#error "GDO2 not mapped"
#endif
#if defined(SWUART)
// Software interrupt
#define SW_INT_ENBL ( 1<<PCIE0 )
#define SW_INT_VECT PCINT0_vect
#define SW_INT_MASK PCMSK0
#define SW_INT_PORT PORTB
#define SW_INT_PIN PINB
#define SW_INT_DDR DDRB
#define SW_INT_IN ( 1<<PORTB4 )
#endif // SWUART
// Some debug pins
#define DEBUG_PORT PORTF
#define DEBUG_DDR DDRF
#define DEBUG_PIN1 ( 1<<PORTF7 )
#define DEBUG_PIN2 ( 1<<PORTF6 )
#define DEBUG_PIN3 ( 1<<PORTF5 )
#define DEBUG_PIN4 ( 1<<PORTF4 )
#define DEBUG_PIN5 ( 1<<PORTF1 )
#define DEBUG_PIN6 ( 1<<PORTF0 )
// TTY USB
#define TTY_USB
// LED
#define HAS_LED
#define LED_DDR DDRC
#define LED_PORT PORTC
#define LED_PIN 7
#endif