From 3b4de5ac1426d0087d82e4d1c04ad56401cb7f9b Mon Sep 17 00:00:00 2001 From: Elias Santistevan Date: Mon, 19 Jun 2023 14:24:53 -0600 Subject: [PATCH] Adds yaml and changes command delay --- .github/workflows/compile-sketch.yml | 109 ++++++++++++++++++++++++ src/SparkFun_Bio_Sensor_Hub_Library.cpp | 10 +-- 2 files changed, 114 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/compile-sketch.yml diff --git a/.github/workflows/compile-sketch.yml b/.github/workflows/compile-sketch.yml new file mode 100644 index 0000000..eb64a50 --- /dev/null +++ b/.github/workflows/compile-sketch.yml @@ -0,0 +1,109 @@ +name: Cross-compilation + +on: + - push + #- pull_request + + +jobs: + compile-sketch: + runs-on: ubuntu-latest + + strategy: + fail-fast: false + + matrix: + board: + # Uno + # https://github.com/arduino/ArduinoCore-avr/blob/master/boards.txt + - fqbn: arduino:avr:mega + platforms: | + - name: arduino:avr + source-url: https://downloads.arduino.cc/packages/package_index.json + + # ESP32 + # https://github.com/espressif/arduino-esp32/blob/master/boards.txt + - fqbn: esp32:esp32:esp32 + platforms: | + - name: esp32:esp32 + source-url: https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json + + # ESP32-S2 + # https://github.com/espressif/arduino-esp32/blob/master/boards.txt + - fqbn: esp32:esp32:esp32s2 + platforms: | + - name: esp32:esp32 + source-url: https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json + + # ESP32-C3 + # https://github.com/espressif/arduino-esp32/blob/master/boards.txt + - fqbn: esp32:esp32:esp32c3 + platforms: | + - name: esp32:esp32 + source-url: https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json + + # Artemis / Apollo3 + # https://github.com/sparkfun/Arduino_Apollo3/blob/main/boards.txt + - fqbn: SparkFun:apollo3:sfe_artemis_atp + platforms: | + - name: SparkFun:apollo3 + source-url: https://raw.githubusercontent.com/sparkfun/Arduino_Apollo3/master/package_sparkfun_apollo3_index.json + + # ESP8266 + # https://github.com/esp8266/Arduino/blob/master/boards.txt + - fqbn: esp8266:esp8266:thingdev + platforms: | + - name: esp8266:esp8266 + source-url: https://arduino.esp8266.com/stable/package_esp8266com_index.json + + # SAMD21 + # https://github.com/arduino/ArduinoCore-samd/blob/master/boards.txt + - fqbn: arduino:samd:mkr1000 + platforms: | + - name: arduino:samd + # source-url: https://downloads.arduino.cc/packages/package_index.json + + # Nano BLE 33 / nRF52840 + # https://github.com/arduino/ArduinoCore-mbed/blob/master/boards.txt + - fqbn: arduino:mbed:nano33ble + platforms: | + - name: arduino:mbed + # source-url: https://downloads.arduino.cc/packages/package_index.json + + # RP2040 + # https://github.com/arduino/ArduinoCore-mbed/blob/master/boards.txt + - fqbn: rp2040:rp2040:sparkfun_promicrorp2040 + platforms: | + - name: rp2040:rp2040 + source-url: https://github.com/earlephilhower/arduino-pico/releases/download/global/package_rp2040_index.json + + # STM32 + # https://github.com/arduino/ArduinoCore-mbed/blob/master/boards.txt + - fqbn: STMicroelectronics:stm32:GenF4 + platforms: | + - name: STMicroelectronics:stm32 + source-url: https://github.com/stm32duino/BoardManagerFiles/raw/main/package_stmicroelectronics_index.json + + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Branch name + run: echo running on branch ${GITHUB_REF##*/} + + - name: Compile Sketch + uses: arduino/compile-sketches@v1 + with: + platforms: ${{ matrix.board.platforms }} + fqbn: ${{ matrix.board.fqbn }} + libraries: | + - source-path: ./ + sketch-paths: | + - examples/Example1_config_BPM_Mode1 + enable-warnings-report: true + enable-deltas-report: true + verbose: true + + # outputs: + # report-artifact-name: ${{ steps.report-artifact-name.outputs.report-artifact-name }} + diff --git a/src/SparkFun_Bio_Sensor_Hub_Library.cpp b/src/SparkFun_Bio_Sensor_Hub_Library.cpp index 69fa740..2de96f0 100644 --- a/src/SparkFun_Bio_Sensor_Hub_Library.cpp +++ b/src/SparkFun_Bio_Sensor_Hub_Library.cpp @@ -1469,7 +1469,7 @@ uint8_t SparkFun_Bio_Sensor_Hub::readByte(uint8_t _familyByte, uint8_t _indexByt _i2cPort->write(_familyByte); _i2cPort->write(_indexByte); _i2cPort->endTransmission(); - delay(CMD_DELAY); + delayMicroseconds(CMD_DELAY*1000); _i2cPort->requestFrom(_address, static_cast(sizeof(returnByte) + sizeof(statusByte))); statusByte = _i2cPort->read(); @@ -1522,7 +1522,7 @@ uint8_t SparkFun_Bio_Sensor_Hub::readFillArray(uint8_t _familyByte, uint8_t _ind _i2cPort->write(_familyByte); _i2cPort->write(_indexByte); _i2cPort->endTransmission(); - delay(CMD_DELAY); + delayMicroseconds(CMD_DELAY*1000); _i2cPort->requestFrom(_address, static_cast(_numOfReads + sizeof(statusByte))); statusByte = _i2cPort->read(); @@ -1557,7 +1557,7 @@ uint16_t SparkFun_Bio_Sensor_Hub::readIntByte(uint8_t _familyByte, uint8_t _inde _i2cPort->write(_indexByte); _i2cPort->write(_writeByte); _i2cPort->endTransmission(); - delay(CMD_DELAY); + delayMicroseconds(CMD_DELAY*1000); _i2cPort->requestFrom(_address, static_cast(sizeof(returnByte) + sizeof(statusByte))); statusByte = _i2cPort->read(); @@ -1589,7 +1589,7 @@ uint8_t SparkFun_Bio_Sensor_Hub::readMultipleBytes(uint8_t _familyByte, uint8_t _i2cPort->write(_indexByte); _i2cPort->write(_writeByte); _i2cPort->endTransmission(); - delay(CMD_DELAY); + delayMicroseconds(CMD_DELAY*1000); _i2cPort->requestFrom(_address, static_cast(sizeof(int32_t) * _numOfReads + sizeof(statusByte))); statusByte = _i2cPort->read(); @@ -1624,7 +1624,7 @@ uint8_t SparkFun_Bio_Sensor_Hub::readMultipleBytes(uint8_t _familyByte, uint8_t _i2cPort->write(_indexByte); _i2cPort->write(_writeByte); _i2cPort->endTransmission(); - delay(CMD_DELAY); + delayMicroseconds(CMD_DELAY*1000); _i2cPort->requestFrom(_address, static_cast(_numOfReads + sizeof(statusByte))); statusByte = _i2cPort->read();