diff --git a/README b/README index 4a2dba5..4872dbb 100644 --- a/README +++ b/README @@ -24,3 +24,20 @@ New features: Known issues: None + + +------------------------------------------------------------------------------- +Pin usage on WiShield v1.0 +------------------------------------------------------------------------------- +1.SPI + * Slave select (SS) : Arduino pin 10 + * Clock (SCK) : Arduino pin 13 + * Master in, slave out (MISO) : Arduino pin 12 + * Master out, slave in (MOSI) : Arduino pin 11 +2. Interrupt (Uses only one of the following, depending on jumper setting) + * INT0 : Arduino pin 2 + * DIG8 : Arduino pin 8 +3. LED : Arduino pin 9 + * To regain use of this pin, remove the LED jumper cap +4. 5V power +5. GND diff --git a/WiServer.cpp b/WiServer.cpp index 2dce1f1..a76db04 100644 --- a/WiServer.cpp +++ b/WiServer.cpp @@ -35,7 +35,7 @@ *****************************************************************************/ -#include "WProgram.h" +#include "arduino.h" #include "WiServer.h" extern "C" { diff --git a/WiServer.h b/WiServer.h index a8d9e4b..928145b 100644 --- a/WiServer.h +++ b/WiServer.h @@ -57,7 +57,7 @@ typedef void (*returnFunction)(char* data, int len); /* * Function for serving web pages */ -typedef boolean (*pageServingFunction)(char* URL); +typedef bool (*pageServingFunction)(char* URL); /* * Function for providing the body of a POST request @@ -103,7 +103,7 @@ class GETrequest * or is currently connected and communicating with the server). If it is, any calls that attempt * to change the properties of the request will be ignored. */ - boolean isActive(); + bool isActive(); /* * Sets the URL for the request. Calls to this method will be ignored if the request @@ -124,7 +124,7 @@ class GETrequest // Return value callback function (may be NULL) returnFunction returnFunc; // Indicates if the request is currently active (i.e. has a connection) - boolean active; + bool active; // Body data callback function (may be NULL) bodyFunction body; // Body preamble (may be NULL) @@ -185,7 +185,7 @@ class Server: public Print * will output log info via the Serial class. Verbose mode is disabled by * default, but is automatically enabled if DEBUG is defined */ - void enableVerboseMode(boolean enable); + void enableVerboseMode(bool enable); /** * The server task method (must be called in the main loop to run the WiServer) @@ -195,7 +195,7 @@ 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 @@ -224,7 +224,7 @@ class Server: public Print * in the network. Changes to the content of the page should only be made if this method * returns false. */ - boolean sendInProgress(); + bool sendInProgress(); /** * Checks if the client for the current server request resides on the same local network @@ -239,7 +239,7 @@ class Server: public Print * Note that security checks based on the client IP address are not 100% reliable, * so this feature should not be relied upon to control access to sensitive data! */ - boolean clientIsLocal(); + bool clientIsLocal(); /** * Sets the pins used to indicate TX and RX activity over the network. diff --git a/WiShield.cpp b/WiShield.cpp index 401f7bf..6ab02ef 100644 --- a/WiShield.cpp +++ b/WiShield.cpp @@ -43,7 +43,7 @@ extern "C" { void stack_process(void); } -#include "WProgram.h" +#include "arduino.h" #include "WiShield.h" boolean WiShield::init(U8 seconds) diff --git a/WiShield.h b/WiShield.h index d61f471..85a2c00 100644 --- a/WiShield.h +++ b/WiShield.h @@ -44,8 +44,8 @@ extern "C" { class WiShield { public: - boolean init() {return init(60);} - boolean init(U8 seconds); + bool init() {return init(60);} + bool init(U8 seconds); void run(); }; diff --git a/apps-conf.h b/apps-conf.h index abb76c2..ed878a6 100644 --- a/apps-conf.h +++ b/apps-conf.h @@ -44,11 +44,11 @@ // DNS and/or DHCP then your APP_TYPE (e.g. APP_WISERVER) AND APP_UDPAPP must be defined // (uncommented). Currently only APP_UDPAPP may be defined at the same time as any other APP_TYPE // -//#define APP_WEBSERVER +#define APP_WEBSERVER //#define APP_WEBCLIENT //#define APP_SOCKAPP //#define APP_UDPAPP -#define APP_WISERVER +//#define APP_WISERVER // // Add on features; uncomment to enable additional functionality diff --git a/clock-arch.c b/clock-arch.c index 9dc7e5d..2296a67 100644 --- a/clock-arch.c +++ b/clock-arch.c @@ -41,7 +41,7 @@ #include #include "clock-arch.h" -#include "wiring.h" +#include "arduino.h" #if 0 //Counted time diff --git a/config.h b/config.h index a3245d1..bc1a483 100644 --- a/config.h +++ b/config.h @@ -43,15 +43,15 @@ extern U8 gateway_ip[]; extern U8 subnet_mask[]; extern char ssid[]; extern U8 ssid_len; -extern const prog_char security_passphrase[]; +extern const char PROGMEM security_passphrase[]; extern U8 security_passphrase_len; extern U8 security_type; extern U8 wireless_mode; -extern prog_uchar wep_keys[]; +extern const unsigned char PROGMEM wep_keys[]; -extern const prog_char webpage[]; -extern const prog_char twitter[]; +extern const char PROGMEM webpage[]; +extern const char PROGMEM twitter[]; extern unsigned char mfg_id[4]; #define WIRELESS_MODE_INFRA 1 diff --git a/examples/WebServer/WebServer.pde b/examples/WebServer/WebServer.pde index 6ff4d45..b90db5f 100644 --- a/examples/WebServer/WebServer.pde +++ b/examples/WebServer/WebServer.pde @@ -7,17 +7,17 @@ #include // Wireless configuration parameters ---------------------------------------- -unsigned char local_ip[] = {192,168,1,2}; // IP address of WiShield -unsigned char gateway_ip[] = {192,168,1,1}; // router or gateway IP address +unsigned char local_ip[] = {10,0,9,44}; // IP address of WiShield +unsigned char gateway_ip[] = {10,0,9,1}; // router or gateway IP address unsigned char subnet_mask[] = {255,255,255,0}; // subnet mask for the local network -char ssid[] = {"ASYNCLABS"}; // max 32 bytes +char ssid[] = {"NintendoDS"}; // max 32 bytes unsigned char security_type = 0; // 0 - open; 1 - WEP; 2 - WPA; 3 - WPA2 // WPA/WPA2 passphrase -const prog_char security_passphrase[] PROGMEM = {"12345678"}; // max 64 characters +const char PROGMEM security_passphrase[] PROGMEM = {"Etc1brew!"}; // max 64 characters // WEP 128-bit keys -prog_uchar wep_keys[] PROGMEM = { +const unsigned char PROGMEM wep_keys[] PROGMEM = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, // Key 0 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Key 1 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // Key 2 @@ -39,7 +39,7 @@ void setup() } // This is the webpage that is served up by the webserver -const prog_char webpage[] PROGMEM = {"HTTP/1.1 200 OK\r\nContent-Type: text/html\r\n\r\n

