Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
craiglink authored Jul 29, 2024
2 parents ab3082a + f5be003 commit 7fa3afd
Show file tree
Hide file tree
Showing 13 changed files with 1,067 additions and 218 deletions.
8 changes: 7 additions & 1 deletion .github/scripts/install-arduino-cli.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ fi
if [ ! -d "$ARDUINO_IDE_PATH" ] || [ ! -f "$ARDUINO_IDE_PATH/arduino-cli" ]; then
echo "Installing Arduino CLI on $OS_NAME ..."
mkdir -p "$ARDUINO_IDE_PATH"
curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | BINDIR="$ARDUINO_IDE_PATH" sh
if [ "$OS_IS_WINDOWS" == "1" ]; then
curl -fsSL https://downloads.arduino.cc/arduino-cli/arduino-cli_latest_Windows_64bit.zip -o arduino-cli.zip
unzip -q arduino-cli.zip -d "$ARDUINO_IDE_PATH"
rm arduino-cli.zip
else
curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | BINDIR="$ARDUINO_IDE_PATH" sh
fi
fi

14 changes: 14 additions & 0 deletions .github/workflows/tests_hw.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@ on:
description: 'Chip to run tests for'
required: true

env:
DEBIAN_FRONTEND: noninteractive

defaults:
run:
shell: bash

jobs:
hardware-test:
name: Hardware ${{ inputs.chip }} ${{ inputs.type }} tests
Expand Down Expand Up @@ -48,6 +55,13 @@ jobs:
- name: Checkout user repository
if: ${{ steps.check-tests.outputs.enabled == 'true' }}
uses: actions/checkout@v4
with:
sparse-checkout: |
*
- name: List files
if: ${{ steps.check-tests.outputs.enabled == 'true' }}
run: ls -la

