W5500 from SeeedStudio on NUCLEO-L476RG
Dependents: coap-example Borsch coap-example
Fork of W5500Interface by
Diff: W5500Interface.cpp
- Revision:
- 3:61ff27ed8355
- Parent:
- 2:06b6f9f7c071
- Child:
- 4:80e302a610fd
diff -r 06b6f9f7c071 -r 61ff27ed8355 W5500Interface.cpp --- a/W5500Interface.cpp Sat Jul 01 07:29:02 2017 +0000 +++ b/W5500Interface.cpp Wed Jul 05 18:37:40 2017 +0000 @@ -235,7 +235,6 @@ switch (SKT(handle)->proto) { case NSAPI_UDP: // set local port - debug("in NSAPI_UDP\n"); if (address.get_port() != 0) { WIZnet_Chip::sreg<uint16_t>(SKT(handle)->fd, Sn_PORT, address.get_port()); } else { @@ -247,7 +246,6 @@ WIZnet_Chip::scmd(SKT(handle)->fd, OPEN); return 0; case NSAPI_TCP: - debug("in NSAPI_TCP\n"); listen_port = address.get_port(); // set TCP protocol WIZnet_Chip::setProtocol(SKT(handle)->fd, TCP); @@ -410,21 +408,17 @@ nsapi_size_or_error_t W5500Interface::socket_sendto(nsapi_socket_t handle, const SocketAddress &address, const void *data, nsapi_size_t size) { - debug("sendto: wait writeable with \n"); - //int size = eth->wait_writeable(_sock_fd, _blocking ? -1 : _timeout, length-1); - int len = WIZnet_Chip::wait_writeable(SKT(handle)->fd, w5500_WAIT_TIMEOUT, size-1); // change applied to use 1500 timeout !!! + //compare with original: int size = eth->wait_writeable(_sock_fd, _blocking ? -1 : _timeout, length-1); + int len = WIZnet_Chip::wait_writeable(SKT(handle)->fd, w5500_WAIT_TIMEOUT, size-1); if (len < 0) { - debug("sendto: wait writeable error NSAPI_ERROR_WOULD_BLOCK\n"); return NSAPI_ERROR_WOULD_BLOCK;; } - debug("sendto: set remote host"); // set remote host WIZnet_Chip::sreg_ip(SKT(handle)->fd, Sn_DIPR, address.get_ip_address()); // set remote port - debug("sendto: set remote port"); WIZnet_Chip::sreg<uint16_t>(SKT(handle)->fd, Sn_DPORT, address.get_port()); - debug("sendto: send data"); + return WIZnet_Chip::send(SKT(handle)->fd, (const char*)data, size); }