New lwIP-based Ethernet library for Teensy 4.1

Sure, I can include an HTTP client. I’ll probably do it a little differently, though.

Other changes I’m planning:
1. Decouple the driver initialization from setting the MAC
2. Add a small capabilities API for determining what the driver supports
3. Not sure when or if — support for a more modern TLS library, eg. MbedTLS 3 or maybe even WolfSSL
4. Not sure when or if — more TLS examples
5. Maybe — Even more examples

Nos. 1 & 2 are almost complete, 5 I think about from time to time, and 3 & 4 are on my mind.
 
Some more ideas I’m thinking about:

6. A set of functions that do the things that are very repetitive when starting, and creating, an Ethernet-based app. (I have many thoughts about this for better Arduino app development too.) (Remember Borland’s OWL framework?) (I don’t want to get too far down the “app builder” rabbit hole, however.)

7. IPv6, IEEE 1588 (Precision Time Protocol (PTP)) and associated things, on-device crypto for use with TLS (and an independent crypto library), C++11 support for other boards. (Fun fact: I have all these things working, except for some minor details here and there.)

8. An Arduino API layer of sorts that lets me support all the Arduino API parts but lets me exclude the parts I don’t like.
 
I just released v0.30.0. Here's the Changelog:

Markdown (GitHub flavored):
## [0.30.0]

### Added
* Added a _SimpleHTTPClient_ example.
* Added a way to get the driver capabilities:
  `EthernetClass::driverCapabilities()` and `driver_get_capabilities(dc)`.
* Added a way to get the library version: `EthernetClass::libraryVersion()`.
* New `QNETHERNET_DO_LOOP_IN_YIELD` configuration macro for indicating that
  the library should attempt to hook into or override `yield()` to
  call `Ethernet.loop()`.
* New version of `receiveQueueSize()` in `EthernetUDP` and `EthernetFrame` that
  returns the number of unprocessed packets or frames.
* Added `droppedReceiveCount()` and `totalReceiveCount()` to `EthernetUDP`
  and `EthernetFrame`.
* Added `driver_set_link_speed(speed)` and `driver_set_link_full_duplex(flag)`.
* Added `EthernetClass::renewDHCP()`.
* Added `EthernetClass::interfaceName()`.
* Added `setOutgoingTTL(ttl)` and `outgoingTTL()` functions for modifying and
  accessing the TTL field, respectively, in the outgoing IP header, to
  `EthernetClient` and `EthernetUDP`.
* Added `EthernetUDP::receivedTTL()` for retrieving the TTL value of the last
  received packet.
* Added "Compatibility with other APIs" section to the README.

### Changed
* Separated setting the MAC address from driver initialization.
* Changed the netif name to "en0".
* Added macro-gated calls to `Ethernet.loop()` after any `yield()`s in case an
  overridden version doesn't call this. This affects:
  * `DNSClient::getHostByName()`
  * `EthernetClass::waitForLink()`
  * `EthernetClass::waitForLocalIP()`
  * `EthernetClient::connect()`
  * `EthernetClient::stop()`
* Updated example `yield()` implementation notes for
  non-EventResponder versions.
* Changed `setReceiveQueueSize(size)` to `setReceiveQueueCapacity(capacity)`
  and `receiveQueueSize()` to `receiveQueueCapacity()` in both `EthernetUDP`
  and `EthernetFrame`.
* Updated `QNETHERNET_ENABLE_RAW_FRAME_LOOPBACK` behaviour to also check for
  the broadcast MAC addresses.
* Added `FLASHMEM` to some driver functions.
* Changed `EthernetClass` and `MDNSClass` `hostname()` function to return a
  `const char *` instead of a `String`.
* Now always setting the DNS in `EthernetClass::begin(ip, mask, gateway, dns)`,
  even if it's zero.
* Use rename instead of end-then-start when the netif has already been added,
  in `MDNSClass::begin(hostname)`.
* DHCP is started when just the IP address is the "any" address instead of all
  of the IP address, netmask, and gateway.
* `begin(ip, mask, gateway, dns)` now always sets the DNS address.
* `Ethernet.broadcastIP()` now returns 255.255.255.255 if Ethernet is
  not initialized.

### Removed
* Removed `EthernetClass::isLinkStateDetectable()` in favour of the
  driver capabilities.
* Removed `get_uint32(ip)` utility function because a `static_cast<uint32_t>()`
  is sufficient.

