Permalink
Browse files

Added some more doxygen documentation.

  • Loading branch information...
1 parent c3943d5 commit 7d90bc2d4559d6c2487e778595289cbf61326bb2 @Vliegendehuiskat Vliegendehuiskat committed Aug 14, 2012
Showing with 40 additions and 22 deletions.
  1. +1 −1 Doxyfile
  2. +17 −1 Ports.cpp
  3. +17 −14 Ports.h
  4. +5 −6 RF12.h
View
@@ -151,7 +151,7 @@ SHORT_NAMES = NO
# comments will behave just like regular Qt-style comments
# (thus requiring an explicit @brief command for a brief description.)
-JAVADOC_AUTOBRIEF = NO
+JAVADOC_AUTOBRIEF = YES
# If the QT_AUTOBRIEF tag is set to YES then Doxygen will
# interpret the first line (until the first dot) of a Qt-style
View
@@ -192,6 +192,9 @@ void MilliTimer::set(word ms) {
next = millis() + ms - 1;
}
+/**Turn on the corresponding leds.
+ * @param mask 0 for neither led, 1 for the first led, 2 for the second led or 3 for both leds.
+ */
void BlinkPlug::ledOn (byte mask) {
if (mask & 1) {
digiWrite(0);
@@ -204,6 +207,9 @@ void BlinkPlug::ledOn (byte mask) {
leds |= mask; //TODO could be read back from pins, i.s.o. saving here
}
+/**Turn off the corresponding leds.
+ * @param mask 0 for neither led, 1 for the first led, 2 for the second led or 3 for both leds.
+ */
void BlinkPlug::ledOff (byte mask) {
if (mask & 1) {
mode(INPUT);
@@ -216,6 +222,10 @@ void BlinkPlug::ledOff (byte mask) {
leds &= ~ mask; //TODO could be read back from pins, i.s.o. saving here
}
+/**Read entire BlinkPlug state.
+ * @return One byte with the state of the leds on the 1st and 2nd least significant
+ * bits and the state of the buttons on the 3rd and 4th least significant bits.
+ */
byte BlinkPlug::state () {
byte saved = leds;
ledOff(1+2);
@@ -224,7 +234,7 @@ byte BlinkPlug::state () {
return result;
}
-//TODO deprecated, use buttonCheck() !
+///@deprecated TODO deprecated, use buttonCheck() !
byte BlinkPlug::pushed () {
if (debounce.idle() || debounce.poll()) {
byte newState = state();
@@ -238,6 +248,9 @@ byte BlinkPlug::pushed () {
return 0;
}
+/**Check the state of the buttons.
+ * @return The corresponding enum state.
+ */
byte BlinkPlug::buttonCheck () {
// collect button changes in the checkFlags bits, with proper debouncing
if (debounce.idle() || debounce.poll()) {
@@ -552,6 +565,9 @@ const int* GravityPlug::getAxes() {
return data.w;
}
+/**Select the channel on the multiplexer.
+ * @param channel A number between 0..15.
+ */
void InputPlug::select(uint8_t channel) {
digiWrite(0);
mode(OUTPUT);
View
31 Ports.h
@@ -285,18 +285,21 @@ class Scheduler {
byte idle(byte task) { return tasks[task] == ~0; }
};
-// interface for the Blink Plug - see http://jeelabs.org/bp1
+///Interface for the Blink Plug - see http://jeelabs.org/bp1
class BlinkPlug : public Port {
MilliTimer debounce;
byte leds, lastState, checkFlags;
public:
+ ///Enum containing shorthands for BlinkPlug button states.
enum { ALL_OFF, ON1, OFF1, ON2, OFF2, SOME_ON, ALL_ON }; // for buttonCheck
-
+
+ ///Constructor for the BlinkPlug class. @param port Portnumber the blinkplug is connected to.
BlinkPlug (byte port)
: Port (port), leds (0), lastState (0), checkFlags (0) {}
void ledOn(byte mask);
void ledOff(byte mask);
+ /// @return One byte containing the state of both leds.
byte ledState() const { return leds; }
byte state();
@@ -331,7 +334,7 @@ class MemoryStream {
void reset();
};
-/// interface for the UART Plug - see http://jeelabs.org/up1
+/// Interface for the UART Plug - see http://jeelabs.org/up1
class UartPlug : public Print {
DeviceI2C dev;
// avoid per-byte access, fill entire buffer instead to reduce I2C overhead
@@ -425,7 +428,7 @@ class GravityPlug : public DeviceI2C {
const int* getAxes();
};
-// interface for the Input Plug - see http://jeelabs.org/ip1
+/// Interface for the Input Plug - see http://jeelabs.org/ip1
class InputPlug : public Port {
uint8_t slow;
public:
@@ -434,33 +437,33 @@ class InputPlug : public Port {
void select(uint8_t channel);
};
-// interface for the Infrared Plug - see http://jeelabs.org/ir1
+///Interface for the Infrared Plug - see http://jeelabs.org/ir1
class InfraredPlug : public Port {
uint8_t slot, gap, buf [40];
char fill;
uint32_t prev;
public:
- // initialize with default values for NEC protocol
+ ///Initialize with default values for NEC protocol
InfraredPlug (uint8_t num);
- // set slot size (us*4) and end-of-data gap (us*256)
+ ///Set slot size (us*4) and end-of-data gap (us*256)
void configure(uint8_t slot4, uint8_t gap256 =80);
- // call this continuously or at least right after a pin change
+ ///Call this continuously or at least right after a pin change
void poll();
- // returns number of nibbles read, or 0 if not yet ready
+ ///Returns number of nibbles read, or 0 if not yet ready
uint8_t done();
-
- // try to decode a received packet, return type of packet
- // if recognized, the receive buffer will be overwritten with the results
+
enum { UNKNOWN, NEC, NEC_REP };
+ ///Try to decode a received packet, return type of packet
+ ///if recognized, the receive buffer will be overwritten with the results
uint8_t decoder(uint8_t nibbles);
- // access to the receive buffer
+ ///Access to the receive buffer
const uint8_t* buffer() { return buf; }
- // send out a bit pattern, cycle time is the "slot4" config value
+ ///Send out a bit pattern, cycle time is the "slot4" config value
void send(const uint8_t* data, uint16_t bits);
};
View
11 RF12.h
@@ -1,15 +1,14 @@
-/** RFM12B driver definitions
- * 2009-02-09 <jc@wippler.nl> http://opensource.org/licenses/mit-license.php
- */
+// RFM12B driver definitions
+// 2009-02-09 <jc@wippler.nl> http://opensource.org/licenses/mit-license.php
#ifndef RF12_h
#define RF12_h
#include <stdint.h>
-// Version 1 did not include the group code in the crc
-// Version 2 does include the group code in the crc
/// RF12 Protocol version.
+/// Version 1 did not include the group code in the crc.
+/// Version 2 does include the group code in the crc.
#define RF12_VERSION 2
/// Shorthand for RF12 group byte in rf12_buf.
@@ -43,7 +42,7 @@
#define RF12_EEPROM_EKEY (RF12_EEPROM_ADDR + RF12_EEPROM_SIZE)
#define RF12_EEPROM_ELEN 16
-// shorthand to simplify sending out the proper ACK when requested
+// shorthands to simplify sending out the proper ACK when requested
#define RF12_WANTS_ACK ((rf12_hdr & RF12_HDR_ACK) && !(rf12_hdr & RF12_HDR_CTL))
#define RF12_ACK_REPLY (rf12_hdr & RF12_HDR_DST ? RF12_HDR_CTL : \
RF12_HDR_CTL | RF12_HDR_DST | (rf12_hdr & RF12_HDR_MASK))

0 comments on commit 7d90bc2

Please sign in to comment.