From ddc326e1bbdecefbd80c6765c24d3adea6f30e3a Mon Sep 17 00:00:00 2001
From: Thibaut VIARD <thibaut.viard@atmel.com>
Date: Thu, 11 Sep 2014 14:58:16 +0200
Subject: [PATCH]  validation Studio projects update

Signed-off-by: Thibaut VIARD <thibaut.viard@atmel.com>
---
 cores/validation/validation_I2C_I01/test.cpp  |  10 +-
 cores/validation/validation_I2C_LCD/test.cpp  |   2 +-
 cores/validation/validation_I2C_RTC/test.cpp  |  36 +++---
 .../validation/validation_I2C_multi/test.cpp  |  14 +--
 cores/validation/validation_PWM/test.cpp      |   8 +-
 cores/validation/validation_chuck/test.cpp    |  42 +++----
 cores/validation/validation_core/test.cpp     |  42 +++----
 .../validation_shield_wifi/test.cpp           | 104 +++++++++---------
 8 files changed, 129 insertions(+), 129 deletions(-)

diff --git a/cores/validation/validation_I2C_I01/test.cpp b/cores/validation/validation_I2C_I01/test.cpp
index cbaab331..46b60848 100644
--- a/cores/validation/validation_I2C_I01/test.cpp
+++ b/cores/validation/validation_I2C_I01/test.cpp
@@ -25,8 +25,8 @@ uint8_t a, b;
 
 void setup()
 {
-  Serial5.begin( 115200 );
-  Serial5.println("Wire init");
+  SERIAL_PORT_MONITOR.begin( 115200 );
+  SERIAL_PORT_MONITOR.println("Wire init");
   Wire.begin();
 }
 
@@ -39,8 +39,8 @@ void loop()
   delay(100);
 
   Wire.requestFrom(addressTemp, 2);
-  Serial5.print((char)13);
-  Serial5.print("Temperature : ");
+  SERIAL_PORT_MONITOR.print((char)13);
+  SERIAL_PORT_MONITOR.print("Temperature : ");
 
   a = Wire.read();
   b = Wire.read();
@@ -49,5 +49,5 @@ void loop()
   temp |= a;
   temp >>= 7;
 
-  Serial5.print(temp);
+  SERIAL_PORT_MONITOR.print(temp);
 }
