Skip to content

Commit

Permalink
add changelog.md (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
RobTillaart authored Nov 26, 2022
1 parent 3521181 commit e0f18ea
Show file tree
Hide file tree
Showing 7 changed files with 85 additions and 44 deletions.
24 changes: 20 additions & 4 deletions .arduino-ci.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,27 @@
platforms:
rpipico:
board: rp2040:rp2040:rpipico
package: rp2040:rp2040
gcc:
features:
defines:
- ARDUINO_ARCH_RP2040
warnings:
flags:

packages:
rp2040:rp2040:
url: https://github.com/earlephilhower/arduino-pico/releases/download/global/package_rp2040_index.json

compile:
# Choosing to run compilation tests on 2 different Arduino platforms
platforms:
- uno
- due
- zero
- leonardo
# - due
# - zero
# - leonardo
- m4
- esp32
- esp8266
- mega2560
# - mega2560
- rpipico
27 changes: 27 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Change Log TCA9555

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).


## [0.1.3] - 2022-11-25
- Add RP2040 support to build-CI.
- Add CHANGELOG.md
- update readme.md


## [0.1.2] - 2021-12-28
- update Arduino-CI
- update readme.md
- update license
- minor edits

## [0.1.1] - 2021-06-10
- add 16 bit interface


## [0.1.0] - 2021-06-09
- initial version

13 changes: 8 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,14 +107,17 @@ See examples


#### Must

- buy TCA9555 / TCA9535
- test all functionality (initial version is written with no hardware around)
- add TCA9535 error codes

#### Should
- INPUT_PULLUP mappen op INPUT (pinMode ?)
- investigate internal pull up etc.
- add TCA9535 error codes
- investigate TCA9535 differences
- elaborate derived class

#### Could
- rethink class hierarchy

- buy TCA9555 / TCA9535
- rethink class hierarchy?
- investigate internal pull up etc.

47 changes: 21 additions & 26 deletions TCA9555.cpp
Original file line number Diff line number Diff line change
@@ -1,28 +1,23 @@
//
// FILE: TCA9555.cpp
// AUTHOR: Rob Tillaart
// VERSION: 0.1.2
// VERSION: 0.1.3
// PURPOSE: Arduino library for I2C TCA9555 16 channel port expander
// DATE: 2021-06-09
// URL: https://github.com/RobTillaart/TCA9555
//
// HISTORY:
// 0.1.0 2021-06-09 initial version
// 0.1.1 2021-06-10 add 16 bit interface
// 0.1.2 2021-12-28 update Arduino-CI, readme, license, minor edits


#include "TCA9555.h"


// REGISTERS
#define TCA9555_INPUT_PORT_REGISTER_0 0x00 // read()
// REGISTERS
#define TCA9555_INPUT_PORT_REGISTER_0 0x00 // read()
#define TCA9555_INPUT_PORT_REGISTER_1 0x01
#define TCA9555_OUTPUT_PORT_REGISTER_0 0x02 // write()
#define TCA9555_OUTPUT_PORT_REGISTER_0 0x02 // write()
#define TCA9555_OUTPUT_PORT_REGISTER_1 0x03
#define TCA9555_POLARITY_REGISTER_0 0x04 // get/setPolarity
#define TCA9555_POLARITY_REGISTER_0 0x04 // get/setPolarity
#define TCA9555_POLARITY_REGISTER_1 0x05
#define TCA9555_CONFIGURATION_PORT_0 0x06 // pinMode
#define TCA9555_CONFIGURATION_PORT_0 0x06 // pinMode
#define TCA9555_CONFIGURATION_PORT_1 0x07


Expand Down Expand Up @@ -62,9 +57,9 @@ bool TCA9555::isConnected()

