Archives du projet VélIoT

Dependencies:   mbed NDefLib M24SR BSP_B-L475E-IOT01

Files at this revision

API Documentation at this revision

Comitter:
galaadleconte
Date:
Wed Oct 28 07:57:12 2020 +0000
Commit message:
iot

Changed in this revision

BSP_B-L475E-IOT01.lib Show annotated file Show diff for this revision Revisions of this file
M24SR.lib Show annotated file Show diff for this revision Revisions of this file
NDefLib.lib Show annotated file Show diff for this revision Revisions of this file
ReadUriCallbacks.h Show annotated file Show diff for this revision Revisions of this file
WriteUriCallbacks.h Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed-os.lib Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
mbed_app.json Show annotated file Show diff for this revision Revisions of this file
mbed_app_idw01m1.json Show annotated file Show diff for this revision Revisions of this file
mbed_app_idw04a1.json Show annotated file Show diff for this revision Revisions of this file
mbed_app_ism43362.json Show annotated file Show diff for this revision Revisions of this file
wifi-ism43362.lib Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r 8ef2057f72b4 BSP_B-L475E-IOT01.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/BSP_B-L475E-IOT01.lib	Wed Oct 28 07:57:12 2020 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/teams/ST/code/BSP_B-L475E-IOT01/#bfe8272ced90
diff -r 000000000000 -r 8ef2057f72b4 M24SR.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/M24SR.lib	Wed Oct 28 07:57:12 2020 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/teams/ST-Expansion-SW-Team/code/M24SR/#11161008d77a
diff -r 000000000000 -r 8ef2057f72b4 NDefLib.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/NDefLib.lib	Wed Oct 28 07:57:12 2020 +0000
@@ -0,0 +1,1 @@
+https://developer.mbed.org/teams/ST/code/NDefLib/#72c86cbd49be
diff -r 000000000000 -r 8ef2057f72b4 ReadUriCallbacks.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ReadUriCallbacks.h	Wed Oct 28 07:57:12 2020 +0000
@@ -0,0 +1,123 @@
+/**
+  ******************************************************************************
+  * @file       ReadUriCallbacks.cpp
+  * @date       12/07/2017
+  * @brief      Class to read and print a URI tag.
+  ******************************************************************************
+  *
+  * COPYRIGHT(c) 2017 STMicroelectronics
+  *
+  * Redistribution and use in source and binary forms, with or without modification,
+  * are permitted provided that the following conditions are met:
+  *   1. Redistributions of source code must retain the above copyright notice,
+  *      this list of conditions and the following disclaimer.
+  *   2. Redistributions in binary form must reproduce the above copyright notice,
+  *      this list of conditions and the following disclaimer in the documentation
+  *      and/or other materials provided with the distribution.
+  *   3. Neither the name of STMicroelectronics nor the names of its contributors
+  *      may be used to endorse or promote products derived from this software
+  *      without specific prior written permission.
+  *
+  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+  *
+  ******************************************************************************
+  */
+
+#include "mbed.h"
+#include "NDefLib/RecordType/RecordURI.h"
+
+/**
+ * Chain of callback that will read a NDef Message and print all the
+ * record of type URI.
+ * After each operation the class will switch on a led
+ */
+class ReadUriCallbacks : public NDefLib::NDefNfcTag::Callbacks {
+ 
+    DigitalOut &mOnOpenSession;
+    DigitalOut &mOnRead;
+    DigitalOut &mOnCloseSession;
+ 
+    NDefLib::Message mMsg;
+ 
+public:
+ 
+    /**
+     * create the callback chain
+     * @param onOpenSession led to switch on when the session open
+     * @param onWrite led to switch on when the write end
+     * @param onCloseSession led to switch on when the session end
+     */
+    ReadUriCallbacks(DigitalOut &onOpenSession,DigitalOut &onRead,
+        DigitalOut &onCloseSession):mOnOpenSession(onOpenSession),
+        mOnRead(onRead),mOnCloseSession(onCloseSession){};
+ 
+    /**
+     * crate the new message and write it
+     * @param tag tag where write the message
+     * @param success true if the session correctly open
+     */
+    virtual void on_session_open(NDefLib::NDefNfcTag *tag,bool success){
+        if (!success) {
+            printf("Error opening the session\r\n");
+        }//else
+        printf("Session opened\r\n");
+        //ask to have an interrupt when the command finish
+        mOnOpenSession=1;
+        mOnCloseSession=0;
+        
+        tag->read(&mMsg);
+    }
+ 
+    /**
+     * request to close the session
+     * @param tag tag where close the session
+     * @param success true if the message is correctly wrote
+     * @param message wrote
+     */
+    virtual void on_message_read(NDefLib::NDefNfcTag *tag,bool success,
+        const NDefLib::Message*){
+ 
+        if (!success) {
+            printf("Error Reading tag!\r\n");
+        } else {
+            const uint32_t nRecords =mMsg.get_N_records();
+            printf("Read %d records!\r\n",nRecords);
+            for (uint32_t i=0;i<nRecords;i++) {
+                if (mMsg[i]->get_type()== NDefLib::Record::TYPE_URI) {
+                    NDefLib::RecordURI *rUri = (NDefLib::RecordURI *)mMsg[i];
+                    printf("UriType: %x\r\nUriContent: %s\r\n",
+                        rUri->get_uri_id(),
+                        rUri->get_content().c_str());
+                }//if
+            }//for
+            NDefLib::Message::remove_and_delete_all_record(mMsg);
+            mOnRead=1;
+        }//if-else
+        tag->close_session();
+    }
+ 
+    /**
+     * switch on the led
+     * @param tag where the session is closed
+     * @param success true if the session is correctly close
+     */
+    virtual void on_session_close(NDefLib::NDefNfcTag*, bool success) {
+        if (success) {
+            printf("Session closed\r\n");
+            mOnCloseSession=1;
+            mOnOpenSession=0;
+            mOnRead=0;
+        } else {
+            printf("Error opening the session\r\n");
+        }
+    }
+};
diff -r 000000000000 -r 8ef2057f72b4 WriteUriCallbacks.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/WriteUriCallbacks.h	Wed Oct 28 07:57:12 2020 +0000
@@ -0,0 +1,120 @@
+/**
+  ******************************************************************************
+  * @file       WriteUriCallbacks.h
+  * @date       12/07/2017
+  * @brief      Class to write a URI tag.
+  ******************************************************************************
+  *
+  * COPYRIGHT(c) 2017 STMicroelectronics
+  *
+  * Redistribution and use in source and binary forms, with or without modification,
+  * are permitted provided that the following conditions are met:
+  *   1. Redistributions of source code must retain the above copyright notice,
+  *      this list of conditions and the following disclaimer.
+  *   2. Redistributions in binary form must reproduce the above copyright notice,
+  *      this list of conditions and the following disclaimer in the documentation
+  *      and/or other materials provided with the distribution.
+  *   3. Neither the name of STMicroelectronics nor the names of its contributors
+  *      may be used to endorse or promote products derived from this software
+  *      without specific prior written permission.
+  *
+  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+  *
+  ******************************************************************************
+  */
+
+#include "mbed.h"
+#include "NDefLib/RecordType/RecordURI.h"
+ 
+/**
+ * Chain of callback that will crate a Uri record and write it.
+ * After each operation the class will switch on a led
+ */
+class WriteUriCallbacks : public NDefLib::NDefNfcTag::Callbacks {
+ 
+    DigitalOut &mOnOpenSession;
+    DigitalOut &mOnWrite;
+    DigitalOut &mOnCloseSession;
+    NDefLib::Message *mMsg;
+ 
+public:
+ 
+    /**
+     * create the callback chain
+     * @param onOpenSession led to switch on when the session open
+     * @param onWrite led to switch on when the write end
+     * @param onCloseSession led to switch on when the session end
+     */
+    WriteUriCallbacks(DigitalOut &onOpenSession,DigitalOut &onWrite,
+        DigitalOut &onCloseSession):mOnOpenSession(onOpenSession),
+        mOnWrite(onWrite),mOnCloseSession(onCloseSession){};
+ 
+    /**
+     * crate the new message and write it
+     * @param tag tag where write the message
+     * @param success true if the session correctly open
+     */
+    virtual void on_session_open(NDefLib::NDefNfcTag *tag,bool success) {
+        if (!success) {
+            printf("Error opening the session\r\n");
+        }//else
+        printf("Session opened\r\n");
+        //ask to have an interrupt when the command finish
+        mOnOpenSession=1;
+        mOnCloseSession=0;
+        
+       // NDefLib::RecordURI *rUri = new NDefLib::RecordURI(NDefLib::RecordURI::HTTP_WWW,"http://www.st.com");
+        NDefLib::RecordURI *rUri2 = new NDefLib::RecordURI(NDefLib::RecordURI::UNKNOWN,"\nPropriétaire : Start-Up VélIoT. \nDernière révision : 18/10/19\nProchaine révision obligatoire : 26/01/21\nNuméro de téléphone du propriétaire : +33679469595\nAdresse du propriétaire : 1 rue Joliot Curie, 91190, Gif sur Yvette\nDate d'achat : 18/10/19\nLieu d'achat : Cycles Fab, 62280, La Capelle les Boulogne\n");
+ 
+		mMsg = new NDefLib::Message();
+       // mMsg->add_record(rUri);
+        mMsg->add_record(rUri2);
+ 
+        tag->write(*mMsg);
+    }
+ 
+    /**
+     * request to close the session
+     * @param tag tag where close the session
+     * @param success true if the message is correctly wrote
+     * @param message wrote
+     */
+    virtual void on_message_write(NDefLib::NDefNfcTag *tag,bool success) {
+ 
+        if (!success) {
+            printf("Error writing tag!\r\n");
+        } else {
+            printf("Tag written!\r\n");
+            mOnWrite=1;
+        }//if-else
+			
+		NDefLib::Message::remove_and_delete_all_record(*mMsg);
+		delete mMsg;
+        tag->close_session();
+    }
+ 
+    /**
+     * switch on the led
+     * @param tag where the session is closed
+     * @param success true if the session is correctly close
+     */
+    virtual void on_session_close(NDefLib::NDefNfcTag*, bool success) {
+        if (success) {
+            printf("Session closed\r\n");
+            mOnCloseSession=1;
+            mOnOpenSession=0;
+            mOnWrite=0;
+        } else {
+            printf("Error closing the session\r\n");
+        }
+    }
+};
diff -r 000000000000 -r 8ef2057f72b4 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Wed Oct 28 07:57:12 2020 +0000
@@ -0,0 +1,378 @@
+/* WiFi Example
+ * Copyright (c) 2018 ARM Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "mbed.h"
+#include "TCPSocket.h"
+ 
+#define WIFI_IDW0XX1    2
+
+#define TS_DEVICE "StmWifi" //mettre le nom de votre canal TS
+#define thingspeak_APIkey_write "2QCEO7RP079WP5R4" //mettre la clé écriture de votre canal TS
+#define thingspeak_APIkey_read "OMFA9O4ZPHUXPRKB" //mettre la clé lecture de votre canal TS
+
+
+#if (defined(TARGET_DISCO_L475VG_IOT01A) || defined(TARGET_DISCO_F413ZH))
+#include "ISM43362Interface.h"
+ISM43362Interface wifi(MBED_CONF_APP_WIFI_SPI_MOSI, MBED_CONF_APP_WIFI_SPI_MISO,
+ MBED_CONF_APP_WIFI_SPI_SCLK, MBED_CONF_APP_WIFI_SPI_NSS, MBED_CONF_APP_WIFI_RESET,
+  MBED_CONF_APP_WIFI_DATAREADY, MBED_CONF_APP_WIFI_WAKEUP, false);
+
+#else // External WiFi modules
+
+#if MBED_CONF_APP_WIFI_SHIELD == WIFI_IDW0XX1
+#include "SpwfSAInterface.h"
+SpwfSAInterface wifi(MBED_CONF_APP_WIFI_TX, MBED_CONF_APP_WIFI_RX);
+#endif // MBED_CONF_APP_WIFI_SHIELD == WIFI_IDW0XX1
+
+#endif
+
+#include "mbed.h"
+#include <chrono>
+#include <iostream>
+
+// Sensors drivers present in the BSP library
+#include "stm32l475e_iot01_gyro.h"
+#include "stm32l475e_iot01_accelero.h"
+
+// pour NFC
+#include "M24SR.h"
+#include "ReadUriCallbacks.h"
+#include "WriteUriCallbacks.h"
+
+
+// Pins definition for the DISCO_L475VG_IOT01A board
+#define NFC_I2C_SDA_PIN     PB_11
+#define NFC_I2C_SCL_PIN     PB_10
+#define NFC_GPO_PIN         PE_4
+#define NFC_RF_DISABLE_PIN  PE_2
+
+#define LED1_PIN    PA_5
+#define LED2_PIN    PB_14
+#define LED3_PIN    PC_9
+
+#define M24SR_ADDR          0xAC
+
+// Fin NFC
+
+
+/* Status PIN */
+DigitalOut sessionOpenLed(LED1_PIN); // tag session is open
+DigitalOut ongoingOperationLed(LED2_PIN); // ongoing read/write operation
+DigitalOut sessionClosedLed(LED3_PIN); // tag session is closed
+
+
+/** Variable set to true when we receive an interrupt from the NFC component */
+static volatile bool nfcInterruptFlag = false;
+
+/** Variable set to true when the user press the board user button */
+static volatile bool buttonPress = false;
+
+/** NFC ISR called when the NFC component has a message ready */
+static void nfc_interrupt_callback()
+{
+    nfcInterruptFlag = true;
+}
+
+static void set_button_press()
+{
+    buttonPress = true;
+}
+
+
+PwmOut R(D9);
+PwmOut G(D10);
+PwmOut B(D11);
+AnalogIn analog_value0(A0);
+AnalogIn analog_value1(A1);
+
+
+DigitalOut led(LED1);
+
+int chute = 0;
+
+const char *sec2str(nsapi_security_t sec)
+{
+    switch (sec) {
+        case NSAPI_SECURITY_NONE:
+            return "None";
+        case NSAPI_SECURITY_WEP:
+            return "WEP";
+        case NSAPI_SECURITY_WPA:
+            return "WPA";
+        case NSAPI_SECURITY_WPA2:
+            return "WPA2";
+        case NSAPI_SECURITY_WPA_WPA2:
+            return "WPA/WPA2";
+        case NSAPI_SECURITY_UNKNOWN:
+        default:
+            return "Unknown";
+    }
+}
+
+int scan_demo(WiFiInterface *wifi)
+{
+    WiFiAccessPoint *ap;
+
+    printf("Scan:\n");
+
+    int count = wifi->scan(NULL,0);
+    printf("%d networks available.\n", count);
+
+    /* Limit number of network arbitrary to 15 */
+    count = count < 15 ? count : 15;
+
+    ap = new WiFiAccessPoint[count];
+    count = wifi->scan(ap, count);
+    for (int i = 0; i < count; i++)
+    {
+        printf("Network: %s secured: %s BSSID: %hhX:%hhX:%hhX:%hhx:%hhx:%hhx RSSI: %hhd Ch: %hhd\n", ap[i].get_ssid(),
+               sec2str(ap[i].get_security()), ap[i].get_bssid()[0], ap[i].get_bssid()[1], ap[i].get_bssid()[2],
+               ap[i].get_bssid()[3], ap[i].get_bssid()[4], ap[i].get_bssid()[5], ap[i].get_rssi(), ap[i].get_channel());
+    }
+
+    delete[] ap;
+    return count;
+}
+
+
+//________________________________________________
+
+
+void http_demo(NetworkInterface *net)
+{
+    TCPSocket socket;
+    nsapi_error_t response;
+    
+    char sbuffer[256];
+    char message[64];
+    // mise en place des capteurs (accelerations et gyromètres)
+    float sensor_value = 0;
+    int16_t pDataXYZ[3] = {0};
+    int16_t pDataXYZ_init[3] = {0};
+    float pGyroDataXYZ[3] = {0};
+    float pGyroDataXYZ_init[3] = {0};
+
+    printf("Start sensor init\n");
+    //  BSP_GYRO_Init();
+    //  BSP_GYRO_GetXYZ(pGyroDataXYZ_init);
+    BSP_ACCELERO_Init();
+    BSP_ACCELERO_AccGetXYZ(pDataXYZ_init);
+    float meas_r0;
+    float meas_r1;
+    float i;
+    
+    
+    //mise en place du NFC
+    InterruptIn userButton(USER_BUTTON);
+    userButton.fall(set_button_press);
+
+    // Create the NFC component
+    I2C i2cChannel(NFC_I2C_SDA_PIN, NFC_I2C_SCL_PIN);
+    
+    M24SR nfcTag(M24SR_ADDR,i2cChannel, &nfc_interrupt_callback, NFC_GPO_PIN, NFC_RF_DISABLE_PIN);
+
+    // init needed to enable the component
+    nfcTag.init(NULL);
+    // No call back needed since default behavior is sync
+    nfcTag.get_session();
+    nfcTag.manage_I2C_GPO(M24SR::I2C_ANSWER_READY); // Switch to async mode
+
+    NDefLib::NDefNfcTag &tag = nfcTag.get_NDef_tag();
+
+
+    // Create the callback to use to write a tag
+    WriteUriCallbacks NDefWriteCallback(sessionOpenLed,ongoingOperationLed,sessionClosedLed);
+    ReadUriCallbacks NDefReadCallback(sessionOpenLed,ongoingOperationLed,sessionClosedLed);
+    tag.set_callback(&NDefWriteCallback); // Set the callback
+    tag.open_session(); // Start the callback chain
+ 
+    // declaration des variables utilisées pour le temps
+    
+    auto mseconds_last = 0;
+
+
+//----
+
+    /* Loop */  
+    while(true)
+    {
+// Open a socket on the network interface, and create a TCP connection to thingspeaks.com
+    // Si detection de NFC
+        if (nfcInterruptFlag) 
+        {
+            nfcInterruptFlag = false;
+            // Manage an async event from the NFC component
+            nfcTag.manage_event();
+        }
+        
+        __WFE(); // Wait For Event
+
+        // Clignotants
+        
+        meas_r0 = analog_value0.read();
+        printf("\n\rx= %f ", meas_r0);
+        meas_r1 = analog_value1.read();
+         
+        if (meas_r0 > 0.8)
+        {
+            G.write(0);
+            i=0;
+            while (i<12  and meas_r1 < 0.8)
+            {
+                B.write(1);
+                meas_r1 = analog_value1.read();
+                wait(0.2);
+                B.write(0);
+                wait(0.2);
+                printf("y= %f \n\r", meas_r1);
+                i=i+1;
+            }
+        }
+        if (meas_r0 < 0.5)
+        {
+            B.write(0);
+            i=0;
+            while (i<12  and meas_r1 < 0.8)
+            {
+                G.write(1);
+                meas_r1 = analog_value1.read();
+                wait(0.2);
+                G.write(0);
+                wait(0.2);
+                printf("y= %f \n\r", meas_r1);
+                i=i+1;
+            }
+        }
+        
+        
+        //feux de freinages
+        
+        BSP_ACCELERO_AccGetXYZ(pDataXYZ);
+        printf("\n\rACCELERO_X = %d", pDataXYZ[0]);
+
+        
+        
+        
+        if (pDataXYZ[0] < -40){
+            R.write(1);
+            wait(1.2);
+            R.write(0);       
+            }
+        if (pDataXYZ[2] < 750){
+            R.write(1);
+            chute = 1;
+            }
+        else{
+            chute = 0;
+            R.write(0);
+            }
+        
+    
+    socket.open(net);
+    response = socket.connect("api.thingspeak.com", 80);
+    if(0 != response)
+    {
+        printf("Error connecting: %d\n", response);
+        socket.close();
+        return;
+    }
+printf("Connected to the Server\n");
+//lecture des données des capteurs et actualisation des variables à transmettre
+    //captX=10; // | Pour illustration :
+    //captY=20; // | dans cet exemple on attribue des valeurs constantes aux variables
+    //captZ=30; // | captX =10, captY=20, captZ=30
+    
+    /* Construct content of HTTP command */ //message à transmettre (données des capteurs)
+    sprintf(message, "{\"field1\": %0.2f, \"field2\": %0.2f, \"field3\": %0.2f}", meas_r0, (double)pDataXYZ[0], (double) chute);
+    printf("Content Length = %d\r\n", (int)strlen(message));
+    
+    /* Construct HTTP command to send */  // Phase de transmission des données à ThingSpeaks.com
+    sprintf(sbuffer, "GET /update?api_key=%s HTTP/1.1\r\nHost: api.thingspeak.com\r\nContent-Type: application/json\r\nContent-Length: %d\r\n\r\n%s", thingspeak_APIkey_write, (int)strlen(message),message);
+    printf("HTTP command %s\r\n", sbuffer);
+    // Send a simple http request
+    printf("Sending HTTP request to thingspeak.com...\n");
+    nsapi_size_t size = strlen(sbuffer);
+    response = 0;
+    while(size)
+    {
+        response = socket.send(sbuffer+response, size);
+        if (response < 0)
+        {
+            printf("Error sending data: %d\n", response);
+            socket.close();
+            return;
+        }
+        else
+        {
+            size -= response;
+            // Check if entire message was sent or not
+            printf("sent %d [%.*s]\n", response, strstr(sbuffer, "\r\n")-sbuffer, sbuffer);
+        }
+    }
+    // Receive a simple http response and print out the response line
+    char rbuffer[64];
+    response = socket.recv(rbuffer, sizeof rbuffer);
+    if (response < 0)
+    {
+        printf("Error receiving data: %d\n", response);
+    }
+    else
+    {
+        printf("recv %d [%.*s]\n", response, strstr(rbuffer, "\r\n")-rbuffer, rbuffer);
+    }
+    // Close the socket to return its memory and bring down the network interface
+    socket.close();
+    }
+}
+
+
+
+
+//---------------------------------------------------------------------------------------
+
+
+
+
+
+
+
+
+int main()
+{
+    int count = 0;
+
+    printf("WiFi example\n\n");
+    printf("\nConnecting to %s...\n", MBED_CONF_APP_WIFI_SSID);
+    int ret = wifi.connect(MBED_CONF_APP_WIFI_SSID, MBED_CONF_APP_WIFI_PASSWORD, NSAPI_SECURITY_WPA_WPA2);
+    if (ret != 0)
+    {
+    printf("\nConnection error\n");
+    return -1;
+    }
+
+    printf("Success\n\n");
+    printf("MAC: %s\n", wifi.get_mac_address());
+    printf("IP: %s\n", wifi.get_ip_address());
+    printf("Netmask: %s\n", wifi.get_netmask());
+    printf("Gateway: %s\n", wifi.get_gateway());
+    printf("RSSI: %d\n\n", wifi.get_rssi());
+
+    http_demo(&wifi);
+
+    wifi.disconnect();
+
+    printf("\nDone\n");
+}
diff -r 000000000000 -r 8ef2057f72b4 mbed-os.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed-os.lib	Wed Oct 28 07:57:12 2020 +0000
@@ -0,0 +1,1 @@
+https://github.com/ARMmbed/mbed-os/#b81aeff1a3e171c6421984faa2cc18d0e35746c0
diff -r 000000000000 -r 8ef2057f72b4 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Wed Oct 28 07:57:12 2020 +0000
@@ -0,0 +1,1 @@
+https://mbed.org/users/mbed_official/code/mbed/builds/fd96258d940d
\ No newline at end of file
diff -r 000000000000 -r 8ef2057f72b4 mbed_app.json
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed_app.json	Wed Oct 28 07:57:12 2020 +0000
@@ -0,0 +1,83 @@
+{
+    "config": {
+        "wifi-shield": {
+            "help": "Options are internal, WIFI_IDW0XX1",
+            "value": "internal"
+        },
+        "wifi-ssid": {
+            "help": "WiFi SSID",
+            "value": "\"dlink-0B28\""
+        },
+        "wifi-password": {
+            "help": "WiFi Password",
+            "value": "\"qpdhs79182\""
+        },
+        "wifi-tx": {
+            "help": "TX pin for serial connection to external device",
+            "value": "D1"
+        },
+        "wifi-rx": {
+            "help": "RX pin for serial connection to external device",
+            "value": "D0"
+        },
+        "wifi-spi_miso": {
+            "help": "SPI-MISO connection to external device",
+            "value": "PC_11"
+        },
+        "wifi-spi_mosi": {
+            "help": "SPI-MOSI connection to external device",
+            "value": "PC_12"
+        },
+        "wifi-spi_sclk": {
+            "help": "SPI-CLOCK connection to external device",
+            "value": "PC_10"
+        },
+        "wifi-spi_nss": {
+            "help": "SPI chip select of external device",
+            "value": "PE_0"
+        },
+        "wifi-reset": {
+            "help": "WIFI module reset pin",
+            "value": "PE_8"
+        },
+        "wifi-dataready": {
+            "help": "WIFI module data ready pin",
+            "value": "PE_1"
+        },
+        "wifi-wakeup": {
+            "help": "WIFI module wakeup pin",
+            "value": "PB_12"
+        }
+    },
+    "target_overrides": {
+        "*": {
+            "platform.stdio-convert-newlines": true
+        },
+        "NUCLEO_L476RG": {
+            "wifi-tx": "D8",
+            "wifi-rx": "D2"
+        },
+        "NUCLEO_F401RE": {
+            "wifi-tx": "D8",
+            "wifi-rx": "D2"
+        },
+        "DISCO_L475VG_IOT1A": {
+            "wifi-spi_miso": "PC_11",
+            "wifi-spi_mosi": "PC_12",
+            "wifi-spi_sclk": "PC_10",
+            "wifi-spi_nss": "PE_0",
+            "wifi-reset": "PE_8",
+            "wifi-dataready": "PE_1",
+            "wifi-wakeup": "PB_12"
+        },
+        "DISCO_F413ZH": {
+            "wifi-spi_miso": "PB_4",
+            "wifi-spi_mosi": "PB_5",
+            "wifi-spi_sclk": "PB_12",
+            "wifi-spi_nss": "PG_11",
+            "wifi-reset": "PH_1",
+            "wifi-dataready": "PG_12",
+            "wifi-wakeup": "PB_15"
+        }
+    }
+}
diff -r 000000000000 -r 8ef2057f72b4 mbed_app_idw01m1.json
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed_app_idw01m1.json	Wed Oct 28 07:57:12 2020 +0000
@@ -0,0 +1,35 @@
+{
+    "config": {
+	"wifi-shield": {
+            "help": "Options are internal, WIFI_ESP8266, WIFI_IDW0XX1",
+            "value": "WIFI_IDW0XX1"
+	},
+        "wifi-ssid": {
+            "help": "WiFi SSID",
+            "value": "\"dlink-0B28\""
+        },
+        "wifi-password": {
+            "help": "WiFi Password",
+            "value": "\"qpdhs79182\""
+        },
+        "wifi-tx": {
+            "help": "TX pin for serial connection to external device",
+            "value": "PA_9"
+        },
+        "wifi-rx": {
+            "help": "RX pin for serial connection to external device",
+            "value": "PA_10"
+        }
+    },
+    "target_overrides": {
+        "*": {
+            "platform.stdio-convert-newlines": true,
+            "idw0xx1.expansion-board": "IDW01M1",
+	    "drivers.uart-serial-txbuf-size": 730,
+	    "drivers.uart-serial-rxbuf-size": 730
+        },
+        "UBLOX_EVK_ODIN_W2": {
+            "target.device_has": ["EMAC"]
+        }
+    }
+}
diff -r 000000000000 -r 8ef2057f72b4 mbed_app_idw04a1.json
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed_app_idw04a1.json	Wed Oct 28 07:57:12 2020 +0000
@@ -0,0 +1,36 @@
+{
+    "config": {
+	"wifi-shield": {
+            "help": "Options are internal, WIFI_ESP8266, WIFI_IDW0XX1",
+            "value": "WIFI_IDW0XX1"
+	},
+        "wifi-ssid": {
+            "help": "WiFi SSID",
+            "value": "\"dlink-0B28\""
+        },
+        "wifi-password": {
+            "help": "WiFi Password",
+            "value": "\"qpdhs79182\""
+        },
+        "wifi-tx": {
+            "help": "TX pin for serial connection to external device",
+            "value": "D8"
+        },
+        "wifi-rx": {
+            "help": "RX pin for serial connection to external device",
+            "value": "D2"
+        }
+    },
+    "target_overrides": {
+        "*": {
+            "platform.stdio-convert-newlines": true,
+            "idw0xx1.expansion-board": "IDW04A1",
+	    "drivers.uart-serial-txbuf-size": 750,
+	    "drivers.uart-serial-rxbuf-size": 750
+        },
+	"UBLOX_EVK_ODIN_W2": {
+            "target.device_has": ["EMAC"]
+	}
+    },
+    "macros": ["IDW04A1_WIFI_HW_BUG_WA"]
+}
diff -r 000000000000 -r 8ef2057f72b4 mbed_app_ism43362.json
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed_app_ism43362.json	Wed Oct 28 07:57:12 2020 +0000
@@ -0,0 +1,86 @@
+{
+    "config": {
+        "wifi-shield": {
+            "help": "Options are internal, WIFI_ESP8266, WIFI_IDW0XX1",
+            "value": "internal"
+        },
+        "wifi-ssid": {
+            "help": "WiFi SSID",
+            "value": "\"dlink-0B28\""
+        },
+        "wifi-password": {
+            "help": "WiFi Password",
+            "value": "\"qpdhs79182\""
+        },
+        "wifi-tx": {
+            "help": "TX pin for serial connection to external device",
+            "value": "D1"
+        },
+        "wifi-rx": {
+            "help": "RX pin for serial connection to external device",
+            "value": "D0"
+        },
+        "wifi-spi_miso": {
+            "help": "SPI-MISO connection to external device",
+            "value": "PC_11"
+        },
+        "wifi-spi_mosi": {
+            "help": "SPI-MOSI connection to external device",
+            "value": "PC_12"
+        },
+        "wifi-spi_sclk": {
+            "help": "SPI-CLOCK connection to external device",
+            "value": "PC_10"
+        },
+        "wifi-spi_nss": {
+            "help": "SPI chip select of external device",
+            "value": "PE_0"
+        },
+        "wifi-reset": {
+            "help": "WIFI module reset pin",
+            "value": "PE_8"
+        },
+        "wifi-dataready": {
+            "help": "WIFI module data ready pin",
+            "value": "PE_1"
+        },
+        "wifi-wakeup": {
+            "help": "WIFI module wakeup pin",
+            "value": "PB_12"
+        }
+    },
+    "target_overrides": {
+        "*": {
+            "platform.stdio-convert-newlines": true
+        },
+        "UBLOX_EVK_ODIN_W2": {
+            "target.device_has": ["EMAC"]
+        },
+        "NUCLEO_L476RG": {
+            "wifi-tx": "D8",
+            "wifi-rx": "D2"
+        },
+        "NUCLEO_F401RE": {
+            "wifi-tx": "D8",
+            "wifi-rx": "D2"
+        },
+        "DISCO_L475VG_IOT1A": {
+            "wifi-spi_miso": "PC_11",
+            "wifi-spi_mosi": "PC_12",
+            "wifi-spi_sclk": "PC_10",
+            "wifi-spi_nss": "PE_0",
+            "wifi-reset": "PE_8",
+            "wifi-dataready": "PE_1",
+            "wifi-wakeup": "PB_12"
+        },
+        "DISCO_F413ZH": {
+            "wifi-spi_miso": "PB_4",
+            "wifi-spi_mosi": "PB_5",
+            "wifi-spi_sclk": "PB_12",
+            "wifi-spi_nss": "PG_11",
+            "wifi-reset": "PH_1",
+            "wifi-dataready": "PG_12",
+            "wifi-wakeup": "PB_15"
+        }
+    }
+}
diff -r 000000000000 -r 8ef2057f72b4 wifi-ism43362.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/wifi-ism43362.lib	Wed Oct 28 07:57:12 2020 +0000
@@ -0,0 +1,1 @@
+https://github.com/ARMmbed/wifi-ism43362/#e4ecc27e87d96072f7df62a25ef007986dc95c4e