SimpleFOClibrary  2.1
samd21_wo_associations.h
Go to the documentation of this file.
1 
2 
3 struct wo_association {
4  EPortType port;
5  uint32_t pin;
6  ETCChannel tccE;
7  uint8_t woE;
8  ETCChannel tccF;
9  uint8_t woF;
10 };
11 
12 
13 
14 #ifdef _SAMD21_
15 
16 
17 
18 #ifndef TCC3_CH0
19 #define TCC3_CH0 NOT_ON_TIMER
20 #endif
21 #ifndef TCC3_CH1
22 #define TCC3_CH1 NOT_ON_TIMER
23 #endif
24 #ifndef TCC3_CH2
25 #define TCC3_CH2 NOT_ON_TIMER
26 #endif
27 #ifndef TCC3_CH3
28 #define TCC3_CH3 NOT_ON_TIMER
29 #endif
30 #ifndef TCC3_CH4
31 #define TCC3_CH4 NOT_ON_TIMER
32 #endif
33 #ifndef TCC3_CH5
34 #define TCC3_CH5 NOT_ON_TIMER
35 #endif
36 #ifndef TCC3_CH6
37 #define TCC3_CH6 NOT_ON_TIMER
38 #endif
39 #ifndef TCC3_CH7
40 #define TCC3_CH7 NOT_ON_TIMER
41 #endif
42 #ifndef TC6_CH0
43 #define TC6_CH0 NOT_ON_TIMER
44 #endif
45 #ifndef TC6_CH1
46 #define TC6_CH1 NOT_ON_TIMER
47 #endif
48 #ifndef TC7_CH0
49 #define TC7_CH0 NOT_ON_TIMER
50 #endif
51 #ifndef TC7_CH1
52 #define TC7_CH1 NOT_ON_TIMER
53 #endif
54 
55 
56 /*
57  * For SAM D21 A/B/C/D Variant Devices and SAM DA1 A/B Variant Devices
58  * Good for SAMD2xE, SAMD2xG and SAMD2xJ devices. Other SAMD21s currently not supported in arduino anyway?
59  *
60  * Note: only the pins which have timers associated are listed in this table.
61  * You can use the values from g_APinDescription.ulPort and g_APinDescription.ulPin to find the correct row in the table.
62  *
63  * See Microchip Technology datasheet DS40001882F-page 30
64  */
65 struct wo_association WO_associations[] = {
66 
67  { PORTA, 0, TCC2_CH0, 0, NOT_ON_TIMER, 0},
68  { PORTA, 1, TCC2_CH1, 1, NOT_ON_TIMER, 0},
69  { PORTA, 2, NOT_ON_TIMER, 0, TCC3_CH0, 0},
70  { PORTA, 3, NOT_ON_TIMER, 0, TCC3_CH1, 1},
71  // PB04, PB05, PB06, PB07 - no timers
72  { PORTB, 8, TC4_CH0, 0, TCC3_CH6, 6},
73  { PORTB, 9, TC4_CH1, 1, TCC3_CH7, 7},
74  { PORTA, 4, TCC0_CH0, 0, TCC3_CH2, 2},
75  { PORTA, 5, TCC0_CH1, 1, TCC3_CH3, 3},
76  { PORTA, 6, TCC1_CH0, 0, TCC3_CH4, 4},
77  { PORTA, 7, TCC1_CH1, 1, TCC3_CH5, 5},
78  { PORTA, 8, TCC0_CH0, 0, TCC1_CH2, 2},
79  { PORTA, 9, TCC0_CH1, 1, TCC1_CH3, 3},
80  { PORTA, 10, TCC1_CH0, 0, TCC0_CH2, 2},
81  { PORTA, 11, TCC1_CH1, 1, TCC0_CH3, 3},
82  { PORTB, 10, TC5_CH0, 0, TCC0_CH4, 4},
83  { PORTB, 11, TC5_CH1, 1, TCC0_CH5, 5},
84  { PORTB, 12, TC4_CH0, 0, TCC0_CH6, 6},
85  { PORTB, 13, TC4_CH1, 1, TCC0_CH7, 7},
86  { PORTB, 14, TC5_CH0, 0, NOT_ON_TIMER, 0},
87  { PORTB, 15, TC5_CH1, 1, NOT_ON_TIMER, 0},
88  { PORTA, 12, TCC2_CH0, 0, TCC0_CH6, 6},
89  { PORTA, 13, TCC2_CH1, 1, TCC0_CH7, 7},
90  { PORTA, 14, TC3_CH0, 0, TCC0_CH4, 4},
91  { PORTA, 15, TC3_CH1, 1, TCC0_CH5, 5},
92  { PORTA, 16, TCC2_CH0, 0, TCC0_CH6, 6},
93  { PORTA, 17, TCC2_CH1, 1, TCC0_CH7, 7},
94  { PORTA, 18, TC3_CH0, 0, TCC0_CH2, 2},
95  { PORTA, 19, TC3_CH1, 1, TCC0_CH3, 3},
96  { PORTB, 16, TC6_CH0, 0, TCC0_CH4, 4},
97  { PORTB, 17, TC6_CH1, 1, TCC0_CH5, 5},
98  { PORTA, 20, TC7_CH0, 0, TCC0_CH6, 6},
99  { PORTA, 21, TC7_CH1, 1, TCC0_CH7, 7},
100  { PORTA, 22, TC4_CH0, 0, TCC0_CH4, 4},
101  { PORTA, 23, TC4_CH1, 1, TCC0_CH5, 5},
102  { PORTA, 24, TC5_CH0, 0, TCC1_CH2, 2},
103  { PORTA, 25, TC5_CH1, 1, TCC1_CH3, 3},
104  { PORTB, 22, TC7_CH0, 0, TCC3_CH0, 0},
105  { PORTB, 23, TC7_CH1, 1, TCC3_CH1, 1},
106  { PORTA, 27, NOT_ON_TIMER, 0, TCC3_CH6, 6},
107  { PORTA, 28, NOT_ON_TIMER, 0, TCC3_CH7, 7},
108  { PORTA, 30, TCC1_CH0, 0, TCC3_CH4, 4},
109  { PORTA, 31, TCC1_CH1, 1, TCC3_CH5, 5},
110  { PORTB, 30, TCC0_CH0, 0, TCC1_CH2, 2},
111  { PORTB, 31, TCC0_CH1, 1, TCC1_CH3, 3},
112  { PORTB, 0, TC7_CH0, 0, NOT_ON_TIMER, 0},
113  { PORTB, 1, TC7_CH1, 1, NOT_ON_TIMER, 0},
114  { PORTB, 2, TC6_CH0, 0, TCC3_CH2, 2},
115  { PORTB, 3, TC6_CH1, 1, TCC3_CH3, 3}
116 };
117 #define NUM_WO_ASSOCIATIONS 48
118 
119 wo_association ASSOCIATION_NOT_FOUND = { NOT_A_PORT, 0, NOT_ON_TIMER, 0, NOT_ON_TIMER, 0};
120 
121 
122 struct wo_association& getWOAssociation(EPortType port, uint32_t pin) {
123  for (int i=0;i<NUM_WO_ASSOCIATIONS;i++) {
124  if (WO_associations[i].port==port && WO_associations[i].pin==pin)
125  return WO_associations[i];
126  }
127  return ASSOCIATION_NOT_FOUND;
128 };
129 
130 
131 #endif
wo_association::pin
uint32_t pin
Definition: samd21_wo_associations.h:5
wo_association::woE
uint8_t woE
Definition: samd21_wo_associations.h:7
wo_association
Definition: samd21_wo_associations.h:3
wo_association::tccE
ETCChannel tccE
Definition: samd21_wo_associations.h:6
wo_association::tccF
ETCChannel tccF
Definition: samd21_wo_associations.h:8
wo_association::woF
uint8_t woF
Definition: samd21_wo_associations.h:9
wo_association::port
EPortType port
Definition: samd21_wo_associations.h:4