Skip to content

Commit

Permalink
For ESP8266 special port register type
Browse files Browse the repository at this point in the history
  • Loading branch information
prampec committed May 7, 2017
1 parent 0eb6860 commit e057c68
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/BlinkTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*
* Author: Balazs Kelemen
* Contact: [email protected]
* Copyright: 2012 Balazs Kelemen
* Copyright: 2017 Balazs Kelemen
* Copying permission statement:
This file is part of SoftTimer.
Expand Down Expand Up @@ -34,8 +34,8 @@ void BlinkTask::init(byte outPin, unsigned long onMs, unsigned long offMs, byte
this->delayMs = delayMs;

pinMode(outPin, OUTPUT);
_bitMask = digitalPinToBitMask(outPin);
_portRegister = portOutputRegister(digitalPinToPort(outPin));
this->_bitMask = digitalPinToBitMask(outPin);
this->_portRegister = portOutputRegister(digitalPinToPort(outPin));

this->onLevel = HIGH;
}
Expand Down
6 changes: 5 additions & 1 deletion src/BlinkTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*
* Author: Balazs Kelemen
* Contact: [email protected]
* Copyright: 2012 Balazs Kelemen
* Copyright: 2017 Balazs Kelemen
* Copying permission statement:
This file is part of SoftTimer.
Expand Down Expand Up @@ -113,7 +113,11 @@ class BlinkTask : public Task
byte _state;

uint8_t _bitMask;
#ifndef ESP8266
volatile uint8_t *_portRegister;
#else
volatile uint32_t *_portRegister;
#endif
};

#endif
6 changes: 5 additions & 1 deletion src/FrequencyTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*
* Author: Balazs Kelemen
* Contact: [email protected]
* Copyright: 2012 Balazs Kelemen
* Copyright: 2017 Balazs Kelemen
* Copying permission statement:
This file is part of SoftTimer.
Expand Down Expand Up @@ -50,7 +50,11 @@ class FrequencyTask : public Task
private:
boolean _stateOn;
uint8_t _bitMask;
#ifndef ESP8266
volatile uint8_t *_portRegister;
#else
volatile uint32_t *_portRegister;
#endif
static void step(Task* me);
};

Expand Down
6 changes: 5 additions & 1 deletion src/SoftPwmTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*
* Author: Balazs Kelemen
* Contact: [email protected]
* Copyright: 2012 Balazs Kelemen
* Copyright: 2017 Balazs Kelemen
* Copying permission statement:
This file is part of SoftTimer.
Expand Down Expand Up @@ -62,7 +62,11 @@ class SoftPwmTask : public Task
static void step(Task* me);

uint8_t _bitMask;
#ifndef ESP8266
volatile uint8_t *_portRegister;
#else
volatile uint32_t *_portRegister;
#endif
};

#endif

0 comments on commit e057c68

Please sign in to comment.