Skip to content

Commit 69333be

Browse files
authored
Merge pull request #428 from adafruit/add-ch32v2-support
Add ch32v2 support
2 parents c953968 + 7ca12e3 commit 69333be

File tree

85 files changed

+4360
-660
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+4360
-660
lines changed

.github/workflows/githubci.yml

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,12 @@ name: Build
33
on: [pull_request, push, repository_dispatch]
44

55
concurrency:
6-
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
6+
group: ${{ github.workflow }}-${{ github.ref }}
77
cancel-in-progress: true
88

9+
env:
10+
ARDUINO_LIBS: "\"Adafruit SPIFlash\" \"Adafruit seesaw Library\" \"Adafruit NeoPixel\" \"Adafruit Circuit Playground\" \"Adafruit InternalFlash\" \"SdFat - Adafruit Fork\" \"SD\" \"MIDI Library\" \"Pico PIO USB\""
11+
912
jobs:
1013
pre-commit:
1114
runs-on: ubuntu-latest
@@ -34,6 +37,9 @@ jobs:
3437
PRETTYNAME : "Adafruit TinyUSB Library"
3538
run: bash ci/doxy_gen_and_deploy.sh
3639

40+
# ---------------------------------------
41+
# Main
42+
# ---------------------------------------
3743
build:
3844
runs-on: ubuntu-latest
3945
needs: pre-commit
@@ -53,7 +59,8 @@ jobs:
5359
# SAMD
5460
- 'metro_m0_tinyusb'
5561
- 'metro_m4_tinyusb'
56-
62+
# Ch32v2
63+
- 'CH32V20x_EVT'
5764
steps:
5865
- name: Checkout code
5966
uses: actions/checkout@v4
@@ -62,18 +69,22 @@ jobs:
6269
uses: actions/checkout@v4
6370
with:
6471
repository: adafruit/ci-arduino
65-
ref: importable-build_platform
6672
path: ci
6773

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

71-
- name: Install Libraries for building examples
72-
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"
77+
- name: Install Libraries
78+
run: |
79+
arduino-cli lib install ${{ env.ARDUINO_LIBS }}
80+
arduino-cli lib list
7381
7482
- name: test platforms
7583
run: python3 ci/build_platform.py ${{ matrix.arduino-platform }}
7684

85+
# ---------------------------------------
86+
# Build ESP32 v2
87+
# ---------------------------------------
7788
build-esp32-v2:
7889
if: false
7990
runs-on: ubuntu-latest
@@ -95,7 +106,6 @@ jobs:
95106
uses: actions/checkout@v4
96107
with:
97108
repository: adafruit/ci-arduino
98-
ref: importable-build_platform
99109
path: ci
100110

101111
- name: pre-install
@@ -106,7 +116,7 @@ jobs:
106116
BSP_URLS: https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
107117
run: |
108118
arduino-cli core install esp32:esp32@${{ matrix.esp32-version }} --additional-urls $BSP_URLS
109-
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"
119+
arduino-cli lib install ${{ env.ARDUINO_LIBS }}
110120
arduino-cli core list
111121
arduino-cli lib list
112122

examples/CDC/no_serial/no_serial.ino

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ int led = LED_BUILTIN;
2323

2424
void setup()
2525
{
26+
// Manual begin() is required on core without built-in support e.g. mbed rp2040
27+
if (!TinyUSBDevice.isInitialized()) {
28+
TinyUSBDevice.begin(0);
29+
}
30+
2631
// clear configuration will remove all USB interfaces including CDC (Serial)
2732
TinyUSBDevice.clearConfiguration();
2833

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

3237
void loop()
3338
{
34-
digitalWrite(led, HIGH);
35-
delay(1000);
36-
digitalWrite(led, LOW);
37-
delay(1000);
39+
#ifdef TINYUSB_NEED_POLLING_TASK
40+
// Manual call tud_task since it isn't called by Core's background
41+
TinyUSBDevice.task();
42+
#endif
43+
44+
// toggle LED
45+
static uint32_t ms = 0;
46+
static uint8_t led_state = 0;
47+
if (millis() - ms > 1000) {
48+
ms = millis();
49+
digitalWrite(LED_BUILTIN, 1-led_state);
50+
}
3851
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/*********************************************************************
2+
Adafruit invests time and resources providing this open source code,
3+
please support Adafruit and open-source hardware by purchasing
4+
products from Adafruit!
5+
6+
MIT license, check LICENSE for more information
7+
Copyright (c) 2019 Ha Thach for Adafruit Industries
8+
All text above, and the splash screen below must be included in
9+
any redistribution
10+
*********************************************************************/
11+
12+
#include "Adafruit_TinyUSB.h"
13+
14+
/* This sketch demonstrates USB CDC Serial echo (convert to upper case) using SerialTinyUSB which
15+
* is available for both core with built-in USB support and without.
16+
*/
17+
18+
void setup() {
19+
// Manual begin() is required on core without built-in support e.g. mbed rp2040
20+
if (!TinyUSBDevice.isInitialized()) {
21+
TinyUSBDevice.begin(0);
22+
}
23+
}
24+
25+
void loop() {
26+
#ifdef TINYUSB_NEED_POLLING_TASK
27+
// Manual call tud_task since it isn't called by Core's background
28+
TinyUSBDevice.task();
29+
#endif
30+
31+
uint8_t buf[64];
32+
uint32_t count = 0;
33+
while (SerialTinyUSB.available()) {
34+
buf[count++] = (uint8_t) toupper(SerialTinyUSB.read());
35+
}
36+
37+
if (count) {
38+
SerialTinyUSB.write(buf, count);
39+
}
40+
}

examples/Composite/mouse_external_flash/.feather52833.test.skip

Whitespace-only changes.

examples/Composite/mouse_external_flash/mouse_external_flash.ino

Lines changed: 0 additions & 200 deletions
This file was deleted.

0 commit comments

Comments
 (0)