From 1127b497531bd00aa1bb1a5bbc9785990aabeb1a Mon Sep 17 00:00:00 2001 From: rob tillaart Date: Sat, 19 Nov 2022 16:53:05 +0100 Subject: [PATCH] 0.2.4 PCA9634 --- libraries/PCA9634/.arduino-ci.yml | 19 ++++++++- libraries/PCA9634/CHANGELOG.md | 43 ++++++++++++++++++++ libraries/PCA9634/PCA9634.cpp | 18 +-------- libraries/PCA9634/PCA9634.h | 59 ++++++++++++++-------------- libraries/PCA9634/README.md | 5 +++ libraries/PCA9634/library.json | 2 +- libraries/PCA9634/library.properties | 2 +- 7 files changed, 98 insertions(+), 50 deletions(-) create mode 100644 libraries/PCA9634/CHANGELOG.md diff --git a/libraries/PCA9634/.arduino-ci.yml b/libraries/PCA9634/.arduino-ci.yml index e7cb4633..10c0e10b 100644 --- a/libraries/PCA9634/.arduino-ci.yml +++ b/libraries/PCA9634/.arduino-ci.yml @@ -1,3 +1,18 @@ +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: @@ -8,4 +23,6 @@ compile: - m4 - esp32 # - esp8266 - # - mega2560 \ No newline at end of file + # - mega2560 + - rpipico + diff --git a/libraries/PCA9634/CHANGELOG.md b/libraries/PCA9634/CHANGELOG.md new file mode 100644 index 00000000..2d353e00 --- /dev/null +++ b/libraries/PCA9634/CHANGELOG.md @@ -0,0 +1,43 @@ +# Change Log PCA9634 + +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.2.4] - 2022-11-19 +- add RP2040 in build-CI +- add changelog.md + + + +## [0.2.3] - 2022-09-11 +- update documentation +- fix begin() for ESP32 ambiguity - See PCA9635 #17 + +## [0.2.2] - 2022-09-02 +- add static I2C_SoftwareReset() + +## [0.2.1] - 2022-05-30 +- add mode parameters to begin() + +## [0.2.0] - 2022-05-29 +- breaking changes +- rename reset() to configure() +- add mode1 and mode2 parameter to configure. +- add SUB CALL and ALL CALL functions. +- update documentation. +- renamed PCA9634_MODE2_STOP to PCA9634_MODE2_ACK + +---- + +## [0.1.2] - 2022-04-13 +- issue #7 add constants and functions for mode registers. + +## [0.1.1] - 2022-01-04 +- minor fixes + +## [0.1.0] - 2022-01-03 +- initial version -- based upon 0.3.2 PCA9635 + diff --git a/libraries/PCA9634/PCA9634.cpp b/libraries/PCA9634/PCA9634.cpp index 683f4f36..653468bf 100644 --- a/libraries/PCA9634/PCA9634.cpp +++ b/libraries/PCA9634/PCA9634.cpp @@ -2,25 +2,9 @@ // FILE: PCA9634.cpp // AUTHOR: Rob Tillaart // DATE: 03-01-2022 -// VERSION: 0.2.3 +// VERSION: 0.2.4 // PURPOSE: Arduino library for PCA9634 I2C LED driver // URL: https://github.com/RobTillaart/PCA9634 -// -// HISTORY: -// 0.1.0 2022-01-03 initial version -- based upon 0.3.2 PCA9635 -// 0.1.1 2022-01-04 minor fixes -// 0.1.2 2022-04-13 issue #7 add constants and functions for mode registers. -// -// 0.2.0 2022-05-29 breaking changes -// rename reset() to configure() -// add mode1 and mode2 parameter to configure. -// add SUB CALL and ALL CALL functions. -// update documentation. -// renamed PCA9634_MODE2_STOP to PCA9634_MODE2_ACK -// 0.2.1 2022-05-30 add mode parameters to begin() -// 0.2.2 2022-09-02 add static I2C_SoftwareReset() -// 0.2.3 2022-09-11 update documentation -// fix begin() for ESP32 ambiguity - See PCA9635 #17 #include "PCA9634.h" diff --git a/libraries/PCA9634/PCA9634.h b/libraries/PCA9634/PCA9634.h index b452c0ba..65481943 100644 --- a/libraries/PCA9634/PCA9634.h +++ b/libraries/PCA9634/PCA9634.h @@ -3,7 +3,7 @@ // FILE: PCA9634.h // AUTHOR: Rob Tillaart // DATE: 03-01-2022 -// VERSION: 0.2.3 +// VERSION: 0.2.4 // 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.3")) +#define PCA9634_LIB_VERSION (F("0.2.4")) #define PCA9634_MODE1 0x00 #define PCA9634_MODE2 0x01 @@ -25,8 +25,8 @@ #define PCA9634_GRPFREQ 0x0B // check datasheet for details -#define PCA9634_LEDOUT_BASE 0x0C // 0x0C..0x0D -#define PCA9634_LEDOFF 0x00 // default @ startup +#define PCA9634_LEDOUT_BASE 0x0C // 0x0C..0x0D +#define PCA9634_LEDOFF 0x00 // default @ startup #define PCA9634_LEDON 0x01 #define PCA9634_LEDPWM 0x02 #define PCA9634_LEDGRPPWM 0x03 @@ -41,22 +41,22 @@ #define PCA9634_ERR_I2C 0xFA -// Configuration bits MODE1 register -#define PCA9634_MODE1_AUTOINCR2 0x80 // ReadOnly, 0 = disable 1 = enable -#define PCA9634_MODE1_AUTOINCR1 0x40 // ReadOnly, bit1 -#define PCA9634_MODE1_AUTOINCR0 0x20 // ReadOnly, bit0 -#define PCA9634_MODE1_SLEEP 0x10 // 0 = normal 1 = sleep -#define PCA9634_MODE1_SUB1 0x08 // 0 = disable 1 = enable -#define PCA9634_MODE1_SUB2 0x04 // 0 = disable 1 = enable -#define PCA9634_MODE1_SUB3 0x02 // 0 = disable 1 = enable -#define PCA9634_MODE1_ALLCALL 0x01 // 0 = disable 1 = enable +// Configuration bits MODE1 register +#define PCA9634_MODE1_AUTOINCR2 0x80 // ReadOnly, 0 = disable 1 = enable +#define PCA9634_MODE1_AUTOINCR1 0x40 // ReadOnly, bit1 +#define PCA9634_MODE1_AUTOINCR0 0x20 // ReadOnly, bit0 +#define PCA9634_MODE1_SLEEP 0x10 // 0 = normal 1 = sleep +#define PCA9634_MODE1_SUB1 0x08 // 0 = disable 1 = enable +#define PCA9634_MODE1_SUB2 0x04 // 0 = disable 1 = enable +#define PCA9634_MODE1_SUB3 0x02 // 0 = disable 1 = enable +#define PCA9634_MODE1_ALLCALL 0x01 // 0 = disable 1 = enable #define PCA9634_MODE1_NONE 0x00 -// Configuration bits MODE2 register -#define PCA9634_MODE2_BLINK 0x20 // 0 = dim 1 = blink -#define PCA9634_MODE2_INVERT 0x10 // 0 = normal 1 = inverted -#define PCA9634_MODE2_ACK 0x08 // 0 = on STOP 1 = on ACK -#define PCA9634_MODE2_TOTEMPOLE 0x04 // 0 = open drain 1 = totem-pole +// Configuration bits MODE2 register +#define PCA9634_MODE2_BLINK 0x20 // 0 = dim 1 = blink +#define PCA9634_MODE2_INVERT 0x10 // 0 = normal 1 = inverted +#define PCA9634_MODE2_ACK 0x08 // 0 = on STOP 1 = on ACK +#define PCA9634_MODE2_TOTEMPOLE 0x04 // 0 = open drain 1 = totem-pole #define PCA9634_MODE2_NONE 0x00 // (since 0.2.0) @@ -84,30 +84,30 @@ public: uint8_t setLedDriverMode(uint8_t channel, uint8_t mode); uint8_t getLedDriverMode(uint8_t channel); - // single PWM setting + // single PWM setting uint8_t write1(uint8_t channel, uint8_t value); - // RGB setting, write three consecutive PWM registers + // RGB setting, write three consecutive PWM registers uint8_t write3(uint8_t channel, uint8_t R, uint8_t G, uint8_t B); - // generic worker, write N consecutive PWM registers + // generic worker, write N consecutive PWM registers uint8_t writeN(uint8_t channel, uint8_t* arr, uint8_t count); - // reg = 1, 2 check datasheet for values + // reg = 1, 2 check datasheet for values uint8_t writeMode(uint8_t reg, uint8_t value); uint8_t readMode(uint8_t reg); - // convenience wrappers + // convenience wrappers uint8_t setMode1(uint8_t value) { return writeMode(PCA9634_MODE1, value); }; uint8_t setMode2(uint8_t value) { return writeMode(PCA9634_MODE2, value); }; uint8_t getMode1() { return readMode(PCA9634_MODE1); }; uint8_t getMode2() { return readMode(PCA9634_MODE2); }; - // TODO PWM also in %% ? + // TODO PWM also in %% ? void setGroupPWM(uint8_t value) { writeReg(PCA9634_GRPPWM, value); }; uint8_t getGroupPWM() { return readReg(PCA9634_GRPPWM); }; - // TODO set time in milliseconds and round to nearest value? + // TODO set time in milliseconds and round to nearest value? void setGroupFREQ(uint8_t value) { writeReg(PCA9634_GRPFREQ, value); }; uint8_t getGroupFREQ() { return readReg(PCA9634_GRPFREQ); }; @@ -115,7 +115,7 @@ public: ///////////////////////////////////////////////////// // - // SUB CALL - ALL CALL (since 0.2.0) + // SUB CALL - ALL CALL (since 0.2.0) // // nr = { 1, 2, 3 } bool enableSubCall(uint8_t nr); @@ -135,8 +135,8 @@ public: private: - // DIRECT CONTROL - uint8_t writeReg(uint8_t reg, uint8_t value); // returns error status. + // DIRECT CONTROL + uint8_t writeReg(uint8_t reg, uint8_t value); // returns error status. uint8_t readReg(uint8_t reg); uint8_t _address; @@ -149,6 +149,5 @@ private: }; - -// -- END OF FILE -- +// -- END OF FILE -- diff --git a/libraries/PCA9634/README.md b/libraries/PCA9634/README.md index ba829c1a..889cafb4 100644 --- a/libraries/PCA9634/README.md +++ b/libraries/PCA9634/README.md @@ -228,11 +228,16 @@ See examples ## Future +#### must - improve documentation + +#### should - unit tests - SUB CALL if possible? - ALL CALL if possible? - add examples + +#### could - sync with PCA9635 developments - merge with PCA9635 and a PCA963X base class if possible diff --git a/libraries/PCA9634/library.json b/libraries/PCA9634/library.json index dcd3c862..0c5e4881 100644 --- a/libraries/PCA9634/library.json +++ b/libraries/PCA9634/library.json @@ -15,7 +15,7 @@ "type": "git", "url": "https://github.com/RobTillaart/PCA9634.git" }, - "version": "0.2.3", + "version": "0.2.4", "license": "MIT", "frameworks": "arduino", "platforms": "*", diff --git a/libraries/PCA9634/library.properties b/libraries/PCA9634/library.properties index f079ef07..b4c0230f 100644 --- a/libraries/PCA9634/library.properties +++ b/libraries/PCA9634/library.properties @@ -1,5 +1,5 @@ name=PCA9634 -version=0.2.3 +version=0.2.4 author=Rob Tillaart maintainer=Rob Tillaart sentence=Arduino library for PCA9634 I2C LED driver 8 channel