mirror of https://github.com/ARMmbed/mbed-os.git
Fix builds for targets without wifi or without mbed_app.json
parent
5b40280cab
commit
72e7c326c9
|
@ -1,11 +1,32 @@
|
|||
#include "mbed.h"
|
||||
|
||||
// Pick the correct driver based on mbed_app.json
|
||||
#define INTERNAL 1
|
||||
#define WIFI_ESP8266 2
|
||||
#define X_NUCLEO_IDW01M1 3
|
||||
|
||||
#if MBED_CONF_APP_WIFI_DRIVER == INTERNAL
|
||||
|
||||
#if TARGET_UBLOX_EVK_ODIN_W2
|
||||
#include "OdinWiFiInterface.h"
|
||||
#define DRIVER OdinWiFiInterface
|
||||
|
||||
#elif TARGET_REALTEK_RTL8195AM
|
||||
#include "RTWInterface.h"
|
||||
#define DRIVER RTWInterface
|
||||
#else
|
||||
#error [NOT_SUPPORTED] Unsupported Wifi driver
|
||||
#endif
|
||||
|
||||
#elif MBED_CONF_APP_WIFI_DRIVER == WIFI_ESP8266
|
||||
#include "ESP8266Interface.h"
|
||||
#define DRIVER ESP8266Interface
|
||||
|
||||
#elif MBED_CONF_APP_WIFI_DRIVER == X_NUCLEO_IDW01M1
|
||||
#include "SpwfSAInterface.h"
|
||||
#define DRIVER SpwfSAInterface
|
||||
#else
|
||||
#error [NOT_SUPPORTED] Unsupported Wifi driver
|
||||
#endif
|
||||
|
||||
WiFiInterface *get_interface()
|
||||
|
@ -15,12 +36,10 @@ WiFiInterface *get_interface()
|
|||
if (interface)
|
||||
delete interface;
|
||||
|
||||
#if TARGET_UBLOX_EVK_ODIN_W2
|
||||
interface = new OdinWiFiInterface();
|
||||
#elif TARGET_REALTEK_RTL8195AM
|
||||
interface = new RTWInterface();
|
||||
#if MBED_CONF_APP_WIFI_DRIVER == INTERNAL
|
||||
interface = new DRIVER();
|
||||
#else
|
||||
interface = new ESP8266Interface(D1, D0);
|
||||
interface = new DRIVER(MBED_CONF_APP_WIFI_TX, MBED_CONF_APP_WIFI_RX);
|
||||
#endif
|
||||
return interface;
|
||||
}
|
||||
|
|
|
@ -4,6 +4,21 @@
|
|||
#include "utest.h"
|
||||
#include "wifi_tests.h"
|
||||
|
||||
// Test for parameters
|
||||
#if !defined(MBED_CONF_APP_AP_MAC_SECURE) || \
|
||||
!defined(MBED_CONF_APP_AP_MAC_UNSECURE) || \
|
||||
!defined(MBED_CONF_APP_MAX_SCAN_SIZE) || \
|
||||
!defined(MBED_CONF_APP_WIFI_CH_SECURE) || \
|
||||
!defined(MBED_CONF_APP_WIFI_CH_UNSECURE) || \
|
||||
!defined(MBED_CONF_APP_WIFI_DRIVER) || \
|
||||
!defined(MBED_CONF_APP_WIFI_PASSWORD) || \
|
||||
!defined(MBED_CONF_APP_WIFI_RX) || \
|
||||
!defined(MBED_CONF_APP_WIFI_SECURE_SSID) || \
|
||||
!defined(MBED_CONF_APP_WIFI_TX) || \
|
||||
!defined(MBED_CONF_APP_WIFI_UNSECURE_SSID)
|
||||
#error [NOT_SUPPORTED] Requires parameters from mbed_app.json
|
||||
#endif
|
||||
|
||||
using namespace utest::v1;
|
||||
|
||||
utest::v1::status_t test_setup(const size_t number_of_cases) {
|
||||
|
|
|
@ -20,6 +20,18 @@
|
|||
"help": "Channel number of unsecure SSID",
|
||||
"value": 2
|
||||
},
|
||||
"wifi-driver": {
|
||||
"help": "Wifi driver to use, valid values are INTERNAL, WIFI_ESP8266 and X_NUCLEO_IDW01M1",
|
||||
"value": "INTERNAL"
|
||||
},
|
||||
"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"
|
||||
},
|
||||
"ap-mac-secure": {
|
||||
"help": "BSSID of secure AP in form of AA:BB:CC:DD:EE:FF",
|
||||
"value": "\"AA:AA:AA:AA:AA:AA\""
|
||||
|
|
Loading…
Reference in New Issue