mirror of
https://github.com/RobTillaart/Arduino.git
synced 2024-10-03 18:09:02 -04:00
0.7.0 PCA9685_RT
This commit is contained in:
parent
8066bcf49b
commit
afb6e19353
@ -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.7.0] - 2023-12-21
|
||||
- fix #25, support for Arduino ESP32 S3 - breaking change
|
||||
- update examples
|
||||
|
||||
----
|
||||
|
||||
## [0.6.0] - 2023-12-11
|
||||
- refactor API, begin()
|
||||
- add **uint8_t getAddress()**
|
||||
|
@ -201,7 +201,7 @@ int PCA9685::getFrequency(bool cache)
|
||||
// datasheet P.18 - fig. 9:
|
||||
// Note: bit[11-0] ON should NOT equal timer OFF in ON mode
|
||||
// in OFF mode it doesn't matter.
|
||||
void PCA9685::digitalWrite(uint8_t channel, uint8_t mode)
|
||||
void PCA9685::write1(uint8_t channel, uint8_t mode)
|
||||
{
|
||||
_error = PCA9685_OK;
|
||||
if (channel >= _channelCount)
|
||||
@ -341,7 +341,7 @@ bool PCA9685::setOutputEnablePin(uint8_t pin)
|
||||
if (_OutputEnablePin != 255)
|
||||
{
|
||||
pinMode(_OutputEnablePin, OUTPUT);
|
||||
digitalWrite(_OutputEnablePin, HIGH);
|
||||
write1(_OutputEnablePin, HIGH);
|
||||
return true;
|
||||
}
|
||||
// must it be set to HIGH now?
|
||||
@ -353,7 +353,7 @@ bool PCA9685::setOutputEnable(bool on)
|
||||
{
|
||||
if (_OutputEnablePin != 255)
|
||||
{
|
||||
digitalWrite(_OutputEnablePin, on ? LOW : HIGH);
|
||||
write1(_OutputEnablePin, on ? LOW : HIGH);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -3,7 +3,7 @@
|
||||
// FILE: PCA9685.h
|
||||
// AUTHOR: Rob Tillaart
|
||||
// DATE: 24-apr-2016
|
||||
// VERSION: 0.6.0
|
||||
// VERSION: 0.7.0
|
||||
// PURPOSE: Arduino library for PCA9685 I2C LED driver, 16 channel PWM, 12 bit.
|
||||
// URL: https://github.com/RobTillaart/PCA9685_RT
|
||||
|
||||
@ -12,7 +12,7 @@
|
||||
#include "Wire.h"
|
||||
|
||||
|
||||
#define PCA9685_LIB_VERSION (F("0.6.0"))
|
||||
#define PCA9685_LIB_VERSION (F("0.7.0"))
|
||||
|
||||
// ERROR CODES
|
||||
#define PCA9685_OK 0x00
|
||||
@ -124,11 +124,11 @@ public:
|
||||
int getFrequency(bool cache = true);
|
||||
|
||||
// set channel HIGH or LOW (effectively no PWM)
|
||||
void digitalWrite(uint8_t channel, uint8_t mode);
|
||||
void write1(uint8_t channel, uint8_t mode);
|
||||
|
||||
// for backwards compatibility; will be removed in future
|
||||
void setON(uint8_t channel) { digitalWrite(channel, HIGH); };
|
||||
void setOFF(uint8_t channel) { digitalWrite(channel, LOW); };
|
||||
void setON(uint8_t channel) { write1(channel, HIGH); };
|
||||
void setOFF(uint8_t channel) { write1(channel, LOW); };
|
||||
|
||||
// experimental for 0.3.0
|
||||
void allOFF();
|
||||
|
@ -30,6 +30,29 @@ however in practice not all frequencies are set accurate.
|
||||
Lower frequencies do better than higher frequencies.
|
||||
|
||||
|
||||
|
||||
#### 0.7.0 Breaking change
|
||||
|
||||
The version 0.7.0 has breaking changes in the interface.
|
||||
The rationale is that the programming environment of the **Arduino ESP32 S3**
|
||||
board uses a remapping by means of the include file **io_pin_remap.h**.
|
||||
This file remaps the pins of several core Arduino functions.
|
||||
The remapping is implemented by #define macros and these implement "hard" text
|
||||
replacements without considering context.
|
||||
The effect is that methods from this class (and several others) which have the same
|
||||
name as those Arduino core functions will be remapped into something not working.
|
||||
|
||||
The following library functions have been renamed:
|
||||
|
||||
| old name | new name | notes |
|
||||
|:-----------------|:-------------|:--------|
|
||||
| analogRead() | read() |
|
||||
| analogWrite() | write() |
|
||||
| pinMode() | pinMode1() |
|
||||
| digitalRead() | read1() |
|
||||
| digitalWrite() | write1() |
|
||||
|
||||
|
||||
#### 0.6.0 Breaking change
|
||||
|
||||
Version 0.6.0 introduced a breaking change.
|
||||
@ -132,8 +155,8 @@ read back the configuration of the channel.
|
||||
- **void allOFF()** switches all PWM channels OFF. **Experimental** in 0.3.0.
|
||||
To "undo" the allOFF one can call the **reset()** function and set all
|
||||
PWM channels again.
|
||||
- **void digitalWrite(channel, mode)** mode = HIGH or LOW, just use the PCA9685 as
|
||||
a digital pin.
|
||||
- **void write1(channel, mode)** mode = HIGH or LOW, just use the PCA9685 as
|
||||
a digital pin, write 1 bit.
|
||||
This single function replaces the setON() and setOFF() that will become
|
||||
obsolete in the future.
|
||||
|
||||
|
@ -39,7 +39,7 @@ void setup()
|
||||
// PCA.reset(); // needed to reset the allOFF()
|
||||
// for (int channel = 0; channel < 16; channel++)
|
||||
// {
|
||||
// PCA.digitalWrite(channel, HIGH);
|
||||
// PCA.write1(channel, HIGH);
|
||||
// }
|
||||
}
|
||||
|
||||
|
@ -36,8 +36,8 @@ void setup()
|
||||
attachInterrupt(digitalPinToInterrupt(IRQ_PIN), irq, CHANGE);
|
||||
|
||||
// PCA.setPWM(15, 0, 1000); // works OK - reference to test irq()
|
||||
// PCA.digitalWrite(15, LOW); // works OK
|
||||
PCA.digitalWrite(15, HIGH); // works OK
|
||||
// PCA.write1(15, LOW); // works OK
|
||||
PCA.write1(15, HIGH); // works OK
|
||||
}
|
||||
|
||||
|
||||
@ -68,4 +68,3 @@ void loop()
|
||||
|
||||
|
||||
// -- END OF FILE --
|
||||
|
||||
|
@ -41,7 +41,7 @@ void testSetON()
|
||||
Serial.println("Test - setHIGH");
|
||||
for (uint8_t channel = 0; channel < ledArray.channelCount(); channel++)
|
||||
{
|
||||
ledArray.digitalWrite(channel, HIGH);
|
||||
ledArray.write1(channel, HIGH);
|
||||
}
|
||||
}
|
||||
|
||||
@ -53,7 +53,7 @@ void testSetOFF()
|
||||
Serial.println("Test - setLOW");
|
||||
for (uint8_t channel = 0; channel < ledArray.channelCount(); channel++)
|
||||
{
|
||||
ledArray.digitalWrite(channel, LOW);
|
||||
ledArray.write1(channel, LOW);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -24,12 +24,12 @@ void setup()
|
||||
Wire.begin();
|
||||
ledArray.begin();
|
||||
|
||||
testDigitalWrite(HIGH);
|
||||
testWrite1(HIGH);
|
||||
testPWM(0);
|
||||
testPWMMode();
|
||||
testFrequency();
|
||||
delay(2000);
|
||||
testDigitalWrite(LOW);
|
||||
testWrite1(LOW);
|
||||
|
||||
Serial.print(millis());
|
||||
Serial.print("\t");
|
||||
@ -37,14 +37,14 @@ void setup()
|
||||
}
|
||||
|
||||
|
||||
void testDigitalWrite(uint8_t mode)
|
||||
void testWrite1(uint8_t mode)
|
||||
{
|
||||
Serial.print(millis());
|
||||
Serial.print("\t");
|
||||
Serial.println(__FUNCTION__);
|
||||
for (int channel = 0; channel < ledArray.channelCount(); channel++)
|
||||
{
|
||||
ledArray.digitalWrite(channel, mode);
|
||||
ledArray.write1(channel, mode);
|
||||
delay(100);
|
||||
}
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ getPWM KEYWORD2
|
||||
|
||||
setFrequency KEYWORD2
|
||||
getFrequency KEYWORD2
|
||||
digitalWrite KEYWORD2
|
||||
write1 KEYWORD2
|
||||
|
||||
setON KEYWORD2
|
||||
setOFF KEYWORD2
|
||||
|
@ -15,7 +15,7 @@
|
||||
"type": "git",
|
||||
"url": "https://github.com/RobTillaart/PCA9685_RT.git"
|
||||
},
|
||||
"version": "0.6.0",
|
||||
"version": "0.7.0",
|
||||
"license": "MIT",
|
||||
"frameworks": "*",
|
||||
"platforms": "*",
|
||||
|
@ -1,5 +1,5 @@
|
||||
name=PCA9685_RT
|
||||
version=0.6.0
|
||||
version=0.7.0
|
||||
author=Rob Tillaart <rob.tillaart@gmail.com>
|
||||
maintainer=Rob Tillaart <rob.tillaart@gmail.com>
|
||||
sentence=Arduino library for PCA9685 I2C LED driver, 16 channel PWM, 12 bit.
|
||||
|
Loading…
x
Reference in New Issue
Block a user