### Fixed
* Fixed iperf v2 tests by commenting out per-block settings compare.
* Fixed restarting the netif by also bringing the link down.
* Fixed a bug related to closing a TCP socket when using altcp.

Highlights:
* New SimpleHTTPClient example
* Driver capabilities API
* yield() call flexibility
* Some new API functions
* Various bug fixes

Link: https://github.com/ssilverman/QNEthernet/releases/tag/v0.30.0
 
Just updated my arduino system. Big mistake.
QNEthernet compile is now complaining that it can't to static case of 32-bit unsigned to IPADDRESS.
Any ideas?
 
Show me the code?

I know this works:
C++:
uint32_t x = static_cast<uint32_t>(addr);

Update: I re-read your post and I think you mean this?
C++:
uint32_t x = 0;
IPAddress y{x};  // Parentheses should also work

IPAddress has a uint32_t constructor. It’s not possible to static cast a uint32_t to an IPAddress.
 
Last edited:
Code:
/Users/rhyde/Documents/Arduino/libraries/QNEthernet/src/QNEthernet.cpp: In member function 'bool qindesign::network::EthernetClass::begin(const IPAddress&, const IPAddress&, const IPAddress&, const IPAddress*)':
/Users/rhyde/Documents/Arduino/libraries/QNEthernet/src/QNEthernet.cpp:225:45: error: invalid static_cast from type 'const IPAddress' to type 'uint32_t {aka long unsigned int}'
   ip4_addr_t ipaddr{static_cast<uint32_t>(ip)};

Several of those messages.


Here's the whole compilation message (long and messy):
Code:
FQBN: teensy:avr:teensy41
Using board 'teensy41' from platform in folder: /Users/rhyde/Library/Arduino15/packages/teensy/hardware/avr/1.57.2
Using core 'teensy4' from platform in folder: /Users/rhyde/Library/Arduino15/packages/teensy/hardware/avr/1.57.2

Detecting libraries used...

Lots of okay stuff snipped...

In file included from /Volumes/Data/Embedded/PPCapture/PPCapture.ino:20:0:
/Users/rhyde/Documents/Arduino/libraries/QNEthernet/src/QNEthernet.h:348:56: warning: 'maybe_unused' attribute directive ignored [-Wattributes]
   void setRetransmissionCount([[maybe_unused]] uint8_t number) const {}
                                                        ^
/Users/rhyde/Documents/Arduino/libraries/QNEthernet/src/QNEthernet.h:350:59: warning: 'maybe_unused' attribute directive ignored [-Wattributes]
   void setRetransmissionTimeout([[maybe_unused]] uint16_t milliseconds) const {}
                                                           ^
/Users/rhyde/Documents/Arduino/libraries/QNEthernet/src/QNEthernet.h:429:23: warning: 'nodiscard' attribute directive ignored [-Wattributes]
   bool maybeStartDHCP();
                       ^
/Users/rhyde/Documents/Arduino/libraries/QNEthernet/src/QNEthernet.h:435:14: warning: 'nodiscard' attribute directive ignored [-Wattributes]
   bool start();
              ^
Compiling libraries...

Additional Okay stuff snipped...

In file included from /Users/rhyde/Documents/Arduino/libraries/QNEthernet/src/QNEthernet.cpp:7:0:
/Users/rhyde/Documents/Arduino/libraries/QNEthernet/src/QNEthernet.h:348:56: warning: 'maybe_unused' attribute directive ignored [-Wattributes]
   void setRetransmissionCount([[maybe_unused]] uint8_t number) const {}
                                                        ^
/Users/rhyde/Documents/Arduino/libraries/QNEthernet/src/QNEthernet.h:350:59: warning: 'maybe_unused' attribute directive ignored [-Wattributes]
   void setRetransmissionTimeout([[maybe_unused]] uint16_t milliseconds) const {}
                                                           ^
/Users/rhyde/Documents/Arduino/libraries/QNEthernet/src/QNEthernet.h:429:23: warning: 'nodiscard' attribute directive ignored [-Wattributes]
   bool maybeStartDHCP();
                       ^
/Users/rhyde/Documents/Arduino/libraries/QNEthernet/src/QNEthernet.h:435:14: warning: 'nodiscard' attribute directive ignored [-Wattributes]
   bool start();
              ^
