2017-10-04 14:45:25 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2017, ARM Limited, All Rights Reserved
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
2017-09-19 17:16:36 +00:00
|
|
|
#include "mbed.h"
|
2017-09-29 09:55:04 +00:00
|
|
|
|
2017-10-03 09:50:03 +00:00
|
|
|
// Pick the correct driver based on mbed_app.json
|
|
|
|
#define INTERNAL 1
|
|
|
|
#define WIFI_ESP8266 2
|
2017-11-21 11:09:26 +00:00
|
|
|
#define X_NUCLEO_IDW0XX1 3
|
2017-10-03 09:50:03 +00:00
|
|
|
|
|
|
|
#if MBED_CONF_APP_WIFI_DRIVER == INTERNAL
|
|
|
|
|
2017-09-29 09:55:04 +00:00
|
|
|
#if TARGET_UBLOX_EVK_ODIN_W2
|
|
|
|
#include "OdinWiFiInterface.h"
|
2017-10-03 09:50:03 +00:00
|
|
|
#define DRIVER OdinWiFiInterface
|
|
|
|
|
2017-09-29 09:55:04 +00:00
|
|
|
#elif TARGET_REALTEK_RTL8195AM
|
|
|
|
#include "RTWInterface.h"
|
2017-10-03 09:50:03 +00:00
|
|
|
#define DRIVER RTWInterface
|
2017-09-29 09:55:04 +00:00
|
|
|
#else
|
2017-10-03 09:50:03 +00:00
|
|
|
#error [NOT_SUPPORTED] Unsupported Wifi driver
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#elif MBED_CONF_APP_WIFI_DRIVER == WIFI_ESP8266
|
2017-09-19 17:16:36 +00:00
|
|
|
#include "ESP8266Interface.h"
|
2017-10-03 09:50:03 +00:00
|
|
|
#define DRIVER ESP8266Interface
|
|
|
|
|
2017-11-21 11:09:26 +00:00
|
|
|
#elif MBED_CONF_APP_WIFI_DRIVER == X_NUCLEO_IDW0XX1
|
2017-10-03 09:50:03 +00:00
|
|
|
#include "SpwfSAInterface.h"
|
|
|
|
#define DRIVER SpwfSAInterface
|
|
|
|
#else
|
|
|
|
#error [NOT_SUPPORTED] Unsupported Wifi driver
|
2017-09-29 09:55:04 +00:00
|
|
|
#endif
|
2017-09-19 17:16:36 +00:00
|
|
|
|
|
|
|
WiFiInterface *get_interface()
|
|
|
|
{
|
|
|
|
static WiFiInterface *interface = NULL;
|
|
|
|
|
|
|
|
if (interface)
|
|
|
|
delete interface;
|
|
|
|
|
2017-10-03 09:50:03 +00:00
|
|
|
#if MBED_CONF_APP_WIFI_DRIVER == INTERNAL
|
|
|
|
interface = new DRIVER();
|
2017-09-19 17:16:36 +00:00
|
|
|
#else
|
2017-10-03 09:50:03 +00:00
|
|
|
interface = new DRIVER(MBED_CONF_APP_WIFI_TX, MBED_CONF_APP_WIFI_RX);
|
2017-09-19 17:16:36 +00:00
|
|
|
#endif
|
|
|
|
return interface;
|
|
|
|
}
|