# setup-python currently only works on ubuntu images
# - uses: actions/setup-python@v5
Expand Down
1,033 changes: 851 additions & 182 deletions boards.txt
100644 → 100755

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions cores/esp32/esp32-hal-gpio.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ extern "C" {
#include "esp32-hal.h"
#include "soc/soc_caps.h"
#include "pins_arduino.h"
#include "driver/gpio.h"

#if (CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3)
#define NUM_OUPUT_PINS 46
Expand Down
70 changes: 59 additions & 11 deletions cores/esp32/esp32-hal-timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,28 @@ struct timer_struct_t {
};

inline uint64_t timerRead(hw_timer_t *timer) {

if (timer == NULL) {
log_e("Timer handle is NULL");
return 0;
}
uint64_t value;
gptimer_get_raw_count(timer->timer_handle, &value);
return value;
}

void timerWrite(hw_timer_t *timer, uint64_t val) {
if (timer == NULL) {
log_e("Timer handle is NULL");
return;
}
gptimer_set_raw_count(timer->timer_handle, val);
}

void timerAlarm(hw_timer_t *timer, uint64_t alarm_value, bool autoreload, uint64_t reload_count) {
if (timer == NULL) {
log_e("Timer handle is NULL");
return;
}
esp_err_t err = ESP_OK;
gptimer_alarm_config_t alarm_cfg = {
.alarm_count = alarm_value,
Expand All @@ -61,22 +72,37 @@ void timerAlarm(hw_timer_t *timer, uint64_t alarm_value, bool autoreload, uint64
}

uint32_t timerGetFrequency(hw_timer_t *timer) {
if (timer == NULL) {
return 0;
}
uint32_t frequency;
gptimer_get_resolution(timer->timer_handle, &frequency);
return frequency;
}

void timerStart(hw_timer_t *timer) {
if (timer == NULL) {
log_e("Timer handle is NULL");
return;
}
gptimer_start(timer->timer_handle);
timer->timer_started = true;
}

void timerStop(hw_timer_t *timer) {
if (timer == NULL) {
log_e("Timer handle is NULL");
return;
}
gptimer_stop(timer->timer_handle);
timer->timer_started = false;
}

void timerRestart(hw_timer_t *timer) {
if (timer == NULL) {
log_e("Timer handle is NULL");
return;
}
gptimer_set_raw_count(timer->timer_handle, 0);
}

Expand Down Expand Up @@ -129,17 +155,19 @@ hw_timer_t *timerBegin(uint32_t frequency) {
}

void timerEnd(hw_timer_t *timer) {
esp_err_t err = ESP_OK;
if (timer->timer_started == true) {
gptimer_stop(timer->timer_handle);
}
gptimer_disable(timer->timer_handle);
err = gptimer_del_timer(timer->timer_handle);
if (err != ESP_OK) {
log_e("Failed to destroy GPTimer, error num=%d", err);
return;
if (timer != NULL) {
esp_err_t err = ESP_OK;
if (timer->timer_started == true) {
gptimer_stop(timer->timer_handle);
}
gptimer_disable(timer->timer_handle);
err = gptimer_del_timer(timer->timer_handle);
if (err != ESP_OK) {
log_e("Failed to destroy GPTimer, error num=%d", err);
return;
}
free(timer);
}
free(timer);
}

bool IRAM_ATTR timerFnWrapper(gptimer_handle_t timer, const gptimer_alarm_event_data_t *edata, void *args) {
Expand All @@ -156,6 +184,10 @@ bool IRAM_ATTR timerFnWrapper(gptimer_handle_t timer, const gptimer_alarm_event_
}

void timerAttachInterruptFunctionalArg(hw_timer_t *timer, void (*userFunc)(void *), void *arg) {
if (timer == NULL) {
log_e("Timer handle is NULL");
return;
}
esp_err_t err = ESP_OK;
gptimer_event_callbacks_t cbs = {
.on_alarm = timerFnWrapper,
Expand Down Expand Up @@ -187,6 +219,10 @@ void timerAttachInterrupt(hw_timer_t *timer, voidFuncPtr userFunc) {
}

void timerDetachInterrupt(hw_timer_t *timer) {
if (timer == NULL) {
log_e("Timer handle is NULL");
return;
}
esp_err_t err = ESP_OK;
err = gptimer_set_alarm_action(timer->timer_handle, NULL);
timer->interrupt_handle.fn = NULL;
Expand All @@ -197,18 +233,30 @@ void timerDetachInterrupt(hw_timer_t *timer) {
}

uint64_t timerReadMicros(hw_timer_t *timer) {
if (timer == NULL) {
log_e("Timer handle is NULL");
return 0;
}
uint64_t timer_val = timerRead(timer);
uint32_t frequency = timerGetFrequency(timer);
return timer_val * 1000000 / frequency;
}

uint64_t timerReadMilis(hw_timer_t *timer) {
if (timer == NULL) {
log_e("Timer handle is NULL");
return 0;
}
uint64_t timer_val = timerRead(timer);
uint32_t frequency = timerGetFrequency(timer);
return timer_val * 1000 / frequency;
}

double timerReadSeconds(hw_timer_t *timer) {
if (timer == NULL) {
log_e("Timer handle is NULL");
return 0;
}
uint64_t timer_val = timerRead(timer);
uint32_t frequency = timerGetFrequency(timer);
return (double)timer_val / frequency;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,27 +18,37 @@ const char *server = "www.howsmyssl.com"; // Server URL
// change it to your server root CA
// SHA1 fingerprint is broken now!

const char *test_root_ca = "-----BEGIN CERTIFICATE-----\n"
"MIIDSjCCAjKgAwIBAgIQRK+wgNajJ7qJMDmGLvhAazANBgkqhkiG9w0BAQUFADA/\n"
"MSQwIgYDVQQKExtEaWdpdGFsIFNpZ25hdHVyZSBUcnVzdCBDby4xFzAVBgNVBAMT\n"
"DkRTVCBSb290IENBIFgzMB4XDTAwMDkzMDIxMTIxOVoXDTIxMDkzMDE0MDExNVow\n"
"PzEkMCIGA1UEChMbRGlnaXRhbCBTaWduYXR1cmUgVHJ1c3QgQ28uMRcwFQYDVQQD\n"
"Ew5EU1QgUm9vdCBDQSBYMzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB\n"
"AN+v6ZdQCINXtMxiZfaQguzH0yxrMMpb7NnDfcdAwRgUi+DoM3ZJKuM/IUmTrE4O\n"
"rz5Iy2Xu/NMhD2XSKtkyj4zl93ewEnu1lcCJo6m67XMuegwGMoOifooUMM0RoOEq\n"
"OLl5CjH9UL2AZd+3UWODyOKIYepLYYHsUmu5ouJLGiifSKOeDNoJjj4XLh7dIN9b\n"
"xiqKqy69cK3FCxolkHRyxXtqqzTWMIn/5WgTe1QLyNau7Fqckh49ZLOMxt+/yUFw\n"
"7BZy1SbsOFU5Q9D8/RhcQPGX69Wam40dutolucbY38EVAjqr2m7xPi71XAicPNaD\n"
"aeQQmxkqtilX4+U9m5/wAl0CAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNV\n"
"HQ8BAf8EBAMCAQYwHQYDVR0OBBYEFMSnsaR7LHH62+FL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NIjqbVgXLx
KPpdzvvtTnOPlC7SQZSYmdunr3Bf9b77AiC/ZidstK36dRILKz7OA54=
-----END CERTIFICATE-----
)literal";
// You can use x.509 client certificates if you want
//const char* test_client_key = ""; //to verify the client
//const char* test_client_cert = ""; //to verify the client
Expand Down
6 changes: 4 additions & 2 deletions libraries/RainMaker/examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@

While building any examples for ESP RainMaker, take care of the following:

1. Change partition scheme in Arduino IDE to RainMaker (Tools -> Partition Scheme -> RainMaker).
1. Change the partition scheme that fits your flash size in Arduino IDE to "RainMaker 4MB", "RainMaker 4MB no OTA" or "RainMaker 8MB" (Tools -> Partition Scheme -> RainMaker).
2. Once ESP RainMaker gets started, compulsorily call `WiFi.beginProvision()` which is responsible for user-node mapping.
3. Use the appropriate provisioning scheme as per the board.
- ESP32 Board: BLE Provisioning
- ESP32-C3 Board: BLE Provisioning
- ESP32-S3 Board: BLE Provisioning
- ESP32-S2 Board: SoftAP Provisioning
4. Set debug level to Info (Tools -> Core Debug Level -> Info). This is recommended debug level but not mandatory to run RainMaker.
- ESP32-C6 Board: BLE Provisioning
- ESP32-H2 Board: BLE Provisioning
4. Set debug level to Info (Tools -> Core Debug Level -> Info). This is the recommended debug level but not mandatory to run RainMaker.
2 changes: 1 addition & 1 deletion tools/partitions/rainmaker.csv
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ otadata, data, ota, 0xe000, 0x2000,
ota_0, app, ota_0, 0x10000, 0x1E0000,
ota_1, app, ota_1, 0x1F0000, 0x1E0000,
fctry, data, nvs, 0x3D0000, 0x6000,
coredump, data, coredump, 0x3F0000, 0x10000,
coredump, data, coredump,0x3F0000, 0x10000,
6 changes: 6 additions & 0 deletions tools/partitions/rainmaker_4MB_no_ota.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Name, Type, SubType, Offset, Size, Flags
nvs, data, nvs, 0x9000, 0x5000,
otadata, data, ota, 0xe000, 0x2000,
ota_0, app, ota_0, 0x10000, 0x3DA000,
fctry, data, nvs, 0x3EA000, 0x6000,
coredump, data, coredump,0x3F0000, 0x10000,
7 changes: 7 additions & 0 deletions tools/partitions/rainmaker_8MB.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Name, Type, SubType, Offset, Size, Flags
nvs, data, nvs, 0x9000, 0x5000,
otadata, data, ota, 0xe000, 0x2000,
ota_0, app, ota_0, 0x10000, 0x3ED000,
ota_1, app, ota_1, 0x3FD000, 0x3ED000,
fctry, data, nvs, 0x7EA000, 0x6000,
coredump, data, coredump,0x7F0000, 0x10000,
3 changes: 3 additions & 0 deletions variants/ws_esp32_s3_matrix/partitions_all_app_4MB.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Name, Type, SubType, Offset, Size, Flags
nvs, data, nvs, 0x9000, 0x5000,
factory, app, factory, 0x10000, 0x3F0000,
6 changes: 6 additions & 0 deletions variants/ws_esp32_s3_matrix/partitions_otanofs_4MB.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Name, Type, SubType, Offset, Size, Flags
nvs, data, nvs, 0x9000, 0x5000,
otadata, data, ota, 0xE000, 0x2000,
app0, app, ota_0, 0x10000, 0x1F0000,
app1, app, ota_1, 0x200000, 0x1F0000,
coredump, data, coredump, 0x3F0000, 0x10000,
77 changes: 77 additions & 0 deletions variants/ws_esp32_s3_matrix/pins_arduino.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@

#ifndef Pins_Arduino_h
#define Pins_Arduino_h

#include <stdint.h>
#include "soc/soc_caps.h"

// BN: ESP32 Family Device
#define USB_VID 0x303a
#define USB_PID 0x1001

#define USB_MANUFACTURER "Waveshare"
#define USB_PRODUCT "ESP32-S3-Matrix"
#define USB_SERIAL ""

// Onboard 8 x 8 Matrix panel
#define WS_MATRIX_DIN 14

// Onboard QMI8658 IMU
#define WS_IMU_SDA 11
#define WS_IMU_SCL 12
#define WS_IMU_ADDRESS 0x6B
#define WS_IMU_INT1 10
#define WS_IMU_INT2 13

// UART0 pins
static const uint8_t TX = 43;
static const uint8_t RX = 44;

// Def for I2C that shares the IMU I2C pins
static const uint8_t SDA = 11;
static const uint8_t SCL = 12;

// Mapping based on the ESP32S3 data sheet - alternate for SPI2
static const uint8_t SS = 34; // FSPICS0
static const uint8_t MOSI = 35; // FSPID
static const uint8_t MISO = 37; // FSPIQ
static const uint8_t SCK = 36; // FSPICLK

// Analog capable pins on the header
static const uint8_t A0 = 1;
static const uint8_t A1 = 2;
static const uint8_t A2 = 3;
static const uint8_t A3 = 4;
static const uint8_t A4 = 5;
static const uint8_t A5 = 6;
static const uint8_t A6 = 7;

// GPIO capable pins on the header
static const uint8_t D0 = 7;
static const uint8_t D1 = 6;
static const uint8_t D2 = 5;
static const uint8_t D3 = 4;
static const uint8_t D4 = 3;
static const uint8_t D5 = 2;
static const uint8_t D6 = 1;
static const uint8_t D7 = 44;
static const uint8_t D8 = 43;
static const uint8_t D9 = 40;
static const uint8_t D10 = 39;
static const uint8_t D11 = 38;
static const uint8_t D12 = 37;
static const uint8_t D13 = 36;
static const uint8_t D14 = 35;
static const uint8_t D15 = 34;
static const uint8_t D16 = 33;

// Touch input capable pins on the header
static const uint8_t T1 = 1;
static const uint8_t T2 = 2;
static const uint8_t T3 = 3;
static const uint8_t T4 = 4;
static const uint8_t T5 = 5;
static const uint8_t T6 = 6;
static const uint8_t T7 = 7;

#endif /* Pins_Arduino_h */

0 comments on commit 7fa3afd

Please sign in to comment.