/Users/rhyde/Documents/Arduino/libraries/QNEthernet/src/QNEthernet.cpp: In member function 'bool qindesign::network::EthernetClass::begin(const IPAddress&, const IPAddress&, const IPAddress&, const IPAddress*)':
/Users/rhyde/Documents/Arduino/libraries/QNEthernet/src/QNEthernet.cpp:225:45: error: invalid static_cast from type 'const IPAddress' to type 'uint32_t {aka long unsigned int}'
   ip4_addr_t ipaddr{static_cast<uint32_t>(ip)};
                                             ^
/Users/rhyde/Documents/Arduino/libraries/QNEthernet/src/QNEthernet.cpp:226:48: error: invalid static_cast from type 'const IPAddress' to type 'uint32_t {aka long unsigned int}'
   ip4_addr_t netmask{static_cast<uint32_t>(mask)};
                                                ^
/Users/rhyde/Documents/Arduino/libraries/QNEthernet/src/QNEthernet.cpp:227:46: error: invalid static_cast from type 'const IPAddress' to type 'uint32_t {aka long unsigned int}'
   ip4_addr_t gw{static_cast<uint32_t>(gateway)};
                                              ^
/Users/rhyde/Documents/Arduino/libraries/QNEthernet/src/QNEthernet.cpp: In member function 'bool qindesign::network::EthernetClass::start()':
/Users/rhyde/Documents/Arduino/libraries/QNEthernet/src/QNEthernet.cpp:303:3: error: 'snprintf' is not a member of 'std'
   std::snprintf(&ifName_[2], sizeof(ifName_) - 2, "%u", netif_->num);
   ^
/Users/rhyde/Documents/Arduino/libraries/QNEthernet/src/QNEthernet.cpp:303:3: note: suggested alternative:
In file included from /Users/rhyde/Library/Arduino15/packages/teensy/tools/teensy-compile/5.4.1/arm/arm-none-eabi/include/wchar.h:4:0,
                 from /Users/rhyde/Library/Arduino15/packages/teensy/tools/teensy-compile/5.4.1/arm/arm-none-eabi/include/c++/5.4.1/cwchar:44,
                 from /Users/rhyde/Library/Arduino15/packages/teensy/tools/teensy-compile/5.4.1/arm/arm-none-eabi/include/c++/5.4.1/bits/postypes.h:40,
                 from /Users/rhyde/Library/Arduino15/packages/teensy/tools/teensy-compile/5.4.1/arm/arm-none-eabi/include/c++/5.4.1/bits/char_traits.h:40,
                 from /Users/rhyde/Library/Arduino15/packages/teensy/tools/teensy-compile/5.4.1/arm/arm-none-eabi/include/c++/5.4.1/string:40,
                 from /Users/rhyde/Library/Arduino15/packages/teensy/tools/teensy-compile/5.4.1/arm/arm-none-eabi/include/c++/5.4.1/stdexcept:39,
                 from /Users/rhyde/Library/Arduino15/packages/teensy/tools/teensy-compile/5.4.1/arm/arm-none-eabi/include/c++/5.4.1/array:38,
                 from /Users/rhyde/Library/Arduino15/packages/teensy/tools/teensy-compile/5.4.1/arm/arm-none-eabi/include/c++/5.4.1/tuple:39,
                 from /Users/rhyde/Library/Arduino15/packages/teensy/tools/teensy-compile/5.4.1/arm/arm-none-eabi/include/c++/5.4.1/functional:55,
                 from /Users/rhyde/Documents/Arduino/libraries/QNEthernet/src/QNEthernet.h:12,
                 from /Users/rhyde/Documents/Arduino/libraries/QNEthernet/src/QNEthernet.cpp:7:
