0.3.0 HC4051

This commit is contained in:
Rob Tillaart 2024-08-14 16:20:38 +02:00
parent 3bc3891230
commit 3621777c7f
5 changed files with 18 additions and 7 deletions

View File

@ -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/). and this project adheres to [Semantic Versioning](http://semver.org/).
## [0.3.0] - 2024-08-14
- Fix for setChannel(), Thanks to C. Fraser!
- update readme.md
----
## [0.2.1] - 2024-05-28 ## [0.2.1] - 2024-05-28
- change return type of **bool setChannel()** - change return type of **bool setChannel()**
- verify the channel parameter of **bool setChannel()** - verify the channel parameter of **bool setChannel()**

View File

@ -3,7 +3,7 @@
// FILE: HC4051.h // FILE: HC4051.h
// AUTHOR: Rob Tillaart // AUTHOR: Rob Tillaart
// DATE: 2023-01-25 // DATE: 2023-01-25
// VERSION: 0.2.1 // VERSION: 0.3.0
// PURPOSE: Arduino library for CD74HC4051 1 x 8 channel multiplexer and compatibles. // PURPOSE: Arduino library for CD74HC4051 1 x 8 channel multiplexer and compatibles.
// URL: https://github.com/RobTillaart/HC4051 // URL: https://github.com/RobTillaart/HC4051
@ -11,7 +11,7 @@
#include "Arduino.h" #include "Arduino.h"
#define HC4051_LIB_VERSION (F("0.2.1")) #define HC4051_LIB_VERSION (F("0.3.0"))
class HC4051 class HC4051
@ -57,8 +57,9 @@ public:
// only write changed pins. // AVR only? // only write changed pins. // AVR only?
if (mask & _changed) if (mask & _changed)
{ {
digitalWrite(_pins[i--], (mask & _new)); digitalWrite(_pins[i], (mask & _new));
} }
i--;
mask >>= 1; mask >>= 1;
} }
enable(); enable();

View File

@ -31,6 +31,10 @@ The channel selection is done with four select lines **A, B, C**
The device can be enabled/disabled by the enable line **INH** The device can be enabled/disabled by the enable line **INH**
### 0.3.0 breaking change
Version 0.3.0 has a bugfix for **setChannel()** which obsolete all previous versions.
#### Compatibles #### Compatibles
@ -99,7 +103,7 @@ This will result in another subset of the Y pins to select from.
#include "HC4051.h" #include "HC4051.h"
``` ```
#### Core ### Core
- **HC4051(uint8_t A, uint8_t B, uint8_t C, uint8_t enablePin = 255)** constructor. - **HC4051(uint8_t A, uint8_t B, uint8_t C, uint8_t enablePin = 255)** constructor.
Set the three select pins and optional the enable pin. Set the three select pins and optional the enable pin.
@ -118,7 +122,7 @@ Note the device cannot be disabled if there is no enable pin configured.
The selected channel is also returned when the multiplexer is disabled. The selected channel is also returned when the multiplexer is disabled.
#### Enable ### Enable
These functions work only if a valid **enablePin** is set in the constructor. These functions work only if a valid **enablePin** is set in the constructor.

View File

@ -15,7 +15,7 @@
"type": "git", "type": "git",
"url": "https://github.com/RobTillaart/HC4051.git" "url": "https://github.com/RobTillaart/HC4051.git"
}, },
"version": "0.2.1", "version": "0.3.0",
"license": "MIT", "license": "MIT",
"frameworks": "*", "frameworks": "*",
"platforms": "*", "platforms": "*",

View File

@ -1,5 +1,5 @@
name=HC4051 name=HC4051
version=0.2.1 version=0.3.0
author=Rob Tillaart <rob.tillaart@gmail.com> author=Rob Tillaart <rob.tillaart@gmail.com>
maintainer=Rob Tillaart <rob.tillaart@gmail.com> maintainer=Rob Tillaart <rob.tillaart@gmail.com>
sentence=Arduino library for a HC4051 1x8 channel multiplexer sentence=Arduino library for a HC4051 1x8 channel multiplexer