//////////////////////////////////////////////////////////
//
// 1 PIN INTERFACE
// 1 PIN INTERFACE
//
bool TCA9555::pinMode(uint8_t pin, uint8_t mode)
bool TCA9555::pinMode(uint8_t pin, uint8_t mode) // pin = 0..15
{
if (pin > 15)
{
Expand Down Expand Up @@ -92,7 +87,7 @@ bool TCA9555::pinMode(uint8_t pin, uint8_t mode)
}


bool TCA9555::digitalWrite(uint8_t pin, uint8_t value) // pin = 0..15
bool TCA9555::digitalWrite(uint8_t pin, uint8_t value) // pin = 0..15
{
if (pin > 15)
{
Expand All @@ -115,7 +110,7 @@ bool TCA9555::digitalWrite(uint8_t pin, uint8_t value) // pin = 0..15
}


uint8_t TCA9555::digitalRead(uint8_t pin)
uint8_t TCA9555::digitalRead(uint8_t pin) // pin = 0..15
{
if (pin > 15)
{
Expand All @@ -136,7 +131,7 @@ uint8_t TCA9555::digitalRead(uint8_t pin)
}


bool TCA9555::setPolarity(uint8_t pin, uint8_t value) // pin = 0..15
bool TCA9555::setPolarity(uint8_t pin, uint8_t value) // pin = 0..15
{
if (pin > 15)
{
Expand Down Expand Up @@ -177,7 +172,7 @@ uint8_t TCA9555::getPolarity(uint8_t pin)

//////////////////////////////////////////////////////////
//
// 8 PIN INTERFACE
// 8 PIN INTERFACE
//
bool TCA9555::pinMode8(uint8_t port, uint8_t mask)
{
Expand All @@ -193,7 +188,7 @@ bool TCA9555::pinMode8(uint8_t port, uint8_t mask)
}


bool TCA9555::write8(uint8_t port, uint8_t mask) // port = 0..1
bool TCA9555::write8(uint8_t port, uint8_t mask) // port = 0..1
{
if (port > 1)
{
Expand Down Expand Up @@ -240,12 +235,12 @@ uint8_t TCA9555::getPolarity8(uint8_t port)
if (port > 1)
{
_error = TCA9555_PORT_ERROR;
return false;
return 0;
}
_error = TCA9555_OK;
if (port == 0) return readRegister(TCA9555_POLARITY_REGISTER_0);
if (port == 1) return readRegister(TCA9555_POLARITY_REGISTER_1);
return 0; // keeps compiler happy
return 0; // keeps compiler happy
}


Expand Down Expand Up @@ -291,7 +286,7 @@ bool TCA9555::setPolarity16(uint16_t mask)

uint8_t TCA9555::getPolarity16()
{
uint16_t rv = 0;
uint16_t rv = 0;
rv |= (getPolarity8(1) << 8);
rv |= getPolarity8(0);
return rv;
Expand All @@ -300,15 +295,15 @@ uint8_t TCA9555::getPolarity16()

int TCA9555::lastError()
{
int e = _error;
_error = TCA9555_OK; // reset error after read.
return e;
int error = _error;
_error = TCA9555_OK; // reset error after read.
return error;
}


////////////////////////////////////////////////////
//
// PRIVATE
// PRIVATE
//
bool TCA9555::writeRegister(uint8_t reg, uint8_t value)
{
Expand Down Expand Up @@ -346,7 +341,7 @@ uint8_t TCA9555::readRegister(uint8_t reg)

/////////////////////////////////////////////////////////////////////////////
//
// TCA9535
// TCA9535
//
TCA9535::TCA9535(uint8_t address, TwoWire *wire)
:TCA9555(address, wire)
Expand Down
14 changes: 7 additions & 7 deletions TCA9555.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//
// FILE: TCA9555.h
// AUTHOR: Rob Tillaart
// VERSION: 0.1.2
// VERSION: 0.1.3
// PURPOSE: Arduino library for I2C TCA9555 16 channel port expander
// DATE: 2021-06-09
// URL: https://github.com/RobTillaart/TCA9555
Expand All @@ -12,7 +12,7 @@
#include "Wire.h"


#define TCA9555_LIB_VERSION (F("0.1.2"))
#define TCA9555_LIB_VERSION (F("0.1.3"))

#define TCA9555_OK 0x00
#define TCA9555_PIN_ERROR 0x81
Expand Down Expand Up @@ -43,7 +43,7 @@ class TCA9555
bool pinMode(uint8_t pin, uint8_t mode);
bool digitalWrite(uint8_t pin, uint8_t value);
uint8_t digitalRead(uint8_t pin);
bool setPolarity(uint8_t pin, uint8_t value); // input pins only.
bool setPolarity(uint8_t pin, uint8_t value); // input pins only.
uint8_t getPolarity(uint8_t pin);


Expand Down Expand Up @@ -75,15 +75,15 @@ class TCA9555
bool writeRegister(uint8_t reg, uint8_t value);
uint8_t readRegister(uint8_t reg);

uint8_t _address;
TwoWire* _wire;
uint8_t _error;
uint8_t _address;
TwoWire* _wire;
uint8_t _error;
};


/////////////////////////////////////////////////////////////////////////////
//
// TCA9535 class which is just a wrapper (for now)
// TCA9535 class which is just a wrapper (for now)
//
class TCA9535 : public TCA9555
{
Expand Down
2 changes: 1 addition & 1 deletion library.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"type": "git",
"url": "https://github.com/RobTillaart/TCA9555.git"
},
"version": "0.1.2",
"version": "0.1.3",
"license": "MIT",
"frameworks": "arduino",
"platforms": "*",
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=TCA9555
version=0.1.2
version=0.1.3
author=Rob Tillaart <rob.tillaart@gmail.com>
maintainer=Rob Tillaart <rob.tillaart@gmail.com>
sentence=Arduino library for I2C TCA9555 16 channel port expander - 16 IO-lines
Expand Down

0 comments on commit e0f18ea

Please sign in to comment.