Hello World!! I am WiShield

Toggle LED:
"}; +const char PROGMEM webpage[] PROGMEM = {"HTTP/1.1 200 OK\r\nContent-Type: text/html\r\n\r\n

Hello World!! I am WiShield

Toggle LED:
"}; void loop() { diff --git a/request.cpp b/request.cpp index 8841820..91e1695 100644 --- a/request.cpp +++ b/request.cpp @@ -74,7 +74,7 @@ void GETrequest::submit() { if (!this->active) WiServer.submitRequest(this); } -boolean GETrequest::isActive() { +bool GETrequest::isActive() { return this->active; } diff --git a/strings.c b/strings.c index f49dec9..566d844 100644 --- a/strings.c +++ b/strings.c @@ -36,43 +36,43 @@ // They are stored in program memory to reduce RAM usage. // HTTP OK response -const prog_char httpOK[] = {"HTTP/1.0 200 OK"}; +const char PROGMEM httpOK[] = {"HTTP/1.0 200 OK"}; // HTTP Not Found response -const prog_char httpNotFound[] = {"HTTP/1.0 404 Not Found"}; +const char PROGMEM httpNotFound[] = {"HTTP/1.0 404 Not Found"}; #ifdef ENABLE_CLIENT_MODE // Trailing HTTP/1.0 for GET and POST requests -const prog_char http10[] = {" HTTP/1.0"}; +const char PROGMEM http10[] = {" HTTP/1.0"}; // Authorization: Basic field name -const prog_char authBasic[] = {"Authorization: Basic "}; +const char PROGMEM authBasic[] = {"Authorization: Basic "}; // Content-Length field name -const prog_char contentLength[] = {"Content-Length: "}; +const char PROGMEM contentLength[] = {"Content-Length: "}; // User agent field with value -const prog_char userAgent[] = {"User-Agent: WiServer/1.1"}; +const char PROGMEM userAgent[] = {"User-Agent: WiServer/1.1"}; // Content type form data -const prog_char contentTypeForm[] = {"Content-Type: application/x-www-form-urlencoded"}; +const char PROGMEM contentTypeForm[] = {"Content-Type: application/x-www-form-urlencoded"}; // POST request -const prog_char post[] = {"POST "}; +const char PROGMEM post[] = {"POST "}; // GET request -const prog_char get[] = {"GET "}; +const char PROGMEM get[] = {"GET "}; // Host, User-Agent, and Content-Type lines for Twitter POSTs -const prog_char host[] = {"Host: "}; +const char PROGMEM host[] = {"Host: "}; // Status prefix for Twitter -const prog_char status[] = {"status="}; +const char PROGMEM status[] = {"status="}; /* Base64 Encoder data */ -const prog_char base64Chars[] PROGMEM = {"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"}; +const char PROGMEM base64Chars[] PROGMEM = {"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"}; #endif // ENABLE_CLIENT_MODE diff --git a/witypes.h b/witypes.h index 3614b7f..45af252 100644 --- a/witypes.h +++ b/witypes.h @@ -62,11 +62,12 @@ typedef volatile unsigned long vuint32; typedef unsigned char u8; typedef unsigned char U8; -typedef unsigned int u16; +typedef short unsigned int u16; typedef unsigned int U16; typedef unsigned long u32; typedef unsigned long U32; -typedef uint8_t boolean; +//typedef uint8_t boolean; +//typedef bool boolean; #endif /* WITYPES_H_ */