8000 drivers, wiznet5k: Add HAL_Delay(1) to "infinite" loops. · sparkfun/circuitpython@9091e84 · GitHub
[go: up one dir, main page]

Skip to content

Commit 9091e84

Browse files
committed
drivers, wiznet5k: Add HAL_Delay(1) to "infinite" loops.
1 parent 7da9145 commit 9091e84

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

drivers/wiznet5k/ethernet/socket.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@
5151
//*****************************************************************************
5252
#include "socket.h"
5353

54+
extern void HAL_Delay(uint32_t);
55+
5456
#define SOCK_ANY_PORT_NUM 0xC000;
5557

5658
static uint16_t sock_any_port = SOCK_ANY_PORT_NUM;
@@ -225,6 +227,7 @@ int8_t connect(uint8_t sn, uint8_t * addr, uint16_t port)
225227
#endif
226228
return SOCKERR_TIMEOUT;
227229
}
230+
HAL_Delay(1);
228231
}
229232
#if _WIZCHIP_ == 5200 // for W5200 ARP errata
230233
setSUBR((uint8_t*)"\x00\x00\x00\x00");
@@ -345,6 +348,7 @@ int32_t recv(uint8_t sn, uint8_t * buf, uint16_t len)
345348
}
346349
if((sock_io_mode & (1<<sn)) && (recvsize == 0)) return SOCK_BUSY;
347350
if(recvsize != 0) break;
351+
HAL_Delay(1);
348352
};
349353
if(recvsize < len) len = recvsize;
350354
wiz_recv_data(sn, buf, len);
@@ -392,6 +396,7 @@ int32_t sendto(uint8_t sn, uint8_t * buf, uint16_t len, uint8_t * addr, uint16_t
392396
if(getSn_SR(sn) == SOCK_CLOSED) return SOCKERR_SOCKCLOSED;
393397
if( (sock_io_mode & (1<<sn)) && (len > freesize) ) return SOCK_BUSY;
394398
if(len <= freesize) break;
399+
HAL_Delay(1);
395400
};
396401
wiz_send_data(sn, buf, len);
397402

@@ -421,6 +426,7 @@ int32_t sendto(uint8_t sn, uint8_t * buf, uint16_t len, uint8_t * addr, uint16_t
421426
return SOCKERR_TIMEOUT;
422427
}
423428
////////////
429+
HAL_Delay(1);
424430
}
425431
#if _WIZCHIP_ == 5200 // for W5200 ARP errata
426432
setSUBR((uint8_t*)"\x00\x00\x00\x00");

0 commit comments

Comments
 (0)
0