Morse code encoder library

Dependents:   MIDI_CW

Revision:
3:9c975c0e2342
Parent:
2:7dc8528b23da
Child:
4:e0cc0df745ef
--- a/morse.cpp	Wed Aug 06 23:45:26 2014 +0000
+++ b/morse.cpp	Thu Aug 07 00:15:05 2014 +0000
@@ -35,9 +35,10 @@
  * @endcode
  */
 
-//
-// 0to127-value vs CW_tick table
-//   =0.03*5^(1-i/128)
+/**
+ * 0to127-value vs CW_tick table
+ *   =0.03*5^(1-i/128)
+ */
 const float Morse::table[] = { 0.15000000  ,0.14812575  ,0.14627491  ,0.14444721  ,0.14264234  ,0.14086002  ,0.13909997  ,0.13736192  ,
                                0.13564558  ,0.13395068  ,0.13227697  ,0.13062416  ,0.12899201  ,0.12738026  ,0.12578864  ,0.12421691  ,
                                0.12266482  ,0.12113212  ,0.11961857  ,0.11812393  ,0.11664797  ,0.11519045  ,0.11375115  ,0.11232983  ,
@@ -57,6 +58,8 @@
 
 /** beeping function
  * this is a private funciton / internal use only
+ *
+ * @param k - beep duration factor; k times cw_tick
  */
 void Morse::beep (int k)
 {
@@ -69,13 +72,17 @@
 
 /** spacing function
  * this is a private funciton / internal use only
+ *
+ * @param k - spacing factor; k times cw_tick
  */
 void Morse::space(int k)
 {
     wait(cw_tick * (float)k);
 }
 
-/** set frequency
+/** set morse oscillation frequency
+ *
+ * @param f - a morse code speed tick [0.03-0.3] (sec)
  */
 void Morse::setfreq(float f)
 {
@@ -84,7 +91,9 @@
     _pwm.write(0.0);
 }
 
-/** get frequency
+/** get morse oscillation frequency
+ *
+ * @return morse oscillation frequency (Hz) 
  */
 float Morse::getfreq()
 {
@@ -92,6 +101,8 @@
 }
 
 /** set morse code speed
+ *
+ * @param t - a morse code speed tick [0.03-0.3] (sec)
  */
 void Morse::settick(float t)
 {
@@ -99,24 +110,37 @@
         cw_tick = t;
 }
 
-/** get morse code speed
+/** get morse code speed tick
+ *
+ * @return a morse code speed tick
  */
 float Morse::gettick()
 {
     return cw_tick;
 }
 
+/** set morse code speed index
+ *
+ * @param idx - a morse code speed index [0-127]
+ */
 void Morse::setidx(int idx)
 {
     tick_idx = idx;
     settick(table[tick_idx]);
 }
 
+/** get morse code speed index
+ *
+ * @return a morse code speed index [0-127]
+ */
 int Morse::getidx(void)
 {
     return tick_idx;
 }
 
+/** increment morse code speed index
+ *
+ */
 void Morse::incidx(void)
 {
     tick_idx++;
@@ -126,6 +150,9 @@
     settick(table[tick_idx]);
 }
 
+/** decrement morse code speed index
+ *
+ */
 void Morse::decidx(void)
 {
     tick_idx--;