0.3.0 PCA9553

This commit is contained in:
Rob Tillaart 2023-12-11 11:48:47 +01:00
parent c391e24cb5
commit 98627d5292
13 changed files with 41 additions and 27 deletions

View File

@ -6,11 +6,17 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).
## [0.3.0] - 2023-12-11
- refactor API, begin();
- update readme.md;
- update examples
----
## [0.2.1] - 2023-09-25
- add Wire1 support for ESP32
- update readme.md
## [0.2.0] - 2023-07-17
- refactor interface (breaking)
- for compatibility with PCA9552, PCA9551

View File

@ -2,7 +2,7 @@
// FILE: PCA9553.cpp
// AUTHOR: Rob Tillaart
// DATE: 2023-07-16
// VERSION: 0.2.1
// VERSION: 0.3.0
// PURPOSE: Arduino library for for I2C PCA9553 4 channel PWM
// URL: https://github.com/RobTillaart/PCA9553
@ -23,24 +23,8 @@ PCA9553::PCA9553(const uint8_t deviceAddress, TwoWire *wire)
}
#if defined (ESP8266) || defined(ESP32)
bool PCA9553::begin(int sda, int scl)
{
if ((sda < 255) && (scl < 255))
{
_wire->begin(sda, scl);
} else {
_wire->begin();
}
if (! isConnected()) return false;
return true;
}
#endif
bool PCA9553::begin()
{
_wire->begin();
if (! isConnected()) return false;
return true;
}

View File

@ -3,7 +3,7 @@
// FILE: PCA9553.h
// AUTHOR: Rob Tillaart
// DATE: 2023-07-16
// VERSION: 0.2.1
// VERSION: 0.3.0
// PUPROSE: Arduino library for for I2C PCA9553 4 channel PWM
// URL: https://github.com/RobTillaart/PCA9553
@ -12,7 +12,7 @@
#include "Wire.h"
#define PCA9553_LIB_VERSION (F("0.2.1"))
#define PCA9553_LIB_VERSION (F("0.3.0"))
// REGISTERS
@ -50,9 +50,6 @@ class PCA9553
public:
explicit PCA9553(const uint8_t deviceAddress, TwoWire *wire = &Wire);
#if defined (ESP8266) || defined(ESP32)
bool begin(int sda, int scl);
#endif
bool begin();
bool isConnected();
uint8_t reset();

View File

@ -40,6 +40,15 @@ Power-On Reset (POR) initializes the registers to their default state,
all zeroes, causing the bits to be set HIGH (LED off).
#### 0.3.0 Breaking change
Version 0.3.0 introduced a breaking change.
You cannot set the pins in **begin()** any more.
This reduces the dependency of processor dependent Wire implementations.
The user has to call **Wire.begin()** and can optionally set the Wire pins
before calling **begin()**.
#### I2C adresses
| type | Address |
@ -75,8 +84,6 @@ Address = 0x62 or 0x63.
Optional the Wire interface as parameter.
- **bool begin()** initializes the library after startup.
Returns true if device address is available on I2C bus.
- **bool begin(int sda, int scl)**
idem, ESP32 ESP8266 only.
- **bool isConnected()** checks if address is available on I2C bus.
- **uint8_t getAddress()** returns I2C address.
- **uint8_t outputCount()** returns the number of channels = 4.

View File

@ -20,10 +20,13 @@ PCA9553 leds(0x62);
void setup()
{
Serial.begin(115200);
Serial.println(__FILE__);
Serial.print("PCA9553_LIB_VERSION: ");
Serial.println(PCA9553_LIB_VERSION);
Serial.println();
Wire.begin();
if (leds.begin() == false)
{
Serial.println("Could not connect.");

View File

@ -20,10 +20,13 @@ PCA9553 leds(0x62);
void setup()
{
Serial.begin(115200);
Serial.println(__FILE__);
Serial.print("PCA9553_LIB_VERSION: ");
Serial.println(PCA9553_LIB_VERSION);
Serial.println();
Wire.begin();
if (leds.begin() == false)
{
Serial.println("Could not connect.");

View File

@ -20,10 +20,13 @@ PCA9553 leds(0x62);
void setup()
{
Serial.begin(115200);
Serial.println(__FILE__);
Serial.print("PCA9553_LIB_VERSION: ");
Serial.println(PCA9553_LIB_VERSION);
Serial.println();
Wire.begin();
if (leds.begin() == false)
{
Serial.println("Could not connect.");

View File

@ -17,10 +17,13 @@ PCA9553 leds(0x62);
void setup()
{
Serial.begin(115200);
Serial.println(__FILE__);
Serial.print("PCA9553_LIB_VERSION: ");
Serial.println(PCA9553_LIB_VERSION);
Serial.println();
Wire.begin();
if (leds.begin() == false)
{
Serial.println("Could not connect.");

View File

@ -17,10 +17,13 @@ PCA9553 leds(0x62);
void setup()
{
Serial.begin(115200);
Serial.println(__FILE__);
Serial.print("PCA9553_LIB_VERSION: ");
Serial.println(PCA9553_LIB_VERSION);
Serial.println();
Wire.begin();
if (leds.begin() == false)
{
Serial.println("Could not connect.");

View File

@ -88,10 +88,13 @@ void test_source()
void setup()
{
Serial.begin(115200);
Serial.println(__FILE__);
Serial.print("PCA9553_LIB_VERSION: ");
Serial.println(PCA9553_LIB_VERSION);
Serial.println();
Wire.begin();
if (leds.begin() == false)
{
Serial.println("Could not connect.");

View File

@ -15,7 +15,7 @@
"type": "git",
"url": "https://github.com/RobTillaart/PCA9553.git"
},
"version": "0.2.1",
"version": "0.3.0",
"license": "MIT",
"frameworks": "*",
"platforms": "*",

View File

@ -1,5 +1,5 @@
name=PCA9553
version=0.2.1
version=0.3.0
author=Rob Tillaart <rob.tillaart@gmail.com>
maintainer=Rob Tillaart <rob.tillaart@gmail.com>
sentence=Arduino library for PCA9553 I2C LED driver 4 channel

View File

@ -77,6 +77,8 @@ unittest(test_constructor)
{
PCA9553 pca(0x62);
Wire.begin();
assertEqual(4, pca.outputCount());
assertEqual(0x62, pca.getAddress());
}