Skip to content

Commit

Permalink
Simplify initialization of both ppp mode and ublox mode, by providing…
Browse files Browse the repository at this point in the history
… batteries included new functions that sets up ATAT and all related resources
  • Loading branch information
MathiasKoch committed Feb 23, 2024
1 parent 8ab1612 commit e96769a
Show file tree
Hide file tree
Showing 32 changed files with 935 additions and 2,187 deletions.
48 changes: 27 additions & 21 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,46 +15,61 @@ name = "ublox_short_range"
doctest = false

[dependencies]
atat = { version = "0.21", features = ["derive", "bytes"] }
# atat = { version = "0.21", features = ["derive", "bytes"] }
atat = { path = "../atat/atat", features = ["derive", "bytes"] }

# atat = { git = "https://github.com/BlackbirdHQ/atat", rev = "70283be", features = ["derive", "defmt", "bytes"] }
heapless = { version = "^0.8", features = ["serde"] }
no-std-net = { version = "0.6", features = ["serde"] }
serde = { version = "^1", default-features = false, features = ["derive"] }
# ublox-sockets = { version = "0.5", features = ["edm"], optional = true }
ublox-sockets = { git = "https://github.com/BlackbirdHQ/ublox-sockets", rev = "9f7fe54", features = ["edm"], optional = true }
ublox-sockets = { git = "https://github.com/BlackbirdHQ/ublox-sockets", rev = "9f7fe54", optional = true }
postcard = "1.0.4"
portable-atomic = "1.5"
portable-atomic = "1.6"

defmt = { version = "0.3", optional = true }
log = { version = "0.4.14", optional = true }
log = { version = "^0.4", default-features = false, optional = true }
defmt = { version = "^0.3", optional = true }

embedded-hal = "1.0"
embassy-time = "0.3"
embassy-sync = "0.5"
embassy-futures = "0.1"
embassy-net-driver = "0.2"

embedded-nal-async = { version = "0.7" }
futures = { version = "0.3.17", default-features = false, features = [
"async-await",
] }
futures-util = { version = "0.3.29", default-features = false }

embedded-io = "0.6"
embedded-io-async = "0.6"

embassy-net-ppp = { version = "0.1", optional = true }
embassy-net = { version = "0.4", features = [
"proto-ipv4",
"medium-ip",
], optional = true }


[features]
default = ["odin_w2xx", "ublox-sockets", "socket-tcp", "socket-udp"]
default = ["socket-tcp", "socket-udp", "odin_w2xx"]

internal-network-stack = ["dep:ublox-sockets", "edm"]
edm = ["ublox-sockets?/edm"]

# PPP mode requires UDP sockets enabled, to be able to do AT commands over UDP port 23
ppp = ["dep:embassy-net-ppp", "dep:embassy-net", "socket-udp"]

std = []
socket-tcp = ["ublox-sockets?/socket-tcp", "embassy-net?/tcp"]
socket-udp = ["ublox-sockets?/socket-udp", "embassy-net?/udp"]

defmt = [
"dep:defmt",
"postcard/use-defmt",
"heapless/defmt-03",
"atat/defmt",
"ublox-sockets?/defmt",
"embassy-net-ppp?/defmt",
"embassy-net?/defmt",
]
log = ["dep:log", "ublox-sockets?/log", "atat/log"]

odin_w2xx = []
nina_w1xx = []
Expand All @@ -63,15 +78,6 @@ anna_b1xx = []
nina_b2xx = []
nina_b3xx = []

socket-tcp = [
"ublox-sockets?/socket-tcp",
# "smoltcp?/socket-tcp"
]
socket-udp = [
"ublox-sockets?/socket-udp",
# "smoltcp?/socket-udp"
]

[workspace]
members = []
default-members = ["."]
Expand All @@ -80,4 +86,4 @@ exclude = ["examples"]

[patch.crates-io]
no-std-net = { git = "https://github.com/rushmorem/no-std-net", branch = "issue-15" }
atat = { path = "../atat/atat" }
atat = { path = "../atat/atat" }
152 changes: 0 additions & 152 deletions examples/linux.rs

This file was deleted.

3 changes: 1 addition & 2 deletions examples/rpi-pico/.cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
[target.'cfg(all(target_arch = "arm", target_os = "none"))']
# runner = "probe-rs-cli run --chip RP2040"
runner = "probe-run --chip RP2040"
runner = "probe-rs run --chip RP2040"

