Skip to content

Commit 1f58227

Browse files
committed
0.2.1 HC4053
1 parent b8f33ab commit 1f58227

File tree

8 files changed

+29
-10
lines changed

8 files changed

+29
-10
lines changed

libraries/HC4053/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.2.1] - 2024-05-28
10+
- change return type of **bool setChannel()**
11+
- verify the channel parameter of **bool setChannel()**
12+
- add parameter to **bool setChannel(channel, disable = true)**
13+
- update readme.md
14+
915
## [0.2.0] - 2024-04-03
1016
- fix ghost channels when using for OUTPUT
1117
- add disable/enable in setChannel()

libraries/HC4053/HC4053.h

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,14 @@
33
// FILE: HC4053.h
44
// AUTHOR: Rob Tillaart
55
// DATE: 2023-01-25
6-
// VERSION: 0.2.0
6+
// VERSION: 0.2.1
77
// PURPOSE: Arduino library for CD74HC4053 8 channel multiplexer and compatibles.
88
// URL: https://github.com/RobTillaart/HC4053
99

1010

11-
1211
#include "Arduino.h"
1312

14-
#define HC4053_LIB_VERSION (F("0.2.0"))
13+
#define HC4053_LIB_VERSION (F("0.2.1"))
1514

1615

1716
class HC4053
@@ -42,13 +41,18 @@ class HC4053
4241
}
4342

4443

45-
void setChannel(uint8_t channel)
44+
bool setChannel(uint8_t channel, bool disable = true)
4645
{
47-
disable();
46+
if (channel > 1) return false;
47+
if (disable)
48+
{
49+
this->disable();
50+
}
4851
setChannelA(channel);
4952
setChannelB(channel);
5053
setChannelC(channel);
5154
enable();
55+
return true;
5256
}
5357

5458

libraries/HC4053/README.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,16 @@ Example multiplexing three times analog in.
9393
- **HC4053(uint8_t A, uint8_t B, uint8_t C, uint8_t enablePin = 255)** constructor.
9494
Set the three select pins and optional the enable pin.
9595
If the enablePin == 255 it is considered not used.
96-
- **void setChannel(uint8_t channel)** sets A, B and C to channel in one call.
96+
- **bool setChannel(uint8_t channel, bool disable = true)** sets A, B and C to channel in one call.
9797
Think of it as a master switch.
98-
Valid values 0, 1, this value is not checked, only last bit is used.
99-
Note the three channels will not change at the very same moment.
98+
Valid values 0, 1, this value is checked (since 0.2.1).
99+
Returns false if channel out of range.
100+
Note the three channels will not change at the very same moment,
101+
possibly resulting in an invalid selection for a (very short) time.
102+
The disable flag can be set to false so the device is not disabled during channel switching.
103+
Default the device is disabled during channel switching to prevent (very short) ghost channels.
104+
Note that a call to **setChannel()** will always enable the device again.
105+
Note the device cannot be disabled if there is no enable pin configured.
100106
- **void setChannelA(uint8_t channel)** sets A to channel.
101107
Valid values 0, 1, this value is not checked, only last bit is used.
102108
- **void setChannelB(uint8_t channel)** sets B to channel.

libraries/HC4053/examples/HC4053_demo/HC4053_demo.ino

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// FILE: HC4053_demo.ino
33
// AUTHOR: Rob Tillaart
44
// PURPOSE: Demo for HC4051 8 channel (simple) multiplexer
5+
// URL: https://github.com/RobTillaart/HC4053
56

67

78
#include "HC4053.h"

libraries/HC4053/examples/HC4053_performance/HC4053_performance.ino

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// FILE: HC4053_performance.ino
33
// AUTHOR: Rob Tillaart
44
// PURPOSE: Demo for HC4053 3 x 2 channel (simple) multiplexer
5+
// URL: https://github.com/RobTillaart/HC4053
56

67

78
#include "HC4053.h"

libraries/HC4053/keywords.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ HC4053 KEYWORD1
66
# Methods and Functions (KEYWORD2)
77
setChannel KEYWORD2
88
getChannel KEYWORD2
9+
910
enable KEYWORD2
1011
disable KEYWORD2
1112
isEnabled KEYWORD2

libraries/HC4053/library.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"type": "git",
1616
"url": "https://github.com/RobTillaart/HC4053.git"
1717
},
18-
"version": "0.2.0",
18+
"version": "0.2.1",
1919
"license": "MIT",
2020
"frameworks": "*",
2121
"platforms": "*",

libraries/HC4053/library.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=HC4053
2-
version=0.2.0
2+
version=0.2.1
33
author=Rob Tillaart <[email protected]>
44
maintainer=Rob Tillaart <[email protected]>
55
sentence=Arduino library for a HC4053 3 x 2 channel multiplexer

0 commit comments

Comments
 (0)