1
+ /* Portenta Breakout Carrier Library for Arduino =
2
+
3
+ Arduino Library for the Arduino Portenta Breakout Carrier
4
+
5
+ For more information about this library please visit us at https://www.arduino.cc/en/Reference/PortentaBreakoutCarrier
6
+
7
+ == License ==
8
+
9
+ Copyright (c) 2021 Arduino SA. All rights reserved.
10
+
11
+ This library is free software; you can redistribute it and/or
12
+ modify it under the terms of the GNU Lesser General Public
13
+ License as published by the Free Software Foundation; either
14
+ version 2.1 of the License, or (at your option) any later version.
15
+
16
+ This library is distributed in the hope that it will be useful,
17
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
18
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19
+ Lesser General Public License for more details.
20
+
21
+ You should have received a copy of the GNU Lesser General Public
22
+ License along with this library; if not, write to the Free Software
23
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24
+ */
25
+
26
+ #ifndef _BREAKOUT_CARRIER_H
27
+ #define _BREAKOUT_CARRIER_H
28
+ #include " Arduino.h"
29
+ #include " mbed.h"
30
+ #define PK_7_pox LEDB
31
+ typedef enum {
32
+ SPI0_CS = -1 ,
33
+ SPI0_CK = -1 ,
34
+ SPI0_MISO = -1 ,
35
+ SPI0_MOSI = -1 ,
36
+ SPI1_CS = PK_7_pox + 129 ,
37
+ SPI1_CK = PK_7_pox + 130 ,
38
+ SPI1_MISO = PK_7_pox + 35 ,
39
+ SPI1_MOSI = PK_7_pox + 36 ,
40
+ UART2_TX = PK_7_pox + 111 ,
41
+ UART2_RX = PK_7_pox+ 106 ,
42
+ UART2_RTS = -1 ,
43
+ UART2_CTS = -1 ,
44
+ UART3_TX = PK_7_pox + 153 ,
45
+ UART3_RX = PK_7_pox + 154 ,
46
+ UART3_RTS = -1 ,
47
+ UART3_CTS = -1 ,
48
+ PCIE_TXN = -1 ,
49
+ PCIE_TXP = -1 ,
50
+ PCIE_RXN = -1 ,
51
+ PCIE_RXP = -1 ,
52
+ PCIE_CKN = -1 ,
53
+ PCIE_CKP = -1 ,
54
+ I2S_SDO = PK_7_pox + 132 ,
55
+ I2S_SDI = PK_7_pox + 131 ,
56
+ I2S_WS = PK_7_pox + 26 ,
57
+ I2S_CK = PK_7_pox + 52 ,
58
+ SAI_D1 = -1 ,
59
+ SAI_D0 = PK_7_pox + 135 ,
60
+ SAI_FS = PK_7_pox + 136 ,
61
+ SAI_SCK = PK_7_pox + 134 ,
62
+ CAMERA_D0P = PK_7_pox + 123 ,
63
+ CAMERA_D0N = PK_7_pox + 122 ,
64
+ CAMERA_D1P = PK_7_pox + 125 ,
65
+ CAMERA_D1N = PK_7_pox + 124 ,
66
+ CAMERA_D2P = PK_7_pox + 133 ,
67
+ CAMERA_D2N = PK_7_pox + 127 ,
68
+ CAMERA_D3P = PK_7_pox + 136 ,
69
+ CAMERA_D3N = PK_7_pox + 135 ,
70
+ CAMERA_CKP = PK_7_pox + 134 ,
71
+ CAMERA_CKN = PK_7_pox + 7 ,
72
+ CAMERA_HS = PK_7_pox + 5 ,
73
+ PDM_D1 = -1 ,
74
+ PDM_D0 = PK_7_pox + 19 ,
75
+ PDM_CK = PK_7_pox + 67 ,
76
+ SPDIF_RX = -1 ,
77
+ SPDIF_TX= -1 ,
78
+ USBHS_ID = PK_7_pox + 151 ,
79
+ USBHS_DN = -1 ,
80
+ USBHS_DP = -1 ,
81
+ USBFS_ID = -1 ,
82
+ USBFS_DN = PK_7_pox + 13 ,
83
+ USBFS_DP = PK_7_pox + 12 ,
84
+ SD_WP = -1 ,
85
+ SD_CD = -1 ,
86
+ SD_D0 = PK_7_pox + 31 ,
87
+ SD_D3 = PK_7_pox + 21 ,
88
+ SD_CMD = PK_7_pox + 56 ,
89
+ SD_D2 = PK_7_pox + 20 ,
90
+ SD_CLK = PK_7_pox + 55 ,
91
+ SD_D1 = PK_7_pox + 32 ,
92
+ SD_VSD = -1 ,
93
+ ETHERNET_DP = -1 ,
94
+ ETHERNET_DN = -1 ,
95
+ ETHERNET_CN = -1 ,
96
+ ETHERNET_CP = -1 ,
97
+ ETHERNET_BN = -1 ,
98
+ ETHERNET_BP = -1 ,
99
+ ETHERNET_AN = -1 ,
100
+ ETHERNET_AP = -1 ,
101
+ ETHERNET_L2 = -1 ,
102
+ ETHERNET_L1 = -1 ,
103
+ UART0_TX = PK_7_pox + 1 ,
104
+ UART0_RX = PK_7_pox + 138 ,
105
+ UART0_RTS = PK_7_pox + 139 ,
106
+ UART0_CTS = PK_7_pox + 142 ,
107
+ UART1_TX = PK_7_pox + 10 ,
108
+ UART1_RX = PK_7_pox + 11 ,
109
+ UART1_RTS = PK_7_pox + 143 ,
110
+ UART1_CTS = PK_7_pox + 144 ,
111
+ DISPLAY_D3P = -1 ,
112
+ DISPLAY_D3N = -1 ,
113
+ DISPLAY_D2P = -1 ,
114
+ DISPLAY_D2N = -1 ,
115
+ DISPLAY_D1P = -1 ,
116
+ DISPLAY_D1N = -1 ,
117
+ DISPLAY_D0P = -1 ,
118
+ DISPLAY_D0N = -1 ,
119
+ DISPLAY_CLK_P = -1 ,
120
+ DISPLAY_CLK_N = -1 ,
121
+ CAN0_TX = -1 ,
122
+ CAN0_RX = -1 ,
123
+ CAN1_TX = PK_7_pox + 126 ,
124
+ CAN1_RX = PK_7_pox + 25 ,
125
+ I2C_SDA_1 = PK_7_pox + 24 ,
126
+ I2C_SCL_1 = PK_7_pox + 23 ,
127
+ I2C_SDA_0 = PK_7_pox + 121 ,
128
+ I2C_SCL_0 = PK_7_pox + 120 ,
129
+ I2C_SDA_2 = PK_7_pox + 125 ,
130
+ I2C_SCL_2 = PK_7_pox + 124 ,
131
+ GPIO_0 = PK_7_pox + 46 ,
132
+ GPIO_1 = PK_7_pox + 48 ,
133
+ GPIO_2 = PK_7_pox + 53 ,
134
+ GPIO_3 = PK_7_pox + 54 ,
135
+ GPIO_4 = PK_7_pox + 68 ,
136
+ GPIO_5 = PK_7_pox + 100 ,
137
+ GPIO_6 = PK_7_pox + 107 ,
138
+ ANALOG_REFN = -1 ,
139
+ ANALOG_REFP = -1 ,
140
+ ANALOG_A7 = PK_7_pox + 7 ,
141
+ ANALOG_A6 = PK_7_pox + 5 ,
142
+ ANALOG_A5 = PK_7_pox + 36 ,
143
+ ANALOG_A4 = PK_7_pox + 35 ,
144
+ ANALOG_A3 = PK_7_pox + 36 ,
145
+ ANALOG_A2 = PK_7_pox + 35 ,
146
+ ANALOG_A1 = PK_7_pox + 2 ,
147
+ ANALOG_A0 = PK_7_pox + 1 ,
148
+ PWM9 = PK_7_pox + 119 ,
149
+ PWM8 = PK_7_pox + 155 ,
150
+ PWM7 = PK_7_pox + 152 ,
151
+ PWM6 = PK_7_pox + 128 ,
152
+ PWM5 = PK_7_pox + 162 ,
153
+ PWM4 = PK_7_pox + 156 ,
154
+ PWM3 = PK_7_pox + 104 ,
155
+ PWM2 = PK_7_pox + 39 ,
156
+ PWM1 = PK_7_pox + 38 ,
157
+ PWM0 = PK_7_pox + 9 ,
158
+ TRST = -1 ,
159
+ TRACEDATA_0 = PK_7_pox + 68 ,
160
+ TRACEDATA_1 = PK_7_pox + 111 ,
161
+ TRACEDATA_CLK = PK_7_pox + 67 ,
162
+ USB_FLAG = -1 ,
163
+ USB_EN = -1
164
+ };
165
+
166
+ class BreakoutCarrierClass {
167
+ public:
168
+ pin_size_t getPin (int pin) {
169
+ if (pin > -1 ) {
170
+ return digitalPinToPinName (pin);
171
+ }
172
+ return 0 ;
173
+ }
174
+
175
+ int setPinMode (int pin, PinMode mode) {
176
+ if (pin > -1 ) {
177
+ pinMode (digitalPinToPinName (pin), mode);
178
+ return 1 ;
179
+ }
180
+ return -1 ;
181
+ }
182
+ int GPIOWrite (int pin, PinStatus status) {
183
+ if (pin > -1 ) {
184
+ digitalWrite (digitalPinToPinName (pin), status);
185
+ return 1 ;
186
+ }
187
+ return -1 ;
188
+ }
189
+ bool GPIORead (int pin){
190
+ if (pin > -1 ) {
191
+ return digitalRead (digitalPinToPinName (pin));
192
+ }
193
+ return -1 ;
194
+ }
195
+ };
196
+
197
+ BreakoutCarrierClass Breakout;
198
+
199
+ #endif // _BREAKOUT_CARRIER_H
0 commit comments