Skip to content

Commit df16b0d

Browse files
committed
Gets library compiling for particle.io photon
Main changes: - arraySize was renamed since particle defines a macro named arraySize - Added a new flavor of attachInterrupt for particle which takes InterruptMode
1 parent bca8d8d commit df16b0d

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

src/TaskBlock.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,31 +28,31 @@ class TaskBlock {
2828
private:
2929
TimerTask tasks[DEFAULT_TASK_SIZE];
3030
const taskid_t first;
31-
const taskid_t arraySize;
31+
const taskid_t tasksSize;
3232
public:
33-
explicit TaskBlock(taskid_t first_) : first(first_), arraySize(DEFAULT_TASK_SIZE) {}
33+
explicit TaskBlock(taskid_t first_) : first(first_), tasksSize(DEFAULT_TASK_SIZE) {}
3434

3535
/**
3636
* Checks if taskId is contained within this block
3737
* @param task the task ID to check
3838
* @return true if contained, otherwise false
3939
*/
4040
bool isTaskContained(taskid_t task) const {
41-
return task >= first && task < (first + arraySize);
41+
return task >= first && task < (first + tasksSize);
4242
};
4343

4444
TimerTask* getContainedTask(taskid_t task) {
4545
return isTaskContained(task) ? &tasks[task - first] : nullptr;
4646
}
4747

4848
void clearAll() {
49-
for(taskid_t i=0; i<arraySize;i++) {
49+
for(taskid_t i=0; i<tasksSize;i++) {
5050
tasks[i].clear();
5151
}
5252
}
5353

5454
taskid_t allocateTask() {
55-
for(taskid_t i=0; i<arraySize; i++) {
55+
for(taskid_t i=0; i<tasksSize; i++) {
5656
if(tasks[i].allocateIfPossible()) {
5757
return i + first;
5858
}
@@ -61,7 +61,7 @@ class TaskBlock {
6161
}
6262

6363
taskid_t lastSlot() const {
64-
return first + arraySize - 1;
64+
return first + tasksSize - 1;
6565
}
6666

6767
taskid_t firstSlot() const {

src/TaskManagerIO.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010
#include "TaskTypes.h"
1111
#include "TaskBlock.h"
1212

13+
#ifdef PARTICLE
14+
enum InterruptMode;
15+
#endif // PARTICLE
16+
1317
/**
1418
* @file TaskManagerIO.h
1519
*
@@ -74,8 +78,10 @@ class InterruptAbstraction {
7478
*/
7579
class BasicArduinoInterruptAbstraction : public InterruptAbstraction {
7680
void attachInterrupt(pintype_t pin, RawIntHandler fn, uint8_t mode) override {
77-
#ifdef ARDUINO_MBED_MODE
81+
#if defined(ARDUINO_MBED_MODE)
7882
::attachInterrupt(pin, fn, (PinStatus)mode);
83+
#elif defined(PARTICLE)
84+
::attachInterrupt(pin, fn, (InterruptMode)mode);
7985
#else
8086
::attachInterrupt(pin, fn, mode);
8187
#endif // ARDUINO_MBED_MODE

0 commit comments

Comments
 (0)