SmartWheels self-driving race car. Designed for NXP Cup. Uses FRDM-KL25Z, area-scan camera, and simple image processing to detect and navigate any NXP spec track.

Dependencies:   TSI USBDevice mbed-dev

Fork of SmartWheels by haofan Zheng

Revision:
94:32712e603a5f
Parent:
62:bc5caf59fe39
Child:
98:fc92bb37ee17
--- a/SWCommon.h	Wed Apr 19 18:34:12 2017 +0000
+++ b/SWCommon.h	Wed Apr 19 18:57:23 2017 +0000
@@ -1,3 +1,9 @@
+/**
+ * @file SWCommon.h
+ * @brief The header file for Smart Wheels Common functions. Note: The functions in here will be only used in debug purpose, and all of these debug functions will not be included for the release version.
+ * @author Jordan Brack <jabrack@mix.wvu.edu>, Haofan Zheng <hazheng@mix.wvu.edu>
+ * 
+ */
 #pragma once
 #ifndef SW_COMMON_H
 #define SW_COMMON_H
@@ -6,18 +12,29 @@
 #include <mbed.h>
 
 #ifdef SW_DEBUG
-#define LOGI(...) char sw_common_buf_v87t790[100];\
+#define LOGI(...) char sw_common_buf_v87t790[100];\                     /*!< @brief Print debug message on the UTFT screen in debug mode. Do nothing in release mode. */
                 sprintf(sw_common_buf_v87t790, __VA_ARGS__);\
                 ardu_utft_print(sw_common_buf_v87t790, 230, 100);
                 
-#else
-#define LOGI(...) 
+#else //SW_DEBUG
+#define LOGI(...)                                                       /*!< @brief Print debug message on the UTFT screen in debug mode. Do nothing in release mode. */
+
+#endif //SW_DEBUG
 
-#endif
+#ifdef SW_DEBUGCOUNTER
 
+/**
+ * @class DebugCounter
+ * @brief This class will be used as a counter during debugging. This class can be used when estimating the running speed of the system, or some specific function.
+ */
 class DebugCounter
 {
 public:
+    /**
+    * @brief The constructor for the DebugCounter class.
+    * @param maxCount The number of counts that should be accumulated before changing the output pin status.
+    * @param pin The read address for the slave device.
+    */
     DebugCounter(uint16_t maxCount, PinName pin) :
         m_output(DigitalOut(pin, 0)),
         m_maxCount(maxCount),
@@ -26,6 +43,9 @@
         
     }
     
+    /**
+    * @brief The update function, where the counter gets count. If the number of counts approached the max count, the output pin status will be flipped.
+    */
     void Update()
     {
         ++m_counter;
@@ -38,11 +58,12 @@
     
 
 private:
-    DigitalOut m_output;
-    const uint16_t m_maxCount;
-    uint16_t m_counter;
+    DigitalOut m_output;        /*!< @brief The output pin. */
+    const uint16_t m_maxCount;  /*!< @brief The max count. */
+    uint16_t m_counter;         /*!< @brief The counter. */
     
 };
+#endif //SW_DEBUGCOUNTER
 
 
 #endif //SW_COMMON_H
\ No newline at end of file