Skip to content

Commit

Permalink
fix: arduino 3.0.2 example
Browse files Browse the repository at this point in the history
  • Loading branch information
RobertByrnes committed Jul 23, 2024
1 parent 4fb129b commit f091dff
Show file tree
Hide file tree
Showing 13 changed files with 365 additions and 27 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/arduino_examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ jobs:
- name: Compile Examples for [email protected]
run: |
arduino-cli core install esp32:[email protected]
./.github/workflows/scripts/compile_arduino_examples.sh --clean
./scripts/compile_arduino_examples.sh --clean
- name: Compile Examples for [email protected]
run: |
arduino-cli core install esp32:[email protected]
./.github/workflows/scripts/compile_arduino_examples.sh --clean
./scripts/compile_arduino_examples.sh --clean
2 changes: 1 addition & 1 deletion .github/workflows/pio_examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ jobs:
- name: Compile Examples
run: |
./.github/workflows/scripts/compile_pio_examples.sh --clean
./scripts/compile_pio_examples.sh --clean
247 changes: 247 additions & 0 deletions compile_output.txt

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -3,52 +3,52 @@
* ESP32 LilyGo-T-ETH-POE Example
*
* HTTPS (TLS/SLL) with CA Certificate via "ETH.h"
* This example use the WiFiClient class to integrate ETH functionality
* This example uses the WiFiClient class to integrate ETH functionality
*
* About board: https://github.com/Xinyuan-LilyGO/LilyGO-T-ETH-POE
* Base example: https://github.com/Xinyuan-LilyGO/LilyGO-T-ETH-POE/blob/master/example/eth/eth.ino
*
**************************************************************/
// To make HTTP request easy: https://github.com/arduino-libraries/ArduinoHttpClient
#include <ArduinoHttpClient.h>
#include <ETH.h>
#include "WiFi.h"
#include "SSLClient.h"
//To make http request esay: https://github.com/arduino-libraries/ArduinoHttpClient
#include <ArduinoHttpClient.h>

//Please enter your CA certificate in ca_cert.h
// Please enter your CA certificate in ca_cert.h
#include "ca_cert.h"

//ESP32 LilyGo-T-ETH-POE Board Ethernet pins definition
// ESP32 LilyGo-T-ETH-POE Board Ethernet pins definition
#define ETH_CLK_MODE ETH_CLOCK_GPIO17_OUT
#define ETH_POWER_PIN -1
#define ETH_TYPE ETH_PHY_LAN8720
#define ETH_ADDR 0
#define ETH_ADDR 1 // Update this according to the required value
#define ETH_MDC_PIN 23
#define ETH_MDIO_PIN 18

const char hostname[] = "www.howsmyssl.com";
int port = 443;

//Layers stack
WiFiClient eth_transpor_layer;
SSLClient secure_presentation_layer(&eth_transpor_layer);
// Layers stack
WiFiClient eth_transport_layer;
SSLClient secure_presentation_layer(&eth_transport_layer);
HttpClient http_client = HttpClient(secure_presentation_layer, hostname, port);

static bool eth_connected = false;

