Răsfoiți Sursa

add run-cl-arduino.yml && Modify macro definitions to adapt to different platforms

ackPeng 1 an în urmă
părinte
comite
da6dc87dfa
3 a modificat fișierele cu 62 adăugiri și 8 ștergeri
  1. 41 0
      .github/workflows/run-cl-arduino.yml
  2. 3 1
      Seeed_SHT35.h
  3. 18 7
      examples/basic_demo/basic_demo.ino

+ 41 - 0
.github/workflows/run-cl-arduino.yml

@@ -0,0 +1,41 @@
+name: Run Ci Arduino
+
+on:
+  push:
+  pull_request:
+  repository_dispatch:
+    types: [trigger-workflow]
+
+jobs:
+  ci-arduino:
+    runs-on: ubuntu-latest
+
+    steps:
+      - name: Checkout repository
+        uses: actions/checkout@v4
+
+      - name: Checkout script repository
+        uses: actions/checkout@v4
+        with:
+            repository: Seeed-Studio/ci-arduino
+            path: ci
+
+
+      - name: Setup arduino cli
+        uses: arduino/setup-arduino-cli@v2.0.0
+
+      - name: Build sketch
+        run: ./ci/tools/compile.sh
+
+      - name: Build result
+        run: |
+            cat build.log
+            if [ ${{ github.event_name }} == 'pull_request' ] && [ -f compile.failed ]; then
+                exit 1
+            fi
+
+      - name: Generate issue
+        if: ${{ github.event_name != 'pull_request' }}
+        run: ./ci/tools/issue.sh
+        env:
+          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

+ 3 - 1
Seeed_SHT35.h

@@ -39,7 +39,9 @@
 #ifndef SEEED_DN_DEFINES
 #define SEEED_DN_DEFINES
 
-#ifdef ARDUINO_SAMD_VARIANT_COMPLIANCE
+#ifdef SEEED_XIAO_M0
+    #define SERIAL_DB Serial
+#elif defined(ARDUINO_SAMD_VARIANT_COMPLIANCE)
     #define SERIAL_DB SerialUSB
 #else
     #define SERIAL_DB Serial

+ 18 - 7
examples/basic_demo/basic_demo.ino

@@ -32,19 +32,30 @@
 #include "Seeed_SHT35.h"
 
 
-/*SAMD core*/
-#ifdef ARDUINO_SAMD_VARIANT_COMPLIANCE
-    #define SDAPIN  20
-    #define SCLPIN  21
-    #define RSTPIN  7
-    #define SERIAL SerialUSB
+#if defined(ARDUINO_ARCH_RP2040) || defined(ARDUINO_ARCH_RP2350) || defined(ESP32)
+    #define SDAPIN  D4
+    #define SCLPIN  D5
 #else
     #define SDAPIN  A4
     #define SCLPIN  A5
-    #define RSTPIN  2
+#endif
+
+
+#ifdef SEEED_XIAO_M0
     #define SERIAL Serial
+#elif defined(ARDUINO_SAMD_VARIANT_COMPLIANCE)
+    #define SERIAL SerialUSB
+#else
+    #define SERIAL Serial
+#endif
+
+#ifdef ARDUINO_SAMD_VARIANT_COMPLIANCE
+    #define RSTPIN  7
+#else
+    #define RSTPIN  2
 #endif
 
+
 SHT35 sensor(SCLPIN);