Skip to content

Commit

Permalink
Add a large number of convenience functions to Control and cleanup ru…
Browse files Browse the repository at this point in the history
…nner patterns
  • Loading branch information
MathiasKoch committed Jul 16, 2024
1 parent 1e6cfbc commit 77668f7
Show file tree
Hide file tree
Showing 21 changed files with 753 additions and 376 deletions.
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"rust-analyzer.check.allTargets": false,
"rust-analyzer.linkedProjects": [],
"rust-analyzer.cargo.features": [
"odin_w2xx",
"odin-w2xx",
// "internal-network-stack"
"ppp"
],
Expand Down
17 changes: 10 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ atat = { version = "0.23", features = ["derive", "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 = { version = "0.5", optional = true }
ublox-sockets = { git = "https://github.com/BlackbirdHQ/ublox-sockets", rev = "9f7fe54", optional = true }
portable-atomic = "1.6"

Expand Down Expand Up @@ -50,6 +50,8 @@ default = ["socket-tcp", "socket-udp"]
internal-network-stack = ["dep:ublox-sockets", "edm"]
edm = ["ublox-sockets?/edm"]

ipv6 = ["embassy-net?/proto-ipv6"]

# 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"]

Expand All @@ -66,12 +68,13 @@ defmt = [
]
log = ["dep:log", "ublox-sockets?/log", "atat/log"]

odin_w2xx = []
nina_w1xx = []
nina_b1xx = []
anna_b1xx = []
nina_b2xx = []
nina_b3xx = []
# Supported Ublox modules
odin-w2xx = []
nina-w1xx = []
nina-b1xx = []
anna-b1xx = []
nina-b2xx = []
nina-b3xx = []

[workspace]
members = []
Expand Down
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
A driver crate for AT-command based serial ublox short range modules, built on top of [atat].
The driver aims to be compatible with the ublox short range modules:

- odin_w2xx
- nina_w1xx
- nina_b1xx
- anna_b1xx
- nina_b2xx
- nina_b3xx
- odin-w2xx
- nina-w1xx
- nina-b1xx
- anna-b1xx
- nina-b2xx
- nina-b3xx

[atat]: https://crates.io/crates/atat

Expand Down Expand Up @@ -48,12 +48,12 @@ The samples can be built using `cargo build -p linux_example --target x86_64-unk
## Features

- device selection (must select one, and only one!):
- `odin_w2xx`
- `nina_w1xx`
- `nina_b1xx`
- `anna_b1xx`
- `nina_b2xx`
- `nina_b3xx`
- `odin-w2xx`
- `nina-w1xx`
- `nina-b1xx`
- `anna-b1xx`
- `nina-b2xx`
- `nina-b3xx`
- `socket-tcp`: Enabled by default. Adds TCP socket capabilities, and implements [`TcpStack`] trait.
- `socket-udp`: Enabled by default. Adds UDP socket capabilities, and implements [`UdpStack`] trait.
- `defmt-default`: Disabled by default. Add log statements on trace (dev) or info (release) log levels to aid debugging.
Expand Down
2 changes: 1 addition & 1 deletion examples/rpi-pico/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ edition = "2021"


[dependencies]
ublox-short-range-rs = { path = "../../", features = ["odin_w2xx", "defmt"] }
ublox-short-range-rs = { path = "../../", features = ["odin-w2xx", "defmt"] }
embassy-executor = { version = "0.5", features = [
"defmt",
"integrated-timers",
Expand Down
12 changes: 12 additions & 0 deletions src/asynch/at_udp_socket.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
use embassy_net::{udp::UdpSocket, Ipv4Address};
use embedded_io_async::{Read, Write};

use crate::config::Transport;

pub struct AtUdpSocket<'a>(pub(crate) UdpSocket<'a>);

impl<'a> AtUdpSocket<'a> {
Expand Down Expand Up @@ -32,6 +34,16 @@ impl<'a> Write for &AtUdpSocket<'a> {
}
}

impl<'a> Transport for AtUdpSocket<'a> {
fn set_baudrate(&mut self, _baudrate: u32) {
// Nothing to do here
}

fn split_ref(&mut self) -> (impl Write, impl Read) {
(&*self, &*self)
}
}

impl<'a> embedded_io_async::ErrorType for AtUdpSocket<'a> {
type Error = core::convert::Infallible;
}
Expand Down
Loading

0 comments on commit 77668f7

Please sign in to comment.