mirror of
https://github.com/esp8266/Arduino.git
synced 2025-07-30 16:24:09 +03:00
Fix for issue 439. UDP API changed to derive from Stream. The old sendPacket and readPacket calls have been removed, and replaced with Stream-derived alternatives which provide more commonality with other communications classes and to allow both buffered and full-packet-at-a-time uses. Also includes the introduction of an IPAddress class to make passing them around easier (and require fewer pointers to be exposed)
This commit is contained in:
@ -65,10 +65,16 @@ uint16_t W5100Class::getRXReceivedSize(SOCKET s)
|
||||
}
|
||||
|
||||
|
||||
void W5100Class::send_data_processing(SOCKET s, uint8_t *data, uint16_t len)
|
||||
void W5100Class::send_data_processing(SOCKET s, const uint8_t *data, uint16_t len)
|
||||
{
|
||||
// This is same as having no offset in a call to send_data_processing_offset
|
||||
send_data_processing_offset(s, 0, data, len);
|
||||
}
|
||||
|
||||
void W5100Class::send_data_processing_offset(SOCKET s, uint16_t data_offset, const uint8_t *data, uint16_t len)
|
||||
{
|
||||
uint16_t ptr = readSnTX_WR(s);
|
||||
|
||||
ptr += data_offset;
|
||||
uint16_t offset = ptr & SMASK;
|
||||
uint16_t dstAddr = offset + SBASE[s];
|
||||
|
||||
@ -132,7 +138,7 @@ uint8_t W5100Class::write(uint16_t _addr, uint8_t _data)
|
||||
return 1;
|
||||
}
|
||||
|
||||
uint16_t W5100Class::write(uint16_t _addr, uint8_t *_buf, uint16_t _len)
|
||||
uint16_t W5100Class::write(uint16_t _addr, const uint8_t *_buf, uint16_t _len)
|
||||
{
|
||||
for (int i=0; i<_len; i++)
|
||||
{
|
||||
|
Reference in New Issue
Block a user