mirror of
https://github.com/RobTillaart/Arduino.git
synced 2024-10-03 18:09:02 -04:00
0.3.0 PCA9634
This commit is contained in:
parent
98627d5292
commit
d770aeeeff
@ -6,11 +6,18 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
||||
and this project adheres to [Semantic Versioning](http://semver.org/).
|
||||
|
||||
|
||||
## [0.2.8] - 2023-09-24
|
||||
## [0.3.0] - 2023-12-11
|
||||
- refactor API, begin()
|
||||
- update readme.md
|
||||
- add **uint8_t getAddress()**
|
||||
- minor edits
|
||||
|
||||
----
|
||||
|
||||
## [0.2.9] - 2023-09-24
|
||||
- add Wire1 support for ESP32
|
||||
- update readme.md
|
||||
|
||||
|
||||
## [0.2.8] - 2023-05-24
|
||||
- renaming #defines PCA963X... to prepare merge with PCA9634.
|
||||
- old defines will work until next major release
|
||||
|
@ -2,7 +2,7 @@
|
||||
// FILE: PCA9634.cpp
|
||||
// AUTHOR: Rob Tillaart
|
||||
// DATE: 2022-01-03
|
||||
// VERSION: 0.2.9
|
||||
// VERSION: 0.3.0
|
||||
// PURPOSE: Arduino library for PCA9634 I2C LED driver
|
||||
// URL: https://github.com/RobTillaart/PCA9634
|
||||
|
||||
@ -24,25 +24,8 @@ PCA9634::PCA9634(const uint8_t deviceAddress, TwoWire *wire)
|
||||
}
|
||||
|
||||
|
||||
#if defined (ESP8266) || defined(ESP32)
|
||||
bool PCA9634::begin(int sda, int scl, uint8_t mode1_mask, uint8_t mode2_mask)
|
||||
{
|
||||
if ((sda < 255) && (scl < 255))
|
||||
{
|
||||
_wire->begin(sda, scl);
|
||||
} else {
|
||||
_wire->begin();
|
||||
}
|
||||
if (! isConnected()) return false;
|
||||
configure(mode1_mask, mode2_mask);
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
bool PCA9634::begin(uint8_t mode1_mask, uint8_t mode2_mask)
|
||||
{
|
||||
_wire->begin();
|
||||
if (! isConnected()) return false;
|
||||
configure(mode1_mask, mode2_mask);
|
||||
return true;
|
||||
@ -57,6 +40,12 @@ bool PCA9634::isConnected()
|
||||
}
|
||||
|
||||
|
||||
uint8_t PCA9634::getAddress()
|
||||
{
|
||||
return _address;
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
//
|
||||
// CONFIGURATION
|
||||
|
@ -3,7 +3,7 @@
|
||||
// FILE: PCA9634.h
|
||||
// AUTHOR: Rob Tillaart
|
||||
// DATE: 2022-01-03
|
||||
// VERSION: 0.2.9
|
||||
// VERSION: 0.3.0
|
||||
// PURPOSE: Arduino library for PCA9634 I2C LED driver, 8 channel
|
||||
// URL: https://github.com/RobTillaart/PCA9634
|
||||
|
||||
@ -12,7 +12,7 @@
|
||||
#include "Wire.h"
|
||||
|
||||
|
||||
#define PCA9634_LIB_VERSION (F("0.2.9"))
|
||||
#define PCA9634_LIB_VERSION (F("0.3.0"))
|
||||
|
||||
|
||||
// mode codes
|
||||
@ -143,14 +143,10 @@ class PCA9634
|
||||
public:
|
||||
explicit PCA9634(const uint8_t deviceAddress, TwoWire *wire = &Wire);
|
||||
|
||||
#if defined (ESP8266) || defined(ESP32)
|
||||
bool begin(int sda, int scl,
|
||||
uint8_t mode1_mask = PCA963X_MODE1_ALLCALL,
|
||||
uint8_t mode2_mask = PCA963X_MODE2_NONE);
|
||||
#endif
|
||||
bool begin(uint8_t mode1_mask = PCA963X_MODE1_ALLCALL,
|
||||
uint8_t mode2_mask = PCA963X_MODE2_NONE);
|
||||
bool isConnected();
|
||||
uint8_t getAddress();
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
|
@ -22,6 +22,15 @@ This allows for better than 1% fine tuning of the duty-cycle
|
||||
of the PWM signal.
|
||||
|
||||
|
||||
#### 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()**.
|
||||
|
||||
|
||||
#### Related
|
||||
|
||||
- https://github.com/RobTillaart/PCA9634 (8 channel)
|
||||
@ -43,8 +52,6 @@ and optional the Wire interface as parameter.
|
||||
- **bool begin(uint8_t mode1_mask = PCA963X_MODE1_ALLCALL, uint8_t mode2_mask = PCA963X_MODE2_NONE)**
|
||||
initializes the library after startup. Optionally setting the MODE1 and MODE2 configuration registers.
|
||||
See PCA9634.h and datasheet for settings possible.
|
||||
- **bool begin(int sda, int scl, uint8_t mode1_mask = PCA963X_MODE1_ALLCALL, uint8_t mode2_mask = PCA963X_MODE2_NONE)**
|
||||
idem, ESP32 ESP8266 only.
|
||||
- **void configure(uint8_t mode1_mask, uint8_t mode2_mask)**
|
||||
To configure the library after startup one can set the MODE1 and MODE2 configuration registers.
|
||||
See PCA9634.h and datasheet for settings possible.
|
||||
|
@ -1,7 +1,8 @@
|
||||
//
|
||||
// FILE: PCA9634_OE_control.ino
|
||||
// AUTHOR: Rob Tillaart
|
||||
// PURPOSE: test PCA9635 library
|
||||
// PURPOSE: test PCA9634 library
|
||||
// URL: https://github.com/RobTillaart/PCA9634
|
||||
|
||||
|
||||
#include "Arduino.h"
|
||||
@ -15,10 +16,13 @@ PCA9634 ledArray(0x20);
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(115200);
|
||||
Serial.println(__FILE__);
|
||||
Serial.print("PCA9634 LIB version: ");
|
||||
Serial.println(PCA9634_LIB_VERSION);
|
||||
Serial.println();
|
||||
|
||||
Wire.begin();
|
||||
|
||||
ledArray.begin();
|
||||
|
||||
// just one channel
|
||||
|
@ -18,10 +18,13 @@ uint8_t channels = 8;
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(115200);
|
||||
Serial.println(__FILE__);
|
||||
Serial.print("PCA9634 LIB version: ");
|
||||
Serial.println(PCA9634_LIB_VERSION);
|
||||
Serial.println();
|
||||
|
||||
Wire.begin();
|
||||
|
||||
ledArray.begin();
|
||||
|
||||
channels = ledArray.channelCount();
|
||||
|
@ -2,6 +2,7 @@
|
||||
// FILE: PCA9634_software_reset.ino
|
||||
// AUTHOR: Rob Tillaart
|
||||
// PURPOSE: test PCA9634 library
|
||||
// URL: https://github.com/RobTillaart/PCA9634
|
||||
|
||||
|
||||
#include "Arduino.h"
|
||||
@ -15,10 +16,13 @@ PCA9634 ledArray(0x20);
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(115200);
|
||||
Serial.println(__FILE__);
|
||||
Serial.print("PCA9634 LIB version: ");
|
||||
Serial.println(PCA9634_LIB_VERSION);
|
||||
Serial.println();
|
||||
|
||||
Wire.begin();
|
||||
|
||||
ledArray.begin();
|
||||
|
||||
ledArray.setLedDriverMode(0, PCA963X_LEDON);
|
||||
|
@ -1,8 +1,8 @@
|
||||
//
|
||||
// FILE: PCA9634_test01.ino
|
||||
// AUTHOR: Rob Tillaart
|
||||
// DATE: 2022-01-03
|
||||
// PURPOSE: test PCA9634 library
|
||||
// URL: https://github.com/RobTillaart/PCA9634
|
||||
|
||||
|
||||
#include "Arduino.h"
|
||||
@ -16,10 +16,13 @@ PCA9634 ledArray(0x20);
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(115200);
|
||||
Serial.println(__FILE__);
|
||||
Serial.print("PCA9634 LIB version: ");
|
||||
Serial.println(PCA9634_LIB_VERSION);
|
||||
Serial.println();
|
||||
|
||||
Wire.begin();
|
||||
|
||||
ledArray.begin();
|
||||
|
||||
testSetLedDriverModeLEDON();
|
||||
|
@ -1,8 +1,8 @@
|
||||
//
|
||||
// FILE: PCA9634_test_multiple.ino
|
||||
// AUTHOR: Rob Tillaart
|
||||
// DATE: 2022-01-03
|
||||
// PURPOSE: test PCA9634 library
|
||||
// URL: https://github.com/RobTillaart/PCA9634
|
||||
|
||||
|
||||
#include "Arduino.h"
|
||||
@ -17,10 +17,13 @@ PCA9634 ledArray2(0x21);
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(115200);
|
||||
Serial.println(__FILE__);
|
||||
Serial.print("PCA9634 LIB version: ");
|
||||
Serial.println(PCA9634_LIB_VERSION);
|
||||
Serial.println();
|
||||
|
||||
Wire.begin();
|
||||
|
||||
ledArray.begin();
|
||||
ledArray2.begin();
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
"type": "git",
|
||||
"url": "https://github.com/RobTillaart/PCA9634.git"
|
||||
},
|
||||
"version": "0.2.9",
|
||||
"version": "0.3.0",
|
||||
"license": "MIT",
|
||||
"frameworks": "*",
|
||||
"platforms": "*",
|
||||
|
@ -1,5 +1,5 @@
|
||||
name=PCA9634
|
||||
version=0.2.9
|
||||
version=0.3.0
|
||||
author=Rob Tillaart <rob.tillaart@gmail.com>
|
||||
maintainer=Rob Tillaart <rob.tillaart@gmail.com>
|
||||
sentence=Arduino library for PCA9634 I2C LED driver 8 channel
|
||||
|
@ -77,6 +77,9 @@ unittest(test_constants)
|
||||
unittest(test_constructor)
|
||||
{
|
||||
PCA9634 ledArray(0x20);
|
||||
|
||||
Wire.begin();
|
||||
|
||||
assertTrue(ledArray.begin());
|
||||
assertTrue(ledArray.isConnected());
|
||||
assertEqual(8, ledArray.channelCount());
|
||||
@ -86,6 +89,9 @@ unittest(test_constructor)
|
||||
unittest(test_LedDriverMode)
|
||||
{
|
||||
PCA9634 ledArray(0x20);
|
||||
|
||||
Wire.begin();
|
||||
|
||||
assertTrue(ledArray.begin());
|
||||
|
||||
// TODO
|
||||
@ -96,12 +102,14 @@ unittest(test_OutputEnable)
|
||||
{
|
||||
PCA9634 ledArray(0x20);
|
||||
|
||||
Wire.begin();
|
||||
|
||||
assertTrue(ledArray.begin());
|
||||
|
||||
assertEqual(HIGH, ledArray.getOutputEnable());
|
||||
|
||||
assertTrue(ledArray.setOutputEnablePin(12));
|
||||
// assertEqual(HIGH, ledArray.getOutputEnable()); // need mock
|
||||
// assertEqual(HIGH, ledArray.getOutputEnable()); // need mock
|
||||
|
||||
assertTrue(ledArray.setOutputEnable(true));
|
||||
// assertEqual(LOW, ledArray.getOutputEnable());
|
||||
|
Loading…
x
Reference in New Issue
Block a user