Skip to content

Commit

Permalink
update readme.md
Browse files Browse the repository at this point in the history
  • Loading branch information
RobTillaart committed Jul 14, 2024
1 parent 17cad15 commit fe196f4
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 16 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).


## [0.4.1] - 2024-07-14
- update readme.md


## [0.4.0] - 2023-11-09
- simplify begin()
- added I2Ckeypad_Wire1_ESP32.ino
Expand Down
16 changes: 8 additions & 8 deletions I2CKeyPad .cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//
// FILE: I2CKeyPad.cpp
// AUTHOR: Rob Tillaart
// VERSION: 0.4.0
// VERSION: 0.4.1
// PURPOSE: Arduino library for 4x4 KeyPad connected to an I2C PCF8574
// URL: https://github.com/RobTillaart/I2CKeyPad

Expand Down Expand Up @@ -36,8 +36,8 @@ uint8_t I2CKeyPad::getKey()
}


uint8_t I2CKeyPad::getLastKey()
{
uint8_t I2CKeyPad::getLastKey()
{
return _lastKey;
};

Expand All @@ -59,14 +59,14 @@ bool I2CKeyPad::isConnected()


uint8_t I2CKeyPad::getChar()
{
return _keyMap[getKey()];
{
return _keyMap[getKey()];
};


uint8_t I2CKeyPad::getLastChar()
{
return _keyMap[_lastKey];
{
return _keyMap[_lastKey];
};


Expand All @@ -78,7 +78,7 @@ void I2CKeyPad::loadKeyMap(char * keyMap)

void I2CKeyPad::setKeyPadMode(uint8_t mode)
{
if ((mode == I2C_KEYPAD_5x3) ||
if ((mode == I2C_KEYPAD_5x3) ||
(mode == I2C_KEYPAD_6x2) ||
(mode == I2C_KEYPAD_8x1))
{
Expand Down
4 changes: 2 additions & 2 deletions I2CKeyPad.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//
// FILE: I2CKeyPad.h
// AUTHOR: Rob Tillaart
// VERSION: 0.4.0
// VERSION: 0.4.1
// PURPOSE: Arduino library for 4x4 KeyPad connected to an I2C PCF8574
// URL: https://github.com/RobTillaart/I2CKeyPad

Expand All @@ -11,7 +11,7 @@
#include "Wire.h"


#define I2C_KEYPAD_LIB_VERSION (F("0.4.0"))
#define I2C_KEYPAD_LIB_VERSION (F("0.4.1"))

#define I2C_KEYPAD_NOKEY 16
#define I2C_KEYPAD_FAIL 17
Expand Down
40 changes: 36 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ Since 0.3.2 the library allows a 5x3, 6x2 or 8x1 or smaller keypad to be connect

Relates strongly to https://github.com/RobTillaart/I2CKeyPad8x8. which is an 8x8 version using **PCF8575**.

- https://github.com/RobTillaart/PCF8574
- https://github.com/RobTillaart/AnalogKeypad
- https://github.com/RobTillaart/I2CKeyPad8x8
- https://github.com/WK-Software56/AdvKeyPad (derived work with keyboard alike interface)
Expand Down Expand Up @@ -52,13 +53,44 @@ It might take some trying to get the correct pins connected.
```


## I2C

### I2C addresses

This library uses a PCF8574 or a PCF8574A chip.
These devices are identical in behaviour although there are two distinct address ranges.

| Type | Address-range | Notes |
|:-----------|:---------------:|:-------------------------:|
| PCF8574 | 0x20 to 0x27 | same range as PCF8575 ! |
| PCF8574A | 0x38 to 0x3F |


### I2C multiplexing

Sometimes you need to control more devices than possible with the default
address range the device provides.
This is possible with an I2C multiplexer e.g. TCA9548 which creates up
to eight channels (think of it as I2C subnets) which can use the complete
address range of the device.

Drawback of using a multiplexer is that it takes more administration in
your code e.g. which device is on which channel.
This will slow down the access, which must be taken into account when
deciding which devices are on which channel.
Also note that switching between channels will slow down other devices
too if they are behind the multiplexer.

- https://github.com/RobTillaart/TCA9548


## Interface

```cpp
#include "I2CKeyPad.h"
```

#### Base
### Base

- **I2CKeyPad(const uint8_t deviceAddress, TwoWire \*wire = &Wire)**
The constructor sets the device address and optionally
Expand All @@ -73,7 +105,7 @@ Returns 16 if no key is pressed and 17 in case of an error.
however it is not checked if multiple keys are pressed.


#### Mode functions
### Mode functions

Note: experimental

Expand All @@ -95,7 +127,7 @@ E.g. a 4x3 keypad can be read in mode 4x4 or in mode 5x3.
| 8x1 | 81 | I2C_KEYPAD_8x1 | not real matrix, connect pins to switch to GND.


#### KeyMap functions
### KeyMap functions

**loadKeyMap()** must be called before **getChar()** and **getLastChar()**!

Expand Down Expand Up @@ -127,7 +159,7 @@ The length is **NOT** checked upon loading.
Note: The 5x3, 6x2 and the 8x1 modi also uses a keymap of length 18.


#### Basic working
### Basic working

After the **keypad.begin()** the sketch calls the **keyPad.getKey()** to read values from the keypad.
- If no key is pressed **I2CKEYPAD_NOKEY** code (16) is returned.
Expand Down
2 changes: 1 addition & 1 deletion library.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"type": "git",
"url": "https://github.com/RobTillaart/I2CKeyPad.git"
},
"version": "0.4.0",
"version": "0.4.1",
"license": "MIT",
"frameworks": "*",
"platforms": "*",
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=I2CKeyPad
version=0.4.0
version=0.4.1
author=Rob Tillaart <[email protected]>
maintainer=Rob Tillaart <[email protected]>
sentence=Arduino library for a KeyPad connected to a PCF8574.
Expand Down

0 comments on commit fe196f4

Please sign in to comment.