mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-17 22:23:10 +03:00
Removed unused stuff from WiFi library.
This commit is contained in:
@ -104,7 +104,10 @@ int WiFiClient::read() {
|
|||||||
|
|
||||||
|
|
||||||
int WiFiClient::read(uint8_t* buf, size_t size) {
|
int WiFiClient::read(uint8_t* buf, size_t size) {
|
||||||
if (!ServerDrv::getDataBuf(_sock, buf, &size))
|
// sizeof(size_t) is architecture dependent
|
||||||
|
// but we need a 16 bit data type here
|
||||||
|
uint16_t _size = size;
|
||||||
|
if (!ServerDrv::getDataBuf(_sock, buf, &_size))
|
||||||
return -1;
|
return -1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -115,7 +115,7 @@ int WiFiUDP::read(unsigned char* buffer, size_t len)
|
|||||||
{
|
{
|
||||||
if (available())
|
if (available())
|
||||||
{
|
{
|
||||||
size_t size = 0;
|
uint16_t size = 0;
|
||||||
if (!ServerDrv::getDataBuf(_sock, buffer, &size))
|
if (!ServerDrv::getDataBuf(_sock, buffer, &size))
|
||||||
return -1;
|
return -1;
|
||||||
// TODO check if the buffer is too smal respect to buffer size
|
// TODO check if the buffer is too smal respect to buffer size
|
||||||
|
@ -15,73 +15,20 @@
|
|||||||
#define SOCK_NOT_AVAIL 255
|
#define SOCK_NOT_AVAIL 255
|
||||||
|
|
||||||
#include "utility/wl_definitions.h"
|
#include "utility/wl_definitions.h"
|
||||||
/**
|
|
||||||
* The 8-bit signed data type.
|
|
||||||
*/
|
|
||||||
typedef char int8;
|
|
||||||
/**
|
|
||||||
* The volatile 8-bit signed data type.
|
|
||||||
*/
|
|
||||||
typedef volatile char vint8;
|
|
||||||
/**
|
|
||||||
* The 8-bit unsigned data type.
|
|
||||||
*/
|
|
||||||
typedef unsigned char uint8;
|
|
||||||
/**
|
|
||||||
* The volatile 8-bit unsigned data type.
|
|
||||||
*/
|
|
||||||
typedef volatile unsigned char vuint8;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The 16-bit signed data type.
|
|
||||||
*/
|
|
||||||
typedef int int16;
|
|
||||||
/**
|
|
||||||
* The volatile 16-bit signed data type.
|
|
||||||
*/
|
|
||||||
typedef volatile int vint16;
|
|
||||||
/**
|
|
||||||
* The 16-bit unsigned data type.
|
|
||||||
*/
|
|
||||||
typedef unsigned int uint16;
|
|
||||||
/**
|
|
||||||
* The volatile 16-bit unsigned data type.
|
|
||||||
*/
|
|
||||||
typedef volatile unsigned int vuint16;
|
|
||||||
/**
|
|
||||||
* The 32-bit signed data type.
|
|
||||||
*/
|
|
||||||
typedef long int32;
|
|
||||||
/**
|
|
||||||
* The volatile 32-bit signed data type.
|
|
||||||
*/
|
|
||||||
typedef volatile long vint32;
|
|
||||||
/**
|
|
||||||
* The 32-bit unsigned data type.
|
|
||||||
*/
|
|
||||||
typedef unsigned long uint32;
|
|
||||||
/**
|
|
||||||
* The volatile 32-bit unsigned data type.
|
|
||||||
*/
|
|
||||||
typedef volatile unsigned long vuint32;
|
|
||||||
|
|
||||||
/* bsd */
|
|
||||||
typedef uint8 u_char; /**< 8-bit value */
|
|
||||||
typedef uint16_t SOCKET;
|
typedef uint16_t SOCKET;
|
||||||
typedef uint16 u_short; /**< 16-bit value */
|
|
||||||
typedef uint16 u_int; /**< 16-bit value */
|
|
||||||
typedef uint32 u_long; /**< 32-bit value */
|
|
||||||
|
|
||||||
extern SOCKET socket(uint8 protocol); // Opens a socket(TCP or UDP or IP_RAW mode)
|
extern SOCKET socket(uint8_t protocol); // Opens a socket(TCP or UDP or IP_RAW mode)
|
||||||
extern void close(SOCKET s); // Close socket
|
extern void close(SOCKET s); // Close socket
|
||||||
extern uint8 connect(SOCKET s, uint8 * addr, uint16 port); // Establish TCP connection (Active connection)
|
extern uint8_t connect(SOCKET s, uint8_t * addr, uint16_t port); // Establish TCP connection (Active connection)
|
||||||
extern void disconnect(SOCKET s); // disconnect the connection
|
extern void disconnect(SOCKET s); // disconnect the connection
|
||||||
extern uint8 listen(SOCKET s); // Establish TCP connection (Passive connection)
|
extern uint8_t listen(SOCKET s); // Establish TCP connection (Passive connection)
|
||||||
extern uint16 send(SOCKET s, const uint8 * buf, uint16 len); // Send data (TCP)
|
extern uint16_t send(SOCKET s, const uint8_t * buf, uint16_t len); // Send data (TCP)
|
||||||
extern uint16 recv(SOCKET s, uint8 * buf, uint16 len); // Receive data (TCP)
|
extern uint16_t recv(SOCKET s, uint8_t * buf, uint16_t len); // Receive data (TCP)
|
||||||
extern uint16 sendto(SOCKET s, const uint8 * buf, uint16 len, uint8 * addr, uint16 port); // Send data (UDP/IP RAW)
|
extern uint16_t sendto(SOCKET s, const uint8_t * buf, uint16_t len, uint8_t * addr, uint16_t port); // Send data (UDP/IP RAW)
|
||||||
extern uint16 recvfrom(SOCKET s, uint8 * buf, uint16 len, uint8 * addr, uint16 *port); // Receive data (UDP/IP RAW)
|
extern uint16_t recvfrom(SOCKET s, uint8_t * buf, uint16_t len, uint8_t * addr, uint16_t *port); // Receive data (UDP/IP RAW)
|
||||||
|
|
||||||
|
extern uint16_t igmpsend(SOCKET s, const uint8_t * buf, uint16_t len);
|
||||||
|
|
||||||
extern uint16 igmpsend(SOCKET s, const uint8 * buf, uint16 len);
|
|
||||||
#endif
|
#endif
|
||||||
/* _SOCKET_H_ */
|
/* _SOCKET_H_ */
|
||||||
|
@ -15,7 +15,6 @@ extern "C" {
|
|||||||
#define SLAVEREADY 7 // handshake pin
|
#define SLAVEREADY 7 // handshake pin
|
||||||
#define WIFILED 9 // led on wifi shield
|
#define WIFILED 9 // led on wifi shield
|
||||||
|
|
||||||
#define DELAY_100NS do { asm volatile("nop"); }while(0);
|
|
||||||
#define DELAY_SPI(X) { int ii=0; do { asm volatile("nop"); } while (++ii < X); }
|
#define DELAY_SPI(X) { int ii=0; do { asm volatile("nop"); } while (++ii < X); }
|
||||||
#define DELAY_TRANSFER() DELAY_SPI(10)
|
#define DELAY_TRANSFER() DELAY_SPI(10)
|
||||||
|
|
||||||
@ -52,17 +51,6 @@ void SpiDrv::spiSlaveDeselect()
|
|||||||
digitalWrite(SLAVESELECT,HIGH);
|
digitalWrite(SLAVESELECT,HIGH);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
void delaySpi()
|
|
||||||
{
|
|
||||||
int i = 0;
|
|
||||||
const int DELAY = 1000;
|
|
||||||
for (;i<DELAY;++i)
|
|
||||||
{
|
|
||||||
int a =a+1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
char SpiDrv::spiTransfer(volatile char data)
|
char SpiDrv::spiTransfer(volatile char data)
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#ifndef WiFi_Spi_h
|
#ifndef WiFi_Spi_h
|
||||||
#define WiFi_Spi_h
|
#define WiFi_Spi_h
|
||||||
|
|
||||||
|
#include <inttypes.h>
|
||||||
#include "utility/wl_definitions.h"
|
#include "utility/wl_definitions.h"
|
||||||
|
|
||||||
#define CMD_FLAG 0
|
#define CMD_FLAG 0
|
||||||
|
@ -104,6 +104,8 @@ int WiFiClient::read() {
|
|||||||
|
|
||||||
|
|
||||||
int WiFiClient::read(uint8_t* buf, size_t size) {
|
int WiFiClient::read(uint8_t* buf, size_t size) {
|
||||||
|
// sizeof(size_t) is architecture dependent
|
||||||
|
// but we need a 16 bit data type here
|
||||||
uint16_t _size = size;
|
uint16_t _size = size;
|
||||||
if (!ServerDrv::getDataBuf(_sock, buf, &_size))
|
if (!ServerDrv::getDataBuf(_sock, buf, &_size))
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -15,73 +15,20 @@
|
|||||||
#define SOCK_NOT_AVAIL 255
|
#define SOCK_NOT_AVAIL 255
|
||||||
|
|
||||||
#include "utility/wl_definitions.h"
|
#include "utility/wl_definitions.h"
|
||||||
/**
|
|
||||||
* The 8-bit signed data type.
|
|
||||||
*/
|
|
||||||
typedef char int8;
|
|
||||||
/**
|
|
||||||
* The volatile 8-bit signed data type.
|
|
||||||
*/
|
|
||||||
typedef volatile char vint8;
|
|
||||||
/**
|
|
||||||
* The 8-bit unsigned data type.
|
|
||||||
*/
|
|
||||||
typedef unsigned char uint8;
|
|
||||||
/**
|
|
||||||
* The volatile 8-bit unsigned data type.
|
|
||||||
*/
|
|
||||||
typedef volatile unsigned char vuint8;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The 16-bit signed data type.
|
|
||||||
*/
|
|
||||||
typedef int int16;
|
|
||||||
/**
|
|
||||||
* The volatile 16-bit signed data type.
|
|
||||||
*/
|
|
||||||
typedef volatile int vint16;
|
|
||||||
/**
|
|
||||||
* The 16-bit unsigned data type.
|
|
||||||
*/
|
|
||||||
typedef unsigned int uint16;
|
|
||||||
/**
|
|
||||||
* The volatile 16-bit unsigned data type.
|
|
||||||
*/
|
|
||||||
typedef volatile unsigned int vuint16;
|
|
||||||
/**
|
|
||||||
* The 32-bit signed data type.
|
|
||||||
*/
|
|
||||||
typedef long int32;
|
|
||||||
/**
|
|
||||||
* The volatile 32-bit signed data type.
|
|
||||||
*/
|
|
||||||
typedef volatile long vint32;
|
|
||||||
/**
|
|
||||||
* The 32-bit unsigned data type.
|
|
||||||
*/
|
|
||||||
typedef unsigned long uint32;
|
|
||||||
/**
|
|
||||||
* The volatile 32-bit unsigned data type.
|
|
||||||
*/
|
|
||||||
typedef volatile unsigned long vuint32;
|
|
||||||
|
|
||||||
/* bsd */
|
|
||||||
typedef uint8 u_char; /**< 8-bit value */
|
|
||||||
typedef uint16_t SOCKET;
|
typedef uint16_t SOCKET;
|
||||||
//typedef uint16 u_short; /**< 16-bit value */
|
|
||||||
typedef uint16 u_int; /**< 16-bit value */
|
|
||||||
typedef uint32 u_long; /**< 32-bit value */
|
|
||||||
|
|
||||||
extern SOCKET socket(uint8 protocol); // Opens a socket(TCP or UDP or IP_RAW mode)
|
extern SOCKET socket(uint8_t protocol); // Opens a socket(TCP or UDP or IP_RAW mode)
|
||||||
extern void close(SOCKET s); // Close socket
|
extern void close(SOCKET s); // Close socket
|
||||||
extern uint8 connect(SOCKET s, uint8 * addr, uint16 port); // Establish TCP connection (Active connection)
|
extern uint8_t connect(SOCKET s, uint8_t * addr, uint16_t port); // Establish TCP connection (Active connection)
|
||||||
extern void disconnect(SOCKET s); // disconnect the connection
|
extern void disconnect(SOCKET s); // disconnect the connection
|
||||||
extern uint8 listen(SOCKET s); // Establish TCP connection (Passive connection)
|
extern uint8_t listen(SOCKET s); // Establish TCP connection (Passive connection)
|
||||||
extern uint16 send(SOCKET s, const uint8 * buf, uint16 len); // Send data (TCP)
|
extern uint16_t send(SOCKET s, const uint8_t * buf, uint16_t len); // Send data (TCP)
|
||||||
extern uint16 recv(SOCKET s, uint8 * buf, uint16 len); // Receive data (TCP)
|
extern uint16_t recv(SOCKET s, uint8_t * buf, uint16_t len); // Receive data (TCP)
|
||||||
extern uint16 sendto(SOCKET s, const uint8 * buf, uint16 len, uint8 * addr, uint16 port); // Send data (UDP/IP RAW)
|
extern uint16_t sendto(SOCKET s, const uint8_t * buf, uint16_t len, uint8_t * addr, uint16_t port); // Send data (UDP/IP RAW)
|
||||||
extern uint16 recvfrom(SOCKET s, uint8 * buf, uint16 len, uint8 * addr, uint16 *port); // Receive data (UDP/IP RAW)
|
extern uint16_t recvfrom(SOCKET s, uint8_t * buf, uint16_t len, uint8_t * addr, uint16_t *port); // Receive data (UDP/IP RAW)
|
||||||
|
|
||||||
|
extern uint16_t igmpsend(SOCKET s, const uint8_t * buf, uint16_t len);
|
||||||
|
|
||||||
extern uint16 igmpsend(SOCKET s, const uint8 * buf, uint16 len);
|
|
||||||
#endif
|
#endif
|
||||||
/* _SOCKET_H_ */
|
/* _SOCKET_H_ */
|
||||||
|
@ -51,15 +51,6 @@ void SpiDrv::spiSlaveDeselect()
|
|||||||
digitalWrite(SLAVESELECT,HIGH);
|
digitalWrite(SLAVESELECT,HIGH);
|
||||||
}
|
}
|
||||||
|
|
||||||
//void delaySpi()
|
|
||||||
//{
|
|
||||||
// int i = 0;
|
|
||||||
// const int DELAY = 1000;
|
|
||||||
// for (;i<DELAY;++i)
|
|
||||||
// {
|
|
||||||
// int a =a+1;
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
|
|
||||||
char SpiDrv::spiTransfer(volatile char data)
|
char SpiDrv::spiTransfer(volatile char data)
|
||||||
{
|
{
|
||||||
|
@ -7,14 +7,14 @@
|
|||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
#include "utility/socket.h"
|
#include "utility/socket.h"
|
||||||
|
|
||||||
SOCKET socket(uint8 protocol) {return 0;} // Opens a socket(TCP or UDP or IP_RAW mode)
|
SOCKET socket(uint8_t protocol) {return 0;} // Opens a socket(TCP or UDP or IP_RAW mode)
|
||||||
void close(SOCKET s) {} // Close socket
|
void close(SOCKET s) {} // Close socket
|
||||||
uint8 connect(SOCKET s, uint8 * addr, uint16 port) {return 0;} // Establish TCP connection (Active connection)
|
uint8_t connect(SOCKET s, uint8_t * addr, uint16_t port) {return 0;} // Establish TCP connection (Active connection)
|
||||||
void disconnect(SOCKET s) {} // disconnect the connection
|
void disconnect(SOCKET s) {} // disconnect the connection
|
||||||
uint8 listen(SOCKET s) { return 0;} // Establish TCP connection (Passive connection)
|
uint8_t listen(SOCKET s) { return 0;} // Establish TCP connection (Passive connection)
|
||||||
uint16 send(SOCKET s, const uint8 * buf, uint16 len) { return 0;} // Send data (TCP)
|
uint16_t send(SOCKET s, const uint8_t * buf, uint16_t len) { return 0;} // Send data (TCP)
|
||||||
uint16 recv(SOCKET s, uint8 * buf, uint16 len) {return 0;} // Receive data (TCP)
|
uint16_t recv(SOCKET s, uint8_t * buf, uint16_t len) {return 0;} // Receive data (TCP)
|
||||||
uint16 sendto(SOCKET s, const uint8 * buf, uint16 len, uint8 * addr, uint16 port) {return 0;} // Send data (UDP/IP RAW)
|
uint16_t sendto(SOCKET s, const uint8_t * buf, uint16_t len, uint8_t * addr, uint16_t port) {return 0;} // Send data (UDP/IP RAW)
|
||||||
uint16 recvfrom(SOCKET s, uint8 * buf, uint16 len, uint8 * addr, uint16 *port) {return 0;} // Receive data (UDP/IP RAW)
|
uint16_t recvfrom(SOCKET s, uint8_t * buf, uint16_t len, uint8_t * addr, uint16_t *port) {return 0;} // Receive data (UDP/IP RAW)
|
||||||
|
|
||||||
uint16 igmpsend(SOCKET s, const uint8 * buf, uint16 len) {return 0;}
|
uint16_t igmpsend(SOCKET s, const uint8_t * buf, uint16_t len) {return 0;}
|
||||||
|
Reference in New Issue
Block a user