Added mutex for multiple SPI devices on the same SPI bus
Fork of cc3000_hostdriver_mbedsocket by
Diff: Socket/Endpoint.cpp
- Revision:
- 34:1ad18123bf11
- Parent:
- 18:7e22775eadb9
- Child:
- 45:50ab13d8f2dc
diff -r 9e23b24fb4f3 -r 1ad18123bf11 Socket/Endpoint.cpp --- a/Socket/Endpoint.cpp Tue Oct 08 07:04:07 2013 +0200 +++ b/Socket/Endpoint.cpp Tue Oct 08 13:13:05 2013 +0200 @@ -95,23 +95,14 @@ //Resolve DNS address or populate hard-coded IP address uint32_t address_integer; resolveRetCode = _cc3000_module->_socket.gethostbyname((uint8_t *)host, strlen(host) , &address_integer); - - if ((resolveRetCode > -1) && ( 0 != address_integer )) - { - // Resolved address - uint32_t ip = 0; - ip = (ip | (address_integer >> 24)); - ip = (ip | ((address_integer & 0x00FF0000) >> 8)); - ip = (ip | ((address_integer & 0x0000FF00) << 8)); - ip = (ip | ((address_integer & 0x000000FF) << 24)); - _remote_host.sin_addr.s_addr = ip; + + if ((resolveRetCode > -1) && (0 != address_integer)) { + _remote_host.sin_addr.s_addr = htonl(address_integer); inet_ntoa_r(_remote_host.sin_addr, _ipAddress, sizeof(_ipAddress)); - } - else - { + } else { // Failed to resolve the address DBG_SOCKET("Failed to resolve the hostname : %s",host); - return ( -1 ); + return (-1); } } else { std::memcpy((char*)&_remote_host.sin_addr.s_addr, p_address, 4); @@ -127,7 +118,7 @@ int((_remote_host.sin_addr.s_addr & 0xFF0000) >> 16), int((_remote_host.sin_addr.s_addr & 0xFF000000) >> 24)); DBG_SOCKET("port: %d", port); - + return 0; }