Joe Shotton / ll16j23s_test_docs

Files at this revision

API Documentation at this revision

Comitter:
eencae
Date:
Tue Feb 07 11:53:37 2017 +0000
Parent:
9:893189072e89
Child:
11:ff86b2ffce01
Commit message:
Renamed LED methods.

Changed in this revision

Gamepad.cpp Show annotated file Show diff for this revision Revisions of this file
Gamepad.h Show annotated file Show diff for this revision Revisions of this file
--- a/Gamepad.cpp	Tue Feb 07 11:50:26 2017 +0000
+++ b/Gamepad.cpp	Tue Feb 07 11:53:37 2017 +0000
@@ -3,12 +3,12 @@
 //////////// constructor/destructor ////////////
 Gamepad::Gamepad()
 {
-    led1 = new PwmOut(PTA1);
-    led2 = new PwmOut(PTA2);
-    led3 = new PwmOut(PTC2);
-    led4 = new PwmOut(PTC3);
-    led5 = new PwmOut(PTC4);
-    led6 = new PwmOut(PTD3);
+    _led1 = new PwmOut(PTA1);
+    _led2 = new PwmOut(PTA2);
+    _led3 = new PwmOut(PTC2);
+    _led4 = new PwmOut(PTC3);
+    _led5 = new PwmOut(PTC4);
+    _led6 = new PwmOut(PTD3);
 
     button_A = new InterruptIn(PTB9);
     button_B = new InterruptIn(PTD0);
@@ -32,7 +32,7 @@
 
 Gamepad::~Gamepad()
 {
-    delete led1,led2,led3,led4,led5,led6;
+    delete _led1,_led2,_led3,_led4,_led5,_led6;
     delete button_A,button_B,button_joystick,vert,horiz;
     delete button_X, button_Y, button_back, button_start;
     delete button_L, button_R, buzzer, pot, timeout;
@@ -57,15 +57,15 @@
 
 void Gamepad::leds_off()
 {
-    set_leds(0.0);
+    leds(0.0);
 }
 
 void Gamepad::leds_on()
 {
-    set_leds(1.0);
+    leds(1.0);
 }
 
-void Gamepad::set_leds(float val)
+void Gamepad::leds(float val)
 {
     if (val < 0.0f) {
         val = 0.0f;
@@ -78,31 +78,31 @@
     // 0.0 corresponds to fully-off, 1.0 to fully-on
     val = 1.0f - val;
 
-    led1->write(val);
-    led2->write(val);
-    led3->write(val);
-    led4->write(val);
-    led5->write(val);
-    led6->write(val);
+    _led1->write(val);
+    _led2->write(val);
+    _led3->write(val);
+    _led4->write(val);
+    _led5->write(val);
+    _led6->write(val);
 }
 
-void Gamepad::set_led1(float val) {
-    led1->write(1.0f-val);   // active-low so subtract from 1
+void Gamepad::led1(float val) {
+    _led1->write(1.0f-val);   // active-low so subtract from 1
 }
-void Gamepad::set_led2(float val) {
-    led2->write(1.0f-val);   // active-low so subtract from 1
+void Gamepad::led2(float val) {
+    _led2->write(1.0f-val);   // active-low so subtract from 1
 }
-void Gamepad::set_led3(float val) {
-    led3->write(1.0f-val);   // active-low so subtract from 1
+void Gamepad::led3(float val) {
+    _led3->write(1.0f-val);   // active-low so subtract from 1
 }
-void Gamepad::set_led4(float val) {
-    led4->write(1.0f-val);   // active-low so subtract from 1
+void Gamepad::led4(float val) {
+    _led4->write(1.0f-val);   // active-low so subtract from 1
 }
-void Gamepad::set_led5(float val) {
-    led5->write(1.0f-val);   // active-low so subtract from 1
+void Gamepad::led5(float val) {
+    _led5->write(1.0f-val);   // active-low so subtract from 1
 }
-void Gamepad::set_led6(float val) {
-    led6->write(1.0f-val);   // active-low so subtract from 1
+void Gamepad::led6(float val) {
+    _led6->write(1.0f-val);   // active-low so subtract from 1
 }
 
 float Gamepad::read_pot()
--- a/Gamepad.h	Tue Feb 07 11:50:26 2017 +0000
+++ b/Gamepad.h	Tue Feb 07 11:53:37 2017 +0000
@@ -59,37 +59,37 @@
     /** Set all LEDs to duty-cycle
     *@param value in range 0.0 to 1.0
     */
-    void set_leds(float val);
+    void leds(float val);
 
     /** Set LED to duty-cycle
     *@param value in range 0.0 to 1.0
     */
-    void set_led1(float val);
+    void led1(float val);
 
     /** Set LED to duty-cycle
       *@param value in range 0.0 to 1.0
       */
-    void set_led2(float val);
+    void led2(float val);
 
     /** Set LED to duty-cycle
     *@param value in range 0.0 to 1.0
     */
-    void set_led3(float val);
+    void led3(float val);
 
     /** Set LED to duty-cycle
     *@param value in range 0.0 to 1.0
     */
-    void set_led4(float val);
+    void led4(float val);
 
     /** Set LED to duty-cycle
     *@param value in range 0.0 to 1.0
     */
-    void set_led5(float val);
+    void led5(float val);
 
     /** Set LED to duty-cycle
     *@param value in range 0.0 to 1.0
     */
-    void set_led6(float val);
+    void led6(float val);
 
     /** Read potentiometer
     *@returns potentiometer value in range 0.0 to 1.0
@@ -180,12 +180,12 @@
 
 private:
 
-    PwmOut *led1;
-    PwmOut *led2;
-    PwmOut *led3;
-    PwmOut *led4;
-    PwmOut *led5;
-    PwmOut *led6;
+    PwmOut *_led1;
+    PwmOut *_led2;
+    PwmOut *_led3;
+    PwmOut *_led4;
+    PwmOut *_led5;
+    PwmOut *_led6;
 
     InterruptIn *button_A;
     InterruptIn *button_B;