File tree Expand file tree Collapse file tree 8 files changed +27
-10
lines changed Expand file tree Collapse file tree 8 files changed +27
-10
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,11 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
6
6
and this project adheres to [ Semantic Versioning] ( http://semver.org/ ) .
7
7
8
8
9
+ ## [ 0.2.1] - 2024-05-28
10
+ - verify the channel parameter of ** bool setChannel()**
11
+ - add parameter to ** bool setChannel(channel, disable = true)**
12
+ - update readme.md
13
+
9
14
## [ 0.2.0] - 2024-04-03
10
15
- fix ghost channels when using for OUTPUT
11
16
- add disable/enable in setChannel()
Original file line number Diff line number Diff line change 3
3
// FILE: HC4052.h
4
4
// AUTHOR: Rob Tillaart
5
5
// DATE: 2023-01-25
6
- // VERSION: 0.2.0
6
+ // VERSION: 0.2.1
7
7
// PURPOSE: Arduino library for HC4052 2 x 4 channel multiplexer and compatibles.
8
8
// URL: https://github.com/RobTillaart/HC4052
9
9
10
10
11
11
#include " Arduino.h"
12
12
13
- #define HC4052_LIB_VERSION (F(" 0.2.0 " ))
13
+ #define HC4052_LIB_VERSION (F(" 0.2.1 " ))
14
14
15
15
16
16
class HC4052
@@ -37,12 +37,15 @@ class HC4052
37
37
}
38
38
39
39
40
- bool setChannel (uint8_t channel)
40
+ bool setChannel (uint8_t channel, bool disable = true )
41
41
{
42
- if (channel > 0x03 ) return false ;
42
+ if (channel > 3 ) return false ;
43
43
if (channel != _channel)
44
44
{
45
- disable (); // prevent ghost channels.
45
+ if (disable)
46
+ {
47
+ this ->disable (); // prevent ghost channels.
48
+ }
46
49
digitalWrite (_pins[0 ], channel & 0x01 );
47
50
digitalWrite (_pins[1 ], channel & 0x02 );
48
51
enable ();
Original file line number Diff line number Diff line change @@ -92,9 +92,15 @@ Example multiplexing analog in.
92
92
Set the two select pins and optional the enable pin.
93
93
If the enablePin == 255 it is considered not used.
94
94
- ** bool setChannel(uint8_t channel)** set the current channel.
95
- Valid values 0..3, returns false if channel out of range.
95
+ Valid values 0..3, this value is checked (since 0.2.1).
96
+ Returns false if channel out of range.
96
97
If the channel is already selected it does not change it.
97
- Calling setChannel will enable it.
98
+ Note the three channels will not change at the very same moment,
99
+ possibly resulting in an invalid selection for a (very short) time.
100
+ The disable flag can be set to false so the device is not disabled during channel switching.
101
+ Default the device is disabled during channel switching to prevent (very short) ghost channels.
102
+ Note that a call to ** setChannel()** will always enable the device again.
103
+ Note the device cannot be disabled if there is no enable pin configured.
98
104
- ** uint8_t getChannel()** returns the current channel 0..3.
99
105
The selected channel is also returned when the multiplexer is disabled.
100
106
Original file line number Diff line number Diff line change 2
2
// FILE: HC4052_demo.ino
3
3
// AUTHOR: Rob Tillaart
4
4
// PURPOSE: Demo for HC4052 2 x 4 channel (simple) multiplexer
5
+ // URL: https://github.com/RobTillaart/HC4052
5
6
6
7
7
8
#include " HC4052.h"
Original file line number Diff line number Diff line change 2
2
// FILE: HC4052_performance.ino
3
3
// AUTHOR: Rob Tillaart
4
4
// PURPOSE: Demo for HC4052 2 x 4 channel (simple) multiplexer
5
+ // URL: https://github.com/RobTillaart/HC4052
5
6
6
7
7
8
#include " HC4052.h"
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ HC4052 KEYWORD1
6
6
# Methods and Functions (KEYWORD2)
7
7
setChannel KEYWORD2
8
8
getChannel KEYWORD2
9
+
9
10
enable KEYWORD2
10
11
disable KEYWORD2
11
12
isEnabled KEYWORD2
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " HC4052" ,
3
3
"keywords" : " " ,
4
- "description" : " Arduino library for a HC4052 2x4 channel multiplexer." ,
4
+ "description" : " Arduino library for a HC4052 2 x 4 channel multiplexer." ,
5
5
"authors" :
6
6
[
7
7
{
15
15
"type" : " git" ,
16
16
"url" : " https://github.com/RobTillaart/HC4052.git"
17
17
},
18
- "version" : " 0.2.0 " ,
18
+ "version" : " 0.2.1 " ,
19
19
"license" : " MIT" ,
20
20
"frameworks" : " *" ,
21
21
"platforms" : " *" ,
Original file line number Diff line number Diff line change 1
1
name =HC4052
2
- version =0.2.0
2
+ version =0.2.1
3
3
author =Rob Tillaart <
[email protected] >
4
4
maintainer =Rob Tillaart <
[email protected] >
5
5
sentence =Arduino library for a HC4052 2 x 4 channel multiplexer
You can’t perform that action at this time.
0 commit comments