mirror of
https://github.com/arduino/Arduino.git
synced 2025-01-18 07:52:14 +01:00
Removed unused stuff from WiFi library.
This commit is contained in:
parent
825d8c8455
commit
d920b7b67c
@ -104,7 +104,10 @@ int WiFiClient::read() {
|
||||
|
||||
|
||||
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 0;
|
||||
}
|
||||
|
@ -115,7 +115,7 @@ int WiFiUDP::read(unsigned char* buffer, size_t len)
|
||||
{
|
||||
if (available())
|
||||
{
|
||||
size_t size = 0;
|
||||
uint16_t size = 0;
|
||||
if (!ServerDrv::getDataBuf(_sock, buffer, &size))
|
||||
return -1;
|
||||
// TODO check if the buffer is too smal respect to buffer size
|
||||
|
@ -15,73 +15,20 @@
|
||||
#define SOCK_NOT_AVAIL 255
|
||||
|
||||
#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;
|
||||
typedef uint16_t SOCKET;
|
||||
|
||||
/* bsd */
|
||||
typedef uint8 u_char; /**< 8-bit value */
|
||||
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 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 uint8 listen(SOCKET s); // Establish TCP connection (Passive connection)
|
||||
extern uint16 send(SOCKET s, const uint8 * buf, uint16 len); // Send data (TCP)
|
||||
extern uint16 recv(SOCKET s, uint8 * buf, uint16 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 recvfrom(SOCKET s, uint8 * buf, uint16 len, uint8 * addr, uint16 *port); // Receive data (UDP/IP RAW)
|
||||
extern uint8_t listen(SOCKET s); // Establish TCP connection (Passive connection)
|
||||
extern uint16_t send(SOCKET s, const uint8_t * buf, uint16_t len); // Send data (TCP)
|
||||
extern uint16_t recv(SOCKET s, uint8_t * buf, uint16_t len); // Receive data (TCP)
|
||||
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_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
|
||||
/* _SOCKET_H_ */
|
||||
|
@ -8,15 +8,14 @@ extern "C" {
|
||||
#include "utility/debug.h"
|
||||
}
|
||||
|
||||
#define DATAOUT 11 // MOSI
|
||||
#define DATAIN 12 // MISO
|
||||
#define SPICLOCK 13 // sck
|
||||
#define SLAVESELECT 10 // ss
|
||||
#define SLAVEREADY 7 // handshake pin
|
||||
#define WIFILED 9 // led on wifi shield
|
||||
#define DATAOUT 11 // MOSI
|
||||
#define DATAIN 12 // MISO
|
||||
#define SPICLOCK 13 // sck
|
||||
#define SLAVESELECT 10 // ss
|
||||
#define SLAVEREADY 7 // handshake pin
|
||||
#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)
|
||||
|
||||
void SpiDrv::begin()
|
||||
@ -52,17 +51,6 @@ void SpiDrv::spiSlaveDeselect()
|
||||
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)
|
||||
{
|
||||
|
@ -1,6 +1,7 @@
|
||||
#ifndef WiFi_Spi_h
|
||||
#define WiFi_Spi_h
|
||||
|
||||
#include <inttypes.h>
|
||||
#include "utility/wl_definitions.h"
|
||||
|
||||
#define CMD_FLAG 0
|
||||
|
@ -104,6 +104,8 @@ int WiFiClient::read() {
|
||||
|
||||
|
||||
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;
|
||||
if (!ServerDrv::getDataBuf(_sock, buf, &_size))
|
||||
return -1;
|
||||
|
@ -15,73 +15,20 @@
|
||||
#define SOCK_NOT_AVAIL 255
|
||||
|
||||
#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;
|
||||
typedef uint16_t SOCKET;
|
||||
|
||||
/* bsd */
|
||||
typedef uint8 u_char; /**< 8-bit value */
|
||||
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 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 uint8 listen(SOCKET s); // Establish TCP connection (Passive connection)
|
||||
extern uint16 send(SOCKET s, const uint8 * buf, uint16 len); // Send data (TCP)
|
||||
extern uint16 recv(SOCKET s, uint8 * buf, uint16 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 recvfrom(SOCKET s, uint8 * buf, uint16 len, uint8 * addr, uint16 *port); // Receive data (UDP/IP RAW)
|
||||
extern uint8_t listen(SOCKET s); // Establish TCP connection (Passive connection)
|
||||
extern uint16_t send(SOCKET s, const uint8_t * buf, uint16_t len); // Send data (TCP)
|
||||
extern uint16_t recv(SOCKET s, uint8_t * buf, uint16_t len); // Receive data (TCP)
|
||||
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_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
|
||||
/* _SOCKET_H_ */
|
||||
|
@ -8,12 +8,12 @@ extern "C" {
|
||||
#include "utility/debug.h"
|
||||
}
|
||||
|
||||
#define DATAOUT 11 // MOSI
|
||||
#define DATAIN 12 // MISO
|
||||
#define SPICLOCK 13 // sck
|
||||
#define DATAOUT 11 // MOSI
|
||||
#define DATAIN 12 // MISO
|
||||
#define SPICLOCK 13 // sck
|
||||
#define SLAVESELECT 10 // ss
|
||||
#define SLAVEREADY 7 // handshake pin
|
||||
#define WIFILED 9 // led on wifi shield
|
||||
#define SLAVEREADY 7 // handshake pin
|
||||
#define WIFILED 9 // led on wifi shield
|
||||
|
||||
#define DELAY_SPI(X) { int ii=0; do { asm volatile("nop"); } while (++ii < X*6); }
|
||||
#define DELAY_TRANSFER() DELAY_SPI(10)
|
||||
@ -37,7 +37,7 @@ void SpiDrv::begin()
|
||||
}
|
||||
|
||||
void SpiDrv::end() {
|
||||
SPI.end();
|
||||
SPI.end();
|
||||
}
|
||||
|
||||
void SpiDrv::spiSlaveSelect()
|
||||
@ -51,19 +51,10 @@ void SpiDrv::spiSlaveDeselect()
|
||||
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 result = SPI.transfer(data);
|
||||
char result = SPI.transfer(data);
|
||||
DELAY_TRANSFER();
|
||||
|
||||
return result; // return the received byte
|
||||
|
@ -7,14 +7,14 @@
|
||||
#include <inttypes.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
|
||||
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
|
||||
uint8 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 recv(SOCKET s, uint8 * buf, uint16 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 recvfrom(SOCKET s, uint8 * buf, uint16 len, uint8 * addr, uint16 *port) {return 0;} // Receive data (UDP/IP RAW)
|
||||
uint8_t listen(SOCKET s) { return 0;} // Establish TCP connection (Passive connection)
|
||||
uint16_t send(SOCKET s, const uint8_t * buf, uint16_t len) { return 0;} // Send data (TCP)
|
||||
uint16_t recv(SOCKET s, uint8_t * buf, uint16_t len) {return 0;} // Receive data (TCP)
|
||||
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_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;}
|
||||
|
Loading…
x
Reference in New Issue
Block a user