Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit a2369aa

Browse files
committedNov 28, 2024·
add variant for the ROBOTIS OpenRB-150.
1 parent 993398c commit a2369aa

File tree

7 files changed

+945
-0
lines changed

7 files changed

+945
-0
lines changed
 
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#
2+
# Arduino Zero OpenOCD script.
3+
#
4+
# Copyright (c) 2014-2015 Arduino LLC. All right reserved.
5+
#
6+
# This library is free software; you can redistribute it and/or
7+
# modify it under the terms of the GNU Lesser General Public
8+
# License as published by the Free Software Foundation; either
9+
# version 2.1 of the License, or (at your option) any later version.
10+
#
11+
# This library is distributed in the hope that it will be useful,
12+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14+
# See the GNU Lesser General Public License for more details.
15+
#
16+
# You should have received a copy of the GNU Lesser General Public
17+
# License along with this library; if not, write to the Free Software
18+
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19+
#
20+
21+
# Define 'reset' command
22+
define reset
23+
24+
info reg
25+
26+
break main
27+
28+
# End of 'reset' command
29+
end
30+
31+
target remote | openocd -c "interface cmsis-dap" -c "set CHIPNAME at91samd21g18" -f target/at91samdXX.cfg -c "gdb_port pipe; log_output openocd.log"
Lines changed: 216 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,216 @@
1+
/*
2+
Copyright (c) 2014-2015 Arduino LLC. All right reserved.
3+
4+
This library is free software; you can redistribute it and/or
5+
modify it under the terms of the GNU Lesser General Public
6+
License as published by the Free Software Foundation; either
7+
version 2.1 of the License, or (at your option) any later version.
8+
9+
This library is distributed in the hope that it will be useful,
10+
but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12+
See the GNU Lesser General Public License for more details.
13+
14+
You should have received a copy of the GNU Lesser General Public
15+
License along with this library; if not, write to the Free Software
16+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17+
*/
18+
19+
/* Linker script to configure memory regions.
20+
* Need modifying for a specific board.
21+
* FLASH.ORIGIN: starting address of flash
22+
* FLASH.LENGTH: length of flash
23+
* RAM.ORIGIN: starting address of RAM bank 0
24+
* RAM.LENGTH: length of RAM bank 0
25+
*/
26+
MEMORY
27+
{
28+
FLASH (rx) : ORIGIN = 0x00000000+0x2000, LENGTH = 0x00040000-0x2000 /* First 8KB used by bootloader */
29+
RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00008000
30+
}
31+
32+
/* Linker script to place sections and symbol values. Should be used together
33+
* with other linker script that defines memory regions FLASH and RAM.
34+
* It references following symbols, which must be defined in code:
35+
* Reset_Handler : Entry of reset handler
36+
*
37+
* It defines following symbols, which code can use without definition:
38+
* __exidx_start
39+
* __exidx_end
40+
* __copy_table_start__
41+
* __copy_table_end__
42+
* __zero_table_start__
43+
* __zero_table_end__
44+
* __etext
45+
* __data_start__
46+
* __preinit_array_start
47+
* __preinit_array_end
48+
* __init_array_start
49+
* __init_array_end
50+
* __fini_array_start
51+
* __fini_array_end
52+
* __data_end__
53+
* __bss_start__
54+
* __bss_end__
55+
* __end__
56+
* end
57+
* __HeapLimit
58+
* __StackLimit
59+
* __StackTop
60+
* __stack
61+
*/
62+
ENTRY(Reset_Handler)
63+
64+
SECTIONS
65+
{
66+
.text :
67+
{
68+
__text_start__ = .;
69+
70+
KEEP(*(.sketch_boot))
71+
72+
. = ALIGN(0x2000);
73+
KEEP(*(.isr_vector))
74+
*(.text*)
75+
76+
KEEP(*(.init))
77+
KEEP(*(.fini))
78+
79+
/* .ctors */
80+
*crtbegin.o(.ctors)
81+
*crtbegin?.o(.ctors)
82+
*(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors)
83+
*(SORT(.ctors.*))
84+
*(.ctors)
85+
86+
/* .dtors */
87+
*crtbegin.o(.dtors)
88+
*crtbegin?.o(.dtors)
89+
*(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors)
90+
*(SORT(.dtors.*))
91+
*(.dtors)
92+
93+
*(.rodata*)
94+
95+
KEEP(*(.eh_frame*))
96+
} > FLASH
97+
98+
.ARM.extab :
99+
{
100+
*(.ARM.extab* .gnu.linkonce.armextab.*)
101+
} > FLASH
102+
103+
__exidx_start = .;
104+
.ARM.exidx :
105+
{
106+
*(.ARM.exidx* .gnu.linkonce.armexidx.*)
107+
} > FLASH
108+
__exidx_end = .;
109+
110+
/* To copy multiple ROM to RAM sections,
111+
* uncomment .copy.table section and,
112+
* define __STARTUP_COPY_MULTIPLE in startup_ARMCMx.S */
113+
/*
114+
.copy.table :
115+
{
116+
. = ALIGN(4);
117+
__copy_table_start__ = .;
118+
LONG (__etext)
119+
LONG (__data_start__)
120+
LONG (__data_end__ - __data_start__)
121+
LONG (__etext2)
122+
LONG (__data2_start__)
123+
LONG (__data2_end__ - __data2_start__)
124+
__copy_table_end__ = .;
125+
} > FLASH
126+
*/
127+
128+
/* To clear multiple BSS sections,
129+
* uncomment .zero.table section and,
130+
* define __STARTUP_CLEAR_BSS_MULTIPLE in startup_ARMCMx.S */
131+
/*
132+
.zero.table :
133+
{
134+
. = ALIGN(4);
135+
__zero_table_start__ = .;
136+
LONG (__bss_start__)
137+
LONG (__bss_end__ - __bss_start__)
138+
LONG (__bss2_start__)
139+
LONG (__bss2_end__ - __bss2_start__)
140+
__zero_table_end__ = .;
141+
} > FLASH
142+
*/
143+
144+
__etext = .;
145+
146+
.data : AT (__etext)
147+
{
148+
__data_start__ = .;
149+
*(vtable)
150+
*(.data*)
151+
152+
. = ALIGN(4);
153+
/* preinit data */
154+
PROVIDE_HIDDEN (__preinit_array_start = .);
155+
KEEP(*(.preinit_array))
156+
PROVIDE_HIDDEN (__preinit_array_end = .);
157+
158+
. = ALIGN(4);
159+
/* init data */
160+
PROVIDE_HIDDEN (__init_array_start = .);
161+
KEEP(*(SORT(.init_array.*)))
162+
KEEP(*(.init_array))
163+
PROVIDE_HIDDEN (__init_array_end = .);
164+
165+
166+
. = ALIGN(4);
167+
/* finit data */
168+
PROVIDE_HIDDEN (__fini_array_start = .);
169+
KEEP(*(SORT(.fini_array.*)))
170+
KEEP(*(.fini_array))
171+
PROVIDE_HIDDEN (__fini_array_end = .);
172+
173+
KEEP(*(.jcr*))
174+
. = ALIGN(16);
175+
/* All data end */
176+
__data_end__ = .;
177+
178+
} > RAM
179+
180+
.bss :
181+
{
182+
. = ALIGN(4);
183+
__bss_start__ = .;
184+
*(.bss*)
185+
*(COMMON)
186+
. = ALIGN(4);
187+
__bss_end__ = .;
188+
} > RAM
189+
190+
.heap (COPY):
191+
{
192+
__end__ = .;
193+
PROVIDE(end = .);
194+
*(.heap*)
195+
__HeapLimit = .;
196+
} > RAM
197+
198+
/* .stack_dummy section doesn't contains any symbols. It is only
199+
* used for linker to calculate size of stack sections, and assign
200+
* values to stack symbols later */
201+
.stack_dummy (COPY):
202+
{
203+
*(.stack*)
204+
} > RAM
205+
206+
/* Set stack top to end of RAM, and stack limit move down by
207+
* size of stack_dummy section */
208+
__StackTop = ORIGIN(RAM) + LENGTH(RAM);
209+
__StackLimit = __StackTop - SIZEOF(.stack_dummy);
210+
PROVIDE(__stack = __StackTop);
211+
212+
__ram_end__ = ORIGIN(RAM) + LENGTH(RAM) -1 ;
213+
214+
/* Check if data + heap + stack exceeds RAM limit */
215+
ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack")
216+
}
Lines changed: 214 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,214 @@
1+
/*
2+
Copyright (c) 2014-2015 Arduino LLC. All right reserved.
3+
4+
This library is free software; you can redistribute it and/or
5+
modify it under the terms of the GNU Lesser General Public
6+
License as published by the Free Software Foundation; either
7+
version 2.1 of the License, or (at your option) any later version.
8+
9+
This library is distributed in the hope that it will be useful,
10+
but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12+
See the GNU Lesser General Public License for more details.
13+
14+
You should have received a copy of the GNU Lesser General Public
15+
License along with this library; if not, write to the Free Software
16+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17+
*/
18+
19+
/* Linker script to configure memory regions.
20+
* Need modifying for a specific board.
21+
* FLASH.ORIGIN: starting address of flash
22+
* FLASH.LENGTH: length of flash
23+
* RAM.ORIGIN: starting address of RAM bank 0
24+
* RAM.LENGTH: length of RAM bank 0
25+
*/
26+
MEMORY
27+
{
28+
FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x00040000
29+
RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00008000
30+
}
31+
32+
/* Linker script to place sections and symbol values. Should be used together
33+
* with other linker script that defines memory regions FLASH and RAM.
34+
* It references following symbols, which must be defined in code:
35+
* Reset_Handler : Entry of reset handler
36+
*
37+
* It defines following symbols, which code can use without definition:
38+
* __exidx_start
39+
* __exidx_end
40+
* __copy_table_start__
41+
* __copy_table_end__
42+
* __zero_table_start__
43+
* __zero_table_end__
44+
* __etext
45+
* __data_start__
46+
* __preinit_array_start
47+
* __preinit_array_end
48+
* __init_array_start
49+
* __init_array_end
50+
* __fini_array_start
51+
* __fini_array_end
52+
* __data_end__
53+
* __bss_start__
54+
* __bss_end__
55+
* __end__
56+
* end
57+
* __HeapLimit
58+
* __StackLimit
59+
* __StackTop
60+
* __stack
61+
* __ram_end__
62+
*/
63+
ENTRY(Reset_Handler)
64+
65+
SECTIONS
66+
{
67+
.text :
68+
{
69+
__text_start__ = .;
70+
71+
KEEP(*(.isr_vector))
72+
*(.text*)
73+
74+
KEEP(*(.init))
75+
KEEP(*(.fini))
76+
77+
/* .ctors */
78+
*crtbegin.o(.ctors)
79+
*crtbegin?.o(.ctors)
80+
*(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors)
81+
*(SORT(.ctors.*))
82+
*(.ctors)
83+
84+
/* .dtors */
85+
*crtbegin.o(.dtors)
86+
*crtbegin?.o(.dtors)
87+
*(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors)
88+
*(SORT(.dtors.*))
89+
*(.dtors)
90+
91+
*(.rodata*)
92+
93+
KEEP(*(.eh_frame*))
94+
} > FLASH
95+
96+
.ARM.extab :
97+
{
98+
*(.ARM.extab* .gnu.linkonce.armextab.*)
99+
} > FLASH
100+
101+
__exidx_start = .;
102+
.ARM.exidx :
103+
{
104+
*(.ARM.exidx* .gnu.linkonce.armexidx.*)
105+
} > FLASH
106+
__exidx_end = .;
107+
108+
/* To copy multiple ROM to RAM sections,
109+
* uncomment .copy.table section and,
110+
* define __STARTUP_COPY_MULTIPLE in startup_ARMCMx.S */
111+
/*
112+
.copy.table :
113+
{
114+
. = ALIGN(4);
115+
__copy_table_start__ = .;
116+
LONG (__etext)
117+
LONG (__data_start__)
118+
LONG (__data_end__ - __data_start__)
119+
LONG (__etext2)
120+
LONG (__data2_start__)
121+
LONG (__data2_end__ - __data2_start__)
122+
__copy_table_end__ = .;
123+
} > FLASH
124+
*/
125+
126+
/* To clear multiple BSS sections,
127+
* uncomment .zero.table section and,
128+
* define __STARTUP_CLEAR_BSS_MULTIPLE in startup_ARMCMx.S */
129+
/*
130+
.zero.table :
131+
{
132+
. = ALIGN(4);
133+
__zero_table_start__ = .;
134+
LONG (__bss_start__)
135+
LONG (__bss_end__ - __bss_start__)
136+
LONG (__bss2_start__)
137+
LONG (__bss2_end__ - __bss2_start__)
138+
__zero_table_end__ = .;
139+
} > FLASH
140+
*/
141+
142+
__etext = .;
143+
144+
.data : AT (__etext)
145+
{
146+
__data_start__ = .;
147+
*(vtable)
148+
*(.data*)
149+
150+
. = ALIGN(4);
151+
/* preinit data */
152+
PROVIDE_HIDDEN (__preinit_array_start = .);
153+
KEEP(*(.preinit_array))
154+
PROVIDE_HIDDEN (__preinit_array_end = .);
155+
156+
. = ALIGN(4);
157+
/* init data */
158+
PROVIDE_HIDDEN (__init_array_start = .);
159+
KEEP(*(SORT(.init_array.*)))
160+
KEEP(*(.init_array))
161+
PROVIDE_HIDDEN (__init_array_end = .);
162+
163+
164+
. = ALIGN(4);
165+
/* finit data */
166+
PROVIDE_HIDDEN (__fini_array_start = .);
167+
KEEP(*(SORT(.fini_array.*)))
168+
KEEP(*(.fini_array))
169+
PROVIDE_HIDDEN (__fini_array_end = .);
170+
171+
KEEP(*(.jcr*))
172+
. = ALIGN(16);
173+
/* All data end */
174+
__data_end__ = .;
175+
176+
} > RAM
177+
178+
.bss :
179+
{
180+
. = ALIGN(4);
181+
__bss_start__ = .;
182+
*(.bss*)
183+
*(COMMON)
184+
. = ALIGN(4);
185+
__bss_end__ = .;
186+
} > RAM
187+
188+
.heap (COPY):
189+
{
190+
__end__ = .;
191+
PROVIDE(end = .);
192+
*(.heap*)
193+
__HeapLimit = .;
194+
} > RAM
195+
196+
/* .stack_dummy section doesn't contains any symbols. It is only
197+
* used for linker to calculate size of stack sections, and assign
198+
* values to stack symbols later */
199+
.stack_dummy (COPY):
200+
{
201+
*(.stack*)
202+
} > RAM
203+
204+
/* Set stack top to end of RAM, and stack limit move down by
205+
* size of stack_dummy section */
206+
__StackTop = ORIGIN(RAM) + LENGTH(RAM) ;
207+
__StackLimit = __StackTop - SIZEOF(.stack_dummy);
208+
PROVIDE(__stack = __StackTop);
209+
210+
__ram_end__ = ORIGIN(RAM) + LENGTH(RAM) -1 ;
211+
212+
/* Check if data + heap + stack exceeds RAM limit */
213+
ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack")
214+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#
2+
# Arduino Zero OpenOCD script.
3+
#
4+
# Copyright (c) 2014-2015 Arduino LLC. All right reserved.
5+
#
6+
# This library is free software; you can redistribute it and/or
7+
# modify it under the terms of the GNU Lesser General Public
8+
# License as published by the Free Software Foundation; either
9+
# version 2.1 of the License, or (at your option) any later version.
10+
#
11+
# This library is distributed in the hope that it will be useful,
12+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14+
# See the GNU Lesser General Public License for more details.
15+
#
16+
# You should have received a copy of the GNU Lesser General Public
17+
# License along with this library; if not, write to the Free Software
18+
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19+
#
20+
21+
source [find interface/cmsis-dap.cfg]
22+
23+
# chip name
24+
set CHIPNAME at91samd21g18
25+
set ENDIAN little
26+
27+
# choose a port here
28+
set telnet_port 0
29+
30+
source [find target/at91samdXX.cfg]

‎variants/openrb_150/pins_arduino.h

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/*
2+
Copyright (c) 2011 Arduino. All right reserved.
3+
4+
This library is free software; you can redistribute it and/or
5+
modify it under the terms of the GNU Lesser General Public
6+
License as published by the Free Software Foundation; either
7+
version 2.1 of the License, or (at your option) any later version.
8+
9+
This library is distributed in the hope that it will be useful,
10+
but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12+
See the GNU Lesser General Public License for more details.
13+
14+
You should have received a copy of the GNU Lesser General Public
15+
License along with this library; if not, write to the Free Software
16+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17+
*/
18+
19+
// API compatibility
20+
#include "variant.h"
21+

‎variants/openrb_150/variant.cpp

Lines changed: 202 additions & 0 deletions
Large diffs are not rendered by default.

‎variants/openrb_150/variant.h

Lines changed: 231 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,231 @@
1+
/*
2+
Copyright (c) 2014-2015 Arduino LLC. All right reserved.
3+
4+
This library is free software; you can redistribute it and/or
5+
modify it under the terms of the GNU Lesser General Public
6+
License as published by the Free Software Foundation; either
7+
version 2.1 of the License, or (at your option) any later version.
8+
9+
This library is distributed in the hope that it will be useful,
10+
but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12+
See the GNU Lesser General Public License for more details.
13+
14+
You should have received a copy of the GNU Lesser General Public
15+
License along with this library; if not, write to the Free Software
16+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17+
*/
18+
19+
#pragma once
20+
21+
// The definitions here needs a SAMD core >=1.6.10
22+
#define ARDUINO_SAMD_VARIANT_COMPLIANCE 10610
23+
24+
#include <WVariant.h>
25+
26+
// General definitions
27+
// -------------------
28+
29+
// Frequency of the board main oscillator
30+
#define VARIANT_MAINOSC (32768ul)
31+
32+
// Master clock frequency
33+
#define VARIANT_MCK (48000000ul)
34+
35+
// Pins
36+
// ----
37+
38+
// Number of pins defined in PinDescription array
39+
#ifdef __cplusplus
40+
extern "C" unsigned int PINCOUNT_fn();
41+
#endif
42+
#define PINS_COUNT (PINCOUNT_fn())
43+
#define NUM_DIGITAL_PINS (15u)
44+
#define NUM_ANALOG_INPUTS (7u)
45+
#define NUM_ANALOG_OUTPUTS (1u)
46+
47+
// Low-level pin register query macros
48+
// -----------------------------------
49+
#define digitalPinToPort(P) (&(PORT->Group[g_APinDescription[P].ulPort]))
50+
#define digitalPinToBitMask(P) (1 << g_APinDescription[P].ulPin)
51+
//#define analogInPinToBit(P) ()
52+
#define portOutputRegister(port) (&(port->OUT.reg))
53+
#define portInputRegister(port) (&(port->IN.reg))
54+
#define portModeRegister(port) (&(port->DIR.reg))
55+
#define digitalPinHasPWM(P) (g_APinDescription[P].ulPWMChannel != NOT_ON_PWM || g_APinDescription[P].ulTCChannel != NOT_ON_TIMER)
56+
57+
/*
58+
* digitalPinToTimer(..) is AVR-specific and is not defined for SAMD
59+
* architecture. If you need to check if a pin supports PWM you must
60+
* use digitalPinHasPWM(..).
61+
*
62+
* https://github.com/arduino/Arduino/issues/1833
63+
*/
64+
// #define digitalPinToTimer(P)
65+
66+
//Battery
67+
#define ADC_BATTERY (33u)
68+
69+
// LEDs
70+
// ----
71+
#define PIN_LED (32u)
72+
#define LED_BUILTIN PIN_LED
73+
74+
// DYNAMIXEL POWER FET
75+
#define BDPIN_DXL_PWR_EN (31u)
76+
77+
// Analog pins
78+
// -----------
79+
#define PIN_A0 (15u)
80+
#define PIN_A1 (16u)
81+
#define PIN_A2 (17u)
82+
#define PIN_A3 (18u)
83+
#define PIN_A4 (19u)
84+
#define PIN_A5 (20u)
85+
#define PIN_A6 (21u)
86+
static const uint8_t A0 = PIN_A0;
87+
static const uint8_t A1 = PIN_A1;
88+
static const uint8_t A2 = PIN_A2;
89+
static const uint8_t A3 = PIN_A3;
90+
static const uint8_t A4 = PIN_A4;
91+
static const uint8_t A5 = PIN_A5;
92+
static const uint8_t A6 = PIN_A6;
93+
#define ADC_RESOLUTION 12
94+
95+
// SPI Interfaces
96+
// --------------
97+
#define SPI_INTERFACES_COUNT 1
98+
99+
// SPI
100+
#define PIN_SPI_MISO (10u)
101+
#define PIN_SPI_MOSI (8u)
102+
#define PIN_SPI_SCK (9u)
103+
#define PIN_SPI_SS (4u)
104+
#define PERIPH_SPI sercom1
105+
#define PAD_SPI_TX SPI_PAD_0_SCK_1
106+
#define PAD_SPI_RX SERCOM_RX_PAD_3
107+
108+
static const uint8_t SS = PIN_SPI_SS; // SPI Slave SS not used. Set here only for reference.
109+
static const uint8_t MOSI = PIN_SPI_MOSI;
110+
static const uint8_t MISO = PIN_SPI_MISO;
111+
static const uint8_t SCK = PIN_SPI_SCK;
112+
113+
// SPI1: Connected to SD
114+
// #define PIN_SPI1_MISO (29u)
115+
// #define PIN_SPI1_MOSI (26u)
116+
// #define PIN_SPI1_SCK (27u)
117+
// #define PIN_SPI1_SS (28u)
118+
// #define PERIPH_SPI1 sercom4
119+
// #define PAD_SPI1_TX SPI_PAD_0_SCK_1
120+
// #define PAD_SPI1_RX SERCOM_RX_PAD_3
121+
// static const uint8_t SS1 = PIN_SPI1_SS;
122+
// static const uint8_t MOSI1 = PIN_SPI1_MOSI;
123+
// static const uint8_t MISO1 = PIN_SPI1_MISO;
124+
// static const uint8_t SCK1 = PIN_SPI1_SCK;
125+
126+
// Needed for SD library
127+
// #define SDCARD_SPI SPI1
128+
// #define SDCARD_MISO_PIN PIN_SPI1_MISO
129+
// #define SDCARD_MOSI_PIN PIN_SPI1_MOSI
130+
// #define SDCARD_SCK_PIN PIN_SPI1_SCK
131+
// #define SDCARD_SS_PIN PIN_SPI1_SS
132+
133+
// Wire Interfaces
134+
// ---------------
135+
#define WIRE_INTERFACES_COUNT 1
136+
137+
// Wire
138+
#define PIN_WIRE_SDA (11u)
139+
#define PIN_WIRE_SCL (12u)
140+
#define PERIPH_WIRE sercom0
141+
#define WIRE_IT_HANDLER SERCOM0_Handler
142+
static const uint8_t SDA = PIN_WIRE_SDA;
143+
static const uint8_t SCL = PIN_WIRE_SCL;
144+
145+
// USB
146+
// ---
147+
#define PIN_USB_DM (22ul)
148+
#define PIN_USB_DP (23ul)
149+
// #define PIN_USB_HOST_ENABLE (24ul)
150+
151+
// I2S Interfaces
152+
// --------------
153+
// #define I2S_INTERFACES_COUNT 1
154+
155+
// #define I2S_DEVICE 0
156+
// #define I2S_CLOCK_GENERATOR 3
157+
// #define PIN_I2S_SD (PIN_A6)
158+
// #define PIN_I2S_SCK (2u)
159+
// #define PIN_I2S_FS (3u)
160+
161+
// Serial ports
162+
// ------------
163+
#ifdef __cplusplus
164+
#include "SERCOM.h"
165+
#include "Uart.h"
166+
167+
// Instances of SERCOM
168+
extern SERCOM sercom0;
169+
extern SERCOM sercom1;
170+
extern SERCOM sercom2;
171+
extern SERCOM sercom3;
172+
extern SERCOM sercom4;
173+
extern SERCOM sercom5;
174+
175+
// Serial1
176+
extern Uart Serial1;
177+
// #define PIN_SERIAL3_RX (13ul)
178+
// #define PIN_SERIAL3_TX (14ul)
179+
// #define PAD_SERIAL3_TX (UART_TX_PAD_2)
180+
// #define PAD_SERIAL3_RX (SERCOM_RX_PAD_3)
181+
#define PIN_SERIAL1_TX (26ul)
182+
#define PIN_SERIAL1_RX (27ul)
183+
#define PAD_SERIAL1_TX (UART_TX_PAD_0)
184+
#define PAD_SERIAL1_RX (SERCOM_RX_PAD_1)
185+
186+
// Serial2 4pin uart
187+
extern Uart Serial2;
188+
#define PIN_SERIAL2_TX (28ul)
189+
#define PIN_SERIAL2_RX (29ul)
190+
#define PAD_SERIAL2_TX (UART_TX_PAD_2)
191+
#define PAD_SERIAL2_RX (SERCOM_RX_PAD_3)
192+
193+
// Serial3 exp uart
194+
extern Uart Serial3;
195+
#define PIN_SERIAL3_TX (14ul)
196+
#define PIN_SERIAL3_RX (13ul)
197+
#define PAD_SERIAL3_TX (UART_TX_PAD_2)
198+
#define PAD_SERIAL3_RX (SERCOM_RX_PAD_3)
199+
#endif // __cplusplus
200+
201+
#ifdef __cplusplus
202+
extern "C" {
203+
#endif
204+
unsigned int PINCOUNT_fn();
205+
#ifdef __cplusplus
206+
}
207+
#endif
208+
209+
// These serial port names are intended to allow libraries and architecture-neutral
210+
// sketches to automatically default to the correct port name for a particular type
211+
// of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN,
212+
// the first hardware serial port whose RX/TX pins are not dedicated to another use.
213+
//
214+
// SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor
215+
//
216+
// SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial
217+
//
218+
// SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library
219+
//
220+
// SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins.
221+
//
222+
// SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX
223+
// pins are NOT connected to anything by default.
224+
#define SERIAL_PORT_USBVIRTUAL SerialUSB
225+
#define SERIAL_PORT_MONITOR SerialUSB
226+
#define SERIAL_PORT_HARDWARE Serial3
227+
#define SERIAL_PORT_HARDWARE_OPEN Serial3
228+
229+
// Alias Serial to SerialUSB
230+
#define Serial SerialUSB
231+

0 commit comments

Comments
 (0)
Please sign in to comment.