소스 검색

Added a basic doxygen configuration.

Michael Hope 2 년 전
부모
커밋
a58788fcd0
6개의 변경된 파일45개의 추가작업 그리고 23개의 파일을 삭제
  1. 4 4
      neopixel.cc
  2. 4 2
      neopixel.h
  3. 12 7
      ser2neo.cc
  4. 15 0
      ser2neo.dox
  5. 6 6
      serial.cc
  6. 4 4
      serial.h

+ 4 - 4
neopixel.cc 파일 보기

@@ -23,7 +23,7 @@
23 23
 
24 24
 extern Serial serial;
25 25
 
26
-// Initialise the hardware.
26
+/// Initialise the hardware.
27 27
 void NeoPixel::init() {
28 28
     DDRB |= _BV(1);
29 29
     TCCR0A = _BV(WGM01) | _BV(WGM00) | _BV(COM0B1) | _BV(COM0B0);
@@ -34,13 +34,13 @@ void NeoPixel::init() {
34 34
     OCR0B = Low;
35 35
 }
36 36
 
37
-// Set all the LEDs to off and restart at the first LED.
37
+/// Set all the LEDs to off and restart at the first LED.
38 38
 void NeoPixel::clear() {
39 39
     p_ = bits_;
40 40
     memset(bits_, Low, sizeof(bits_));
41 41
 }
42 42
 
43
-// Append a byte to the stream.
43
+/// Append a byte to the stream.
44 44
 void NeoPixel::append(uint8_t b) {
45 45
     if (p_ <= (bits_ + sizeof(bits_) - Tail - BitsPerColour)) {
46 46
         for (auto i = 0; i < BitsPerColour; i++) {
@@ -50,7 +50,7 @@ void NeoPixel::append(uint8_t b) {
50 50
     }
51 51
 }
52 52
 
53
-// Write to the LEDs.
53
+/// Write to the LEDs.
54 54
 void NeoPixel::write() {
55 55
     bits_[sizeof(bits_) - 1] = Stop;
56 56
 

+ 4 - 2
neopixel.h 파일 보기

@@ -18,8 +18,10 @@
18 18
 
19 19
 #include <stdint.h>
20 20
 
21
-// NeoPixel ring driver.
22
-//
21
+/// NeoPixel ring driver.
22
+///
23
+/// Implemented as a bit-banged loop.
24
+///
23 25
 class NeoPixel {
24 26
    public:
25 27
     NeoPixel() { clear(); }

+ 12 - 7
ser2neo.cc 파일 보기

@@ -20,7 +20,11 @@
20 20
 #include "neopixel.h"
21 21
 #include "serial.h"
22 22
 
23
-// Main application class.
23
+/// Main application class.
24
+///
25
+/// Reads commands from the serial port, processes them, and
26
+/// responds.
27
+///
24 28
 class Ser2Neo {
25 29
    public:
26 30
     void init();
@@ -33,18 +37,19 @@ class Ser2Neo {
33 37
     int read_escaped();
34 38
     void read_leds();
35 39
     void wait_eol();
36
-    void send_ok(const char* msg);
40
+    void send_ok(const char* msg=nullptr);
37 41
 
38 42
     NeoPixel leds;
39 43
     Serial serial;
40 44
 };
41 45
 
46
+/// Initialise the hardware.
42 47
 void Ser2Neo::init() {
43 48
     leds.init();
44 49
     serial.init();
45 50
 }
46 51
 
47
-// Read a character, de-escaping if required.
52
+/// Read a character, de-escaping if required.
48 53
 int Ser2Neo::read_escaped() {
49 54
     auto got = serial.getch();
50 55
     if (got == EOF) {
@@ -60,7 +65,7 @@ int Ser2Neo::read_escaped() {
60 65
     return got;
61 66
 }
62 67
 
63
-// Read the (potentially escaped) LED levels.
68
+/// Read the (potentially escaped) LED levels.
64 69
 void Ser2Neo::read_leds() {
65 70
     leds.clear();
66 71
     while (true) {
@@ -72,13 +77,13 @@ void Ser2Neo::read_leds() {
72 77
     }
73 78
 }
74 79
 
75
-// Wait until the end-of-line character is received.
80
+/// Wait until the end-of-line character is received.
76 81
 void Ser2Neo::wait_eol() {
77 82
     while (serial.getch() != EOF) {
78 83
     }
79 84
 }
80 85
 
81
-// Send OK with an optional message.
86
+/// Send OK with an optional message.
82 87
 void Ser2Neo::send_ok(const char* msg) {
83 88
     wait_eol();
84 89
     serial.putstr("OK");
@@ -89,7 +94,7 @@ void Ser2Neo::send_ok(const char* msg) {
89 94
     serial.putstr("\n");
90 95
 }
91 96
 
92
-// Run the main loop.  Process and run commands.
97
+/// Run the main loop.  Process and run commands.
93 98
 void Ser2Neo::run() {
94 99
     sei();
95 100
 

+ 15 - 0
ser2neo.dox 파일 보기

@@ -0,0 +1,15 @@
1
+# A basic Doxygen configuration.
2
+PROJECT_NAME           = "ser2neo"
3
+PROJECT_NUMBER         =
4
+PROJECT_BRIEF          =
5
+PROJECT_LOGO           =
6
+OUTPUT_DIRECTORY       = doc
7
+BRIEF_MEMBER_DESC      = YES
8
+JAVADOC_AUTOBRIEF      = YES
9
+BUILTIN_STL_SUPPORT    = YES
10
+QUIET                  = YES
11
+RECURSIVE              = NO
12
+GENERATE_HTML          = YES
13
+HTML_OUTPUT            = html
14
+GENERATE_HTMLHELP      = NO
15
+GENERATE_LATEX         = NO

+ 6 - 6
serial.cc 파일 보기

@@ -25,7 +25,7 @@ Serial* Serial::instance_;
25 25
 #define _clear(port, pin) port &= ~_BV(pin)
26 26
 #define _set(port, pin) port |= _BV(pin)
27 27
 
28
-// Initialise the hardware.
28
+/// Initialise the hardware.
29 29
 void Serial::init() {
30 30
     state_ = Idle;
31 31
     rx_full_ = false;
@@ -51,7 +51,7 @@ void Serial::init() {
51 51
     _set(GIMSK, PCIE);
52 52
 }
53 53
 
54
-// Handle the pin change interrupt by starting receive.
54
+/// Handle the pin change interrupt by starting receive.
55 55
 void Serial::pcint0() {
56 56
     _clear(PCMSK, RxPin);
57 57
     _clear(TIMSK, TOV1);  // PENDING
@@ -66,7 +66,7 @@ void Serial::pcint0() {
66 66
     _set(TIMSK, TOV1);
67 67
 }
68 68
 
69
-// Handle the timer overflow interrupt by doing the next bit.
69
+/// Handle the timer overflow interrupt by doing the next bit.
70 70
 inline void Serial::timer1ovf() {
71 71
     switch (state_) {
72 72
         case Receive: {
@@ -106,7 +106,7 @@ inline void Serial::timer1ovf() {
106 106
     }
107 107
 }
108 108
 
109
-// Wait until the hardware is free then start the transmit.
109
+/// Wait until the hardware is free then start the transmit.
110 110
 void Serial::putch(uint8_t ch) {
111 111
     while (state_ != Idle) {
112 112
         sleep_cpu();
@@ -119,14 +119,14 @@ void Serial::putch(uint8_t ch) {
119 119
     _set(TIMSK, TOV1);
120 120
 }
121 121
 
122
-// Send a string.
122
+/// Send a string.
123 123
 void Serial::putstr(const char* str) {
124 124
     for (; *str != '\0'; str++) {
125 125
         putch(*str);
126 126
     }
127 127
 }
128 128
 
129
-// Wait until a character is received, then return it.
129
+/// Wait until a character is received, then return it.
130 130
 uint8_t Serial::getch() {
131 131
     while (!rx_full_) {
132 132
         sleep_cpu();

+ 4 - 4
serial.h 파일 보기

@@ -18,10 +18,10 @@
18 18
 
19 19
 #include <stdint.h>
20 20
 
21
-// Half-duplex interrupt based serial port.
22
-//
23
-// Loosely based on AVR304.
24
-//
21
+/// Half-duplex interrupt based serial port.
22
+///
23
+/// Loosely based on AVR304.
24
+///
25 25
 class Serial {
26 26
    public:
27 27
     void init();