Awesome
no_std ESP-AT network layer
Network layer implementation/client for ESP-AT implementing embedded-nal based on ATAT.
Currently, this crates offers the following features
- Joining an WIFI access point, s. wifi module
- TCP client stack (multi socket), s. stack module
Example
Here's a simple example using a mocked AtClient:
use std::str::FromStr;
use embedded_nal::{SocketAddr, TcpClientStack};
use esp_at_nal::example::ExampleTimer;
use esp_at_nal::wifi::{Adapter, WifiAdapter};
use crate::esp_at_nal::example::ExampleAtClient as AtClient;
let client = AtClient::default();
// Creating adapter with 1024 bytes TX and 256 RX block size
let mut adapter: Adapter<_, _, 1_000_000, 1024, 256> = Adapter::new(client, ExampleTimer::default());
// Joining WIFI access point
let state = adapter.join("test_wifi", "secret").unwrap();
assert!(state.connected);
// Creating a TCP connection
let mut socket = adapter.socket().unwrap();
adapter.connect(&mut socket, SocketAddr::from_str("10.0.0.1:21").unwrap()).unwrap();
// Sending some data
adapter.send(&mut socket, b"hallo!").unwrap();
To see a real-world example that runs on Linux, check out examples/linux.rs
:
# For logging
export RUST_LOG=trace
cargo run --example linux --features "atat/log" -- \
/dev/ttyUSB0 115200 mywifi hellopasswd123
Development
Any form of support is greatly appreciated. Feel free to create issues and PRs. See DEVELOPMENT for more details.
License
Licensed under either of
- Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT) at your option.
Each contributor agrees that his/her contribution covers both licenses.