the question is due to my limited knowledge of C.
What is the function type should i specify if i want to check that the esp is connected after calling the function:
Code: Select all
#include <WiFi.h>
<skip>
wl_status_t WIFI_Net_Connect() {
return WL_CONNECTED;
}
The complier is upset :
Code: Select all
In file included from src/main.cpp:10:0:
include/wireless.h:4:1: error: 'wl_status_t' does not name a type
wl_status_t WIFI_Net_Connect() ;
^
Code: Select all
typedef enum {
WL_NO_SHIELD = 255, // for compatibility with WiFi Shield library
WL_IDLE_STATUS = 0,
WL_NO_SSID_AVAIL = 1,
WL_SCAN_COMPLETED = 2,
WL_CONNECTED = 3,
WL_CONNECT_FAILED = 4,
WL_CONNECTION_LOST = 5,
WL_DISCONNECTED = 6
} wl_status_t;
At the same time in WiFiSta.h:
Code: Select all
class WiFiSTAClass {
<skip>
static wl_status_t status();
static void _setStatus(wl_status_t status);
}
TLDR:
Code: Select all
enum Foo { BAR, BAZ };
enum Foo testFunc(void)
{
return BAR;
}
Or, with a typedef:
typedef enum Foo { BAR, BAZ } Foo;
Foo testFunc(void)
{
return BAR;
}
thank you .