Skip to content

Add ch32v2 support #428

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Jun 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 17 additions & 7 deletions .github/workflows/githubci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@ name: Build
on: [pull_request, push, repository_dispatch]

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
ARDUINO_LIBS: "\"Adafruit SPIFlash\" \"Adafruit seesaw Library\" \"Adafruit NeoPixel\" \"Adafruit Circuit Playground\" \"Adafruit InternalFlash\" \"SdFat - Adafruit Fork\" \"SD\" \"MIDI Library\" \"Pico PIO USB\""

jobs:
pre-commit:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -34,6 +37,9 @@ jobs:
PRETTYNAME : "Adafruit TinyUSB Library"
run: bash ci/doxy_gen_and_deploy.sh

# ---------------------------------------
# Main
# ---------------------------------------
build:
runs-on: ubuntu-latest
needs: pre-commit
Expand All @@ -53,7 +59,8 @@ jobs:
# SAMD
- 'metro_m0_tinyusb'
- 'metro_m4_tinyusb'

# Ch32v2
- 'CH32V20x_EVT'
steps:
- name: Checkout code
uses: actions/checkout@v4
Expand All @@ -62,18 +69,22 @@ jobs:
uses: actions/checkout@v4
with:
repository: adafruit/ci-arduino
ref: importable-build_platform
path: ci

- name: pre-install
run: bash ci/actions_install.sh

- name: Install Libraries for building examples
run: arduino-cli lib install "Adafruit SPIFlash" "MIDI Library" "Adafruit seesaw Library" "Adafruit NeoPixel" "SdFat - Adafruit Fork" "SD" "Adafruit Circuit Playground" "Adafruit InternalFlash" "Pico PIO USB"
- name: Install Libraries
run: |
arduino-cli lib install ${{ env.ARDUINO_LIBS }}
arduino-cli lib list
- name: test platforms
run: python3 ci/build_platform.py ${{ matrix.arduino-platform }}

# ---------------------------------------
# Build ESP32 v2
# ---------------------------------------
build-esp32-v2:
if: false
runs-on: ubuntu-latest
Expand All @@ -95,7 +106,6 @@ jobs:
uses: actions/checkout@v4
with:
repository: adafruit/ci-arduino
ref: importable-build_platform
path: ci

- name: pre-install
Expand All @@ -106,7 +116,7 @@ jobs:
BSP_URLS: https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
run: |
arduino-cli core install esp32:esp32@${{ matrix.esp32-version }} --additional-urls $BSP_URLS
arduino-cli lib install "Adafruit SPIFlash" "MIDI Library" "Adafruit seesaw Library" "Adafruit NeoPixel" "SdFat - Adafruit Fork" "SD" "Adafruit Circuit Playground" "Adafruit InternalFlash" "Pico PIO USB"
arduino-cli lib install ${{ env.ARDUINO_LIBS }}
arduino-cli core list
arduino-cli lib list
Expand Down
21 changes: 17 additions & 4 deletions examples/CDC/no_serial/no_serial.ino
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ int led = LED_BUILTIN;

void setup()
{
// Manual begin() is required on core without built-in support e.g. mbed rp2040
if (!TinyUSBDevice.isInitialized()) {
TinyUSBDevice.begin(0);
}

// clear configuration will remove all USB interfaces including CDC (Serial)
TinyUSBDevice.clearConfiguration();

Expand All @@ -31,8 +36,16 @@ void setup()

void loop()
{
digitalWrite(led, HIGH);
delay(1000);
digitalWrite(led, LOW);
delay(1000);
#ifdef TINYUSB_NEED_POLLING_TASK
// Manual call tud_task since it isn't called by Core's background
TinyUSBDevice.task();
#endif

// toggle LED
static uint32_t ms = 0;
static uint8_t led_state = 0;
if (millis() - ms > 1000) {
ms = millis();
digitalWrite(LED_BUILTIN, 1-led_state);
}
}
40 changes: 40 additions & 0 deletions examples/CDC/serial_echo/serial_echo.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*********************************************************************
Adafruit invests time and resources providing this open source code,
please support Adafruit and open-source hardware by purchasing
products from Adafruit!

MIT license, check LICENSE for more information
Copyright (c) 2019 Ha Thach for Adafruit Industries
All text above, and the splash screen below must be included in
any redistribution
*********************************************************************/

#include "Adafruit_TinyUSB.h"

/* This sketch demonstrates USB CDC Serial echo (convert to upper case) using SerialTinyUSB which
* is available for both core with built-in USB support and without.
*/

void setup() {
// Manual begin() is required on core without built-in support e.g. mbed rp2040
if (!TinyUSBDevice.isInitialized()) {
TinyUSBDevice.begin(0);
}
}

void loop() {
#ifdef TINYUSB_NEED_POLLING_TASK
// Manual call tud_task since it isn't called by Core's background
TinyUSBDevice.task();
#endif

uint8_t buf[64];
uint32_t count = 0;
while (SerialTinyUSB.available()) {
buf[count++] = (uint8_t) toupper(SerialTinyUSB.read());
}

if (count) {
SerialTinyUSB.write(buf, count);
}
}
Empty file.
200 changes: 0 additions & 200 deletions examples/Composite/mouse_external_flash/mouse_external_flash.ino

This file was deleted.

Loading