[build]
target = "thumbv6m-none-eabi"
Expand Down
16 changes: 16 additions & 0 deletions examples/rpi-pico/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"editor.formatOnSave": true,
"[toml]": {
"editor.formatOnSave": false
},
"rust-analyzer.cargo.features": [
"ppp",
],
"rust-analyzer.cargo.target": "thumbv6m-none-eabi",
"rust-analyzer.check.allTargets": false,
"rust-analyzer.linkedProjects": [],
"rust-analyzer.server.extraEnv": {
"WIFI_NETWORK": "foo",
"WIFI_PASSWORD": "foo",
}
}
60 changes: 48 additions & 12 deletions examples/rpi-pico/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,24 @@ edition = "2021"


[dependencies]
ublox-short-range-rs = { path = "../../", features = ["odin_w2xx", "ublox-sockets", "socket-tcp"] }
embassy-executor = { version = "0.5", features = ["defmt", "integrated-timers", "nightly"] }
embassy-time = { version = "0.3", features = ["defmt", "defmt-timestamp-uptime"] }
embassy-rp = { version = "0.1.0", features = ["defmt", "unstable-pac", "time-driver"] }
ublox-short-range-rs = { path = "../../", features = ["odin_w2xx", "defmt"] }
embassy-executor = { version = "0.5", features = [
"defmt",
"integrated-timers",
"nightly",
"arch-cortex-m",
"executor-thread",
] }
embassy-time = { version = "0.3", features = [
"defmt",
"defmt-timestamp-uptime",
] }
embassy-sync = { version = "0.5" }
embassy-rp = { version = "0.1.0", features = [
"defmt",
"unstable-pac",
"time-driver",
] }
embassy-futures = { version = "0.1.0" }
no-std-net = { version = "0.6", features = ["serde"] }

Expand All @@ -19,11 +33,31 @@ panic-probe = { version = "0.3", features = ["print-defmt"] }

cortex-m = { version = "0.7.6", features = ["critical-section-single-core"] }
cortex-m-rt = "0.7.0"
futures = { version = "0.3.17", default-features = false, features = ["async-await", "cfg-target-has-atomic", "unstable"] }
futures = { version = "0.3.17", default-features = false, features = [
"async-await",
"cfg-target-has-atomic",
"unstable",
] }

embedded-io-async = { version = "0.6" }
heapless = "0.8"
portable-atomic = { version = "*", features = ["unsafe-assume-single-core"] }

embassy-net = { version = "0.4", optional = true, features = [
"defmt",
"proto-ipv4",
"medium-ip",
"tcp",
"udp",
] }
embassy-net-ppp = { version = "0.1", optional = true, features = ["defmt"] }
embedded-tls = { path = "../../../embedded-tls", default-features = false, features = [
"defmt",
] }

[features]
internal-network-stack = ["ublox-short-range-rs/internal-network-stack"]
ppp = ["dep:embassy-net", "dep:embassy-net-ppp", "ublox-short-range-rs/ppp"]

[patch.crates-io]
# embassy-executor = { git = "https://github.com/embassy-rs/embassy", rev = "03d6363d5af5dcaf21b52734994a466ca593d2b6" }
Expand All @@ -34,13 +68,15 @@ heapless = "0.8"
# embassy-net-driver-channel = { git = "https://github.com/embassy-rs/embassy", rev = "03d6363d5af5dcaf21b52734994a466ca593d2b6" }


embassy-executor = { path = "../../../embassy/embassy-executor" }
embassy-hal-internal = { path = "../../../embassy/embassy-hal-internal" }
embassy-time = { path = "../../../embassy/embassy-time" }
embassy-futures = { path = "../../../embassy/embassy-futures" }
embassy-sync = { path = "../../../embassy/embassy-sync" }
embassy-rp = { path = "../../../embassy/embassy-rp" }
embassy-net-driver = { path = "../../../embassy/embassy-net-driver" }
# embassy-executor = { path = "../../../embassy/embassy-executor" }
# embassy-hal-internal = { path = "../../../embassy/embassy-hal-internal" }
# embassy-time = { path = "../../../embassy/embassy-time" }
# embassy-futures = { path = "../../../embassy/embassy-futures" }
# embassy-sync = { path = "../../../embassy/embassy-sync" }
# embassy-rp = { path = "../../../embassy/embassy-rp" }
# embassy-net-driver = { path = "../../../embassy/embassy-net-driver" }
# embassy-net = { path = "../../../embassy/embassy-net" }
# embassy-net-ppp = { path = "../../../embassy/embassy-net-ppp" }
atat = { path = "../../../atat/atat" }
ublox-sockets = { path = "../../../ublox-sockets" }
no-std-net = { path = "../../../no-std-net" }
Expand Down
7 changes: 7 additions & 0 deletions examples/rpi-pico/rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[toolchain]
channel = "nightly-2024-01-17"
components = [ "rust-src", "rustfmt", "llvm-tools" ]
targets = [
"thumbv6m-none-eabi",
"thumbv7em-none-eabihf"
]
Loading

0 comments on commit e96769a

Please sign in to comment.