mirror of
https://github.com/RobTillaart/Arduino.git
synced 2024-10-03 18:09:02 -04:00
0.2.1 HC4053
This commit is contained in:
parent
b8f33abe9d
commit
1f58227dec
@ -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.2.1] - 2024-05-28
|
||||
- change return type of **bool setChannel()**
|
||||
- verify the channel parameter of **bool setChannel()**
|
||||
- add parameter to **bool setChannel(channel, disable = true)**
|
||||
- update readme.md
|
||||
|
||||
## [0.2.0] - 2024-04-03
|
||||
- fix ghost channels when using for OUTPUT
|
||||
- add disable/enable in setChannel()
|
||||
|
@ -3,15 +3,14 @@
|
||||
// FILE: HC4053.h
|
||||
// AUTHOR: Rob Tillaart
|
||||
// DATE: 2023-01-25
|
||||
// VERSION: 0.2.0
|
||||
// VERSION: 0.2.1
|
||||
// PURPOSE: Arduino library for CD74HC4053 8 channel multiplexer and compatibles.
|
||||
// URL: https://github.com/RobTillaart/HC4053
|
||||
|
||||
|
||||
|
||||
#include "Arduino.h"
|
||||
|
||||
#define HC4053_LIB_VERSION (F("0.2.0"))
|
||||
#define HC4053_LIB_VERSION (F("0.2.1"))
|
||||
|
||||
|
||||
class HC4053
|
||||
@ -42,13 +41,18 @@ public:
|
||||
}
|
||||
|
||||
|
||||
void setChannel(uint8_t channel)
|
||||
bool setChannel(uint8_t channel, bool disable = true)
|
||||
{
|
||||
disable();
|
||||
if (channel > 1) return false;
|
||||
if (disable)
|
||||
{
|
||||
this->disable();
|
||||
}
|
||||
setChannelA(channel);
|
||||
setChannelB(channel);
|
||||
setChannelC(channel);
|
||||
enable();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
@ -93,10 +93,16 @@ Example multiplexing three times analog in.
|
||||
- **HC4053(uint8_t A, uint8_t B, uint8_t C, uint8_t enablePin = 255)** constructor.
|
||||
Set the three select pins and optional the enable pin.
|
||||
If the enablePin == 255 it is considered not used.
|
||||
- **void setChannel(uint8_t channel)** sets A, B and C to channel in one call.
|
||||
- **bool setChannel(uint8_t channel, bool disable = true)** sets A, B and C to channel in one call.
|
||||
Think of it as a master switch.
|
||||
Valid values 0, 1, this value is not checked, only last bit is used.
|
||||
Note the three channels will not change at the very same moment.
|
||||
Valid values 0, 1, this value is checked (since 0.2.1).
|
||||
Returns false if channel out of range.
|
||||
Note the three channels will not change at the very same moment,
|
||||
possibly resulting in an invalid selection for a (very short) time.
|
||||
The disable flag can be set to false so the device is not disabled during channel switching.
|
||||
Default the device is disabled during channel switching to prevent (very short) ghost channels.
|
||||
Note that a call to **setChannel()** will always enable the device again.
|
||||
Note the device cannot be disabled if there is no enable pin configured.
|
||||
- **void setChannelA(uint8_t channel)** sets A to channel.
|
||||
Valid values 0, 1, this value is not checked, only last bit is used.
|
||||
- **void setChannelB(uint8_t channel)** sets B to channel.
|
||||
|
@ -2,6 +2,7 @@
|
||||
// FILE: HC4053_demo.ino
|
||||
// AUTHOR: Rob Tillaart
|
||||
// PURPOSE: Demo for HC4051 8 channel (simple) multiplexer
|
||||
// URL: https://github.com/RobTillaart/HC4053
|
||||
|
||||
|
||||
#include "HC4053.h"
|
||||
|
@ -2,6 +2,7 @@
|
||||
// FILE: HC4053_performance.ino
|
||||
// AUTHOR: Rob Tillaart
|
||||
// PURPOSE: Demo for HC4053 3 x 2 channel (simple) multiplexer
|
||||
// URL: https://github.com/RobTillaart/HC4053
|
||||
|
||||
|
||||
#include "HC4053.h"
|
||||
|
@ -6,6 +6,7 @@ HC4053 KEYWORD1
|
||||
# Methods and Functions (KEYWORD2)
|
||||
setChannel KEYWORD2
|
||||
getChannel KEYWORD2
|
||||
|
||||
enable KEYWORD2
|
||||
disable KEYWORD2
|
||||
isEnabled KEYWORD2
|
||||
|
@ -15,7 +15,7 @@
|
||||
"type": "git",
|
||||
"url": "https://github.com/RobTillaart/HC4053.git"
|
||||
},
|
||||
"version": "0.2.0",
|
||||
"version": "0.2.1",
|
||||
"license": "MIT",
|
||||
"frameworks": "*",
|
||||
"platforms": "*",
|
||||
|
@ -1,5 +1,5 @@
|
||||
name=HC4053
|
||||
version=0.2.0
|
||||
version=0.2.1
|
||||
author=Rob Tillaart <rob.tillaart@gmail.com>
|
||||
maintainer=Rob Tillaart <rob.tillaart@gmail.com>
|
||||
sentence=Arduino library for a HC4053 3 x 2 channel multiplexer
|
||||
|
Loading…
Reference in New Issue
Block a user