Skip to content

Commit 9267104

Browse files
committed
0.1.2 TLC5947
1 parent 56dc45a commit 9267104

File tree

7 files changed

+39
-16
lines changed

7 files changed

+39
-16
lines changed

libraries/TLC5947/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
66
and this project adheres to [Semantic Versioning](http://semver.org/).
77

88

9+
## [0.1.2] - 2023-11-22
10+
- update readme.md
11+
- add **TLC5947_CHANNEL_ERROR**
12+
- catch negative percentages.
13+
14+
915
## [0.1.1] - 2023-06-21
1016
- improve performance AVR
1117
- add percentage wrappers

libraries/TLC5947/README.md

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,11 @@
22
[![Arduino CI](https://github.com/RobTillaart/TLC5947/workflows/Arduino%20CI/badge.svg)](https://github.com/marketplace/actions/arduino_ci)
33
[![Arduino-lint](https://github.com/RobTillaart/TLC5947/actions/workflows/arduino-lint.yml/badge.svg)](https://github.com/RobTillaart/TLC5947/actions/workflows/arduino-lint.yml)
44
[![JSON check](https://github.com/RobTillaart/TLC5947/actions/workflows/jsoncheck.yml/badge.svg)](https://github.com/RobTillaart/TLC5947/actions/workflows/jsoncheck.yml)
5+
[![GitHub issues](https://img.shields.io/github/issues/RobTillaart/TLC5947.svg)](https://github.com/RobTillaart/TLC5947/issues)
6+
57
[![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/RobTillaart/TLC5947/blob/master/LICENSE)
68
[![GitHub release](https://img.shields.io/github/release/RobTillaart/TLC5947.svg?maxAge=3600)](https://github.com/RobTillaart/TLC5947/releases)
9+
[![PlatformIO Registry](https://badges.registry.platformio.org/packages/robtillaart/library/TLC5947.svg)](https://registry.platformio.org/libraries/robtillaart/TLC5947)
710

811

912
# TLC5947
@@ -34,7 +37,7 @@ The data can be shared (to be tested) as data won't be clocked in if
3437
the **clock** line is not shared.
3538

3639

37-
#### Links
40+
#### Related
3841

3942
- https://www.adafruit.com/product/1429
4043
- https://github.com/RobTillaart/TLC5947
@@ -54,8 +57,8 @@ Defines the pins used for uploading / writing the PWM data to the module.
5457
The blank pin is explained in more detail below.
5558
- **~TLC5947()** destructor
5659
- **bool begin()** set the pinModes of the pins and their initial values.
57-
- **bool setPWM(uint8_t channel, uint16_t PWM)**. set a PWM value to the buffer to
58-
be written later.
60+
- **bool setPWM(uint8_t channel, uint16_t PWM)**. set a PWM value to
61+
the buffer to be written later.
5962
channel = 0..23, PWM = 0..4095
6063
Returns true if successful.
6164
- **void setAll(uint16_t PWM)** set the same PWM value for all channels to the buffer, and writes them to device.
@@ -118,9 +121,10 @@ Measured with **TLC5947_performance.ino**.
118121
- buy hardware
119122
- test test test
120123

121-
122124
#### Should
123125

126+
- **setPWM()** should return set value or error
127+
- revisit all functions..
124128
- add examples
125129
- extend performance sketch
126130
- test if partial write (e.g. first N channels) works.
@@ -129,19 +133,25 @@ Measured with **TLC5947_performance.ino**.
129133
- set by **setPWM()** if value changes.
130134
- would speed up unneeded **write()** too.
131135

132-
133136
#### Could
134137

135138
- add unit-tests
136-
- add **void setPercentage(float perc)** and **float getPercentage()** wrappers.
137139
- investigate how to reduce memory usage (now 48 bytes)
138-
- could be 36 (12 bits / channel) or even 24 (8 bits/channel)
139-
- derived class?
140+
- could be 36 (12 bits / channel)
141+
- or even 24 (8 bits/channel) = derived class?
140142
- add **setRGB(LED, R, G, B)** wrapper (channel 0..7)
141143
24 channels == 3 x 8 RGB LEDs
142144
- return value for **setPWM()** ?
143145

146+
#### Wont
147+
148+
149+
## Support
150+
151+
If you appreciate my libraries, you can support the development and maintenance.
152+
Improve the quality of the libraries by providing issues and Pull Requests, or
153+
donate through PayPal or GitHub sponsors.
144154

145-
#### Won't
155+
Thank you,
146156

147157

libraries/TLC5947/TLC5947.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//
22
// FILE: TLC5947.cpp
33
// AUTHOR: Rob Tillaart
4-
// VERSION: 0.1.1
4+
// VERSION: 0.1.2
55
// DATE: 2023-06-17
66
// PURPOSE: Arduino library for the TLC5947 24 channel PWM device
77
// URL: https://github.com/RobTillaart/TLC5947
@@ -50,7 +50,7 @@ bool TLC5947::setPWM(uint8_t channel, uint16_t PWM)
5050

5151
uint16_t TLC5947::getPWM(uint8_t channel)
5252
{
53-
if (channel >= 24) return 0xFFFF;
53+
if (channel >= 24) return TLC5947_CHANNEL_ERROR;
5454
return _buffer[channel] & 0x0FFF;
5555
}
5656

@@ -68,12 +68,14 @@ void TLC5947::setAll(uint16_t PWM)
6868

6969
bool TLC5947::setPercentage(uint8_t channel, float perc)
7070
{
71+
if (perc < 0) perc = 0;
7172
return setPWM(channel, round(perc * 40.95));
7273
}
7374

7475

7576
void TLC5947::setPercentageAll(float perc)
7677
{
78+
if (perc < 0) perc = 0;
7779
setAll(round(perc * 40.95));
7880
}
7981

libraries/TLC5947/TLC5947.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,22 @@
22
//
33
// FILE: TLC5947.h
44
// AUTHOR: Rob Tillaart
5-
// VERSION: 0.1.1
5+
// VERSION: 0.1.2
66
// DATE: 2023-06-17
77
// PURPOSE: Arduino library for the TLC5947 24 channel PWM device
88
// URL: https://github.com/RobTillaart/TLC5947
99

1010

11-
#define TLC5947_LIB_VERSION (F("0.1.1"))
11+
#define TLC5947_LIB_VERSION (F("0.1.2"))
1212

1313

1414
#include "Arduino.h"
1515

1616

1717
#define TLC5947_MAX_CHANNELS 24
1818

19+
#define TLC5947_CHANNEL_ERROR 0xFFFF
20+
1921

2022
class TLC5947
2123
{

libraries/TLC5947/keywords.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ setPercentage KEYWORD2
1616
getPercentage KEYWORD2
1717
setPercentageAll KEYWORD2
1818

19+
write KEYWORD2
20+
1921
enable KEYWORD2
2022
disable KEYWORD2
2123

@@ -26,4 +28,5 @@ disable KEYWORD2
2628
# Constants (LITERAL1)
2729
TLC5947_LIB_VERSION LITERAL1
2830

31+
TLC5947_CHANNEL_ERROR LITERAL1
2932

libraries/TLC5947/library.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
"type": "git",
1616
"url": "https://github.com/RobTillaart/TLC5947.git"
1717
},
18-
"version": "0.1.1",
18+
"version": "0.1.2",
1919
"license": "MIT",
20-
"frameworks": "arduino",
20+
"frameworks": "*",
2121
"platforms": "*",
2222
"headers": "TLC5947.h"
2323
}

libraries/TLC5947/library.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=TLC5947
2-
version=0.1.1
2+
version=0.1.2
33
author=Rob Tillaart <[email protected]>
44
maintainer=Rob Tillaart <[email protected]>
55
sentence=Arduino library for TLC5947 24 channel 12 bit PWM.

0 commit comments

Comments
 (0)