Crate esp_at_nal

source ·
Expand description

§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

§Setup

This crates is based on ATAT and requires a AtClient instance. s. examples.

§Example

use core::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();

Modules§

  • Mocks for doc examples
  • TCP client stack
  • URC parser implementation
  • WIFI access point client