/Users/rhyde/Library/Arduino15/packages/teensy/tools/teensy-compile/5.4.1/arm/arm-none-eabi/include/stdio.h:266:5: note:   'snprintf'
 int _EXFUN(snprintf, (char *__restrict, size_t, const char *__restrict, ...)
     ^
/Users/rhyde/Documents/Arduino/libraries/QNEthernet/src/QNEthernet.cpp: In member function 'void qindesign::network::EthernetClass::setLocalIP(const IPAddress&) const':
/Users/rhyde/Documents/Arduino/libraries/QNEthernet/src/QNEthernet.cpp:613:45: error: invalid static_cast from type 'const IPAddress' to type 'uint32_t {aka long unsigned int}'
   ip4_addr_t ipaddr{static_cast<uint32_t>(ip)};
                                             ^
/Users/rhyde/Documents/Arduino/libraries/QNEthernet/src/QNEthernet.cpp: In member function 'void qindesign::network::EthernetClass::setSubnetMask(const IPAddress&) const':
/Users/rhyde/Documents/Arduino/libraries/QNEthernet/src/QNEthernet.cpp:625:54: error: invalid static_cast from type 'const IPAddress' to type 'uint32_t {aka long unsigned int}'
   ip4_addr_t netmask{static_cast<uint32_t>(subnetMask)};
                                                      ^
/Users/rhyde/Documents/Arduino/libraries/QNEthernet/src/QNEthernet.cpp: In member function 'void qindesign::network::EthernetClass::setGatewayIP(const IPAddress&) const':
/Users/rhyde/Documents/Arduino/libraries/QNEthernet/src/QNEthernet.cpp:637:41: error: invalid static_cast from type 'const IPAddress' to type 'uint32_t {aka long unsigned int}'
   ip4_addr_t gw{static_cast<uint32_t>(ip)};
                                         ^
/Users/rhyde/Documents/Arduino/libraries/QNEthernet/src/QNEthernet.cpp: In member function 'bool qindesign::network::EthernetClass::joinGroup(const IPAddress&) const':
/Users/rhyde/Documents/Arduino/libraries/QNEthernet/src/QNEthernet.cpp:677:48: error: invalid static_cast from type 'const IPAddress' to type 'uint32_t {aka long unsigned int}'
   ip4_addr_t groupaddr{static_cast<uint32_t>(ip)};
                                                ^
/Users/rhyde/Documents/Arduino/libraries/QNEthernet/src/QNEthernet.cpp: In member function 'bool qindesign::network::EthernetClass::leaveGroup(const IPAddress&) const':
/Users/rhyde/Documents/Arduino/libraries/QNEthernet/src/QNEthernet.cpp:696:48: error: invalid static_cast from type 'const IPAddress' to type 'uint32_t {aka long unsigned int}'
   ip4_addr_t groupaddr{static_cast<uint32_t>(ip)};
                                                ^
/Users/rhyde/Library/Arduino15/packages/teensy/tools/teensy-compile/5.4.1/arm/bin/arm-none-eabi-gcc -c -O2 -g -Wall -ffunction-sections -fdata-sections -nostdlib -MMD -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=157 -DARDUINO=10607 -DARDUINO_TEENSY41 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH -I/Users/rhyde/Library/Arduino15/packages/teensy/hardware/avr/1.57.2/cores/teensy4 -I/Users/rhyde/Documents/Arduino/libraries/Adafruit_GFX_Library -I/Users/rhyde/Documents/Arduino/libraries/Adafruit_BusIO -I/Users/rhyde/Library/Arduino15/packages/teensy/hardware/avr/1.57.2/libraries/Wire -I/Users/rhyde/Library/Arduino15/packages/teensy/hardware/avr/1.57.2/libraries/SPI -I/Users/rhyde/Documents/Arduino/libraries/Adafruit_SH110X -I/Users/rhyde/Documents/Arduino/libraries/QNEthernet/src /Users/rhyde/Documents/Arduino/libraries/QNEthernet/src/lwip/ipv6/mld6.c -o /private/var/folders/13/fqsfj5688xl6n0006s6cl2vh0000gr/T/arduino/sketches/A9CBB7C5FF40034F7475A83204727AB4/libraries/QNEthernet/lwip/ipv6/mld6.c.o
/Users/rhyde/Library/Arduino15/packages/teensy/tools/teensy-compile/5.4.1/arm/bin/arm-none-eabi-gcc -c -O2 -g -Wall -ffunction-sections -fdata-sections -nostdlib -MMD -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=157 -DARDUINO=10607 -DARDUINO_TEENSY41 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH -I/Users/rhyde/Library/Arduino15/packages/teensy/hardware/avr/1.57.2/cores/teensy4 -I/Users/rhyde/Documents/Arduino/libraries/Adafruit_GFX_Library -I/Users/rhyde/Documents/Arduino/libraries/Adafruit_BusIO -I/Users/rhyde/Library/Arduino15/packages/teensy/hardware/avr/1.57.2/libraries/Wire -I/Users/rhyde/Library/Arduino15/packages/teensy/hardware/avr/1.57.2/libraries/SPI -I/Users/rhyde/Documents/Arduino/libraries/Adafruit_SH110X -I/Users/rhyde/Documents/Arduino/libraries/QNEthernet/src /Users/rhyde/Documents/Arduino/libraries/QNEthernet/src/lwip/ipv6/nd6.c -o /private/var/folders/13/fqsfj5688xl6n0006s6cl2vh0000gr/T/arduino/sketches/A9CBB7C5FF40034F7475A83204727AB4/libraries/QNEthernet/lwip/ipv6/nd6.c.o
/Users/rhyde/Library/Arduino15/packages/teensy/tools/teensy-compile/5.4.1/arm/bin/arm-none-eabi-gcc -c -O2 -g -Wall -ffunction-sections -fdata-sections -nostdlib -MMD -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=157 -DARDUINO=10607 -DARDUINO_TEENSY41 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH -I/Users/rhyde/Library/Arduino15/packages/teensy/hardware/avr/1.57.2/cores/teensy4 -I/Users/rhyde/Documents/Arduino/libraries/Adafruit_GFX_Library -I/Users/rhyde/Documents/Arduino/libraries/Adafruit_BusIO -I/Users/rhyde/Library/Arduino15/packages/teensy/hardware/avr/1.57.2/libraries/Wire -I/Users/rhyde/Library/Arduino15/packages/teensy/hardware/avr/1.57.2/libraries/SPI -I/Users/rhyde/Documents/Arduino/libraries/Adafruit_SH110X -I/Users/rhyde/Documents/Arduino/libraries/QNEthernet/src /Users/rhyde/Documents/Arduino/libraries/QNEthernet/src/lwip/memp.c -o /private/var/folders/13/fqsfj5688xl6n0006s6cl2vh0000gr/T/arduino/sketches/A9CBB7C5FF40034F7475A83204727AB4/libraries/QNEthernet/lwip/memp.c.o
/Users/rhyde/Library/Arduino15/packages/teensy/tools/teensy-compile/5.4.1/arm/bin/arm-none-eabi-gcc -c -O2 -g -Wall -ffunction-sections -fdata-sections -nostdlib -MMD -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=157 -DARDUINO=10607 -DARDUINO_TEENSY41 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH -I/Users/rhyde/Library/Arduino15/packages/teensy/hardware/avr/1.57.2/cores/teensy4 -I/Users/rhyde/Documents/Arduino/libraries/Adafruit_GFX_Library -I/Users/rhyde/Documents/Arduino/libraries/Adafruit_BusIO -I/Users/rhyde/Library/Arduino15/packages/teensy/hardware/avr/1.57.2/libraries/Wire -I/Users/rhyde/Library/Arduino15/packages/teensy/hardware/avr/1.57.2/libraries/SPI -I/Users/rhyde/Documents/Arduino/libraries/Adafruit_SH110X -I/Users/rhyde/Documents/Arduino/libraries/QNEthernet/src /Users/rhyde/Documents/Arduino/libraries/QNEthernet/src/lwip/netif.c -o /private/var/folders/13/fqsfj5688xl6n0006s6cl2vh0000gr/T/arduino/sketches/A9CBB7C5FF40034F7475A83204727AB4/libraries/QNEthernet/lwip/netif.c.o
/Users/rhyde/Library/Arduino15/packages/teensy/tools/teensy-compile/5.4.1/arm/bin/arm-none-eabi-gcc -c -O2 -g -Wall -ffunction-sections -fdata-sections -nostdlib -MMD -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=157 -DARDUINO=10607 -DARDUINO_TEENSY41 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH -I/Users/rhyde/Library/Arduino15/packages/teensy/hardware/avr/1.57.2/cores/teensy4 -I/Users/rhyde/Documents/Arduino/libraries/Adafruit_GFX_Library -I/Users/rhyde/Documents/Arduino/libraries/Adafruit_BusIO -I/Users/rhyde/Library/Arduino15/packages/teensy/hardware/avr/1.57.2/libraries/Wire -I/Users/rhyde/Library/Arduino15/packages/teensy/hardware/avr/1.57.2/libraries/SPI -I/Users/rhyde/Documents/Arduino/libraries/Adafruit_SH110X -I/Users/rhyde/Documents/Arduino/libraries/QNEthernet/src /Users/rhyde/Documents/Arduino/libraries/QNEthernet/src/lwip/mem.c -o /private/var/folders/13/fqsfj5688xl6n0006s6cl2vh0000gr/T/arduino/sketches/A9CBB7C5FF40034F7475A83204727AB4/libraries/QNEthernet/lwip/mem.c.o
/Users/rhyde/Library/Arduino15/packages/teensy/tools/teensy-compile/5.4.1/arm/bin/arm-none-eabi-gcc -c -O2 -g -Wall -ffunction-sections -fdata-sections -nostdlib -MMD -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=157 -DARDUINO=10607 -DARDUINO_TEENSY41 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH -I/Users/rhyde/Library/Arduino15/packages/teensy/hardware/avr/1.57.2/cores/teensy4 -I/Users/rhyde/Documents/Arduino/libraries/Adafruit_GFX_Library -I/Users/rhyde/Documents/Arduino/libraries/Adafruit_BusIO -I/Users/rhyde/Library/Arduino15/packages/teensy/hardware/avr/1.57.2/libraries/Wire -I/Users/rhyde/Library/Arduino15/packages/teensy/hardware/avr/1.57.2/libraries/SPI -I/Users/rhyde/Documents/Arduino/libraries/Adafruit_SH110X -I/Users/rhyde/Documents/Arduino/libraries/QNEthernet/src /Users/rhyde/Documents/Arduino/libraries/QNEthernet/src/lwip/pbuf.c -o /private/var/folders/13/fqsfj5688xl6n0006s6cl2vh0000gr/T/arduino/sketches/A9CBB7C5FF40034F7475A83204727AB4/libraries/QNEthernet/lwip/pbuf.c.o
In file included from /Users/rhyde/Documents/Arduino/libraries/QNEthernet/src/QNDNSClient.cpp:14:0:
/Users/rhyde/Documents/Arduino/libraries/QNEthernet/src/QNEthernet.h:348:56: warning: 'maybe_unused' attribute directive ignored [-Wattributes]
   void setRetransmissionCount([[maybe_unused]] uint8_t number) const {}
                                                        ^
/Users/rhyde/Documents/Arduino/libraries/QNEthernet/src/QNEthernet.h:350:59: warning: 'maybe_unused' attribute directive ignored [-Wattributes]
   void setRetransmissionTimeout([[maybe_unused]] uint16_t milliseconds) const {}
                                                           ^
/Users/rhyde/Documents/Arduino/libraries/QNEthernet/src/QNEthernet.h:429:23: warning: 'nodiscard' attribute directive ignored [-Wattributes]
   bool maybeStartDHCP();
                       ^
/Users/rhyde/Documents/Arduino/libraries/QNEthernet/src/QNEthernet.h:435:14: warning: 'nodiscard' attribute directive ignored [-Wattributes]
   bool start();
              ^
/Users/rhyde/Documents/Arduino/libraries/QNEthernet/src/QNDNSClient.cpp:25:59: warning: 'maybe_unused' attribute directive ignored [-Wattributes]
 void DNSClient::dnsFoundFunc([[maybe_unused]] const char *name,
                                                           ^
In file included from /Users/rhyde/Documents/Arduino/libraries/QNEthernet/src/QNDNSClient.h:19:0,
                 from /Users/rhyde/Documents/Arduino/libraries/QNEthernet/src/QNDNSClient.cpp:7:
/Users/rhyde/Documents/Arduino/libraries/QNEthernet/src/QNDNSClient.cpp: In static member function 'static bool qindesign::network::DNSClient::setServer(int, const IPAddress&)':
/Users/rhyde/Documents/Arduino/libraries/QNEthernet/src/QNDNSClient.cpp:44:55: error: invalid static_cast from type 'const IPAddress' to type 'uint32_t {aka long unsigned int}'
   ip_addr_t addr IPADDR4_INIT(static_cast<uint32_t>(ip));
                                                       ^
/Users/rhyde/Documents/Arduino/libraries/QNEthernet/src/lwip/ip_addr.h:295:51: note: in definition of macro 'IPADDR4_INIT'
 #define IPADDR4_INIT(u32val)                    { u32val }
                                                   ^
In file included from /Users/rhyde/Documents/Arduino/libraries/QNEthernet/src/QNEthernetClient.cpp:17:0:
/Users/rhyde/Documents/Arduino/libraries/QNEthernet/src/QNEthernet.h:348:56: warning: 'maybe_unused' attribute directive ignored [-Wattributes]
   void setRetransmissionCount([[maybe_unused]] uint8_t number) const {}
                                                        ^
/Users/rhyde/Documents/Arduino/libraries/QNEthernet/src/QNEthernet.h:350:59: warning: 'maybe_unused' attribute directive ignored [-Wattributes]
   void setRetransmissionTimeout([[maybe_unused]] uint16_t milliseconds) const {}
                                                           ^
/Users/rhyde/Documents/Arduino/libraries/QNEthernet/src/QNEthernet.h:429:23: warning: 'nodiscard' attribute directive ignored [-Wattributes]
   bool maybeStartDHCP();
                       ^
/Users/rhyde/Documents/Arduino/libraries/QNEthernet/src/QNEthernet.h:435:14: warning: 'nodiscard' attribute directive ignored [-Wattributes]
   bool start();
              ^
In file included from /Users/rhyde/Documents/Arduino/libraries/QNEthernet/src/lwip/ip.h:46:0,
                 from /Users/rhyde/Documents/Arduino/libraries/QNEthernet/src/lwip/tcp.h:48,
                 from /Users/rhyde/Documents/Arduino/libraries/QNEthernet/src/lwip/altcp.h:150,
                 from /Users/rhyde/Documents/Arduino/libraries/QNEthernet/src/internal/ConnectionState.h:17,
                 from /Users/rhyde/Documents/Arduino/libraries/QNEthernet/src/internal/ConnectionHolder.h:16,
                 from /Users/rhyde/Documents/Arduino/libraries/QNEthernet/src/QNEthernetClient.h:22,
                 from /Users/rhyde/Documents/Arduino/libraries/QNEthernet/src/QNEthernetClient.cpp:7:
/Users/rhyde/Documents/Arduino/libraries/QNEthernet/src/QNEthernetClient.cpp: In member function 'bool qindesign::network::EthernetClient::connectNoWait(const IPAddress&, uint16_t)':
/Users/rhyde/Documents/Arduino/libraries/QNEthernet/src/QNEthernetClient.cpp:89:57: error: invalid static_cast from type 'const IPAddress' to type 'uint32_t {aka long unsigned int}'
   ip_addr_t ipaddr IPADDR4_INIT(static_cast<uint32_t>(ip));
                                                         ^
/Users/rhyde/Documents/Arduino/libraries/QNEthernet/src/lwip/ip_addr.h:295:51: note: in definition of macro 'IPADDR4_INIT'
 #define IPADDR4_INIT(u32val)                    { u32val }
                                                   ^
In file included from /Users/rhyde/Documents/Arduino/libraries/QNEthernet/src/QNEthernetUDP.cpp:16:0:
/Users/rhyde/Documents/Arduino/libraries/QNEthernet/src/QNEthernet.h:348:56: warning: 'maybe_unused' attribute directive ignored [-Wattributes]
   void setRetransmissionCount([[maybe_unused]] uint8_t number) const {}
                                                        ^
/Users/rhyde/Documents/Arduino/libraries/QNEthernet/src/QNEthernet.h:350:59: warning: 'maybe_unused' attribute directive ignored [-Wattributes]
   void setRetransmissionTimeout([[maybe_unused]] uint16_t milliseconds) const {}
                                                           ^
/Users/rhyde/Documents/Arduino/libraries/QNEthernet/src/QNEthernet.h:429:23: warning: 'nodiscard' attribute directive ignored [-Wattributes]
   bool maybeStartDHCP();
                       ^
/Users/rhyde/Documents/Arduino/libraries/QNEthernet/src/QNEthernet.h:435:14: warning: 'nodiscard' attribute directive ignored [-Wattributes]
   bool start();
              ^
In file included from /Users/rhyde/Documents/Arduino/libraries/QNEthernet/src/QNEthernetUDP.h:23:0,
                 from /Users/rhyde/Documents/Arduino/libraries/QNEthernet/src/QNEthernetUDP.cpp:7:
/Users/rhyde/Documents/Arduino/libraries/QNEthernet/src/QNEthernetUDP.cpp: In member function 'bool qindesign::network::EthernetUDP::send(const IPAddress&, uint16_t, const uint8_t*, size_t)':
/Users/rhyde/Documents/Arduino/libraries/QNEthernet/src/QNEthernetUDP.cpp:498:57: error: invalid static_cast from type 'const IPAddress' to type 'uint32_t {aka long unsigned int}'
   ip_addr_t ipaddr IPADDR4_INIT(static_cast<uint32_t>(ip));
                                                         ^
/Users/rhyde/Documents/Arduino/libraries/QNEthernet/src/lwip/ip_addr.h:295:51: note: in definition of macro 'IPADDR4_INIT'
 #define IPADDR4_INIT(u32val)                    { u32val }
                                                   ^
In file included from /Users/rhyde/Documents/Arduino/libraries/QNEthernet/src/QNEthernetServer.cpp:14:0:
/Users/rhyde/Documents/Arduino/libraries/QNEthernet/src/QNEthernet.h:348:56: warning: 'maybe_unused' attribute directive ignored [-Wattributes]
   void setRetransmissionCount([[maybe_unused]] uint8_t number) const {}
                                                        ^
/Users/rhyde/Documents/Arduino/libraries/QNEthernet/src/QNEthernet.h:350:59: warning: 'maybe_unused' attribute directive ignored [-Wattributes]
   void setRetransmissionTimeout([[maybe_unused]] uint16_t milliseconds) const {}
                                                           ^
/Users/rhyde/Documents/Arduino/libraries/QNEthernet/src/QNEthernet.h:429:23: warning: 'nodiscard' attribute directive ignored [-Wattributes]
   bool maybeStartDHCP();
                       ^
/Users/rhyde/Documents/Arduino/libraries/QNEthernet/src/QNEthernet.h:435:14: warning: 'nodiscard' attribute directive ignored [-Wattributes]
   bool start();
              ^
In file included from /Users/rhyde/Documents/Arduino/libraries/QNEthernet/src/internal/ConnectionManager.cpp:18:0:
/Users/rhyde/Documents/Arduino/libraries/QNEthernet/src/QNEthernet.h:348:56: warning: 'maybe_unused' attribute directive ignored [-Wattributes]
   void setRetransmissionCount([[maybe_unused]] uint8_t number) const {}
                                                        ^
/Users/rhyde/Documents/Arduino/libraries/QNEthernet/src/QNEthernet.h:350:59: warning: 'maybe_unused' attribute directive ignored [-Wattributes]
   void setRetransmissionTimeout([[maybe_unused]] uint16_t milliseconds) const {}
                                                           ^
/Users/rhyde/Documents/Arduino/libraries/QNEthernet/src/QNEthernet.h:429:23: warning: 'nodiscard' attribute directive ignored [-Wattributes]
   bool maybeStartDHCP();
                       ^
/Users/rhyde/Documents/Arduino/libraries/QNEthernet/src/QNEthernet.h:435:14: warning: 'nodiscard' attribute directive ignored [-Wattributes]
   bool start();
              ^
/Users/rhyde/Documents/Arduino/libraries/QNEthernet/src/internal/ConnectionManager.cpp: In member function 'void qindesign::network::internal::ConnectionManager::addConnection(const std::shared_ptr<qindesign::network::internal::ConnectionHolder>&)':
/Users/rhyde/Documents/Arduino/libraries/QNEthernet/src/internal/ConnectionManager.cpp:253:69: warning: 'maybe_unused' attribute directive ignored [-Wattributes]
                                   [[maybe_unused]] ConnectionState *state) {
                                                                     ^

Using library Adafruit GFX Library at version 1.11.9 in folder: /Users/rhyde/Documents/Arduino/libraries/Adafruit_GFX_Library
Using library Adafruit BusIO at version 1.16.1 in folder: /Users/rhyde/Documents/Arduino/libraries/Adafruit_BusIO
Using library Wire at version 1.0 in folder: /Users/rhyde/Library/Arduino15/packages/teensy/hardware/avr/1.57.2/libraries/Wire
Using library SPI at version 1.0 in folder: /Users/rhyde/Library/Arduino15/packages/teensy/hardware/avr/1.57.2/libraries/SPI
Using library Adafruit SH110X at version 2.1.10 in folder: /Users/rhyde/Documents/Arduino/libraries/Adafruit_SH110X
Using library QNEthernet at version 0.30.1 in folder: /Users/rhyde/Documents/Arduino/libraries/QNEthernet
exit status 1

Compilation error: exit status 1
 
That code (line 225) is correct. Which version of the Arduino IDE are you using, and which version of Teensyduino? Older versions of Teensyduino don’t yet have support for casting a const IPAddress to a uint32_t. I removed the custom code that fixes this because the last few versions of Teensyduino have the correct thing.
 
This was compiling fine yesterday, before I foolishly allowed Arduino to update itself and the libraries.
 
I can help. But first, which version of Teensyduino are you using? May I suggest updating to 1.59? That should fix the problem.
 
Back
Top