You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
//On the Artemis Mega, what you see is what you get pin-to-pad on the Apollo3
35
+
0,
36
+
1,
37
+
2,
38
+
3,
39
+
4,
40
+
5,
41
+
6,
42
+
7,
43
+
8,
44
+
9,
45
+
10,
46
+
11,
47
+
12,
48
+
13,
49
+
14,
50
+
15,
51
+
16,
52
+
17,
53
+
18,
54
+
19,
55
+
20,
56
+
21,
57
+
22,
58
+
23,
59
+
24,
60
+
25,
61
+
26,
62
+
27,
63
+
28,
64
+
29,
65
+
AP3_GPIO_PAD_UNUSED, //The one pad not broken out of the Apollo3 on the Artemis
66
+
31,
67
+
32,
68
+
33,
69
+
34,
70
+
35,
71
+
36,
72
+
37,
73
+
38,
74
+
39,
75
+
40,
76
+
41,
77
+
42,
78
+
43,
79
+
44,
80
+
45,
81
+
46,
82
+
47,
83
+
48,
84
+
49,
85
+
};
86
+
87
+
// Uart Definitions
88
+
//Serial(instance, RX, TX)
89
+
//
90
+
// Commented out because we don't know which pins should be used on the Artemis module
91
+
//
92
+
// Uart Serial(0, 23, 22); // Declares a Uart object called Serial using instance 0 of Apollo3 UART peripherals with RX on variant pin 23 and TX on pin 24 (note, you specify *pins* not Apollo3 pads. This uses the variant's pin map to determine the Apollo3 pad)
93
+
// Uart Serial1(1, 0, 1); // Declares a Uart object called Serial1 using instance 1 of Apollo3 UART peripherals with RX on pin 0 and TX on pin 1 (note, you specify *pins* not Apollo3 pads. This uses the variant's pin map to determine the Apollo3 pad)
94
+
95
+
96
+
// Pin aliasing using the const uint8_t approach
97
+
//
98
+
// const uint8_t A0 = 16; // means that "A0" is equivalent to saying *pin* 16 (which culd map to any Apollo3 *pad*)
// - "HardwareSerial" is the class that is built into Arduino to allow "Serial.print()"
70
+
// and related functions to work.
71
+
// - The "Uart" class inherits from HardwareSerial and contains Apollo3-specific code
72
+
// - Declaring your Uart objects here makes them available in any Arduino code and you
73
+
// can give them extra descriptive names
74
+
// - The maximum number of Uarts is 2 (instances 0 and 1)
75
+
//
76
+
// In this case the declarations are commented out because we don't know which pins of
77
+
// the Artemis module you would like to use
78
+
classUart; // Forward declaration of Uart class
79
+
// extern Uart Serial;
80
+
// extern Uart Serial1;
81
+
82
+
// A note about IOMaster peripherals:
83
+
// - IOMaster peripherals are used to provide either SPI or I2C communications. The pads
84
+
// of the Apollo3 that a given IOMaster [0,5] use are not configurable
85
+
86
+
// Wire defines
87
+
// - Wire is the I2C class for Arduino.
88
+
// - Wire is handled differently than HardwareSerial/Uart because Wire is a library that
89
+
// you have to include manually (saves space if you won't be using I2C)
90
+
// - In this case we rely on communication between the variant.h file and the Wire library
91
+
// through the use of #define statements
92
+
//
93
+
// - Define the total number of TwoWire class objects that you will allow the user on the board.
94
+
// - The maximum number is 6 because the Apollo3 incudes 6 IOMaster peripherals
95
+
#defineWIRE_INTERFACES_COUNT6
96
+
//
97
+
// - Define settings for as many Wire objects as you defined above, the only required value AP3_Wire[X]_IOM
98
+
// - Note: in this example each Wire object uses the same number IOMaster but that is not required.
99
+
// Any "#define AP3_Wire[X]_IOM Y" statement is valid for Y [0,5] and X [1,5] (or no X for the first "Wire")
100
+
// - Note: Wire objects will appear in order, so if WIRE_INTERFACES_COUNT = 3 then you must define the IOM #
101
+
// for Wire, Wire1, and Wire2
102
+
#defineAP3_Wire_IOM0// Secify that Wire uses IOMaster instance 0
103
+
#defineAP3_Wire1_IOM1// Secify that Wire1 uses IOMaster instance 1
104
+
#defineAP3_Wire2_IOM2// Secify that Wire2 uses IOMaster instance 2
105
+
#defineAP3_Wire3_IOM3// Secify that Wire3 uses IOMaster instance 3
106
+
#defineAP3_Wire4_IOM4// Secify that Wire4 uses IOMaster instance 4
107
+
#defineAP3_Wire5_IOM5// Secify that Wire5 uses IOMaster instance 5
108
+
// This is also a convenient location to provide some aliased names for certain Wire objects
109
+
// For example: (examples commented out because they aren't real)
110
+
//
111
+
// #define WireQwiic Wire // Giving Wire an alias of "WireQwiic" to indicat that it is the I2C controller for the Qwiic bus
112
+
// #define WireAccel Wire1 // Useful if the variant has an onboard accelerometer connected to the Wire1 bus
113
+
114
+
// SPI Defines
115
+
// Like Wire SPI is an optional library so we have to rely on #define statements
116
+
// - Define the total number of SPI class objects that you will allow the user on the board.
117
+
// - The maximum number is 6 because the Apollo3 incudes 6 IOMaster peripherals
118
+
#defineSPI_INTERFACES_COUNT6
119
+
//
120
+
// - For each defined SPI interface (SPI, SPI1, SPI2, SPI3, SPI4, SPI5) in order up to SPI_INTERFACES_COUNT
121
+
// you need to specify two settings:
122
+
// - - AP3_SPI_IOM - which IOMaster peripher the SPI object will use
123
+
// - - AP3_SPI_DUP - which duplex mode the SPI object will use (full duplex is the most common, ap3_spi_tx_only and ap3_spi_rx_only are the other options )
124
+
#defineAP3_SPI_IOM0
125
+
#defineAP3_SPI_DUP ap3_spi_full_duplex
126
+
#defineAP3_SPI1_IOM1
127
+
#defineAP3_SPI1_DUP ap3_spi_full_duplex
128
+
#defineAP3_SPI2_IOM2
129
+
#defineAP3_SPI2_DUP ap3_spi_full_duplex
130
+
#defineAP3_SPI3_IOM3
131
+
#defineAP3_SPI3_DUP ap3_spi_full_duplex
132
+
#defineAP3_SPI4_IOM4
133
+
#defineAP3_SPI4_DUP ap3_spi_full_duplex
134
+
#defineAP3_SPI5_IOM5
135
+
#defineAP3_SPI5_DUP ap3_spi_full_duplex
136
+
137
+
138
+
// Additional Pin Aliasing
139
+
// - It is required that every pin is accessible by a number between 0 and (AP3_VARIANT_NUM_PINS - 1)
140
+
// - You are optionally allowed to provide other ways to refer to those pin #s
141
+
// - - One way is to use a #define. This is good because it takes no program space, but you should be
142
+
// careful of name conflicts
143
+
// - - Another way is to use a const uint8_t variable. This will allow the compiler to warn you about
144
+
// name conflicts but it will use a byte of program space
145
+
// - You should alias Arduino *pin* numbers, not Apollo3 *pad* numbers
146
+
//
147
+
// Here is an example of how the #define technique is used to match the available pins of an Arduino Uno
148
+
//
149
+
// // Mapping of analog pins to digital pins of variant
150
+
// #define A0 16 // means that "A0" is equivalent to saying *pin* 16 (which culd map to any Apollo3 *pad*)
151
+
// #define A1 17
152
+
// #define A2 18
153
+
// #define A3 19
154
+
// #define A4 20
155
+
// #define A5 21
156
+
//
157
+
// When using the const uint8_t method you'll need to use 'extern'
158
+
// extern const uint8_t A0;
159
+
// extern const uint8_t A1;
160
+
// extern const uint8_t A2;
161
+
// extern const uint8_t A3;
162
+
// extern const uint8_t A4;
163
+
// extern const uint8_t A5;
164
+
165
+
// Many Arduino cores provide a built-in LED for quick verification, like in the Blink sketch
0 commit comments