diff --git a/cores/validation/validation_I2C_LCD/test.cpp b/cores/validation/validation_I2C_LCD/test.cpp
index 15462959..46cc499f 100644
--- a/cores/validation/validation_I2C_LCD/test.cpp
+++ b/cores/validation/validation_I2C_LCD/test.cpp
@@ -23,7 +23,7 @@ LiquidCrystal_I2C lcd(0x27, 16, 2);
 
 void setup()
 {
-  Serial5.begin( 9600 ) ;
+  SERIAL_PORT_MONITOR.begin( 9600 ) ;
 
   lcd.init();
 
diff --git a/cores/validation/validation_I2C_RTC/test.cpp b/cores/validation/validation_I2C_RTC/test.cpp
index 26cb1892..b04b9f65 100644
--- a/cores/validation/validation_I2C_RTC/test.cpp
+++ b/cores/validation/validation_I2C_RTC/test.cpp
@@ -34,8 +34,8 @@ uint8_t bcdToDec(byte val)
 
 void setup()
 {
-  Serial5.begin(9600);
-  Serial5.println("Wire init");
+  SERIAL_PORT_MONITOR.begin(9600);
+  SERIAL_PORT_MONITOR.println("Wire init");
   Wire.begin();
 
   // Setting the date
@@ -68,10 +68,10 @@ void loop()
   Wire.requestFrom(address, 7);
 /*  while(Wire.available())
   {
-    Serial5.print(bcdToDec(Wire.read()));
-    Serial5.print(" ");
+    SERIAL_PORT_MONITOR.print(bcdToDec(Wire.read()));
+    SERIAL_PORT_MONITOR.print(" ");
   }
-  Serial5.println();*/
+  SERIAL_PORT_MONITOR.println();*/
 
 
    int second     = bcdToDec(Wire.read() & 0x7f);
@@ -82,19 +82,19 @@ void loop()
    int month      = bcdToDec(Wire.read());
    int year       = bcdToDec(Wire.read());
 
-   Serial5.print(hour, DEC);
-   Serial5.print(":");
-   Serial5.print(minute, DEC);
-   Serial5.print(":");
-   Serial5.print(second, DEC);
-   Serial5.print("  ");
-   Serial5.print(month, DEC);
-   Serial5.print("/");
-   Serial5.print(dayOfMonth, DEC);
-   Serial5.print("/");
-   Serial5.print(year,DEC);
-   Serial5.print("  ");
-   Serial5.println();
+   SERIAL_PORT_MONITOR.print(hour, DEC);
+   SERIAL_PORT_MONITOR.print(":");
+   SERIAL_PORT_MONITOR.print(minute, DEC);
+   SERIAL_PORT_MONITOR.print(":");
+   SERIAL_PORT_MONITOR.print(second, DEC);
+   SERIAL_PORT_MONITOR.print("  ");
+   SERIAL_PORT_MONITOR.print(month, DEC);
+   SERIAL_PORT_MONITOR.print("/");
+   SERIAL_PORT_MONITOR.print(dayOfMonth, DEC);
+   SERIAL_PORT_MONITOR.print("/");
+   SERIAL_PORT_MONITOR.print(year,DEC);
+   SERIAL_PORT_MONITOR.print("  ");
+   SERIAL_PORT_MONITOR.println();
 
   delay(990);
 }
diff --git a/cores/validation/validation_I2C_multi/test.cpp b/cores/validation/validation_I2C_multi/test.cpp
index fbf12078..25419a88 100644
--- a/cores/validation/validation_I2C_multi/test.cpp
+++ b/cores/validation/validation_I2C_multi/test.cpp
@@ -76,8 +76,8 @@ void updateTime()
 
 void setup()
 {
-  Serial5.begin( 115200 );
-  Serial5.println("Wire init");
+  SERIAL_PORT_MONITOR.begin( 115200 );
+  SERIAL_PORT_MONITOR.println("Wire init");
   Wire.begin();
 
   lcd.init();
@@ -106,8 +106,8 @@ void loop()
   delay(10);
 
   Wire.requestFrom(addressTemp, 2);
-  Serial5.print((char)13);  // Erase current line
-  Serial5.print("Temperature : ");
+  SERIAL_PORT_MONITOR.print((char)13);  // Erase current line
+  SERIAL_PORT_MONITOR.print("Temperature : ");
 
   a = Wire.read();
   b = Wire.read();
@@ -116,9 +116,9 @@ void loop()
   valueTemp |= b;
   valueTemp >>= 7;
 
-  Serial5.print(a);
-  Serial5.print(" | ");
-  Serial5.print(b);
+  SERIAL_PORT_MONITOR.print(a);
+  SERIAL_PORT_MONITOR.print(" | ");
+  SERIAL_PORT_MONITOR.print(b);
 
   updateTime();
   lcd.setCursor(0, 0);
diff --git a/cores/validation/validation_PWM/test.cpp b/cores/validation/validation_PWM/test.cpp
index 5001f4f3..9e119362 100644
--- a/cores/validation/validation_PWM/test.cpp
+++ b/cores/validation/validation_PWM/test.cpp
@@ -28,14 +28,14 @@ void setup( void )
     pinMode( i, OUTPUT ) ;
   }
 
-  Serial5.begin( 115200 ) ; // Output to EDBG Virtual COM Port
-  Serial5.println( "test") ;
-  Serial5.println( brightness ) ;
+  SERIAL_PORT_MONITOR.begin( 115200 ) ; // Output to EDBG Virtual COM Port
+  SERIAL_PORT_MONITOR.println( "test") ;
+  SERIAL_PORT_MONITOR.println( brightness ) ;
 }
 
 void loop( void )
 {
-  Serial5.println( brightness ) ;
+  SERIAL_PORT_MONITOR.println( brightness ) ;
 
   for ( int i=2 ; i < 14 ; i++ )
   {
diff --git a/cores/validation/validation_chuck/test.cpp b/cores/validation/validation_chuck/test.cpp
index 6327a84a..1f70241a 100644
--- a/cores/validation/validation_chuck/test.cpp
+++ b/cores/validation/validation_chuck/test.cpp
@@ -23,8 +23,8 @@ uint8_t accx,accy,zbut,cbut ;
 
 void setup()
 {
-  Serial5.begin( 115200 ) ;
-  Serial5.println("nunchuk init");
+  SERIAL_PORT_MONITOR.begin( 115200 ) ;
+  SERIAL_PORT_MONITOR.println("nunchuk init");
 
   Wire.begin(); // join i2c bus as master
   Wire.beginTransmission(0x52);// transmit to device 0x52
@@ -34,7 +34,7 @@ void setup()
     Wire.write((uint8_t)0x00);// sends sent a zero.
   Wire.endTransmission();// stop transmitting
 
-  Serial5.println( "WiiChukDemo ready" ) ;
+  SERIAL_PORT_MONITOR.println( "WiiChukDemo ready" ) ;
   delay(100);
 }
 
@@ -49,39 +49,39 @@ void loop()
   uint8_t accZ = Wire.read();
   uint8_t misc = Wire.read();
 
-  Serial5.print("Joy : ");
-  Serial5.print(jX);
-  Serial5.print(", ");
-  Serial5.print(jY);
+  SERIAL_PORT_MONITOR.print("Joy : ");
+  SERIAL_PORT_MONITOR.print(jX);
+  SERIAL_PORT_MONITOR.print(", ");
+  SERIAL_PORT_MONITOR.print(jY);
 
-  Serial5.print("\tAcc : ");
-  Serial5.print(accX);
-  Serial5.print(", ");
-  Serial5.print(accY);
-  Serial5.print(", ");
-  Serial5.print(accZ);
+  SERIAL_PORT_MONITOR.print("\tAcc : ");
+  SERIAL_PORT_MONITOR.print(accX);
+  SERIAL_PORT_MONITOR.print(", ");
+  SERIAL_PORT_MONITOR.print(accY);
+  SERIAL_PORT_MONITOR.print(", ");
+  SERIAL_PORT_MONITOR.print(accZ);
 
-  Serial5.print("\tBtn : ");
-  Serial5.print(" [");
-  Serial5.print(misc);
-  Serial5.print("] ");
+  SERIAL_PORT_MONITOR.print("\tBtn : ");
+  SERIAL_PORT_MONITOR.print(" [");
+  SERIAL_PORT_MONITOR.print(misc);
+  SERIAL_PORT_MONITOR.print("] ");
 
   switch(misc & 0x3ul)
   {
     case 0x0ul:
-      Serial5.println("Z");
+      SERIAL_PORT_MONITOR.println("Z");
       break;
 
     case 0x1ul:
-      Serial5.println("C");
+      SERIAL_PORT_MONITOR.println("C");
       break;
 
     case 0x2ul:
-      Serial5.println("C + Z");
+      SERIAL_PORT_MONITOR.println("C + Z");
       break;
 
     case 0x3ul:
-      Serial5.println("No key");
+      SERIAL_PORT_MONITOR.println("No key");
       break;
 
     default:
diff --git a/cores/validation/validation_core/test.cpp b/cores/validation/validation_core/test.cpp
index 1c73c560..f62143f2 100644
--- a/cores/validation/validation_core/test.cpp
+++ b/cores/validation/validation_core/test.cpp
@@ -63,7 +63,7 @@ void setup( void )
   pinPeripheral( 13, PIO_AC_CLK ) ; // Clock Gen 3*/
 
 //**********************************************
-  Serial.begin( 115200 ) ; // Output to EDBG Virtual COM Port
+  SERIAL_PORT_MONITOR.begin( 115200 ) ; // Output to EDBG Virtual COM Port
 
   // Test External Interrupt
   attachInterrupt( 3, Interrupt_Pin3, LOW ) ;
@@ -73,11 +73,11 @@ void setup( void )
   attachInterrupt( 7, Interrupt_Pin7, CHANGE) ;
 
   pcBuff = (char *)malloc(50);
-  
+
   strcpy(pcBuff, "CIAO");
-  Serial.println("----");
-  Serial.println(pcBuff);   // Outputs garbage instead of "CIAO"
-  Serial.println("----");  
+  SERIAL_PORT_MONITOR.println("----");
+  SERIAL_PORT_MONITOR.println(pcBuff);   // Outputs garbage instead of "CIAO"
+  SERIAL_PORT_MONITOR.println("----");
 }
 
 static void led_step1( void )
@@ -106,15 +106,15 @@ void loop( void )
   led_step2() ;
   delay( 500 ) ;              // wait for a second
 
-  // Test Serial output
-  Serial.write( '-' ) ;   // send a char
-  Serial.write( "test1\n" ) ;   // send a string
-  Serial.write( "test2" ) ;   // send another string
+  // Test SERIAL_PORT_MONITOR output
+  SERIAL_PORT_MONITOR.write( '-' ) ;   // send a char
+  SERIAL_PORT_MONITOR.write( "test1\n" ) ;   // send a string
+  SERIAL_PORT_MONITOR.write( "test2" ) ;   // send another string
 
   // Test digitalRead: connect pin 2 to either GND or 3.3V. !!!! NOT on 5V pin !!!!
   pin_value=digitalRead( 2 ) ;
-  Serial.write( "pin 2 value is " ) ;
-  Serial.write( (pin_value == LOW)?"LOW\n":"HIGH\n" ) ;
+  SERIAL_PORT_MONITOR.write( "pin 2 value is " ) ;
+  SERIAL_PORT_MONITOR.write( (pin_value == LOW)?"LOW\n":"HIGH\n" ) ;
 
   duty_cycle+=8 ;//=(uint8_t)(millis() & 0xff) ;
   analogWrite( 13, duty_cycle ) ;
@@ -127,46 +127,46 @@ void loop( void )
   dac_value += 64;
   analogWrite(A0, dac_value);
 
-  Serial.print("\r\nAnalog pins: ");
+  SERIAL_PORT_MONITOR.print("\r\nAnalog pins: ");
 
   for ( uint32_t i = A0 ; i <= A0+NUM_ANALOG_INPUTS ; i++ )
   {
 
     int a = analogRead(i);
-    Serial.print(a, DEC);
-    Serial.print(" ");
+    SERIAL_PORT_MONITOR.print(a, DEC);
+    SERIAL_PORT_MONITOR.print(" ");
 
   }
-  Serial.println();
+  SERIAL_PORT_MONITOR.println();
 
-  Serial.println("External interrupt pins:");
+  SERIAL_PORT_MONITOR.println("External interrupt pins:");
   if ( ul_Interrupt_Pin3 == 1 )
   {
-    Serial.println( "Pin 3 triggered (LOW)" ) ;
+    SERIAL_PORT_MONITOR.println( "Pin 3 triggered (LOW)" ) ;
     ul_Interrupt_Pin3 = 0 ;
   }
 
   if ( ul_Interrupt_Pin4 == 1 )
   {
-    Serial.println( "Pin 4 triggered (HIGH)" ) ;
+    SERIAL_PORT_MONITOR.println( "Pin 4 triggered (HIGH)" ) ;
     ul_Interrupt_Pin4 = 0 ;
   }
 
   if ( ul_Interrupt_Pin5 == 1 )
   {
-    Serial.println( "Pin 5 triggered (FALLING)" ) ;
+    SERIAL_PORT_MONITOR.println( "Pin 5 triggered (FALLING)" ) ;
     ul_Interrupt_Pin5 = 0 ;
   }
 
   if ( ul_Interrupt_Pin6 == 1 )
   {
-    Serial.println( "Pin 6 triggered (RISING)" ) ;
+    SERIAL_PORT_MONITOR.println( "Pin 6 triggered (RISING)" ) ;
     ul_Interrupt_Pin6 = 0 ;
   }
 
   if ( ul_Interrupt_Pin7 == 1 )
   {
-    Serial.println( "Pin 7 triggered (CHANGE)" ) ;
+    SERIAL_PORT_MONITOR.println( "Pin 7 triggered (CHANGE)" ) ;
     ul_Interrupt_Pin7 = 0 ;
   }
 }
diff --git a/cores/validation/validation_shield_wifi/test.cpp b/cores/validation/validation_shield_wifi/test.cpp
index 7d1b5343..593ab283 100644
--- a/cores/validation/validation_shield_wifi/test.cpp
+++ b/cores/validation/validation_shield_wifi/test.cpp
@@ -38,8 +38,8 @@ void printCurrentNet();
 void printWifiData();
 void httpRequest();
 
-char ssid[] = "AVRGUEST";     //  your network SSID (name)
-char pass[] = "MicroController";  // your network password
+char ssid[] = "";     //  your network SSID (name)
+char pass[] = "";  // your network password
 int status = WL_IDLE_STATUS;     // the Wifi radio's status
 
 WiFiClient client;
@@ -51,23 +51,23 @@ void setup() {
   delay(500); // Waiting for initialization
 
 //  SPI.begin();
-  //Initialize Serial5 and wait for port to open:
-  Serial5.begin(9600);
-  while (!Serial5) {
-    ; // wait for Serial5 port to connect. Needed for Leonardo only
+  //Initialize SERIAL_PORT_MONITOR and wait for port to open:
+  SERIAL_PORT_MONITOR.begin(9600);
+  while (!SERIAL_PORT_MONITOR) {
+    ; // wait for SERIAL_PORT_MONITOR port to connect. Needed for Leonardo only
   }
 
   // check for the presence of the shield:
   if (WiFi.status() == WL_NO_SHIELD) {
-    Serial5.println("WiFi shield not present");
+    SERIAL_PORT_MONITOR.println("WiFi shield not present");
     // don't continue:
     while(true);
   }
 
  // attempt to connect to Wifi network:
   while ( status != WL_CONNECTED) {
-    Serial5.print("Attempting to connect to WPA SSID: ");
-    Serial5.println(ssid);
+    SERIAL_PORT_MONITOR.print("Attempting to connect to WPA SSID: ");
+    SERIAL_PORT_MONITOR.println(ssid);
     // Connect to WPA/WPA2 network:
     status = WiFi.begin(ssid, pass);
 
@@ -76,7 +76,7 @@ void setup() {
   }
 
   // you're connected now, so print out the data:
-  Serial5.print("You're connected to the network");
+  SERIAL_PORT_MONITOR.print("You're connected to the network");
   printCurrentNet();
   printWifiData();
 
@@ -88,71 +88,71 @@ void loop() {
   printCurrentNet();
 
   // Trying to connect to http://hasthelargehadroncolliderdestroyedtheworldyet.com/
-  Serial5.println("Trying to connect to : www.hasthelargehadroncolliderdestroyedtheworldyet.com :");
+  SERIAL_PORT_MONITOR.println("Trying to connect to : www.hasthelargehadroncolliderdestroyedtheworldyet.com :");
   httpRequest();
   while( client.available() )
   {
-    Serial5.print((char)(client.read()));
+    SERIAL_PORT_MONITOR.print((char)(client.read()));
   }
-  Serial5.println("END");
+  SERIAL_PORT_MONITOR.println("END");
 }
 
 void printWifiData() {
   // print your WiFi shield's IP address:
   IPAddress ip = WiFi.localIP();
-    Serial5.print("IP Address: ");
-  Serial5.println(ip);
-  Serial5.println(ip);
+    SERIAL_PORT_MONITOR.print("IP Address: ");
+  SERIAL_PORT_MONITOR.println(ip);
+  SERIAL_PORT_MONITOR.println(ip);
 
   // print your MAC address:
   byte mac[6];
   WiFi.macAddress(mac);
-  Serial5.print("MAC address: ");
-  Serial5.print(mac[5],HEX);
-  Serial5.print(":");
-  Serial5.print(mac[4],HEX);
-  Serial5.print(":");
-  Serial5.print(mac[3],HEX);
-  Serial5.print(":");
-  Serial5.print(mac[2],HEX);
-  Serial5.print(":");
-  Serial5.print(mac[1],HEX);
-  Serial5.print(":");
-  Serial5.println(mac[0],HEX);
+  SERIAL_PORT_MONITOR.print("MAC address: ");
+  SERIAL_PORT_MONITOR.print(mac[5],HEX);
+  SERIAL_PORT_MONITOR.print(":");
+  SERIAL_PORT_MONITOR.print(mac[4],HEX);
+  SERIAL_PORT_MONITOR.print(":");
+  SERIAL_PORT_MONITOR.print(mac[3],HEX);
+  SERIAL_PORT_MONITOR.print(":");
+  SERIAL_PORT_MONITOR.print(mac[2],HEX);
+  SERIAL_PORT_MONITOR.print(":");
+  SERIAL_PORT_MONITOR.print(mac[1],HEX);
+  SERIAL_PORT_MONITOR.print(":");
+  SERIAL_PORT_MONITOR.println(mac[0],HEX);
 
 }
 
 void printCurrentNet() {
   // print the SSID of the network you're attached to:
-  Serial5.print("SSID: ");
-  Serial5.println(WiFi.SSID());
+  SERIAL_PORT_MONITOR.print("SSID: ");
+  SERIAL_PORT_MONITOR.println(WiFi.SSID());
 
   // print the MAC address of the router you're attached to:
   byte bssid[6];
   WiFi.BSSID(bssid);
-  Serial5.print("BSSID: ");
-  Serial5.print(bssid[5],HEX);
-  Serial5.print(":");
-  Serial5.print(bssid[4],HEX);
-  Serial5.print(":");
-  Serial5.print(bssid[3],HEX);
-  Serial5.print(":");
-  Serial5.print(bssid[2],HEX);
-  Serial5.print(":");
-  Serial5.print(bssid[1],HEX);
-  Serial5.print(":");
-  Serial5.println(bssid[0],HEX);
+  SERIAL_PORT_MONITOR.print("BSSID: ");
+  SERIAL_PORT_MONITOR.print(bssid[5],HEX);
+  SERIAL_PORT_MONITOR.print(":");
+  SERIAL_PORT_MONITOR.print(bssid[4],HEX);
+  SERIAL_PORT_MONITOR.print(":");
+  SERIAL_PORT_MONITOR.print(bssid[3],HEX);
+  SERIAL_PORT_MONITOR.print(":");
+  SERIAL_PORT_MONITOR.print(bssid[2],HEX);
+  SERIAL_PORT_MONITOR.print(":");
+  SERIAL_PORT_MONITOR.print(bssid[1],HEX);
+  SERIAL_PORT_MONITOR.print(":");
+  SERIAL_PORT_MONITOR.println(bssid[0],HEX);
 
   // print the received signal strength:
   long rssi = WiFi.RSSI();
-  Serial5.print("signal strength (RSSI):");
-  Serial5.println(rssi);
+  SERIAL_PORT_MONITOR.print("signal strength (RSSI):");
+  SERIAL_PORT_MONITOR.println(rssi);
 
   // print the encryption type:
   byte encryption = WiFi.encryptionType();
-  Serial5.print("Encryption Type:");
-  Serial5.println(encryption,HEX);
-  Serial5.println();
+  SERIAL_PORT_MONITOR.print("Encryption Type:");
+  SERIAL_PORT_MONITOR.println(encryption,HEX);
+  SERIAL_PORT_MONITOR.println();
 }
 
 void httpRequest() {
@@ -162,7 +162,7 @@ void httpRequest() {
 
   // if there's a successful connection:
   if (client.connect("www.hasthelargehadroncolliderdestroyedtheworldyet.com", 80)) {
-    Serial5.println("connecting...");
+    SERIAL_PORT_MONITOR.println("connecting...");
     // send the HTTP PUT request:
     client.println("GET / HTTP/1.1");
     client.println("Host: www.hasthelargehadroncolliderdestroyedtheworldyet.com");
@@ -172,25 +172,25 @@ void httpRequest() {
 
     if( client.connected() )
     {
-      Serial5.println("\tClient connected");
+      SERIAL_PORT_MONITOR.println("\tClient connected");
       while( client.available() == 0 )
       {
         //Waiting for data
         if( !client.connected() )
         {
-          Serial5.println("\tClient disconnected !");
+          SERIAL_PORT_MONITOR.println("\tClient disconnected !");
           break;
         }
       }
     }
     else
     {
-      Serial5.println("\tClient not connected");
+      SERIAL_PORT_MONITOR.println("\tClient not connected");
     }
 
   }
   else {
     // if you couldn't make a connection:
-    Serial5.println("\tconnection failed");
+    SERIAL_PORT_MONITOR.println("\tconnection failed");
   }
 }
-- 
GitLab