aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorWarren Guy <[email protected]>2024-09-05 10:49:36 +0100
committerGitHub <[email protected]>2024-09-05 11:49:36 +0200
commit1f3e0004a9db9c238fd451284b8b5b0abf4d57bb (patch)
tree217acf55ffafa3be7df1909da1a8ec4d50bbf674
parentd4cb92f27c48148bc269308ff6973338b6f1f7c9 (diff)
downloadtinygo-1f3e0004a9db9c238fd451284b8b5b0abf4d57bb.tar.gz
tinygo-1f3e0004a9db9c238fd451284b8b5b0abf4d57bb.zip
add board: RAKwireless RAK4631 (#4454)
targets: add rak4631
-rw-r--r--GNUmakefile2
-rw-r--r--src/machine/board_rak4631.go86
-rw-r--r--targets/rak4631.json6
3 files changed, 94 insertions, 0 deletions
diff --git a/GNUmakefile b/GNUmakefile
index 94d9c357d..8979e25be 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -642,6 +642,8 @@ endif
@$(MD5SUM) test.hex
$(TINYGO) build -size short -o test.hex -target=xiao examples/blinky1
@$(MD5SUM) test.hex
+ $(TINYGO) build -size short -o test.hex -target=rak4631 examples/blinky1
+ @$(MD5SUM) test.hex
$(TINYGO) build -size short -o test.hex -target=circuitplay-express examples/dac
@$(MD5SUM) test.hex
$(TINYGO) build -size short -o test.hex -target=pyportal examples/dac
diff --git a/src/machine/board_rak4631.go b/src/machine/board_rak4631.go
new file mode 100644
index 000000000..c59f3717b
--- /dev/null
+++ b/src/machine/board_rak4631.go
@@ -0,0 +1,86 @@
+//go:build rak4631
+
+package machine
+
+const HasLowFrequencyCrystal = true
+
+// Digital Pins
+const (
+ D0 Pin = P0_28
+ D1 Pin = P0_02
+)
+
+// Analog pins
+const (
+ A0 Pin = P0_17
+ A1 Pin = P1_02
+ A2 Pin = P0_21
+)
+
+// Onboard LEDs
+const (
+ LED = LED2
+ LED1 = P1_03
+ LED2 = P1_04
+)
+
+// UART pins
+const (
+ // Default to UART1
+ UART_RX_PIN = UART0_RX_PIN
+ UART_TX_PIN = UART0_TX_PIN
+
+ // UART1
+ UART0_RX_PIN = P0_19
+ UART0_TX_PIN = P0_20
+
+ // UART2
+ UART1_RX_PIN = P0_15
+ UART1_TX_PIN = P0_16
+)
+
+// I2C pins
+const (
+ SDA_PIN = SDA1_PIN
+ SCL_PIN = SCL1_PIN
+
+ SDA1_PIN = P0_13
+ SCL1_PIN = P0_14
+
+ SDA2_PIN = P0_24
+ SCL2_PIN = P0_25
+)
+
+// SPI pins
+const (
+ SPI0_SCK_PIN = P0_03
+ SPI0_SDO_PIN = P0_29
+ SPI0_SDI_PIN = P0_30
+)
+
+// Peripherals
+const (
+ LORA_NSS = P1_10
+ LORA_SCK = P1_11
+ LORA_MOSI = P1_12
+ LORA_MISO = P1_13
+ LORA_BUSY = P1_14
+ LORA_DIO1 = P1_15
+ LORA_NRESET = P1_06
+ LORA_POWER = P1_05
+)
+
+// USB CDC identifiers
+const (
+ usb_STRING_PRODUCT = "WisCore RAK4631 Board"
+ usb_STRING_MANUFACTURER = "RAKwireless"
+)
+
+var (
+ usb_VID uint16 = 0x239a
+ usb_PID uint16 = 0x8029
+)
+
+var (
+ DefaultUART = UART0
+)
diff --git a/targets/rak4631.json b/targets/rak4631.json
new file mode 100644
index 000000000..cbd822130
--- /dev/null
+++ b/targets/rak4631.json
@@ -0,0 +1,6 @@
+{
+ "inherits": ["nrf52840", "nrf52840-s140v6-uf2"],
+ "build-tags": ["rak4631"],
+ "serial-port": ["239a:8029"],
+ "msd-volume-name": ["RAK4631"]
+}