Skip to content

Commit

Permalink
Update examples and documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
mobizt committed Jun 11, 2024
1 parent d998de8 commit 8697576
Show file tree
Hide file tree
Showing 4 changed files with 98 additions and 33 deletions.
30 changes: 28 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -567,6 +567,8 @@ In case sync task, the timeouts can be set via `AsyncClientClass::setSyncSendTim
This library provides the class object called async result (`AsyncResult`) which is used as a container that provides 4 types of information: `App Events` (`app_event_t`), `Server Response and Event Data`, `Debug Information` and `Error Information` and will be discussed later.
This library does not use Serial port to print any message internally. All information will be obtained from `AsyncResult` which you can choose which information you want to read or print.
The information of `App Events` (`app_event_t`)'s authentication task can be obtained from `AsyncResult::appEvent()`
The information of `Server Response and Event Data` included the payload, `SSE mode (HTTP Streaming)` event-data, status and header data.
Expand Down Expand Up @@ -1285,6 +1287,10 @@ The `AsyncClientClass` object requires the network config data (`network_config_
> [!WARNING]
> In ESP32, [ADC2](https://docs.espressif.com/projects/esp-idf/en/v4.2/esp32/api-reference/peripherals/adc.html) (`GPIO 0`, `GPIO 2`, `GPIO 4`, `GPIO 12`, `GPIO 13`, `GPIO 14`, `GPIO 15`, `GPIO 25`, `GPIO 26` and `GPIO 27`) cannot be used while using WiFi.
>
> In ESP32, you can't use WiFi while using Bluetooth.
>
> In ESP8266/ESP32, you can't use WiFi while using ESP-Now.
The default network class can be used with WiFi capable MCUs e.g. ESP8266, ESP32 and Raspberry Pi Pico W.
Expand Down Expand Up @@ -1507,10 +1513,30 @@ See [GenericNetwork example](/examples/App/NetworkInterfaces/Async/Callback/Gene
With this library, you can use async functions with or without the callback functions. The sync functions are also supported.
The examples provided by this library can be divided into two use cases i.e. `Async` (with `Callback` and `NoCallback`) and `Sync` as listed in the following tree structure.
Because of all information from operating result, error and debug information are stored in the `AsyncResult`.
Library usage is very flexible which `AsyncResult` can be defined by user or create instantly internally and accessing from within callback, depending on the use cases, which this is how the library examples are organized.
You can choose externally provided `AsyncResult` used with sync or async without callback to save the stack memory usage.
Then the examples provided by this library can be divided into two use cases i.e. `Async` (with `Callback` and `NoCallback`) and `Sync` operations.
For Firebase services, inside the `Async` and `Sync` folders, the examples based on the Firebase REST APIs are located. The additional cases examples are also included in those folders.
For user that ever used the other legacy Firebase library for Realtime database, the examples in the `Simple` folder under the `RealtimeDatabase` folder provide the basic usage that is enough for simple use.
The examples under the `App` folder contains 4 sub folders:
- `AppInitialization` folder is for authentication examples.
- `NetworkInrerfaces` folder is for neiworking examples.
- `UserManagement` folder is for Google authentication examples to manage user.
The following section will provided the basic (bare minimum) code example and the links: for the examples, class and functions description and Google API documentation.
<details>
<summary>Library Examples Structure</summary>
<summary>For the Library Examples Structure, please click here</summary>
* [App](/examples/App/)
* [AppInitialization](/examples/App/AppInitialization/)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@


/**
* This modification and interconnection provided in this example are mostly worked as
* This example is for the LAN8720 module that connected with ESP32.
*
* In case of external LAN8720 module, the following hardeare connection is recommended.
* Some EV board e.g. Olimex ESP32-EVB board has built with LAN8720 chip on board, the modification is not needed.
*
* The modification and interconnection of external LAN8720 module provided in this example are mostly worked as
* the 50 MHz clock was created internally in ESP32 which GPIO 17 is set to be output of this clock
* and feeds to the LAN8720 chip XTAL input.
*
Expand All @@ -24,6 +29,7 @@
* GPIO18 - MDIO MDIO
* GND GND
* 3V3 VCC
*
*
* The complete usage guidelines, please visit https://github.com/mobizt/FirebaseClient
*
Expand Down Expand Up @@ -62,22 +68,26 @@ AsyncClient aClient(ssl_client, getNetwork(default_network));
#ifdef ETH_CLK_MODE
#undef ETH_CLK_MODE
#endif
#define ETH_CLK_MODE ETH_CLOCK_GPIO17_OUT // RMII clock output from GPIO17

// Pin# of the enable signal for the external crystal oscillator (-1 to disable)
#define ETH_POWER_PIN -1

// Type of the Ethernet PHY (LAN8720 or TLK110)
#define ETH_TYPE ETH_PHY_LAN8720
#define ETH_PHY_TYPE ETH_PHY_LAN8720

// I²C-address of Ethernet PHY (0 or 1 for LAN8720, 31 for TLK110)
#define ETH_ADDR 1
#define ETH_PHY_ADDR 1

// Pin# of the I²C clock signal for the Ethernet PHY
#define ETH_MDC_PIN 23
#define ETH_PHY_MDC 23

// Pin# of the I²C IO signal for the Ethernet PHY
#define ETH_MDIO_PIN 18
#define ETH_PHY_MDIO 18

// Pin# of the enable signal for the external crystal oscillator (-1 to disable)
#define ETH_PHY_POWER -1

// RMII clock output from GPIO17 (for modified LAN8720 module only)
// For LAN8720 built-in, RMII clock input at GPIO 0 from LAN8720 e.g. Olimex ESP32-EVB board
// #define ETH_CLK_MODE ETH_CLOCK_GPIO0_IN
#define ETH_CLK_MODE ETH_CLOCK_GPIO17_OUT

static bool eth_connected = false;

Expand Down Expand Up @@ -165,13 +175,16 @@ void WiFiEvent(WiFiEvent_t event)

void setup()
{

Serial.begin(115200);

// This delay is needed in case ETH_CLK_MODE was set to ETH_CLOCK_GPIO0_IN,
// to allow the external clock source to be ready before initialize the Ethernet.
delay(500);

Serial.printf("Firebase Client v%s\n", FIREBASE_CLIENT_VERSION);

WiFi.onEvent(WiFiEvent);
ETH.begin(ETH_ADDR, ETH_POWER_PIN, ETH_MDC_PIN, ETH_MDIO_PIN, ETH_TYPE, ETH_CLK_MODE);
ETH.begin(ETH_PHY_ADDR, ETH_PHY_POWER, ETH_PHY_MDC, ETH_PHY_MDIO, ETH_PHY_TYPE, ETH_CLK_MODE);
}

void setConfig()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@


/**
* This modification and interconnection provided in this example are mostly worked as
* This example is for the LAN8720 module that connected with ESP32.
*
* In case of external LAN8720 module, the following hardeare connection is recommended.
* Some EV board e.g. Olimex ESP32-EVB board has built with LAN8720 chip on board, the modification is not needed.
*
* The modification and interconnection of external LAN8720 module provided in this example are mostly worked as
* the 50 MHz clock was created internally in ESP32 which GPIO 17 is set to be output of this clock
* and feeds to the LAN8720 chip XTAL input.
*
Expand Down Expand Up @@ -62,22 +67,26 @@ AsyncResult aResult_no_callback;
#ifdef ETH_CLK_MODE
#undef ETH_CLK_MODE
#endif
#define ETH_CLK_MODE ETH_CLOCK_GPIO17_OUT // RMII clock output from GPIO17

// Pin# of the enable signal for the external crystal oscillator (-1 to disable)
#define ETH_POWER_PIN -1

// Type of the Ethernet PHY (LAN8720 or TLK110)
#define ETH_TYPE ETH_PHY_LAN8720
#define ETH_PHY_TYPE ETH_PHY_LAN8720

// I²C-address of Ethernet PHY (0 or 1 for LAN8720, 31 for TLK110)
#define ETH_ADDR 1
#define ETH_PHY_ADDR 1

// Pin# of the I²C clock signal for the Ethernet PHY
#define ETH_MDC_PIN 23
#define ETH_PHY_MDC 23

// Pin# of the I²C IO signal for the Ethernet PHY
#define ETH_MDIO_PIN 18
#define ETH_PHY_MDIO 18

// Pin# of the enable signal for the external crystal oscillator (-1 to disable)
#define ETH_PHY_POWER -1

// RMII clock output from GPIO17 (for modified LAN8720 module only)
// For LAN8720 built-in, RMII clock input at GPIO 0 from LAN8720 e.g. Olimex ESP32-EVB board
// #define ETH_CLK_MODE ETH_CLOCK_GPIO0_IN
#define ETH_CLK_MODE ETH_CLOCK_GPIO17_OUT

static bool eth_connected = false;

Expand Down Expand Up @@ -168,10 +177,14 @@ void setup()

Serial.begin(115200);

// This delay is needed in case ETH_CLK_MODE was set to ETH_CLOCK_GPIO0_IN,
// to allow the external clock source to be ready before initialize the Ethernet.
delay(500);

Serial.printf("Firebase Client v%s\n", FIREBASE_CLIENT_VERSION);

WiFi.onEvent(WiFiEvent);
ETH.begin(ETH_ADDR, ETH_POWER_PIN, ETH_MDC_PIN, ETH_MDIO_PIN, ETH_TYPE, ETH_CLK_MODE);
ETH.begin(ETH_PHY_ADDR, ETH_PHY_POWER, ETH_PHY_MDC, ETH_PHY_MDIO, ETH_PHY_TYPE, ETH_CLK_MODE);
}

void setConfig()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@


/**
* This modification and interconnection provided in this example are mostly worked as
* This example is for the LAN8720 module that connected with ESP32.
*
* In case of external LAN8720 module, the following hardeare connection is recommended.
* Some EV board e.g. Olimex ESP32-EVB board has built with LAN8720 chip on board, the modification is not needed.
*
* The modification and interconnection of external LAN8720 module provided in this example are mostly worked as
* the 50 MHz clock was created internally in ESP32 which GPIO 17 is set to be output of this clock
* and feeds to the LAN8720 chip XTAL input.
*
Expand Down Expand Up @@ -64,22 +69,26 @@ AsyncResult aResult_no_callback;
#ifdef ETH_CLK_MODE
#undef ETH_CLK_MODE
#endif
#define ETH_CLK_MODE ETH_CLOCK_GPIO17_OUT // RMII clock output from GPIO17

// Pin# of the enable signal for the external crystal oscillator (-1 to disable)
#define ETH_POWER_PIN -1

// Type of the Ethernet PHY (LAN8720 or TLK110)
#define ETH_TYPE ETH_PHY_LAN8720
#define ETH_PHY_TYPE ETH_PHY_LAN8720

// I²C-address of Ethernet PHY (0 or 1 for LAN8720, 31 for TLK110)
#define ETH_ADDR 1
#define ETH_PHY_ADDR 1

// Pin# of the I²C clock signal for the Ethernet PHY
#define ETH_MDC_PIN 23
#define ETH_PHY_MDC 23

// Pin# of the I²C IO signal for the Ethernet PHY
#define ETH_MDIO_PIN 18
#define ETH_PHY_MDIO 18

// Pin# of the enable signal for the external crystal oscillator (-1 to disable)
#define ETH_PHY_POWER -1

// RMII clock output from GPIO17 (for modified LAN8720 module only)
// For LAN8720 built-in, RMII clock input at GPIO 0 from LAN8720 e.g. Olimex ESP32-EVB board
// #define ETH_CLK_MODE ETH_CLOCK_GPIO0_IN
#define ETH_CLK_MODE ETH_CLOCK_GPIO17_OUT

static bool eth_connected = false;

Expand Down Expand Up @@ -170,10 +179,14 @@ void setup()

Serial.begin(115200);

// This delay is needed in case ETH_CLK_MODE was set to ETH_CLOCK_GPIO0_IN,
// to allow the external clock source to be ready before initialize the Ethernet.
delay(500);

Serial.printf("Firebase Client v%s\n", FIREBASE_CLIENT_VERSION);

WiFi.onEvent(WiFiEvent);
ETH.begin(ETH_ADDR, ETH_POWER_PIN, ETH_MDC_PIN, ETH_MDIO_PIN, ETH_TYPE, ETH_CLK_MODE);
ETH.begin(ETH_PHY_ADDR, ETH_PHY_POWER, ETH_PHY_MDC, ETH_PHY_MDIO, ETH_PHY_TYPE, ETH_CLK_MODE);
}

void setConfig()
Expand Down

0 comments on commit 8697576

Please sign in to comment.