For mbed OS-5 version for WIZnet Ethernet Interface, this is Library using Hardware TCP/IP chip, W5500 and TCP/IP Offload Engine, W7500.
Warning
- If you want to use existing codes, you need to change the class used as EthernetInterface to WIZnetInterface.
This is WIZnet Ethernet Interface using Hardware TCP/IP chip, W5500 and TCP/IP Offload Engine, W7500.
- WIZwiki_W7500 : /platforms/WIZwiki-W7500/
- WIZwiki_W7500P : /platforms/WIZwiki-W7500P/
- WIZwiki_W7500ECO : /platforms/WIZwiki-W7500ECO/
- W5500 Ethernet Shield : /components/W5500-Ethernet-Kit-for-IoT/
This library is an Ethernet Interface library port-based on [EthernetInterface](https://developer.mbed.org/users/mbed_official/code/EthernetInterface/docs/tip/).
For more detail, visit http://embeddist.blogspot.kr/2015/06/wiznetinterface-for-armmbed.html
Socket/pico_string.h@0:d4c8fe4d9b29, 2017-09-04 (annotated)
- Committer:
- justinkim
- Date:
- Mon Sep 04 00:23:04 2017 +0000
- Revision:
- 0:d4c8fe4d9b29
mbed OS 5 version migration...
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
justinkim | 0:d4c8fe4d9b29 | 1 | // pico_string.h 2013/8/27 |
justinkim | 0:d4c8fe4d9b29 | 2 | #pragma once |
justinkim | 0:d4c8fe4d9b29 | 3 | class pico_string { |
justinkim | 0:d4c8fe4d9b29 | 4 | public: |
justinkim | 0:d4c8fe4d9b29 | 5 | pico_string(){ |
justinkim | 0:d4c8fe4d9b29 | 6 | _len = 0; |
justinkim | 0:d4c8fe4d9b29 | 7 | _buf = (char*)malloc(1); |
justinkim | 0:d4c8fe4d9b29 | 8 | if (_buf) { |
justinkim | 0:d4c8fe4d9b29 | 9 | _buf[0] = '\0'; |
justinkim | 0:d4c8fe4d9b29 | 10 | } |
justinkim | 0:d4c8fe4d9b29 | 11 | } |
justinkim | 0:d4c8fe4d9b29 | 12 | ~pico_string() { |
justinkim | 0:d4c8fe4d9b29 | 13 | if (_buf) { |
justinkim | 0:d4c8fe4d9b29 | 14 | free(_buf); |
justinkim | 0:d4c8fe4d9b29 | 15 | } |
justinkim | 0:d4c8fe4d9b29 | 16 | } |
justinkim | 0:d4c8fe4d9b29 | 17 | bool empty() { |
justinkim | 0:d4c8fe4d9b29 | 18 | return _len == 0; |
justinkim | 0:d4c8fe4d9b29 | 19 | } |
justinkim | 0:d4c8fe4d9b29 | 20 | void append(const char* s, int len) { |
justinkim | 0:d4c8fe4d9b29 | 21 | if (_buf == NULL) { |
justinkim | 0:d4c8fe4d9b29 | 22 | return; |
justinkim | 0:d4c8fe4d9b29 | 23 | } |
justinkim | 0:d4c8fe4d9b29 | 24 | char* p = (char*)malloc(_len+len+1); |
justinkim | 0:d4c8fe4d9b29 | 25 | if (p == NULL) { |
justinkim | 0:d4c8fe4d9b29 | 26 | return; |
justinkim | 0:d4c8fe4d9b29 | 27 | } |
justinkim | 0:d4c8fe4d9b29 | 28 | memcpy(p, _buf, _len); |
justinkim | 0:d4c8fe4d9b29 | 29 | memcpy(p+_len, s, len); |
justinkim | 0:d4c8fe4d9b29 | 30 | p[_len+len] = '\0'; |
justinkim | 0:d4c8fe4d9b29 | 31 | free(_buf); |
justinkim | 0:d4c8fe4d9b29 | 32 | _buf = p; |
justinkim | 0:d4c8fe4d9b29 | 33 | } |
justinkim | 0:d4c8fe4d9b29 | 34 | void append(const char* s) { |
justinkim | 0:d4c8fe4d9b29 | 35 | append(s, strlen(s)); |
justinkim | 0:d4c8fe4d9b29 | 36 | } |
justinkim | 0:d4c8fe4d9b29 | 37 | char* c_str() { |
justinkim | 0:d4c8fe4d9b29 | 38 | if (_buf) { |
justinkim | 0:d4c8fe4d9b29 | 39 | return _buf; |
justinkim | 0:d4c8fe4d9b29 | 40 | } |
justinkim | 0:d4c8fe4d9b29 | 41 | return ""; |
justinkim | 0:d4c8fe4d9b29 | 42 | } |
justinkim | 0:d4c8fe4d9b29 | 43 | private: |
justinkim | 0:d4c8fe4d9b29 | 44 | char* _buf; |
justinkim | 0:d4c8fe4d9b29 | 45 | int _len; |
justinkim | 0:d4c8fe4d9b29 | 46 | }; |