0.1.2 MCP23008

This commit is contained in:
rob tillaart 2022-11-17 16:12:58 +01:00
parent 2da9513a7e
commit f79717e15d
7 changed files with 67 additions and 33 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,23 @@
# Change Log MCP23008
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.2] - 2022-11-17
- add RP2040 in build-CI
- add changelog.md
- minor edit readme.md
- update datasheet page numbers of registers MCP23008.cpp
## [0.1.1] - 2022-09-28
- optimize digitalWrite() - as that is the most used one
## [0.1.0] - 2022-01-10
- initial version released
## [0.0.0] - 2019-10-12
- pre release

View File

@ -1,32 +1,27 @@
//
// FILE: MCP23008.cpp
// AUTHOR: Rob Tillaart
// VERSION: 0.1.1
// VERSION: 0.1.2
// PURPOSE: Arduino library for I2C MCP23008 8 channel port expander
// DATE: 2019-10-12
// URL: https://github.com/RobTillaart/MCP23008
//
// HISTORY:
// 0.1.0 2022-01-10 initial version
// 0.1.1 2022-09-28 optimize digitalWrite() [as that is the most used one]
#include "MCP23008.h"
// Registers // description datasheet
#define MCP23008_DDR_A 0x00 // Data Direction Register A P
#define MCP23008_POL_A 0x01 // Input Polarity A P
#define MCP23008_GPINTEN_A 0x02 // NOT USED interrupt enable P
#define MCP23008_DEFVAL_A 0x03 // NOT USED interrupt def P
#define MCP23008_INTCON_A 0x04 // NOT USED interrupt control P
#define MCP23008_IOCR 0x05 // IO control register P
#define MCP23008_PUR_A 0x06 // Pull Up Resistors A P
#define MCP23008_INTF_A 0x07 // NOT USED interrupt flag P
#define MCP23008_INTCAP_A 0x08 // NOT USED interrupt capture P
#define MCP23008_GPIO_A 0x09 // General Purpose IO A P
#define MCP23008_OLAT_A 0x0A // NOT USED output latch P
// Registers // DESCRIPTION DATASHEET
#define MCP23008_DDR_A 0x00 // Data Direction Register A P 10
#define MCP23008_POL_A 0x01 // Input Polarity A P 11
#define MCP23008_GPINTEN_A 0x02 // NOT USED interrupt enable P 12
#define MCP23008_DEFVAL_A 0x03 // NOT USED interrupt def P 13
#define MCP23008_INTCON_A 0x04 // NOT USED interrupt control P 14
#define MCP23008_IOCR 0x05 // IO control register P 15
#define MCP23008_PUR_A 0x06 // Pull Up Resistors A P 16
#define MCP23008_INTF_A 0x07 // NOT USED interrupt flag P 17
#define MCP23008_INTCAP_A 0x08 // NOT USED interrupt capture P 18
#define MCP23008_GPIO_A 0x09 // General Purpose IO A P 19
#define MCP23008_OLAT_A 0x0A // NOT USED output latch P 20
MCP23008::MCP23008(uint8_t address, TwoWire *wire)

View File

@ -2,7 +2,7 @@
//
// FILE: MCP23008.h
// AUTHOR: Rob Tillaart
// VERSION: 0.1.1
// VERSION: 0.1.2
// PURPOSE: Arduino library for I2C MCP23008 16 channel port expander
// DATE: 2022-01-10
// URL: https://github.com/RobTillaart/MCP23008
@ -12,7 +12,7 @@
#include "Wire.h"
#define MCP23008_LIB_VERSION (F("0.1.1"))
#define MCP23008_LIB_VERSION (F("0.1.2"))
#define MCP23008_OK 0x00
#define MCP23008_PIN_ERROR 0x81
@ -36,8 +36,8 @@ public:
bool isConnected();
// single pin interface
// mode = INPUT, OUTPUT or INPUT_PULLUP (==INPUT)
// single pin interface
// mode = INPUT, OUTPUT or INPUT_PULLUP (== INPUT)
bool pinMode(uint8_t pin, uint8_t mode);
bool digitalWrite(uint8_t pin, uint8_t value);
uint8_t digitalRead(uint8_t pin);
@ -48,8 +48,8 @@ public:
bool getPullup(uint8_t pin, bool &pullup);
// 8 pins interface
// value = bit pattern
// 8 pins interface
// value = bit pattern
bool pinMode8(uint8_t value);
bool write8(uint8_t value);
int read8();

View File

@ -62,13 +62,13 @@ If one of the above functions return false, there might be an error.
- **int lastError()** Above functions set an error flag that can be read with this function.
Reading it will reset the flag to **MCP23008_OK**.
| DESCRIPTION | VALUE |
|:----------------------|:-----:|
| MCP23008_OK | 0x00 |
| MCP23008_PIN_ERROR | 0x81 |
| MCP23008_I2C_ERROR | 0x82 |
| MCP23008_VALUE_ERROR | 0x83 |
| MCP23008_PORT_ERROR | 0x84 |
| DESCRIPTION | VALUE |
|:-----------------------|:-------:|
| MCP23008_OK | 0x00 |
| MCP23008_PIN_ERROR | 0x81 |
| MCP23008_I2C_ERROR | 0x82 |
| MCP23008_VALUE_ERROR | 0x83 |
| MCP23008_PORT_ERROR | 0x84 |
## Operation

View File

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

View File

@ -1,5 +1,5 @@
name=MCP23008
version=0.1.1
version=0.1.2
author=Rob Tillaart <rob.tillaart@gmail.com>
maintainer=Rob Tillaart <rob.tillaart@gmail.com>
sentence=Arduino library for I2C MCP23008 8 channel port expander 8 IO-lines