diff --git a/.github/workflows/run-cl-arduino.yml b/.github/workflows/run-cl-arduino.yml new file mode 100644 index 0000000..99feaeb --- /dev/null +++ b/.github/workflows/run-cl-arduino.yml @@ -0,0 +1,52 @@ +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: Create a depend.list file + run: | + # eg: echo "" >> depend.list + + + + - name: Create a ignore.list file + run: | + # eg: echo "," >> ignore.list + + + - 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 }} \ No newline at end of file diff --git a/Seeed_MPR121_driver.cpp b/Seeed_MPR121_driver.cpp index 5128055..67ada8d 100644 --- a/Seeed_MPR121_driver.cpp +++ b/Seeed_MPR121_driver.cpp @@ -71,7 +71,9 @@ s32 Mpr121::select_mode(sensor_mode_t mode) { case START_PROXIMITY_DISABLE_MODE: return sensor_start_proximity_disable(); break; - default: break; + default: + return -1; + break; } } @@ -173,7 +175,7 @@ void Mpr121::get_filtered_reg_data(u16* elecs_stat, u16* elecs_filtered_data) { //use frutits as example void Mpr121::get_fruits_data(u16* elecs_stat, u16* elecs_filtered_data) { - u16 value = 0; + u8 data_l, data_h; for (int i = 0; i < CHANNEL_NUM; i++) { if ((*elecs_stat) & (1 << i)) { @@ -190,7 +192,7 @@ void Mpr121::get_fruits_data(u16* elecs_stat, u16* elecs_filtered_data) { } void Mpr121::get_baseline_data(u16 elecs_stat, u8* base_line_data) { - u16 value = 0; + u8 data = 0; for (int i = 0; i < CHANNEL_NUM; i++) { if (elecs_stat & (1 << i)) { @@ -207,6 +209,7 @@ void Mpr121::get_baseline_data(u16 elecs_stat, u8* base_line_data) { * */ s32 Mpr121::sensor_stop() { return IIC_write_byte(ELEC_CFG_REG_ADDR, 0); + return 0; } /** @brief Set start mode with proximity enable by set ELEC_CFG_REG_ADDR to 0x0 @@ -214,6 +217,7 @@ s32 Mpr121::sensor_stop() { * */ s32 Mpr121::sensor_start_proximity_enable() { IIC_write_byte(ELEC_CFG_REG_ADDR, 0x3c); + return 0; } /** @brief Set start mode with proximity disable by set ELEC_CFG_REG_ADDR to 0x0 @@ -221,6 +225,7 @@ s32 Mpr121::sensor_start_proximity_enable() { * */ s32 Mpr121::sensor_start_proximity_disable() { IIC_write_byte(ELEC_CFG_REG_ADDR, 0x3c); + return 0; } diff --git a/Seeed_MPR121_driver.h b/Seeed_MPR121_driver.h index ff02cda..90fb108 100644 --- a/Seeed_MPR121_driver.h +++ b/Seeed_MPR121_driver.h @@ -112,7 +112,7 @@ typedef enum { ERROR_PARAM = -1, ERROR_COMM = -2, ERROR_OTHERS = -128, -} err_t; +} mpr_err_t; #define CHECK_RESULT(a,b) do{if(a=b) { \ diff --git a/examples/fruit_demo/fruit_demo.ino b/examples/fruit_demo/fruit_demo.ino index e144ed7..15ff08e 100644 --- a/examples/fruit_demo/fruit_demo.ino +++ b/examples/fruit_demo/fruit_demo.ino @@ -1,6 +1,8 @@ #include "Seeed_MPR121_driver.h" -#ifdef ARDUINO_SAMD_VARIANT_COMPLIANCE +#ifdef SEEED_XIAO_M0 + #define SERIAL Serial +#elif defined(ARDUINO_SAMD_VARIANT_COMPLIANCE) #define SERIAL SerialUSB #else #define SERIAL Serial