blob: 11dab88e48c1466067132fc590c103db1bc2ec9f (
plain)
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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
|
//go:build nano_rp2040
// +build nano_rp2040
// This contains the pin mappings for the Arduino Nano RP2040 Connect board.
//
// Sometimes the board is not detected even when the board is connected to your computer.
// To solve this, place a jumper wire between the REC and GND pins, then connect the board to your computer.
//
// For more information, see: https://store.arduino.cc/nano-rp2040-connect
// Also
// - Datasheets: https://docs.arduino.cc/hardware/nano-rp2040-connect
// - Nano RP2040 Connect technical reference: https://docs.arduino.cc/tutorials/nano-rp2040-connect/rp2040-01-technical-reference
//
package machine
import (
"device/rp"
"runtime/interrupt"
)
// Digital Pins
const (
D2 Pin = GPIO25
D3 Pin = GPIO15
D4 Pin = GPIO16
D5 Pin = GPIO17
D6 Pin = GPIO18
D7 Pin = GPIO19
D8 Pin = GPIO20
D9 Pin = GPIO21
D10 Pin = GPIO5
D11 Pin = GPIO7
D12 Pin = GPIO4
D13 Pin = GPIO6
D14 Pin = GPIO26
D15 Pin = GPIO27
D16 Pin = GPIO28
D17 Pin = GPIO29
D18 Pin = GPIO12
D19 Pin = GPIO13
)
// Analog pins
const (
A0 Pin = ADC0
A1 Pin = ADC1
A2 Pin = ADC2
A3 Pin = ADC3
)
// Onboard LED
const (
LED = GPIO6
)
// I2C pins
const (
I2C0_SDA_PIN Pin = GPIO12
I2C0_SCL_PIN Pin = GPIO13
I2C1_SDA_PIN Pin = GPIO18
I2C1_SCL_PIN Pin = GPIO19
)
// SPI pins. SPI1 not available on Nano RP2040 Connect.
const (
SPI0_SCK_PIN Pin = GPIO6
SPI0_SDO_PIN Pin = GPIO7
SPI0_SDI_PIN Pin = GPIO4
// GPIO22 does not have SPI functionality so we set it to avoid interfering with NINA.
SPI1_SCK_PIN Pin = GPIO22
SPI1_SDO_PIN Pin = GPIO22
SPI1_SDI_PIN Pin = GPIO22
)
var (
NINA_SPI = SPI1
)
// NINA-W102 Pins
const (
NINA_SCK Pin = GPIO14
NINA_SDO Pin = GPIO11
NINA_SDI Pin = GPIO8
NINA_CS Pin = GPIO9
NINA_ACK Pin = GPIO10
NINA_GPIO0 Pin = GPIO2
NINA_RESETN Pin = GPIO3
NINA_TX Pin = GPIO9
NINA_RX Pin = GPIO8
)
// Onboard crystal oscillator frequency, in MHz.
const (
xoscFreq = 12 // MHz
)
// USB CDC identifiers
// https://github.com/arduino/ArduinoCore-mbed/blob/master/variants/NANO_RP2040_CONNECT/pins_arduino.h
const (
usb_STRING_PRODUCT = "Nano RP2040 Connect"
usb_STRING_MANUFACTURER = "Arduino"
)
var (
usb_VID uint16 = 0x2341
usb_PID uint16 = 0x005e
)
// UART pins
const (
UART0_TX_PIN = GPIO0
UART0_RX_PIN = GPIO1
UART_TX_PIN = UART0_TX_PIN
UART_RX_PIN = UART0_RX_PIN
)
// UART on the RP2040
var (
UART0 = &_UART0
_UART0 = UART{
Buffer: NewRingBuffer(),
Bus: rp.UART0,
}
)
var DefaultUART = UART0
func init() {
UART0.Interrupt = interrupt.New(rp.IRQ_UART0_IRQ, _UART0.handleInterrupt)
}
|