diff --git a/.github/workflows/arduino-lint.yml b/.github/workflows/arduino-lint.yml index 8a26f14..870a176 100644 --- a/.github/workflows/arduino-lint.yml +++ b/.github/workflows/arduino-lint.yml @@ -6,7 +6,7 @@ jobs: lint: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: arduino/arduino-lint-action@v1 with: library-manager: update diff --git a/.github/workflows/arduino_test_runner.yml b/.github/workflows/arduino_test_runner.yml index fadfa90..5506eb6 100644 --- a/.github/workflows/arduino_test_runner.yml +++ b/.github/workflows/arduino_test_runner.yml @@ -8,7 +8,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: ruby/setup-ruby@v1 with: ruby-version: 2.6 diff --git a/.github/workflows/jsoncheck.yml b/.github/workflows/jsoncheck.yml index 37a1129..beb8829 100644 --- a/.github/workflows/jsoncheck.yml +++ b/.github/workflows/jsoncheck.yml @@ -10,7 +10,7 @@ jobs: test: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: json-syntax-check uses: limitusus/json-syntax-check@v1 with: diff --git a/CHANGELOG.md b/CHANGELOG.md index 8fd09b6..18254df 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,11 +6,16 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). +## [0.3.2] 2024-03-02 +- Fix #17, add parameter to **begin(bool pullup)** +- remove DATE field from examples as it adds no value. +- update GitHub/actions to version v4 in workflows. + + ## [0.3.1] - 2024-01-05 - add URL to examples - minor edits - ## [0.3.0] - 2023-12-24 - Fix #14, support for Arduino ESP32 S3 - breaking change - update readme.md diff --git a/MCP23008.cpp b/MCP23008.cpp index f355b92..0b11274 100644 --- a/MCP23008.cpp +++ b/MCP23008.cpp @@ -1,7 +1,7 @@ // // FILE: MCP23008.cpp // AUTHOR: Rob Tillaart -// VERSION: 0.3.1 +// VERSION: 0.3.2 // PURPOSE: Arduino library for I2C MCP23008 8 channel port expander // DATE: 2019-10-12 // URL: https://github.com/RobTillaart/MCP23008 @@ -32,14 +32,17 @@ MCP23008::MCP23008(uint8_t address, TwoWire *wire) } -bool MCP23008::begin() +bool MCP23008::begin(bool pullup) { // check connected if (! isConnected()) return false; // disable address increment (datasheet) if (! writeReg(MCP23008_IOCR, 0b00100000)) return false; - // Force INPUT_PULLUP - if (! writeReg(MCP23008_PUR_A, 0xFF)) return false; + if (pullup) + { + // Force INPUT_PULLUP + if (! writeReg(MCP23008_PUR_A, 0xFF)) return false; + } return true; } diff --git a/MCP23008.h b/MCP23008.h index 0e70ec4..6d89737 100644 --- a/MCP23008.h +++ b/MCP23008.h @@ -2,7 +2,7 @@ // // FILE: MCP23008.h // AUTHOR: Rob Tillaart -// VERSION: 0.3.1 +// VERSION: 0.3.2 // PURPOSE: Arduino library for I2C MCP23008 8 channel port expander // DATE: 2022-01-10 // URL: https://github.com/RobTillaart/MCP23008 @@ -12,7 +12,7 @@ #include "Wire.h" -#define MCP23008_LIB_VERSION (F("0.3.1")) +#define MCP23008_LIB_VERSION (F("0.3.2")) #define MCP23008_OK 0x00 #define MCP23008_PIN_ERROR 0x81 @@ -29,7 +29,7 @@ class MCP23008 public: MCP23008(uint8_t address, TwoWire *wire = &Wire); - bool begin(); + bool begin(bool pullup = true); bool isConnected(); uint8_t getAddress(); diff --git a/README.md b/README.md index 014d315..6368d4a 100644 --- a/README.md +++ b/README.md @@ -83,7 +83,9 @@ before calling **begin()**. - **MCP23008(uint8_t address, TwoWire \*wire = &Wire)** constructor, with default Wire interface. Can be overruled with Wire0..WireN. -- **bool begin()** initializes library. Returns true upon success. +- **bool begin(bool pullup = true)** initializes library, returns true if successful. +Default sets the pins to INPUT PULLUP. +Returns false if not connected or a register could not be set. - **bool isConnected()** returns true if connected, false otherwise. - **uint8_t getAddress()** returns address set in the constructor. diff --git a/examples/MCP23008_digitalRead/MCP23008_digitalRead.ino b/examples/MCP23008_digitalRead/MCP23008_digitalRead.ino index 38321a2..69fce6b 100644 --- a/examples/MCP23008_digitalRead/MCP23008_digitalRead.ino +++ b/examples/MCP23008_digitalRead/MCP23008_digitalRead.ino @@ -1,7 +1,6 @@ // // FILE: MCP23008_digitalRead.ino // AUTHOR: Rob Tillaart -// DATE: 2019-10-14 // PURPOSE: test MCP23008 library // URL: https://github.com/RobTillaart/MCP23008 diff --git a/examples/MCP23008_digitalWrite/MCP23008_digitalWrite.ino b/examples/MCP23008_digitalWrite/MCP23008_digitalWrite.ino index 42f94d8..ca14aab 100644 --- a/examples/MCP23008_digitalWrite/MCP23008_digitalWrite.ino +++ b/examples/MCP23008_digitalWrite/MCP23008_digitalWrite.ino @@ -1,7 +1,6 @@ // // FILE: MCP23008_digitalWrite.ino // AUTHOR: Rob Tillaart -// DATE: 2019-10-14 // PURPOSE: test MCP23008 library // URL: https://github.com/RobTillaart/MCP23008 diff --git a/examples/MCP23008_performance/MCP23008_performance.ino b/examples/MCP23008_performance/MCP23008_performance.ino index 518b754..0c87c51 100644 --- a/examples/MCP23008_performance/MCP23008_performance.ino +++ b/examples/MCP23008_performance/MCP23008_performance.ino @@ -1,7 +1,6 @@ // // FILE: MCP23008_performance.ino // AUTHOR: Rob Tillaart -// DATE: 2022-01-09 // PURPOSE: test MCP23008 library // URL: https://github.com/RobTillaart/MCP23008 diff --git a/examples/MCP23008_test/MCP23008_test.ino b/examples/MCP23008_test/MCP23008_test.ino index 52e6bbc..6e9f5ae 100644 --- a/examples/MCP23008_test/MCP23008_test.ino +++ b/examples/MCP23008_test/MCP23008_test.ino @@ -1,7 +1,6 @@ // // FILE: MCP23008_test.ino // AUTHOR: Rob Tillaart -// DATE: 2023-06-20 // PURPOSE: test MCP23008 library // URL: https://github.com/RobTillaart/MCP23008 diff --git a/library.json b/library.json index e25fd22..7a6c3b4 100644 --- a/library.json +++ b/library.json @@ -15,7 +15,7 @@ "type": "git", "url": "https://github.com/RobTillaart/MCP23008.git" }, - "version": "0.3.1", + "version": "0.3.2", "license": "MIT", "frameworks": "*", "platforms": "*", diff --git a/library.properties b/library.properties index bcc487c..f1483a0 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=MCP23008 -version=0.3.1 +version=0.3.2 author=Rob Tillaart maintainer=Rob Tillaart sentence=Arduino library for I2C MCP23008 8 channel port expander 8 IO-lines