//Ethernet events
void ETHEvent(WiFiEvent_t event)
// Ethernet events
void ETHEvent(WiFiEvent_t event, WiFiEventInfo_t info)
{
switch (event)
{
case SYSTEM_EVENT_ETH_START:
case ARDUINO_EVENT_ETH_START:
Serial.println("ETH Started");
ETH.setHostname("esp32-ethernet");
break;
case SYSTEM_EVENT_ETH_CONNECTED:
case ARDUINO_EVENT_ETH_CONNECTED:
Serial.println("ETH Connected");
break;
case SYSTEM_EVENT_ETH_GOT_IP:
case ARDUINO_EVENT_ETH_GOT_IP:
Serial.print("ETH MAC: ");
Serial.print(ETH.macAddress());
Serial.print(", IPv4: ");
Expand All @@ -62,11 +62,11 @@ void ETHEvent(WiFiEvent_t event)
Serial.println("Mbps");
eth_connected = true;
break;
case SYSTEM_EVENT_ETH_DISCONNECTED:
case ARDUINO_EVENT_ETH_DISCONNECTED:
Serial.println("ETH Disconnected");
eth_connected = false;
break;
case SYSTEM_EVENT_ETH_STOP:
case ARDUINO_EVENT_ETH_STOP:
Serial.println("ETH Stopped");
eth_connected = false;
break;
Expand All @@ -81,15 +81,15 @@ void setup()

Serial.println("Starting ETH");
WiFi.onEvent(ETHEvent);
ETH.begin(ETH_ADDR, ETH_POWER_PIN, ETH_MDC_PIN, ETH_MDIO_PIN, ETH_TYPE, ETH_CLK_MODE);
ETH.begin(ETH_TYPE, ETH_ADDR, ETH_POWER_PIN, ETH_MDC_PIN, ETH_MDIO_PIN, ETH_CLK_MODE);
while (!eth_connected)
{
Serial.println("connecting to ETH..");
Serial.println("Connecting to ETH..");
delay(1000);
}
Serial.println("Connected");

//Add CA Certificate
// Add CA Certificate
secure_presentation_layer.setCACert(root_ca);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
* https://github.com/Xinyuan-LilyGO/LilyGO-T-SIM7000G/blob/master/examples/Arduino_Azure_IoTHub/Arduino_Azure_IoTHub.ino
*
**************************************************************/
#include "SSLClient.h"
//To make http request esay: https://github.com/arduino-libraries/ArduinoHttpClient
#include <ArduinoHttpClient.h>
#include "SSLClient.h"

//Please enter your CA certificate in ca_cert.h
#include "ca_cert.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
* Base example: https://github.com/Xinyuan-LilyGO/LilyGo-T-Call-SIM800/tree/master/examples/Arduino_TinyGSM
*
**************************************************************/
#include <Wire.h>
#include "SSLClient.h"
//To make http request esay: https://github.com/arduino-libraries/ArduinoHttpClient
#include <ArduinoHttpClient.h>
#include <Wire.h>
#include "SSLClient.h"

//Please enter your CA certificate in ca_cert.h
#include "ca_cert.h"
Expand Down
4 changes: 2 additions & 2 deletions examples/Esp32-Arduino-IDE/https_wifi/https_wifi.ino
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
*
**************************************************************/

#include "WiFi.h"
#include "SSLClient.h"
//To make http request esay: https://github.com/arduino-libraries/ArduinoHttpClient
#include <ArduinoHttpClient.h>
#include "WiFi.h"
#include "SSLClient.h"

//Please enter your CA certificate in ca_cert.h
#include "secrets.h"
Expand Down
91 changes: 91 additions & 0 deletions scripts/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
[![Back to README](https://img.shields.io/badge/Back_to-_README-blue?style=for-the-badge)](../README.md)

# Scripts

This directory contains scripts to help with the development of the SSLClient library.

## Table of Contents
1. [Library Installation Script](#SSLClient-Library-Installation-Script) - Automates the installation of the SSLClient library.
2. [Arduino CLI Utility Script](#Arduino-CLI-Utility-Script) - Provides a convenient way to manage Arduino libraries, platforms, and frameworks.
3. [PlatformIO CLI Utility Script](#PlatformIO-CLI-Utility-Script) - Provides a convenient way to manage libraries, platforms, and frameworks using the PlatformIO CLI.

## SSLClient Library Installation Script

This script automates the process of cloning and installing the `SSLClient` library from a specified branch of the repository. It prepares the library for use with the Arduino CLI.

### Usage

Run from the root of the repository:

`./scripts/install_sslclient_for_testing.sh` [--branch <branch_name>]

#### Parameters

`--branch <branch_name>`: (Optional) Specify the branch to checkout. Defaults to master.

### Script Overview

1. Cloning the Repository: The script clones the SSLClient repository from GitHub.
2. Branch Checkout: It checks out the specified branch (or defaults to master).
3. Library Preparation: The script prepares the library by moving necessary files and creating a zip archive.
4. Installation: Finally, the script installs the library using the Arduino CLI.

### Requirements

`git`
`bash`
`arduino-cli`

## Arduino CLI Utility Script

This script provides a convenient way to manage Arduino libraries, platforms, and frameworks using the Arduino CLI. It also allows you to switch between different versions of the ESP32-Arduino core.

### Usage

`./scripts/arduino_cli_utility.sh` - Run the script to manage libraries, platforms, frameworks, and ESP32-Arduino versions.

### Menu Options

**List Installed Libraries:** Displays a list of all libraries currently installed.
**List Installed Platforms:** Displays a list of all platforms currently installed.
**List Installed Frameworks for Boards:** Displays a list of all available frameworks for boards.
**Switch ESP32-Arduino Version:** Prompts you to enter a specific version of the ESP32-Arduino core to install.
**Exit:** Exits the script.

### Requirements

`arduino-cli` - Ensure that arduino-cli is installed and properly configured on your system before running the script.

### Script Overview
1. Library Management: List all installed libraries.
2. Platform Management: List all installed platforms.
3. Framework Management: List all available frameworks for boards.
4. ESP32 Version Management: Switch to a specific version of the ESP32-Arduino core.

## PlatformIO CLI Utility Script

This script provides a convenient way to manage libraries, platforms, and frameworks using the PlatformIO CLI. It also allows you to switch between different versions of the Arduino-ESP32 core.

### Usage

`./scripts/platformio_cli_utility.sh` - Run the script to manage libraries, platforms, frameworks, and Arduino-ESP32 versions.

### Menu Options

**List Installed Libraries:** Displays a list of all libraries currently installed.
**List Installed Platforms:** Displays a list of all platforms currently installed.
**List Installed Frameworks for Boards:** Displays a list of all available frameworks for boards that use the Arduino framework.
**Switch Arduino-ESP32 Version:** Prompts you to enter a specific version of the Arduino-ESP32 core to install.
**Exit:** Exits the script.

### Requirements

`bash`
`platformio-cli` (pio)

### Script Overview

1. Library Management: List all installed libraries using PlatformIO.
2. Platform Management: List all installed platforms using PlatformIO.
3. Framework Management: List all available frameworks for boards that support the Arduino framework using PlatformIO.
4. Arduino-ESP32 Version Management: Switch to a specific version of the Arduino-ESP32 core using PlatformIO.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit f091dff

Please sign in to comment.