0.1.3 MAX14661

This commit is contained in:
rob tillaart 2022-11-16 15:18:12 +01:00
parent f46f99898f
commit faf8dbf67a
7 changed files with 117 additions and 70 deletions

View File

@ -1,3 +1,18 @@
platforms:
rpipico:
board: rp2040:rp2040:rpipico
package: rp2040:rp2040
gcc:
features:
defines:
- ARDUINO_ARCH_RP2040
warnings:
flags:
packages:
rp2040:rp2040:
url: https://github.com/earlephilhower/arduino-pico/releases/download/global/package_rp2040_index.json
compile:
# Choosing to run compilation tests on 2 different Arduino platforms
platforms:
@ -9,3 +24,4 @@ compile:
- esp32
# - esp8266
# - mega2560
- rpipico

View File

@ -0,0 +1,24 @@
# Change Log MAX14661
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).
## [0.1.3] - 2022-11-16
- add RP2040 in build-CI
- add changelog.md
- minor edits readme.md
## [0.1.2] - 2021-12-21
- update library.json
- update license,
- minor edits
## [0.1.1] - 2021-08-30
- add shadow interface - experimental
## [0.1.0] - 2021-01-29
- initial version.

View File

@ -2,20 +2,19 @@
// FILE: MAX14661.cpp
// AUTHOR: Rob Tillaart
// DATE: 2021-01-29
// VERSION: 0.1.2
// VERSION: 0.1.3
// PURPOSE: Arduino library for MAX14661 16 channel I2C multiplexer
// URL: https://github.com/RobTillaart/MAX14661
//
// HISTORY:
// 0.1.0 2021-01-29 initial version
// 0.1.1 2021-08-30 add shadow interface - experimental
// 0.1.2 2021-12-21 update library.json, license, minor edits
// HISTORY: see changelog.md
#include "MAX14661.h"
// registers
//
// REGISTERS
//
#define MAX14661_DIR0 0x00
#define MAX14661_DIR1 0x01
#define MAX14661_DIR2 0x02
@ -143,6 +142,7 @@ void MAX14661::closeAllChannels()
setChannels(0);
}
void MAX14661::setChannels(uint16_t mask)
{
writeRegister(MAX14661_DIR0, mask & 0x00FF);
@ -178,8 +178,10 @@ void MAX14661::activateShadow()
writeRegister(MAX14661_CMD_B, 0x11);
}
////////////////////////////////////////////////////////////
void MAX14661::setShadowChannelMaskA(uint16_t mask)
{
writeRegister(MAX14661_SHDW0, mask & 0xFF);
@ -209,8 +211,10 @@ uint16_t MAX14661::getShadowChannelMaskB()
return mask;
}
////////////////////////////////////////////////////////////
bool MAX14661::openShadowChannelA(uint8_t channel)
{
if (channel > 15) return false;
@ -455,6 +459,5 @@ int MAX14661::lastError()
}
// -- END OF FILE --

View File

@ -3,7 +3,7 @@
// FILE: MAX14661.h
// AUTHOR: Rob Tillaart
// DATE: 2021-01-29
// VERSION: 0.1.2
// VERSION: 0.1.3
// PURPOSE: Arduino library for MAX14661 16 channel I2C multiplexer
// URL: https://github.com/RobTillaart/MAX14661
//
@ -13,7 +13,7 @@
#include "Wire.h"
#define MAX14661_LIB_VERSION (F("0.1.2"))
#define MAX14661_LIB_VERSION (F("0.1.3"))
class MAX14661
@ -27,7 +27,7 @@ public:
bool begin();
bool isConnected();
//
// PAIR INTERFACE
// - keeps A and B line in sync, ideal for an I2C bus or Serial.
// - returns false if channel nr > 15
@ -50,7 +50,6 @@ public:
uint16_t getChannels();
//
// SHADOW INTERFACE
// - experimental - not tested.
// - prepares channels to be set in one activateShadow().
@ -72,7 +71,6 @@ public:
bool isOpenShadowChannelB(uint8_t channel);
//
// MUX INTERFACE
// - allows only one channel simultaneously open
// - opening a channel closes any other.
@ -83,7 +81,6 @@ public:
uint8_t getMUXB();
//
// FULL CONTROL PER A B LINE
// - selective open and close A and B
// - returns false if channel nr > 15

View File

@ -26,7 +26,7 @@ Addresses go from 0x4C (76) .. 0x4F (79). See table 3 datasheet.
## Interface
The library provides 3 kinds of interfaces.
The library provides 3 kinds of interfaces (PAIR, SHADOW, MUX).
Mixing these interfaces is allowed but definitely not advised as
especially the PAIR interface assumes that A and B selections
are kept in sync.
@ -38,7 +38,7 @@ So depending on your application choose the interface you want to use.
- **MAX14661(deviceAddress, TwoWire \*wire = &Wire)** Constructor with device address,
and optional the Wire interface as parameter.
- **bool begin()** initializes the wire interface
- **bool begin()** initializes the wire interface.
- **bool begin(sda, scl)** idem, for the ESP32 where one can choose the I2C pins.
- **bool isConnected()** checks if the address is visible on the I2C bus.
@ -91,7 +91,7 @@ prepare per channel
### MUX interface
The MUX interface allows one channel to be open at a time.
The MUX interface allows one channel (0..15) to be open at a time.
- **void MUXA(uint8_t channel)** if channel < 16 only that channel will be selected. All other values will select no channel.
- **uint8_t getMUXA()** returns the selected channel. 255 means none selected.
@ -101,7 +101,7 @@ The MUX interface allows one channel to be open at a time.
### FULL CONTROL interface
full control per channel, any combination is possible.
Full control per channel, any combination is possible.
Use with care as these can interfere e.g. with the PAIR interface.
All functions return false if channel > 15.
@ -126,21 +126,28 @@ Check datasheet for these values of the registers.
## Error codes
to be elaborated
## Future
- test behaviour
- test I2C speed.
- measure performance
- optimize low level bit set/clr/get read/write 2bytes at once.
- write unit tests.
- error handling
- improve documentation
- initial values parameter for begin()?
to be elaborated (see future).
## Operation
See examples
## Future
#### must
- improve documentation
#### should
- test behaviour
- write unit tests.
- error handling
#### could
- optimize low level bit set/clr/get read/write 2 bytes at once.
- test I2C speed.
- measure performance.
- initial values parameter for begin()?
- SPI interface.

View File

@ -15,7 +15,7 @@
"type": "git",
"url": "https://github.com/RobTillaart/MAX14661.git"
},
"version": "0.1.2",
"version": "0.1.3",
"license": "MIT",
"frameworks": "arduino",
"platforms": "*",

View File

@ -1,5 +1,5 @@
name=MAX14661
version=0.1.2
version=0.1.3
author=Rob Tillaart <rob.tillaart@gmail.com>
maintainer=Rob Tillaart <rob.tillaart@gmail.com>
sentence=Arduino library for MAX14661 16 channel I2C multiplexer