Skip to content

Commit

Permalink
Add the possibility to insert address at begin() function
Browse files Browse the repository at this point in the history
  • Loading branch information
xreef committed Feb 1, 2024
1 parent f3d3022 commit 9227291
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 4 deletions.
5 changes: 5 additions & 0 deletions PCF8591.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,11 @@ PCF8591::PCF8591(uint8_t address, int sda, int scl){
//
//#endif

void PCF8591::begin(uint8_t address){
_address = address;
return PCF8591::begin();
}

/**
* wake up i2c controller
*/
Expand Down
4 changes: 2 additions & 2 deletions PCF8591.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,14 +112,14 @@ class PCF8591 {
//
//#endif

void begin(void);
void begin();
void begin(uint8_t address);
struct AnalogInput analogReadAll(byte readType = SINGLE_ENDED_INPUT);
uint8_t analogRead(uint8_t channel, byte readType = SINGLE_ENDED_INPUT);
void analogWrite(uint8_t value);

void voltageWrite(float value, bool microcontrollerReferenceVoltage = true, float referenceVoltage = 5.0);
float voltageRead(uint8_t analogPin, bool microcontrollerReferenceVoltage = true, float referenceVoltage = 5.0);

private:
TwoWire *_wire;

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ You can find updated version of documentation on my site​ [PCF8591](https://ww

Library to use i2c analog IC with arduino and esp8266. Can read analog value and write analog value with only 2 wire (perfect for ESP-01).

- 01/02/2024: v1.1.2 Add the possibility to insert address at begin() function
- 10/07/2023: v1.1.1 Add support for Arduino UNO R4
- 16/02/2023: v1.1.0
- Fix STM32 support and add support for Raspberry Pi Pico and other rp2040 boards
Expand Down
2 changes: 1 addition & 1 deletion library.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "PCF8591 library",
"version": "1.1.1",
"version": "1.1.2",
"keywords": "analog, digital, i2c, encoder, expander, pcf8591, pcf8591a, esp32, esp8266, stm32, SAMD, Arduino, wire, Raspberry, rp2040",
"description": "PCF8591 library. i2c digital expander for i2c digital expander for Arduino, Raspberry Pi Pico and rp2040 boards, esp32, SMT32 and ESP8266. Can read write digital values with only 2 wire. Very simple to use and encoder support.",
"homepage": "https://www.mischianti.org/2019/01/03/pcf8591-i2c-analog-i-o-expander/",
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=PCF8591 library
version=1.1.1
version=1.1.2
author=Renzo Mischianti <[email protected]>
maintainer=Renzo Mischianti <[email protected]>
sentence=PCF8591, library for Arduino, Raspberry Pi Pico and rp2040 boards, esp32, SMT32 and ESP8266.
Expand Down

0 comments on commit 9227291

Please sign in to comment.