Wiznet makers

teamprof

Published February 13, 2022 ©

0 UCC

0 VAR

3 Contests

0 Followers

0 Following

Arduino Event driven Ethernet library for W5100

Arduino Event driven Ethernet library for W5100

COMPONENTS Software Apps and online services

- Event driven Ethernet library

x 1

initial release


PROJECT DESCRIPTION
This library is to facilitate your usage of W5100S-EVB-Pico board with the onboard Wiznet W5100S chip, using [**Arduino-mbed RP2040** core](https://github.com/arduino/ArduinoCore-mbed)
In case you are looking for an event driven approach of receiving Ethernet data/status, rather than the traditional polling method, this library may be one of choices for you.
Events to be dispatched to: void (*EthernetEventCallback)(uint8_t ir, uint8_t ir2, uint8_t slir);
1. Interrupt Register (IR)
? ? ?EthernetEventApi::Ir::CONFLICT
? ? ?EthernetEventApi::Ir::UNREACH
? ? ?EthernetEventApi::Ir::PPPTERM
? ?note: NO Sn_INT events in EthernetEventCallback. User should use Sn_IR in SocketEventCallback
2. Interrupt Register 2 (IR2)
? ? ?EthernetEventApi::Ir2::WOL
3. SOCKET-less Interrupt Register (SLIR)
? ? ?EthernetEventApi::Slir::TIMEOUT
? ? ?EthernetEventApi::Slir::ARP
? ? ?EthernetEventApi::Slir::PING
Events to be dispatched to: void (*SocketEventCallback)(uint8_t sn_ir);
1. SOCKET n Interrupt Register (Sn_IR)
? ? SnIR::SEND_OK
? ? SnIR::TIMEOUT
? ? SnIR::RECV
? ? SnIR::DISCON
? ? SnIR::CON
### User's Code comparison:
#### Using [EventEthernet](https://github.com/teamprof/arduino-eventethernet)
############################################################################
#include <EventEthernet.h>
void setup() {
? Ethernet.init(17, 21); // W5100S-EVB-Pico: nCS pin = GPIO17, Intn pin = GPIO21
? while (Ethernet.begin(mac, ir, ir2, slir, onEthernetEvent) == 0)
? {
? ? LOG_DEBUG("Failed to configure Ethernet using DHCP");
? ? delay(1000);
? }
}
############################################################################
#### Using original [WIZnet-ArduinoEthernet](https://github.com/WIZnet-ArduinoEthernet/Ethernet)
############################################################################
#include <Ethernet.h>
//#include <EventEthernet.h> // note: you can use EventEthernet lib on existing code with polling method
void setup() {
? Ethernet.init(17); // W5100S-EVB-Pico: nCS pin = GPIO17
? while (Ethernet.begin(mac) == 0)
? {
? ? LOG_DEBUG("Failed to configure Ethernet using DHCP");
? ? delay(1000);
? }
}
Documents
  • Event Driver Ethernet library

    initial release

  • Event Driver Ethernet library zip file

    initial release

  • screenshot-arduino-ide

    screenshot on arduino ide

  • screenshot-terminals

    screenshot on linux terminals

Comments Write