Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Ported to Arduino 1.0 compiler.

Includes support for size_t print functions (not void) and changed program code suffix (.pde to .ino).
  • Loading branch information...
commit 23f701c75b2a4110c4f1a67e322a046eb9363798 1 parent 8a1a9e3
@jtouch jtouch authored
View
4 README
@@ -4,6 +4,10 @@ Async Labs Inc.
www.asynclabs.com
-------------------------------------------------------------------------------
+Changes:
+- updated to support Ardunino compiler 1.0 (from 0023)
+
+-------------------------------------------------------------------------------
Version 1.2.0
-------------------------------------------------------------------------------
Changes:
View
45 WiServer.cpp
@@ -31,11 +31,13 @@
multi-pass transmission, local client
checks, activity LED support, etc.
+ Joe Touch 12/14/2011 Ported to arduino-1.0 compiler
+
*****************************************************************************/
-#include "WProgram.h"
+#include "Arduino.h"
#include "WiServer.h"
extern "C" {
@@ -154,55 +156,64 @@ void setRXPin(byte value) {
/******* Generic printing and sending functions ********/
-void Server::write_P(const char data[], int len) {
+size_t Server::write_P(const char data[], int len) {
while (len-- > 0) {
this->write(pgm_read_byte(data++));
}
+ return len;
}
-void Server::print_P(const char s[]) {
+size_t Server::print_P(const char s[]) {
char c = pgm_read_byte(s);
+ size_t count = 0;
while (c) {
this->print(c);
c = pgm_read_byte(++s);
+ count++;
}
+ return count;
}
-void Server::println_P(const char c[]) {
- this->print_P(c);
- this->println();
+size_t Server::println_P(const char c[]) {
+ size_t count = 0;
+ count += this->print_P(c);
+ count += this->println();
+ return count;
}
-void Server::printTime(long t) {
+size_t Server::printTime(long t) {
+ size_t count = 0;
long secs = t / 1000;
int mins = (int)(secs / 60);
int hours = mins / 60;
hours %= 24;
- this->print(hours / 10);
- this->print(hours % 10);
- this->print(':');
+ count += this->print(hours / 10);
+ count += this->print(hours % 10);
+ count += this->print(':');
mins %= 60;
- this->print(mins / 10);
- this->print(mins % 10);
- this->print(':');
+ count += this->print(mins / 10);
+ count += this->print(mins % 10);
+ count += this->print(':');
secs %= 60;
- this->print(secs / 10);
- this->print(secs % 10);
+ count += this->print(secs / 10);
+ count += this->print(secs % 10);
+
+ return count;
}
/*
* Writes a byte to the virtual buffer for the current connection
*/
-void Server::write(uint8_t b) {
+size_t Server::write(uint8_t b) {
// Make sure there's a current connection
if (uip_conn) {
@@ -212,8 +223,10 @@ void Server::write(uint8_t b) {
if ((offset >= 0) && (offset < (int)uip_conn->mss)) {
// Write the byte to the corresponding location in the buffer
*((char*)uip_appdata + offset) = b;
+ return 1;
}
}
+ return 0;
}
View
12 WiServer.h
@@ -33,6 +33,8 @@
Mark A. Patel 06/22/2009 Revised client API
+ Joe Touch 12/14/2011 port to arduino-1.0 compiler
+
*****************************************************************************/
@@ -188,28 +190,28 @@ class Server: public Print
/**
* Writes a single byte to the current connection buffer
*/
- virtual void write(uint8_t);
+ virtual size_t write(uint8_t);
/**
* Prints a string that is stored in program memory
*/
- void print_P(const char[]);
+ size_t print_P(const char[]);
/**
* Prints a string that is stored in program memory followed by a line feed
*/
- void println_P(const char[]);
+ size_t println_P(const char[]);
/**
* Writes data of a specified length that is stored in program memory
*/
- void write_P(const char[], int len);
+ size_t write_P(const char[], int len);
/**
* Prints a time value in the form HH:MM:SS. The time value is in milliseconds.
*
*/
- void printTime(long t);
+ size_t printTime(long t);
/**
* Indicates if a page is currently being sent, and that a subsequent call to the page
View
3  WiShield.cpp
@@ -30,6 +30,7 @@
---------------------------------------------------------------
AsyncLabs 05/01/2009 Initial version
AsyncLabs 05/29/2009 Adding support for new library
+ Joe Touch 12/14/2011 Ported to arduino-1.0 compiler
*****************************************************************************/
@@ -43,7 +44,7 @@ extern "C" {
void stack_process(void);
}
-#include "WProgram.h"
+#include "Arduino.h"
#include "WiShield.h"
boolean WiShield::init(U8 seconds)
View
5 clock-arch.c
@@ -30,6 +30,9 @@
---------------------------------------------------------------
AsyncLabs 05/29/2009 Initial port
+ Joe Touch 12/14/2011 ported to arduino-1.0 compiler
+
+
*****************************************************************************/
#include "global-conf.h"
@@ -41,7 +44,7 @@
#include <avr/sfr_defs.h>
#include "clock-arch.h"
-#include "wiring.h"
+#include "Arduino.h"
#if 0
//Counted time
View
0  examples/Flash/Flash.pde → examples/Flash/Flash.ino
File renamed without changes
View
0  examples/SimpleClient/SimpleClient.pde → examples/SimpleClient/SimpleClient.ino
File renamed without changes
View
0  examples/SimpleServer/SimpleServer.pde → examples/SimpleServer/SimpleServer.ino
File renamed without changes
View
0  examples/SimpleTweeter/SimpleTweeter.pde → examples/SimpleTweeter/SimpleTweeter.ino
File renamed without changes
View
0  examples/SocketApp/SocketApp.pde → examples/SocketApp/SocketApp.ino
File renamed without changes
View
0  examples/SocketAppDHCP/SocketAppDHCP.pde → examples/SocketAppDHCP/SocketAppDHCP.ino
File renamed without changes
View
0  examples/SocketAppDNS/SocketAppDNS.pde → examples/SocketAppDNS/SocketAppDNS.ino
File renamed without changes
View
0  examples/UDPApp/UDPApp.pde → examples/UDPApp/UDPApp.ino
File renamed without changes
View
0  examples/WebClient/WebClient.pde → examples/WebClient/WebClient.ino
File renamed without changes
View
0  examples/WebServer/WebServer.pde → examples/WebServer/WebServer.ino
File renamed without changes
View
0  examples/WiFiScan/WiFiScan.pde → examples/WiFiScan/WiFiScan.ino
File renamed without changes
View
0  examples/WiServerDNS/WiServerDNS.pde → examples/WiServerDNS/WiServerDNS.ino
File renamed without changes
Please sign in to comment.
Something went wrong with that request. Please try again.