Skip to content

Commit 2d1102a

Browse files
author
Jasper Klein
committed
Mainly formatting already existing comments to Doxygen format.
1 parent 7d90bc2 commit 2d1102a

File tree

7 files changed

+89
-64
lines changed

7 files changed

+89
-64
lines changed

Ports.h

+36-36
Original file line numberDiff line numberDiff line change
@@ -223,11 +223,11 @@ class DeviceI2C {
223223
{ addr = me << 1; }
224224
};
225225

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())"
231231

232232
class MilliTimer {
233233
word next;
@@ -241,47 +241,47 @@ class MilliTimer {
241241
void set(word ms);
242242
};
243243

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);
246246
class Sleepy {
247247
public:
248-
// start the watchdog timer (or disable it if mode < 0)
248+
/// start the watchdog timer (or disable it if mode < 0)
249249
static void watchdogInterrupts (char mode);
250250

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
252252
static void powerDown ();
253253

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
256256
static byte loseSomeTime (word msecs);
257257

258-
// this must be called from your watchdog interrupt code
258+
/// this must be called from your watchdog interrupt code
259259
static void watchdogEvent();
260260
};
261261

262-
// simple task scheduler for times up to 6000 seconds
262+
/// simple task scheduler for times up to 6000 seconds
263263
class Scheduler {
264264
word* tasks;
265265
word remaining;
266266
byte maxTasks;
267267
MilliTimer ms100;
268268
public:
269-
// initialize for a specified maximum number of tasks
269+
/// initialize for a specified maximum number of tasks
270270
Scheduler (byte max);
271271
Scheduler (word* buf, byte max);
272272

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)
274274
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.
277277
char pollWaiting();
278278

279-
// set a task timer, in tenths of seconds
279+
/// set a task timer, in tenths of seconds
280280
void timer(byte task, word tenths);
281-
// cancel a task timer
281+
/// cancel a task timer
282282
void cancel(byte task);
283283

284-
// return true if a task timer is not running
284+
/// return true if a task timer is not running
285285
byte idle(byte task) { return tasks[task] == ~0; }
286286
};
287287

@@ -307,7 +307,7 @@ class BlinkPlug : public Port {
307307
byte buttonCheck();
308308
};
309309

