Skip to content

Commit 2a2f031

Browse files
...
1 parent a6a6200 commit 2a2f031

File tree

11 files changed

+445
-413
lines changed

11 files changed

+445
-413
lines changed

examples/Timer/Timer.ino

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,34 @@
1-
#include "Timer.h"
1+
#include <Timer.h>
2+
3+
#define SECOND 1000
4+
#define MINUTE 60 * SECOND
5+
#define HOUR 60 * SECOND
6+
7+
void second()
8+
{
9+
Serial.println("Tick");
10+
}
11+
12+
void minute()
13+
{
14+
Serial.println("It has been a minute.");
15+
}
16+
17+
void wake()
18+
{
19+
Serial.println("Time to wake!")
20+
}
21+
22+
void setup()
23+
{
24+
Serial.begin(9600);
25+
26+
Timer.alarm(wake, HOUR);
27+
Timer.repeat(second, SECOND);
28+
Timer.repeat(minute, MINUTE);
29+
}
30+
31+
void loop()
32+
{
33+
Timer.run();
34+
}

library.json

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ArduinoLibrary",
3-
"keywords": "arduino, button, led_matrix, led, list, relay, timer",
3+
"keywords": "arduino, button, led, list, relay, timer",
44
"description": "A collection of objects and utilities for the Arduino.",
55
"repository": {
66
"type": "git",
@@ -10,20 +10,13 @@
1010
{
1111
"name": "Jonathan Meyer",
1212
"email": "[email protected]",
13-
"url": "http://stejsoftware.com",
13+
"url": "https://github.com/stejsoftware/ArduinoLibrary",
1414
"maintainer": true
1515
}
1616
],
17-
"dependencies": [
18-
{
19-
"name": "Adafruit LED Backpack Library",
20-
"frameworks": "arduino"
21-
},
22-
{
23-
"name": "Adafruit GFX Library",
24-
"frameworks": "arduino"
25-
}
26-
],
27-
"version": "1.0.1",
28-
"frameworks": "arduino"
17+
"dependencies": [],
18+
"version": "2.0.0",
19+
"excelude": "tests",
20+
"frameworks": "arduino",
21+
"platforms": ["atmelavr", "espressif"]
2922
}

library.properties

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
name=ArduinoLibrary
2+
version=2.0.0
3+
author=Jonathan Meyer <[email protected]>
4+
maintainer=Jonathan Meyer <[email protected]>
5+
sentence=A collection of objects and utilities for the Arduino.
6+
paragraph=A collection of objects and utilities for the Arduino.
7+
category=Utility
8+
url=https://github.com/stejsoftware/ArduinoLibrary
9+
architectures=*
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Lines changed: 107 additions & 107 deletions
Original file line numberDiff line numberDiff line change
@@ -1,107 +1,107 @@
1-
#ifndef __List_h_
2-
#define __List_h_
3-
4-
#include <Arduino.h>
5-
6-
template<class T>
7-
class Node
8-
{
9-
public:
10-
Node(T item) :
11-
next(NULL),
12-
_item(item)
13-
{
14-
}
15-
16-
~Node()
17-
{
18-
}
19-
20-
T item() const
21-
{
22-
return _item;
23-
}
24-
25-
Node * next;
26-
27-
private:
28-
Node(const Node & rhs);
29-
Node & operator=(const Node & rhs);
30-
31-
T _item;
32-
};
33-
34-
template<class T>
35-
class List
36-
{
37-
public:
38-
List()
39-
{
40-
}
41-
42-
~List()
43-
{
44-
T item;
45-
46-
while (pop(item))
47-
{
48-
}
49-
}
50-
51-
bool push(T item)
52-
{
53-
Node<T> * node = new Node<T>(item);
54-
55-
if (node != NULL)
56-
{
57-
// the list is empty
58-
if (m_begin == NULL)
59-
{
60-
m_begin = node;
61-
}
62-
// the list has items
63-
else
64-
{
65-
// find the end of the list
66-
Node<T> * end = m_begin;
67-
68-
while (end->next != NULL)
69-
{
70-
end = end->next;
71-
}
72-
73-
end->next = node;
74-
}
75-
76-
return true;
77-
}
78-
79-
return false;
80-
}
81-
82-
bool pop(T & item)
83-
{
84-
Node<T> * node = m_begin;
85-
86-
if (node != NULL)
87-
{
88-
item = node->item();
89-
m_begin = node->next;
90-
91-
delete node;
92-
93-
return true;
94-
}
95-
96-
return false;
97-
}
98-
99-
private:
100-
List(const List&rhs);
101-
List & operator=(const List&rhs);
102-
103-
Node<T> * m_begin;
104-
105-
};
106-
107-
#endif // __List_h_
1+
#ifndef __List_h_
2+
#define __List_h_
3+
4+
#include <Arduino.h>
5+
6+
template<class T>
7+
class Node
8+
{
9+
public:
10+
Node(T item) :
11+
next(NULL),
12+
_item(item)
13+
{
14+
}
15+
16+
~Node()
17+
{
18+
}
19+
20+
T item() const
21+
{
22+
return _item;
23+
}
24+
25+
Node * next;
26+
27+
private:
28+
Node(const Node & rhs);
29+
Node & operator=(const Node & rhs);
30+
31+
T _item;
32+
};
33+
34+
template<class T>
35+
class List
36+
{
37+
public:
38+
List()
39+
{
40+
}
41+
42+
~List()
43+
{
44+
T item;
45+
46+
while (pop(item))
47+
{
48+
}
49+
}
50+
51+
bool push(T item)
52+
{
53+
Node<T> * node = new Node<T>(item);
54+
55+
if (node != NULL)
56+
{
57+
// the list is empty
58+
if (m_begin == NULL)
59+
{
60+
m_begin = node;
61+
}
62+
// the list has items
63+
else
64+
{
65+
// find the end of the list
66+
Node<T> * end = m_begin;
67+
68+
while (end->next != NULL)
69+
{
70+
end = end->next;
71+
}
72+
73+
end->next = node;
74+
}
75+
76+
return true;
77+
}
78+
79+
return false;
80+
}
81+
82+
bool pop(T & item)
83+
{
84+
Node<T> * node = m_begin;
85+
86+
if (node != NULL)
87+
{
88+
item = node->item();
89+
m_begin = node->next;
90+
91+
delete node;
92+
93+
return true;
94+
}
95+
96+
return false;
97+
}
98+
99+
private:
100+
List(const List&rhs);
101+
List & operator=(const List&rhs);
102+
103+
Node<T> * m_begin;
104+
105+
};
106+
107+
#endif // __List_h_

0 commit comments

Comments
 (0)