SOFT564Z Group 3 / Mbed 2 deprecated SOFT564Z_Group_3_final

Dependencies:   mbed Servo ros_lib_kinetic

Revision:
6:2cc2aac35868
Parent:
5:bc5081f0c063
Child:
7:8248af58df5a
--- a/RGB_LED/LED.cpp	Tue Nov 12 10:36:59 2019 +0000
+++ b/RGB_LED/LED.cpp	Tue Nov 12 12:56:02 2019 +0000
@@ -1,6 +1,18 @@
+/*--------------------------------------------------------------------------------
+Filename: LED.cpp
+Description: Holds source code for configuring the RGB LED and also buzzer becuase 
+             where else do I put it :P
+--------------------------------------------------------------------------------*/
+
 #include "LED.h"
 
-cRBG_LED::cRBG_LED(DigitalOut DIAG_RED, PwmOut DIAG_BLU, PwmOut DIAG_GRN): _DIAG_RED(DIAG_RED), _DIAG_BLU(DIAG_BLU), _DIAG_GRN(DIAG_GRN)
+/*--------------------------------------------------------------------------------
+Function name: cRGB_LED
+Input Parameters: N/A
+Output Parameters: N/A
+Description: Class constructor (Initialisation upon creating class)
+----------------------------------------------------------------------------------*/
+cRGB_LED::cRGB_LED(DigitalOut DIAG_RED, PwmOut DIAG_BLU, PwmOut DIAG_GRN): _DIAG_RED(DIAG_RED), _DIAG_BLU(DIAG_BLU), _DIAG_GRN(DIAG_GRN)
 {
     // Set initial condition of PWM
     _DIAG_BLU.period(0.001); //1KHz
@@ -14,38 +26,67 @@
     _DIAG_RED = 0;
 }
 
-void cRBG_LED::red_led()
+/*--------------------------------------------------------------------------------
+Function name: cRGB_LED
+Input Parameters: N/A
+Output Parameters: N/A
+Description: Turns on red led
+----------------------------------------------------------------------------------*/
+void cRGB_LED::red_led()
 {
-    _DIAG_RED = 1;
-    _DIAG_BLU = 0.0;
-    _DIAG_GRN = 0.0;
+    _DIAG_RED = 1;      //Enable red
+    _DIAG_BLU = 0.0;    //Disable Blue
+    _DIAG_GRN = 0.0;    //Disable Green
 }
 
-void cRBG_LED::blue_led()
+/*--------------------------------------------------------------------------------
+Function name: blue_led()
+Input Parameters: N/A
+Output Parameters: N/A
+Description: Turns on blue led
+----------------------------------------------------------------------------------*/
+void cRGB_LED::blue_led()
 {
-    _DIAG_RED = 0;
-    _DIAG_BLU = 1.0;
-    _DIAG_GRN = 0.0;
+    _DIAG_RED = 0;      //Disable Red
+    _DIAG_BLU = 1.0;    //Enable Blue
+    _DIAG_GRN = 0.0;    //Enable Green
 }
 
-void cRBG_LED::green_led()
+/*--------------------------------------------------------------------------------
+Function name: green_led()
+Input Parameters: N/A
+Output Parameters: N/A
+Description: Turns on green led
+----------------------------------------------------------------------------------*/
+void cRGB_LED::green_led()
 {
-    _DIAG_RED = 0;
-    _DIAG_BLU = 0.0;
-    _DIAG_GRN = 1.0;
+    _DIAG_RED = 0;      //Disable Red
+    _DIAG_BLU = 0.0;    //Disable Blue
+    _DIAG_GRN = 1.0;    //Enable Green 
 }
 
-
-void cRBG_LED::yellow_led()
+/*--------------------------------------------------------------------------------
+Function name: yellow_led()
+Input Parameters: N/A
+Output Parameters: N/A
+Description: Turns on yellow led
+----------------------------------------------------------------------------------*/
+void cRGB_LED::yellow_led()
 {
-    _DIAG_RED = 1;
-    _DIAG_BLU = 0.0;
-    _DIAG_GRN = 0.35;
+    _DIAG_RED = 1;      //Enable Red
+    _DIAG_BLU = 0.0;    //Disable Blue
+    _DIAG_GRN = 0.35;   //Enable Green at 35% duty 
 }
 
-void cRBG_LED::led_off()
+/*--------------------------------------------------------------------------------
+Function name: led_off()
+Input Parameters: N/A
+Output Parameters: N/A
+Description: Turns the led off
+----------------------------------------------------------------------------------*/
+void cRGB_LED::led_off()
 {
-    _DIAG_RED = 0;
-    _DIAG_BLU = 0;
-    _DIAG_GRN = 0;
+    _DIAG_RED = 0;  //Disable Red
+    _DIAG_BLU = 0;  //Disable Blue
+    _DIAG_GRN = 0;  //Disable Green
 }
\ No newline at end of file