mirror of
https://github.com/RobTillaart/Arduino.git
synced 2024-09-19 16:46:11 -04:00
0.5.1 MCP23S08
This commit is contained in:
parent
df2a0509a6
commit
11b39cc7ff
@ -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
|
||||
|
@ -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
|
||||
|
@ -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:
|
||||
|
@ -6,6 +6,12 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
||||
and this project adheres to [Semantic Versioning](http://semver.org/).
|
||||
|
||||
|
||||
## [0.5.1] 2024-03-02
|
||||
- Fix #17, add parameter to **begin(bool pullup)**
|
||||
- update GitHub/actions to version v4 in workflows.
|
||||
- using ints as parameter in constructor.
|
||||
|
||||
|
||||
## [0.5.0] - 2024-01-20
|
||||
- Fix #14, improve handling SPI dependency.
|
||||
- update examples
|
||||
|
@ -1,7 +1,7 @@
|
||||
//
|
||||
// FILE: MCP23S08.cpp
|
||||
// AUTHOR: Rob Tillaart
|
||||
// VERSION: 0.5.0
|
||||
// VERSION: 0.5.1
|
||||
// PURPOSE: Arduino library for SPI MCP23S08 8 channel port expander
|
||||
// DATE: 2022-01-10
|
||||
// URL: https://github.com/RobTillaart/MCP23S08
|
||||
@ -24,14 +24,14 @@ MCP23S08::MCP23S08(uint8_t select, uint8_t dataIn, uint8_t dataOut, uint8_t cloc
|
||||
|
||||
|
||||
// HARDWARE SPI
|
||||
MCP23S08::MCP23S08(uint8_t select, __SPI_CLASS__ * spi)
|
||||
MCP23S08::MCP23S08(int select, __SPI_CLASS__ * spi)
|
||||
{
|
||||
MCP23S08(select, 0x00, spi);
|
||||
}
|
||||
|
||||
|
||||
// HARDWARE SPI
|
||||
MCP23S08::MCP23S08(uint8_t select, uint8_t address, __SPI_CLASS__ * spi)
|
||||
MCP23S08::MCP23S08(int select, int address, __SPI_CLASS__ * spi)
|
||||
{
|
||||
_address = (address << 1);
|
||||
_select = select;
|
||||
@ -41,7 +41,7 @@ MCP23S08::MCP23S08(uint8_t select, uint8_t address, __SPI_CLASS__ * spi)
|
||||
}
|
||||
|
||||
|
||||
bool MCP23S08::begin()
|
||||
bool MCP23S08::begin(bool pullup)
|
||||
{
|
||||
::pinMode(_select, OUTPUT);
|
||||
::digitalWrite(_select, HIGH);
|
||||
@ -72,8 +72,11 @@ bool MCP23S08::begin()
|
||||
// 0 = Sequential operation enabled, address pointer increments.
|
||||
if (! writeReg(MCP23S08_IOCR, MCP23S08_IOCR_SEQOP)) return false;
|
||||
|
||||
// Force INPUT_PULLUP
|
||||
if (! writeReg(MCP23S08_PUR_A, 0xFF)) return false; // 0xFF == all UP
|
||||
if (pullup)
|
||||
{
|
||||
// Force INPUT_PULLUP
|
||||
if (! writeReg(MCP23S08_PUR_A, 0xFF)) return false; // 0xFF == all UP
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
//
|
||||
// FILE: MCP23S08.h
|
||||
// AUTHOR: Rob Tillaart
|
||||
// VERSION: 0.5.0
|
||||
// VERSION: 0.5.1
|
||||
// PURPOSE: Arduino library for SPI MCP23S08 8 channel port expander
|
||||
// DATE: 2022-01-10
|
||||
// URL: https://github.com/RobTillaart/MCP23S08
|
||||
@ -13,7 +13,7 @@
|
||||
#include "MCP23S08_registers.h"
|
||||
|
||||
|
||||
#define MCP23S08_LIB_VERSION (F("0.5.0"))
|
||||
#define MCP23S08_LIB_VERSION (F("0.5.1"))
|
||||
|
||||
// ERROR CODES
|
||||
#define MCP23S08_OK 0x00
|
||||
@ -45,10 +45,10 @@ public:
|
||||
// SOFTWARE SPI
|
||||
MCP23S08(uint8_t select, uint8_t dataIn, uint8_t dataOut, uint8_t clock, uint8_t address = 0x00);
|
||||
// HARDWARE SPI
|
||||
MCP23S08(uint8_t select, __SPI_CLASS__* spi);
|
||||
MCP23S08(uint8_t select, uint8_t address = 0x00, __SPI_CLASS__* spi = &SPI);
|
||||
MCP23S08(int select, __SPI_CLASS__* spi);
|
||||
MCP23S08(int select, int address = 0x00, __SPI_CLASS__* spi = &SPI);
|
||||
|
||||
bool begin();
|
||||
bool begin(bool pullup = true);
|
||||
bool isConnected();
|
||||
uint8_t getAddress();
|
||||
|
||||
|
@ -87,11 +87,13 @@ Also it makes the library a bit simpler to maintain.
|
||||
### Constructor
|
||||
|
||||
- **MCP23S08(uint8_t select, uint8_t dataIn, uint8_t dataOut, uint8_t clock, uint8_t address = 0x00)** constructor SOFTWARE SPI.
|
||||
- **MCP23S08(uint8_t select, SPIClassRP2040\* spi)** constructor HARDWARE SPI with explicit SPI interface selected.
|
||||
- **MCP23S08(uint8_t select, SPIClass\* spi)** constructor HARDWARE SPI with explicit SPI interface selected.
|
||||
- **MCP23S08(uint8_t select, uint8_t address = 0x00, SPIClassRP2040\* spi = &SPI)** constructor HARDWARE SPI with optional address pins and SPI interface.
|
||||
- **MCP23S08(uint8_t select, uint8_t address = 0x00, SPIClass\* spi = &SPI)** constructor HARDWARE SPI with optional address pins and SPI interface.
|
||||
- **bool begin()** returns true if successful.
|
||||
- **MCP23S08(int select, SPIClassRP2040\* spi)** constructor HARDWARE SPI with explicit SPI interface selected.
|
||||
- **MCP23S08(int select, SPIClass\* spi)** constructor HARDWARE SPI with explicit SPI interface selected.
|
||||
- **MCP23S08(int select, int address = 0x00, SPIClassRP2040\* spi = &SPI)** constructor HARDWARE SPI with optional address pins and SPI interface.
|
||||
- **MCP23S08(int select, int address = 0x00, SPIClass\* spi = &SPI)** constructor HARDWARE SPI with optional address pins and SPI interface.
|
||||
- **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. (dummy for compatibility reasons)
|
||||
- **uint8_t getAddress()** returns the address set in the constructor.
|
||||
Default = 0, range = 0..3.
|
||||
|
@ -15,7 +15,7 @@
|
||||
"type": "git",
|
||||
"url": "https://github.com/RobTillaart/MCP23S08.git"
|
||||
},
|
||||
"version": "0.5.0",
|
||||
"version": "0.5.1",
|
||||
"license": "MIT",
|
||||
"frameworks": "*",
|
||||
"platforms": "*",
|
||||
|
@ -1,5 +1,5 @@
|
||||
name=MCP23S08
|
||||
version=0.5.0
|
||||
version=0.5.1
|
||||
author=Rob Tillaart <rob.tillaart@gmail.com>
|
||||
maintainer=Rob Tillaart <rob.tillaart@gmail.com>
|
||||
sentence=Arduino library for SPI MCP23S08 8 channel port expander 8 IO-lines
|
||||
|
Loading…
Reference in New Issue
Block a user