mirror of
https://github.com/xreef/PCF8574_library.git
synced 2024-08-30 18:12:18 +00:00
Adding integration for Arduino SMT32 #8
This commit is contained in:
@ -22,7 +22,7 @@ PCF8574::PCF8574(uint8_t address, uint8_t interruptPin, void (*interruptFunctio
|
|||||||
_usingInterrupt = true;
|
_usingInterrupt = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifndef __AVR
|
#if !defined(__AVR) && !defined(STM32F1)
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
* @param address: i2c address
|
* @param address: i2c address
|
||||||
@ -59,16 +59,16 @@ PCF8574::PCF8574(uint8_t address, uint8_t interruptPin, void (*interruptFunctio
|
|||||||
* wake up i2c controller
|
* wake up i2c controller
|
||||||
*/
|
*/
|
||||||
void PCF8574::begin(){
|
void PCF8574::begin(){
|
||||||
#ifndef __AVR
|
#if !defined(__AVR) && !defined(STM32F1)
|
||||||
Wire.begin(_sda, _scl);
|
Wire.begin(_sda, _scl);
|
||||||
#else
|
#else
|
||||||
// Default pin for AVR some problem on software emulation
|
// Default pin for AVR and Arduino STM32 some problem on software emulation
|
||||||
// #define SCL_PIN _scl
|
// #define SCL_PIN _scl
|
||||||
// #define SDA_PIN _sda
|
// #define SDA_PIN _sda
|
||||||
Wire.begin();
|
Wire.begin();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Che if there are pins to set low
|
// Check if there are pins to set low
|
||||||
if (writeMode>0 || readMode>0){
|
if (writeMode>0 || readMode>0){
|
||||||
DEBUG_PRINTLN("Set write mode");
|
DEBUG_PRINTLN("Set write mode");
|
||||||
Wire.beginTransmission(_address);
|
Wire.beginTransmission(_address);
|
||||||
|
@ -91,8 +91,14 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
uint8_t _address;
|
uint8_t _address;
|
||||||
|
|
||||||
|
#if !defined(__AVR) && !defined(STM32F1)
|
||||||
|
uint8_t _sda;
|
||||||
|
uint8_t _scl;
|
||||||
|
#else
|
||||||
uint8_t _sda = SDA;
|
uint8_t _sda = SDA;
|
||||||
uint8_t _scl = SCL;
|
uint8_t _scl = SCL;
|
||||||
|
#endif
|
||||||
|
|
||||||
bool _usingInterrupt = false;
|
bool _usingInterrupt = false;
|
||||||
uint8_t _interruptPin = 2;
|
uint8_t _interruptPin = 2;
|
||||||
|
Reference in New Issue
Block a user