diff --git a/CHANGELOG.md b/CHANGELOG.md index d495100..cd6dc2f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,13 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). +## [0.8.1] - 2025-01-20 +- Add PR #41 interrupt functions. Thanks to Klang +- add link to keypad library +- update readme.md +- update keywords.txt + + ## [0.8.0] - 2024-11-19 - fix #47 (MCP23S17), interrupt handling. Kudos to GlibSkunk! - update readme.md diff --git a/LICENSE b/LICENSE index b653d12..5f1e97d 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2019-2024 Rob Tillaart +Copyright (c) 2019-2025 Rob Tillaart Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/MCP23017.cpp b/MCP23017.cpp index 998e4d5..a589106 100644 --- a/MCP23017.cpp +++ b/MCP23017.cpp @@ -1,7 +1,7 @@ // // FILE: MCP23017.cpp // AUTHOR: Rob Tillaart -// VERSION: 0.8.0 +// VERSION: 0.8.1 // PURPOSE: Arduino library for I2C MCP23017 16 channel port expander // DATE: 2019-10-12 // URL: https://github.com/RobTillaart/MCP23017_RT @@ -664,6 +664,7 @@ bool MCP23017::enableInterrupt8(uint8_t port, uint8_t mask, uint8_t mode) return true; } + bool MCP23017::enableInterrupt16(uint16_t mask, uint8_t mode) { uint16_t intcon = 0, defval = 0; @@ -702,7 +703,6 @@ bool MCP23017::disableInterrupt8(uint8_t port, uint8_t mask) _error = MCP23017_PORT_ERROR; return false; } - return writeReg(port == 0 ? MCP23x17_GPINTEN_A : MCP23x17_GPINTEN_B, ~mask); } diff --git a/MCP23017.h b/MCP23017.h index ea068e3..d827f22 100644 --- a/MCP23017.h +++ b/MCP23017.h @@ -2,12 +2,12 @@ // // FILE: MCP23017.h // AUTHOR: Rob Tillaart -// VERSION: 0.8.0 +// VERSION: 0.8.1 // PURPOSE: Arduino library for I2C MCP23017 16 channel port expander // DATE: 2019-10-12 // URL: https://github.com/RobTillaart/MCP23017_RT // -// WARNING: please read REV D note in readme.md +// WARNING: please read REV D note in readme.md // about pin 7 and 15 and INPUT mode. @@ -16,7 +16,7 @@ #include "MCP23x17_registers.h" -#define MCP23017_LIB_VERSION (F("0.8.0")) +#define MCP23017_LIB_VERSION (F("0.8.1")) #define MCP23017_OK 0x00 #define MCP23017_PIN_ERROR 0x81 @@ -96,7 +96,7 @@ class MCP23017 // which pins caused the INT? uint16_t getInterruptFlagRegister(); uint16_t getInterruptCaptureRegister(); - uint8_t getInterruptCaptureRegister8(uint8_t port); + uint8_t getInterruptCaptureRegister8(uint8_t port); // polarity: 0 = LOW, 1 = HIGH, 2 = NONE/ODR bool setInterruptPolarity(uint8_t polarity); diff --git a/README.md b/README.md index e03166e..68f894d 100644 --- a/README.md +++ b/README.md @@ -143,6 +143,10 @@ too if they are behind the multiplexer. - https://github.com/RobTillaart/MCP23S08 - https://github.com/RobTillaart/PCF8574 +Keypad + +- https://github.com/AndreKlang/mcp23017-4x4-keypad + ## Interface @@ -228,9 +232,18 @@ Returns true if successful. Returns MCP23017_PIN_ERROR if pin > 15. +8 pin interface, overrides all earlier settings. +Sets all pins to the same interrupt mode { RISING, FALLING, CHANGE }. +port = 0, 1 +mask = 0x00..0xFF. +- **bool enableInterrupt8(uint8_t port, uint8_t mask, uint8_t mode)** +- **bool disableInterrupt8(uint8_t port, uint8_t mask)** + + 16 pin interface, overrides all earlier settings. Sets all pins to the same interrupt mode { RISING, FALLING, CHANGE }. -- **bool enableInterrupt16(uint16_t mask, uint8_t mode)** mask = 0x0000..0xFFFF. +mask = 0x0000..0xFFFF. +- **bool enableInterrupt16(uint16_t mask, uint8_t mode)** - **bool disableInterrupt16(uint16_t mask)** @@ -238,9 +251,10 @@ Determine which pins caused the Interrupt. (datasheet). - **uint16_t getInterruptFlagRegister()** Reads all 16 pins. - **uint16_t getInterruptCaptureRegister()** Reads all 16 pins. Is used to detect if multiple pins triggered an interrupt. +- **uint8_t getInterruptCaptureRegister8(uint8_t port)** reads 8 pins of port. +Port == 0, 1 - -- **bool setInterruptPolarity(uint8_t ipol)** polarity: 0 = LOW, 1 = HIGH, 2 = NONE/ODR +- **bool setInterruptPolarity(uint8_t polarity)** polarity: 0 = LOW, 1 = HIGH, 2 = NONE/ODR - **uint8_t getInterruptPolarity()** return set value. diff --git a/keywords.txt b/keywords.txt index 47be071..51c5779 100644 --- a/keywords.txt +++ b/keywords.txt @@ -38,11 +38,15 @@ getPullup16 KEYWORD2 enableInterrupt KEYWORD2 disableInterrupt KEYWORD2 +enableInterrupt8 KEYWORD2 +disableInterrupt8 KEYWORD2 enableInterrupt16 KEYWORD2 disableInterrupt16 KEYWORD2 getInterruptFlagRegister KEYWORD2 getInterruptCaptureRegister KEYWORD2 +getInterruptCaptureRegister8 KEYWORD2 + setInterruptPolarity KEYWORD2 getInterruptPolarity KEYWORD2 @@ -54,6 +58,7 @@ lastError KEYWORD2 enableControlRegister KEYWORD2 disableControlRegister KEYWORD2 + # Instances (KEYWORD2) diff --git a/library.json b/library.json index 3bdc34c..ab8dff0 100644 --- a/library.json +++ b/library.json @@ -15,7 +15,7 @@ "type": "git", "url": "https://github.com/RobTillaart/MCP23017_RT.git" }, - "version": "0.8.0", + "version": "0.8.1", "license": "MIT", "frameworks": "*", "platforms": "*", diff --git a/library.properties b/library.properties index 754d9fa..a17f15c 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=MCP23017_RT -version=0.8.0 +version=0.8.1 author=Rob Tillaart maintainer=Rob Tillaart sentence=Arduino library for I2C MCP23017 16 channel port expander 16 IO-lines