Skip to content

Commit 5b79da8

Browse files
committed
Generic peripheral bridge for the interdevice link
The RP2040 serves the ESP32 main firmware as a dumb bridge: I2C transactions and bus scans execute on the local bus, GPS NMEA is forwarded, and the SD card is exposed through chunked file transfers, directory listings and card statistics. The link runs at 2M baud with 4KB chunks; message structs are static since they exceed the core stack. SD init retries on demand, the slot has no card detect line.
1 parent f3b3005 commit 5b79da8

13 files changed

Lines changed: 704 additions & 504 deletions

File tree

.trunk/configs/.shellcheckrc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
enable=all
2+
source-path=SCRIPTDIR
3+
disable=SC2154
4+
5+
# If you're having issues with shellcheck following source, disable the errors via:
6+
# disable=SC1090
7+
# disable=SC1091

.trunk/trunk.yaml

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,31 @@
22
# To learn more about the format of this file, see https://docs.trunk.io/reference/trunk-yaml
33
version: 0.1
44
cli:
5-
version: 1.22.10
5+
version: 1.24.0
66
# Trunk provides extensibility via plugins. (https://docs.trunk.io/plugins)
77
plugins:
88
sources:
99
- id: trunk
10-
ref: v1.6.7
10+
ref: v1.7.1
1111
uri: https://github.com/trunk-io/plugins
1212
# Many linters and tools depend on runtimes - configure them here. (https://docs.trunk.io/runtimes)
1313
runtimes:
1414
enabled:
15-
- node@18.20.5
15+
- go@1.21.0
16+
- node@22.16.0
1617
- python@3.10.8
1718
# This is the section where you manage your linters. (https://docs.trunk.io/check/configuration)
1819
lint:
1920
enabled:
20-
- markdownlint@0.44.0
21-
- checkov@3.2.378
21+
- oxipng@9.1.5
22+
- shellcheck@0.10.0
23+
- shfmt@3.6.0
24+
- markdownlint@0.45.0
25+
- checkov@3.2.447
2226
- git-diff-check
23-
- prettier@3.5.2
24-
- trufflehog@3.88.14
25-
- yamllint@1.35.1
27+
- prettier@3.6.2
28+
- trufflehog@3.89.2
29+
- yamllint@1.37.1
2630
- clang-format@16.0.3
2731
actions:
2832
disabled:

.vscode/extensions.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
2-
// See http://go.microsoft.com/fwlink/?LinkId=827846
3-
// for the documentation about the extensions.json format
42
"recommendations": [
3+
"Jason2866.esp-decoder",
4+
"pioarduino.pioarduino-ide",
55
"platformio.platformio-ide"
66
],
77
"unwantedRecommendations": [

.vscode/settings.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"files.associations": {
3+
"random": "cpp",
4+
"array": "cpp",
5+
"deque": "cpp",
6+
"list": "cpp",
7+
"string": "cpp",
8+
"unordered_map": "cpp",
9+
"vector": "cpp",
10+
"string_view": "cpp",
11+
"format": "cpp",
12+
"initializer_list": "cpp",
13+
"span": "cpp",
14+
"text_encoding": "cpp",
15+
"regex": "cpp",
16+
"chrono": "cpp"
17+
}
18+
}

platformio.ini

Lines changed: 36 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,36 @@
1-
; PlatformIO Project Configuration File
2-
;
3-
; Build options: build flags, source filter
4-
; Upload options: custom upload port, speed and extra flags
5-
; Library options: dependencies, extra library storages
6-
; Advanced options: extra scripting
7-
;
8-
; Please visit documentation for the other options and examples
9-
; https://docs.platformio.org/page/projectconf.html
10-
11-
[env:seeed_indicator_rp2040]
12-
platform = https://github.com/maxgerhardt/platform-raspberrypi.git#c7502925e3b08af70e9f924d54ab9d00a7e64781
13-
platform_packages = framework-arduinopico@https://github.com/earlephilhower/arduino-pico.git#4.4.4
14-
framework = arduino
15-
16-
board = seeed_indicator_rp2040
17-
board_build.core = earlephilhower
18-
board_build.filesystem_size = 0.5m
19-
20-
build_flags =
21-
-Wno-missing-field-initializers
22-
-Wno-format
23-
-Isrc
24-
-Isrc/generated
25-
-Wl,-Map,.pio/build/output.map
26-
-Os
27-
-Wno-unused-variable
28-
-Wcast-align
29-
-D__PLAT_RP2040__
30-
31-
lib_deps =
32-
sensirion/Sensirion Core@0.7.1
33-
sensirion/Sensirion I2C SCD4x@1.0.0
34-
sensirion/Sensirion I2C SGP40@0.1.0
35-
sensirion/Sensirion Gas Index Algorithm@3.2.3
36-
nanopb/Nanopb@0.4.91
37-
https://github.com/Seeed-Studio/Seeed_Arduino_AHT20.git#v1.0.1
38-
39-
40-
monitor_speed = 115200
1+
; PlatformIO Project Configuration File
2+
;
3+
; Build options: build flags, source filter
4+
; Upload options: custom upload port, speed and extra flags
5+
; Library options: dependencies, extra library storages
6+
; Advanced options: extra scripting
7+
;
8+
; Please visit documentation for the other options and examples
9+
; https://docs.platformio.org/page/projectconf.html
10+
11+
[env:seeed_indicator_rp2040]
12+
platform = https://github.com/maxgerhardt/platform-raspberrypi.git#aa70b802be8851668053d4f09734e4089fe41932
13+
framework = arduino
14+
15+
board = seeed_indicator_rp2040
16+
board_build.core = earlephilhower
17+
18+
build_flags =
19+
-Wno-missing-field-initializers
20+
-Wno-format
21+
-Isrc
22+
-Wl,-Map,.pio/build/output.map
23+
-Os
24+
-Wno-unused-variable
25+
-Wcast-align
26+
-D__PLAT_RP2040__
27+
-DDEBUG_RP2040_PORT=Serial
28+
-DHW_SPI1_DEVICE
29+
30+
lib_deps =
31+
# renovate: datasource=custom.pio depName=Nanopb packageName=nanopb/library/Nanopb
32+
nanopb/Nanopb@0.4.91
33+
34+
monitor_speed = 115200
35+
36+
debug_tool = cmsis-dap

protobufs

Submodule protobufs updated 72 files

src/buzzer.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#include "buzzer.h"
2+
3+
uint32_t buzz_off = 0;
4+
5+
void beep_init(void) { pinMode(BUZZER_GPIO, OUTPUT); }
6+
void beep_off(void) { digitalWrite(BUZZER_GPIO, LOW); }
7+
void beep_on(uint32_t duration) {
8+
analogWrite(BUZZER_GPIO, 127);
9+
buzz_off = millis() + duration;
10+
}

src/buzzer.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#pragma once
2+
3+
#ifndef BUZZER_H
4+
#define BUZZER_H
5+
6+
#define BUZZER_GPIO 19
7+
8+
#include <Arduino.h>
9+
10+
extern uint32_t buzz_off;
11+
12+
void beep_init(void);
13+
void beep_off(void);
14+
void beep_on(uint32_t duration);
15+
16+
#endif // BUZZER_H

0 commit comments

Comments
 (0)