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 d627c0f
Show file tree
Hide file tree
Showing 26 changed files with 786 additions and 555 deletions.
14 changes: 0 additions & 14 deletions .github/workflows/audit.yml

This file was deleted.

35 changes: 31 additions & 4 deletions .github/workflows/lint.yml → .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Lint
name: CI

on:
push:
Expand All @@ -10,8 +10,8 @@ defaults:
run:
shell: bash

env:
CLIPPY_PARAMS: -W clippy::all -W clippy::pedantic -W clippy::nursery -W clippy::cargo
# env:
# CLIPPY_PARAMS: -W clippy::all -W clippy::pedantic -W clippy::nursery -W clippy::cargo

jobs:
rustfmt:
Expand Down Expand Up @@ -81,4 +81,31 @@ jobs:
uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: -- ${{ env.CLIPPY_PARAMS }}
args: --features odin-w2xx,ppp -- ${{ env.CLIPPY_PARAMS }}

test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Checkout source code
uses: actions/checkout@v2

- name: Install Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
target: thumbv7m-none-eabi
override: true

- name: Build
uses: actions-rs/cargo@v1
with:
command: build
args: --all --target thumbv7m-none-eabi --features odin-w2xx,ppp

- name: Test
uses: actions-rs/cargo@v1
with:
command: test
args: --lib --features odin-w2xx,ppp
47 changes: 0 additions & 47 deletions .github/workflows/docs.yml

This file was deleted.

78 changes: 0 additions & 78 deletions .github/workflows/grcov.yml

This file was deleted.

35 changes: 0 additions & 35 deletions .github/workflows/test.yml

This file was deleted.

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
20 changes: 12 additions & 8 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 All @@ -81,4 +84,5 @@ exclude = ["examples"]

[patch.crates-io]
no-std-net = { git = "https://github.com/rushmorem/no-std-net", branch = "issue-15" }
atat = { path = "../atat/atat" }
atat = { git = "https://github.com/BlackbirdHQ/atat", rev = "a466836" }
# atat = { path = "../atat/atat" }
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 d627c0f

Please sign in to comment.