@@ -223,11 +223,11 @@ class DeviceI2C {
223
223
{ addr = me << 1 ; }
224
224
};
225
225
226
- // The millisecond timer can be used for timeouts up to 60000 milliseconds.
227
- // Setting the timeout to zero disables the timer.
228
- //
229
- // for periodic timeouts, poll the timer object with "if (timer.poll(123)) ..."
230
- // for one-shot timeouts, call "timer.set(123)" and poll as "if (timer.poll())"
226
+ // / The millisecond timer can be used for timeouts up to 60000 milliseconds.
227
+ // / Setting the timeout to zero disables the timer.
228
+ // /
229
+ // / for periodic timeouts, poll the timer object with "if (timer.poll(123)) ..."
230
+ // / for one-shot timeouts, call "timer.set(123)" and poll as "if (timer.poll())"
231
231
232
232
class MilliTimer {
233
233
word next;
@@ -241,47 +241,47 @@ class MilliTimer {
241
241
void set (word ms);
242
242
};
243
243
244
- // Low-power utility code using the Watchdog Timer (WDT). Requires a WDT interrupt handler, e.g.
245
- // EMPTY_INTERRUPT(WDT_vect);
244
+ // / Low-power utility code using the Watchdog Timer (WDT). Requires a WDT interrupt handler, e.g.
245
+ // / EMPTY_INTERRUPT(WDT_vect);
246
246
class Sleepy {
247
247
public:
248
- // start the watchdog timer (or disable it if mode < 0)
248
+ // / start the watchdog timer (or disable it if mode < 0)
249
249
static void watchdogInterrupts (char mode);
250
250
251
- // enter low-power mode, wake up with watchdog, INT0/1, or pin-change
251
+ // / enter low-power mode, wake up with watchdog, INT0/1, or pin-change
252
252
static void powerDown ();
253
253
254
- // spend some time in low-power mode, the timing is only approximate
255
- // returns 1 if all went normally, or 0 if some other interrupt occurred
254
+ // / spend some time in low-power mode, the timing is only approximate
255
+ // / returns 1 if all went normally, or 0 if some other interrupt occurred
256
256
static byte loseSomeTime (word msecs);
257
257
258
- // this must be called from your watchdog interrupt code
258
+ // / this must be called from your watchdog interrupt code
259
259
static void watchdogEvent ();
260
260
};
261
261
262
- // simple task scheduler for times up to 6000 seconds
262
+ // / simple task scheduler for times up to 6000 seconds
263
263
class Scheduler {
264
264
word* tasks;
265
265
word remaining;
266
266
byte maxTasks;
267
267
MilliTimer ms100;
268
268
public:
269
- // initialize for a specified maximum number of tasks
269
+ // / initialize for a specified maximum number of tasks
270
270
Scheduler (byte max);
271
271
Scheduler (word* buf, byte max);
272
272
273
- // return next task to run, -1 if there are none ready to run, but there are tasks waiting, or -2 if there are no tasks waiting (i.e. all are idle)
273
+ // / return next task to run, -1 if there are none ready to run, but there are tasks waiting, or -2 if there are no tasks waiting (i.e. all are idle)
274
274
char poll ();
275
- // same as poll, but wait for event in power-down mode.
276
- // Uses Sleepy::loseSomeTime() - see comments there re requiring the watchdog timer.
275
+ // / same as poll, but wait for event in power-down mode.
276
+ // / Uses Sleepy::loseSomeTime() - see comments there re requiring the watchdog timer.
277
277
char pollWaiting ();
278
278
279
- // set a task timer, in tenths of seconds
279
+ // / set a task timer, in tenths of seconds
280
280
void timer (byte task, word tenths);
281
- // cancel a task timer
281
+ // / cancel a task timer
282
282
void cancel (byte task);
283
283
284
- // return true if a task timer is not running
284
+ // / return true if a task timer is not running
285
285
byte idle (byte task) { return tasks[task] == ~0 ; }
286
286
};
287
287
@@ -307,7 +307,7 @@ class BlinkPlug : public Port {
307
307
byte buttonCheck ();
308
308
};
309
309
310
- // interface for the Memory Plug - see http://jeelabs.org/mp1
310
+ // /Interface for the Memory Plug - see http://jeelabs.org/mp1
311
311
class MemoryPlug : public DeviceI2C {
312
312
uint32_t nextSave;
313
313
public:
@@ -354,7 +354,7 @@ class UartPlug : public Print {
354
354
virtual WRITE_RESULT write (byte);
355
355
};
356
356
357
- // interface for the Dimmer Plug - see http://jeelabs.org/dp1
357
+ // / Interface for the Dimmer Plug - see http://jeelabs.org/dp1
358
358
class DimmerPlug : public DeviceI2C {
359
359
public:
360
360
enum {
@@ -467,7 +467,7 @@ class InfraredPlug : public Port {
467
467
void send (const uint8_t * data, uint16_t bits);
468
468
};
469
469
470
- // interface for the Heading Board - see http://jeelabs.org/hb1
470
+ // / Interface for the Heading Board - see http://jeelabs.org/hb1
471
471
class HeadingBoard : public PortI2C {
472
472
DeviceI2C eeprom, adc, compass;
473
473
Port aux;
@@ -489,8 +489,8 @@ class HeadingBoard : public PortI2C {
489
489
void heading (int & xaxis, int & yaxis);
490
490
};
491
491
492
- // interface for the Modern Device 3-axis Compass board
493
- // see http://shop.moderndevice.com/products/3-axis-compass
492
+ // / Interface for the Modern Device 3-axis Compass board
493
+ // / see http://shop.moderndevice.com/products/3-axis-compass
494
494
class CompassBoard : public DeviceI2C {
495
495
int read2 (byte last);
496
496
public:
@@ -499,7 +499,7 @@ class CompassBoard : public DeviceI2C {
499
499
float heading ();
500
500
};
501
501
502
- // interface for the Proximity Plug - see http://jeelabs.org/yp1
502
+ // / Interface for the Proximity Plug - see http://jeelabs.org/yp1
503
503
class ProximityPlug : public DeviceI2C {
504
504
public:
505
505
enum {
@@ -518,33 +518,33 @@ class ProximityPlug : public DeviceI2C {
518
518
byte getReg (byte reg) const ;
519
519
};
520
520
521
- // interface for the Analog Plug - see http://jeelabs.org/ap2
521
+ // / Interface for the Analog Plug - see http://jeelabs.org/ap2
522
522
class AnalogPlug : public DeviceI2C {
523
523
byte config;
524
524
public:
525
525
AnalogPlug (const PortI2C& port, byte addr =0x69 )
526
526
: DeviceI2C (port, addr), config (0x1C ) {}
527
527
528
- // default mode is channel 1, continuous, 18-bit, gain x1
528
+ // / Default mode is channel 1, continuous, 18-bit, gain x1
529
529
void begin (byte mode =0x1C );
530
- // select a channel (1..4), must wait to read it out (up to 270 ms for 18-bit)
530
+ // / Select a channel (1..4), must wait to read it out (up to 270 ms for 18-bit)
531
531
void select (byte channel);
532
- // read out 4 bytes, caller will need to shift out the irrelevant lower bits
532
+ // / Read out 4 bytes, caller will need to shift out the irrelevant lower bits
533
533
long reading ();
534
534
};
535
535
536
- // interface for the DHT11 and DHT22 sensors, does not use floating point
536
+ // / Interface for the DHT11 and DHT22 sensors, does not use floating point
537
537
class DHTxx {
538
538
byte pin;
539
539
public:
540
540
DHTxx (byte pinNum);
541
- // results are returned in tenths of a degree and percent, respectively
541
+ // / Results are returned in tenths of a degree and percent, respectively
542
542
bool reading (int & temp, int &humi);
543
543
};
544
544
545
545
#ifdef Stream_h // only available in recent Arduino IDE versions
546
546
547
- // simple parser for input data and one-letter commands
547
+ // / Simple parser for input data and one-letter commands
548
548
class InputParser {
549
549
public:
550
550
typedef struct {
@@ -553,14 +553,14 @@ class InputParser {
553
553
void (*fun)(); // code to call for this command
554
554
} Commands;
555
555
556
- // set up with a buffer of specified size
556
+ // / Set up with a buffer of specified size
557
557
InputParser (byte size, Commands PROGMEM*, Stream& =Serial);
558
558
InputParser (byte* buf, byte size, Commands PROGMEM*, Stream& =Serial);
559
559
560
- // number of data bytes
560
+ // / Number of data bytes
561
561
byte count () { return fill; }
562
562
563
- // call this frequently to check for incoming data
563
+ // / Call this frequently to check for incoming data
564
564
void poll ();
565
565
566
566
InputParser& operator >> (char & v) { return get (&v, 1 ); }
0 commit comments