example common_components: fixed GPIO max range for ESP32-C2

This commit is contained in:
Ondrej Kosta
2022-06-09 15:47:57 +02:00
parent 53082a22f7
commit b83de6acbc
5 changed files with 1592 additions and 6 deletions

View File

@@ -4,7 +4,7 @@ config ENV_GPIO_RANGE_MIN
config ENV_GPIO_RANGE_MAX
int
default 19
default 20
config ENV_GPIO_IN_RANGE_MAX
int

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
# The following lines of boilerplate have to be in your project's CMakeLists
# in this exact order for cmake to work correctly
cmake_minimum_required(VERSION 3.5)
cmake_minimum_required(VERSION 3.16)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(bridge)

View File

@@ -13,7 +13,24 @@ Performance of this type of "software" bridge is limited by the performance of E
You need one ESP32 with at least two Ethernet ports and two PCs (or other Ethernet capable devices). Connect the network as shown in figure below, configure PC#1 as DHCP server and PC#2 as DHCP client.
![example network](docs/network.png)
```mermaid
graph TD;
classDef classPing fill:#0000,stroke-width:0px;
esp32["ESP32 w/ 2 bridged<br/>Ethernet ports<br/>(DHCP Client)"];
pc1["PC#1<br/>(DHCP Server)"];
pc2["PC#2<br/>(DHCP Client)"];
ping1["ping"]:::classPing
ping2["ping"]:::classPing
ping3["ping"]:::classPing
esp32 -.- ping1;
ping1 -.- pc1;
esp32 == Eth === pc2;
esp32 == Eth === pc1;
esp32 -.- ping2;
ping2 -.- pc2;
pc1 <-.- ping3;
pc2 <-.- ping3;
```
The work flow of the example is then as follows:

View File

@@ -301,10 +301,11 @@ void app_main(void)
.base = &esp_netif_br_config,
.stack = ESP_NETIF_NETSTACK_DEFAULT_BR,
};
// Bridge configuration
bridgeif_config_t bridgeif_config = {
.max_fdb_dyn_entries = 10,
.max_fdb_sta_entries = 2,
.max_ports = port_cnt
.max_fdb_dyn_entries = 10, // maximum number of address entries in dynamic forwarding database
.max_fdb_sta_entries = 2, // maximum number of address entries in static forwarding database
.max_ports = port_cnt // maximum number of ports the bridge can consist of
};
esp_netif_br_config.bridge_info = &bridgeif_config;
// Set MAC address of bridge interface the same as the Ethernet interface