mbed-os

Dependents:   cobaLCDJoyMotor_Thread odometry_omni_3roda_v3 odometry_omni_3roda_v1 odometry_omni_3roda_v2 ... more

Committer:
be_bryan
Date:
Mon Dec 11 17:54:04 2017 +0000
Revision:
0:b74591d5ab33
motor ++

Who changed what in which revision?

UserRevisionLine numberNew contents of line
be_bryan 0:b74591d5ab33 1 /*
be_bryan 0:b74591d5ab33 2 * Copyright (c) 2017, ARM Limited, All Rights Reserved
be_bryan 0:b74591d5ab33 3 * SPDX-License-Identifier: Apache-2.0
be_bryan 0:b74591d5ab33 4 *
be_bryan 0:b74591d5ab33 5 * Licensed under the Apache License, Version 2.0 (the "License"); you may
be_bryan 0:b74591d5ab33 6 * not use this file except in compliance with the License.
be_bryan 0:b74591d5ab33 7 * You may obtain a copy of the License at
be_bryan 0:b74591d5ab33 8 *
be_bryan 0:b74591d5ab33 9 * http://www.apache.org/licenses/LICENSE-2.0
be_bryan 0:b74591d5ab33 10 *
be_bryan 0:b74591d5ab33 11 * Unless required by applicable law or agreed to in writing, software
be_bryan 0:b74591d5ab33 12 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
be_bryan 0:b74591d5ab33 13 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
be_bryan 0:b74591d5ab33 14 * See the License for the specific language governing permissions and
be_bryan 0:b74591d5ab33 15 * limitations under the License.
be_bryan 0:b74591d5ab33 16 */
be_bryan 0:b74591d5ab33 17
be_bryan 0:b74591d5ab33 18 #include "mbed.h"
be_bryan 0:b74591d5ab33 19
be_bryan 0:b74591d5ab33 20 // Pick the correct driver based on mbed_app.json
be_bryan 0:b74591d5ab33 21 #define INTERNAL 1
be_bryan 0:b74591d5ab33 22 #define WIFI_ESP8266 2
be_bryan 0:b74591d5ab33 23 #define X_NUCLEO_IDW01M1 3
be_bryan 0:b74591d5ab33 24
be_bryan 0:b74591d5ab33 25 #if MBED_CONF_APP_WIFI_DRIVER == INTERNAL
be_bryan 0:b74591d5ab33 26
be_bryan 0:b74591d5ab33 27 #if TARGET_UBLOX_EVK_ODIN_W2
be_bryan 0:b74591d5ab33 28 #include "OdinWiFiInterface.h"
be_bryan 0:b74591d5ab33 29 #define DRIVER OdinWiFiInterface
be_bryan 0:b74591d5ab33 30
be_bryan 0:b74591d5ab33 31 #elif TARGET_REALTEK_RTL8195AM
be_bryan 0:b74591d5ab33 32 #include "RTWInterface.h"
be_bryan 0:b74591d5ab33 33 #define DRIVER RTWInterface
be_bryan 0:b74591d5ab33 34 #else
be_bryan 0:b74591d5ab33 35 #error [NOT_SUPPORTED] Unsupported Wifi driver
be_bryan 0:b74591d5ab33 36 #endif
be_bryan 0:b74591d5ab33 37
be_bryan 0:b74591d5ab33 38 #elif MBED_CONF_APP_WIFI_DRIVER == WIFI_ESP8266
be_bryan 0:b74591d5ab33 39 #include "ESP8266Interface.h"
be_bryan 0:b74591d5ab33 40 #define DRIVER ESP8266Interface
be_bryan 0:b74591d5ab33 41
be_bryan 0:b74591d5ab33 42 #elif MBED_CONF_APP_WIFI_DRIVER == X_NUCLEO_IDW01M1
be_bryan 0:b74591d5ab33 43 #include "SpwfSAInterface.h"
be_bryan 0:b74591d5ab33 44 #define DRIVER SpwfSAInterface
be_bryan 0:b74591d5ab33 45 #else
be_bryan 0:b74591d5ab33 46 #error [NOT_SUPPORTED] Unsupported Wifi driver
be_bryan 0:b74591d5ab33 47 #endif
be_bryan 0:b74591d5ab33 48
be_bryan 0:b74591d5ab33 49 WiFiInterface *get_interface()
be_bryan 0:b74591d5ab33 50 {
be_bryan 0:b74591d5ab33 51 static WiFiInterface *interface = NULL;
be_bryan 0:b74591d5ab33 52
be_bryan 0:b74591d5ab33 53 if (interface)
be_bryan 0:b74591d5ab33 54 delete interface;
be_bryan 0:b74591d5ab33 55
be_bryan 0:b74591d5ab33 56 #if MBED_CONF_APP_WIFI_DRIVER == INTERNAL
be_bryan 0:b74591d5ab33 57 interface = new DRIVER();
be_bryan 0:b74591d5ab33 58 #else
be_bryan 0:b74591d5ab33 59 interface = new DRIVER(MBED_CONF_APP_WIFI_TX, MBED_CONF_APP_WIFI_RX);
be_bryan 0:b74591d5ab33 60 #endif
be_bryan 0:b74591d5ab33 61 return interface;
be_bryan 0:b74591d5ab33 62 }