310-
// interface for the Memory Plug - see http://jeelabs.org/mp1
310+
///Interface for the Memory Plug - see http://jeelabs.org/mp1
311311
class MemoryPlug : public DeviceI2C {
312312
uint32_t nextSave;
313313
public:
@@ -354,7 +354,7 @@ class UartPlug : public Print {
354354
virtual WRITE_RESULT write(byte);
355355
};
356356

357-
// interface for the Dimmer Plug - see http://jeelabs.org/dp1
357+
/// Interface for the Dimmer Plug - see http://jeelabs.org/dp1
358358
class DimmerPlug : public DeviceI2C {
359359
public:
360360
enum {
@@ -467,7 +467,7 @@ class InfraredPlug : public Port {
467467
void send(const uint8_t* data, uint16_t bits);
468468
};
469469

470-
// interface for the Heading Board - see http://jeelabs.org/hb1
470+
/// Interface for the Heading Board - see http://jeelabs.org/hb1
471471
class HeadingBoard : public PortI2C {
472472
DeviceI2C eeprom, adc, compass;
473473
Port aux;
@@ -489,8 +489,8 @@ class HeadingBoard : public PortI2C {
489489
void heading(int& xaxis, int& yaxis);
490490
};
491491

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
494494
class CompassBoard : public DeviceI2C {
495495
int read2 (byte last);
496496
public:
@@ -499,7 +499,7 @@ class CompassBoard : public DeviceI2C {
499499
float heading();
500500
};
501501

502-
// interface for the Proximity Plug - see http://jeelabs.org/yp1
502+
/// Interface for the Proximity Plug - see http://jeelabs.org/yp1
503503
class ProximityPlug : public DeviceI2C {
504504
public:
505505
enum {
@@ -518,33 +518,33 @@ class ProximityPlug : public DeviceI2C {
518518
byte getReg(byte reg) const;
519519
};
520520

521-
// interface for the Analog Plug - see http://jeelabs.org/ap2
521+
/// Interface for the Analog Plug - see http://jeelabs.org/ap2
522522
class AnalogPlug : public DeviceI2C {
523523
byte config;
524524
public:
525525
AnalogPlug (const PortI2C& port, byte addr =0x69)
526526
: DeviceI2C (port, addr), config (0x1C) {}
527527

528-
// default mode is channel 1, continuous, 18-bit, gain x1
528+
/// Default mode is channel 1, continuous, 18-bit, gain x1
529529
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)
531531
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
533533
long reading ();
534534
};
535535

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
537537
class DHTxx {
538538
byte pin;
539539
public:
540540
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
542542
bool reading (int& temp, int &humi);
543543
};
544544

545545
#ifdef Stream_h // only available in recent Arduino IDE versions
546546

547-
// simple parser for input data and one-letter commands
547+
/// Simple parser for input data and one-letter commands
548548
class InputParser {
549549
public:
550550
typedef struct {
@@ -553,14 +553,14 @@ class InputParser {
553553
void (*fun)(); // code to call for this command
554554
} Commands;
555555

556-
// set up with a buffer of specified size
556+
/// Set up with a buffer of specified size
557557
InputParser (byte size, Commands PROGMEM*, Stream& =Serial);
558558
InputParser (byte* buf, byte size, Commands PROGMEM*, Stream& =Serial);
559559

560-
// number of data bytes
560+
/// Number of data bytes
561561
byte count() { return fill; }
562562

563-
// call this frequently to check for incoming data
563+
/// Call this frequently to check for incoming data
564564
void poll();
565565

566566
InputParser& operator >> (char& v) { return get(&v, 1); }

PortsBMP085.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ int32_t BMP085::getResult(uint8_t type) {
3232
return meas[type];
3333
}
3434

35+
///Call this during setup() if you want to use calculate() later on.
3536
void BMP085::getCalibData() {
3637
readFromReg(0xAA);
3738
ac1 = readWord(0);
@@ -47,6 +48,10 @@ void BMP085::getCalibData() {
4748
md = readWord(1);
4849
}
4950

51+
/**Calculate the temperature and pressure based on the values stored by the last call to measure().
52+
* @param tval Variable temperature value.
53+
* @param pval Raw pressure value.
54+
*/
5055
void BMP085::calculate(int16_t& tval, int32_t& pval) const {
5156
int32_t ut = meas[TEMP], up = meas[PRES];
5257
int32_t x1, x2, x3, b3, b5, b6, p;

PortsBMP085.h

+10-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Port library interface to BMP085 sensors connected via I2C
1+
/// Port library interface to BMP085 sensors connected via I2C - see: http://jeelabs.net/projects/hardware/wiki/pp1
22
// 2009-02-17 <[email protected]> http://opensource.org/licenses/mit-license.php
33

44
class BMP085 : public DeviceI2C {
@@ -14,15 +14,20 @@ class BMP085 : public DeviceI2C {
1414
enum { TEMP, PRES };
1515
int32_t meas[2];
1616
uint8_t oss;
17-
17+
18+
///Constructor for BMP085 class. @param osrs 0..3 Oversampling setting.
1819
BMP085 (const PortI2C& p, uint8_t osrs =0)
1920
: DeviceI2C (p, 0x77), oss (osrs) {}
20-
21+
22+
///Set the oversampling setting for the high resolution mode. @param osrs 0..3.
2123
void setOverSampling(uint8_t osrs) { oss = osrs; }
22-
24+
25+
///Start a measurement. @param type BMP::TEMP for temperature or BMP::PRES for pressure.
2326
uint8_t startMeas(uint8_t type) const;
27+
///Get the results from the last measurement. @param type BMP::TEMP for temperature or BMP::PRES for pressure.
2428
int32_t getResult(uint8_t type);
25-
29+
30+
///Take a measurement. @param type BMP::TEMP for temperature or BMP::PRES for pressure.
2631
int32_t measure(uint8_t type)
2732
{ delay(startMeas(type)); return getResult(type); }
2833

PortsLCD.cpp

+12-12
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ void LiquidCrystalBase::setCursor(byte col, byte row)
103103
command(LCD_SETDDRAMADDR | (col + row_offsets[row]));
104104
}
105105

106-
// Turn the display on/off (quickly)
106+
/// Turn the display on/off (quickly)
107107
void LiquidCrystalBase::noDisplay() {
108108
_displaycontrol &= ~LCD_DISPLAYON;
109109
command(LCD_DISPLAYCONTROL | _displaycontrol);
@@ -113,7 +113,7 @@ void LiquidCrystalBase::display() {
113113
command(LCD_DISPLAYCONTROL | _displaycontrol);
114114
}
115115

116-
// Turns the underline cursor on/off
116+
/// Turns the underline cursor on/off
117117
void LiquidCrystalBase::noCursor() {
118118
_displaycontrol &= ~LCD_CURSORON;
119119
command(LCD_DISPLAYCONTROL | _displaycontrol);
@@ -123,7 +123,7 @@ void LiquidCrystalBase::cursor() {
123123
command(LCD_DISPLAYCONTROL | _displaycontrol);
124124
}
125125

126-
// Turn on and off the blinking cursor
126+
/// Turn on and off the blinking cursor
127127
void LiquidCrystalBase::noBlink() {
128128
_displaycontrol &= ~LCD_BLINKON;
129129
command(LCD_DISPLAYCONTROL | _displaycontrol);
@@ -133,40 +133,40 @@ void LiquidCrystalBase::blink() {
133133
command(LCD_DISPLAYCONTROL | _displaycontrol);
134134
}
135135

136-
// These commands scroll the display without changing the RAM
136+
/// These commands scroll the display without changing the RAM
137137
void LiquidCrystalBase::scrollDisplayLeft(void) {
138138
command(LCD_CURSORSHIFT | LCD_DISPLAYMOVE | LCD_MOVELEFT);
139139
}
140140
void LiquidCrystalBase::scrollDisplayRight(void) {
141141
command(LCD_CURSORSHIFT | LCD_DISPLAYMOVE | LCD_MOVERIGHT);
142142
}
143143

144-
// This is for text that flows Left to Right
144+
/// This is for text that flows Left to Right
145145
void LiquidCrystalBase::leftToRight(void) {
146146
_displaymode |= LCD_ENTRYLEFT;
147147
command(LCD_ENTRYMODESET | _displaymode);
148148
}
149149

150-
// This is for text that flows Right to Left
150+
/// This is for text that flows Right to Left
151151
void LiquidCrystalBase::rightToLeft(void) {
152152
_displaymode &= ~LCD_ENTRYLEFT;
153153
command(LCD_ENTRYMODESET | _displaymode);
154154
}
155155

156-
// This will 'right justify' text from the cursor
156+
/// This will 'right justify' text from the cursor
157157
void LiquidCrystalBase::autoscroll(void) {
158158
_displaymode |= LCD_ENTRYSHIFTINCREMENT;
159159
command(LCD_ENTRYMODESET | _displaymode);
160160
}
161161

162-
// This will 'left justify' text from the cursor
162+
/// This will 'left justify' text from the cursor
163163
void LiquidCrystalBase::noAutoscroll(void) {
164164
_displaymode &= ~LCD_ENTRYSHIFTINCREMENT;
165165
command(LCD_ENTRYMODESET | _displaymode);
166166
}
167167

168-
// Allows us to fill the first 8 CGRAM locations
169-
// with custom characters
168+
/// Allows us to fill the first 8 CGRAM locations
169+
/// with custom characters
170170
void LiquidCrystalBase::createChar(byte location, byte charmap[]) {
171171
location &= 0x7; // we only have 8 locations 0-7
172172
command(LCD_SETCGRAMADDR | (location << 3));
@@ -277,7 +277,7 @@ void LiquidCrystal::config() {
277277
}
278278
}
279279

280-
// write either command or data, with automatic 4/8-bit selection
280+
/// write either command or data, with automatic 4/8-bit selection
281281
void LiquidCrystal::send(byte value, byte mode) {
282282
digitalWrite(_rs_pin, mode);
283283

@@ -363,7 +363,7 @@ void LiquidCrystalI2C::config() {
363363
backlight(); // start with backlight on
364364
}
365365

366-
// write either command or data, with automatic 4/8-bit selection
366+
/// write either command or data, with automatic 4/8-bit selection
367367
void LiquidCrystalI2C::send(byte value, byte mode) {
368368
if (mode != 0)
369369
mode = MCP_REGSEL;

PortsLCD.h

+10-10
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@
4848
#define LCD_5x10DOTS 0x04
4949
#define LCD_5x8DOTS 0x00
5050

51-
// this class defines all the basic functionality needed to drive an LCD display
52-
// it is an incomplete (abstract) base class, which needs to be extended for use
53-
// see the LiquidCrystal and LiquidCrystalI2C classes for two usable versions
51+
/// this class defines all the basic functionality needed to drive an LCD display
52+
/// it is an incomplete (abstract) base class, which needs to be extended for use
53+
/// see the LiquidCrystal and LiquidCrystalI2C classes for two usable versions
5454

5555
class LiquidCrystalBase : public Print {
5656
public:
@@ -90,10 +90,10 @@ class LiquidCrystalBase : public Print {
9090
byte _numlines,_currline;
9191
};
9292

93-
// This class can be used to create an object with drives an LCD through many
94-
// different I/O pins, connected to the display in parallel - it is equivalent
95-
// to the LiquidCrystal class defined in the Arduino, but has be adjusted to
96-
// work with the above LiquidCrystalBase instead.
93+
/// This class can be used to create an object with drives an LCD through many
94+
/// different I/O pins, connected to the display in parallel - it is equivalent
95+
/// to the LiquidCrystal class defined in the Arduino, but has be adjusted to
96+
/// work with the above LiquidCrystalBase instead.
9797

9898
class LiquidCrystal : public LiquidCrystalBase {
9999
public:
@@ -122,9 +122,9 @@ class LiquidCrystal : public LiquidCrystalBase {
122122
byte _data_pins[8];
123123
};
124124

125-
// This class allows driving an LCD connected via I2C using an LCD Plug, which
126-
// is in turn based on an MCP23008 I2C I/O expander chip and some other parts.
127-
// The available functions include all those of the LiquidCrystal class.
125+
/// This class allows driving an LCD connected via I2C using an LCD Plug, which
126+
/// is in turn based on an MCP23008 I2C I/O expander chip and some other parts.
127+
/// The available functions include all those of the LiquidCrystal class.
128128

129129
class LiquidCrystalI2C : public LiquidCrystalBase {
130130
DeviceI2C device;

0 commit comments

Comments
 (0)