#mqtt-client #mqtt #w5500 #wiznet

no-std w5500-mqtt

MQTT client for the Wiznet W5500 internet offload chip

7 unstable releases (3 breaking)

0.4.0 Jun 9, 2024
0.3.0 Oct 2, 2023
0.2.0 Aug 6, 2023
0.1.2 Aug 1, 2022
0.1.0-alpha.0 Mar 20, 2022

#161 in Embedded development

Download history 32/week @ 2024-04-01 7/week @ 2024-04-08 87/week @ 2024-04-15 94/week @ 2024-04-22 78/week @ 2024-04-29 40/week @ 2024-05-06 21/week @ 2024-05-13 10/week @ 2024-05-27 116/week @ 2024-06-03 164/week @ 2024-06-10 46/week @ 2024-06-17 42/week @ 2024-06-24 17/week @ 2024-07-01 38/week @ 2024-07-08 17/week @ 2024-07-15

116 downloads per month

MIT license

210KB
3K SLoC

w5500-mqtt

MQTT v5 client for the Wiznet W5500 SPI internet offload chip.

Limitations

This is very basic at the moment, and will be expanded in the future.

  • Does not support password protected MQTT servers.
  • Only supports QoS 0: At most once delivery.

Example

use w5500_mqtt::{
    ll::{
        net::{Ipv4Addr, SocketAddrV4},
        Sn,
    },
    Client, ClientId, Event, DST_PORT, SRC_PORT,
};

let mut client: Client = Client::new(
    Sn::Sn2,
    SRC_PORT,
    SocketAddrV4::new(Ipv4Addr::new(192, 168, 5, 6), DST_PORT),
);

// wait for a connection or die trying
while !matches!(client.process(&mut w5500, monotonic_secs())?, Event::None) {}

// publish to "duck" with a payload "quack"
client.publish(&mut w5500, "duck", b"quack")?;

// subscribe to "cow"
client.subscribe(&mut w5500, "cow")?;

Relevant Specifications

Feature Flags

All features are disabled by default.

  • eh0: Passthrough to w5500-hl.
  • eh1: Passthrough to w5500-hl.
  • defmt: Enable logging with defmt. Also a passthrough to w5500-hl.
  • log: Enable logging with log.
  • w5500-tls: Enable MQTT over TLS.
  • p256-cm4: Passthrough to w5500-tls.

Dependencies

~0.3–1MB
~16K SLoC