Adding integration for Arduino SMT32 #8

This commit is contained in:
Renzo
2018-09-21 11:36:04 +02:00
parent 3d8298da47
commit d1abfb5f75
2 changed files with 12 additions and 6 deletions

View File

@ -22,7 +22,7 @@ PCF8574::PCF8574(uint8_t address, uint8_t interruptPin, void (*interruptFunctio
_usingInterrupt = true;
};
#ifndef __AVR
#if !defined(__AVR) && !defined(STM32F1)
/**
* Constructor
* @param address: i2c address
@ -59,16 +59,16 @@ PCF8574::PCF8574(uint8_t address, uint8_t interruptPin, void (*interruptFunctio
* wake up i2c controller
*/
void PCF8574::begin(){
#ifndef __AVR
#if !defined(__AVR) && !defined(STM32F1)
Wire.begin(_sda, _scl);
#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 SDA_PIN _sda
Wire.begin();
#endif
// Che if there are pins to set low
// Check if there are pins to set low
if (writeMode>0 || readMode>0){
DEBUG_PRINTLN("Set write mode");
Wire.beginTransmission(_address);

View File

@ -91,8 +91,14 @@ public:
private:
uint8_t _address;
#if !defined(__AVR) && !defined(STM32F1)
uint8_t _sda;
uint8_t _scl;
#else
uint8_t _sda = SDA;
uint8_t _scl = SCL;
#endif
bool _usingInterrupt = false;
uint8_t _interruptPin = 2;