more panel clean up of unused includes and defines
authorJim Morris <morris@wolfman.com>
Sun, 10 Nov 2013 22:48:33 +0000 (14:48 -0800)
committerJim Morris <morris@wolfman.com>
Sun, 10 Nov 2013 22:49:21 +0000 (14:49 -0800)
src/modules/utils/panel/panels/LcdBase.h
src/modules/utils/panel/panels/Smoothiepanel.cpp
src/modules/utils/panel/panels/Smoothiepanel.h
src/modules/utils/panel/panels/VikiLCD.cpp

index ac9ba8a..bf27572 100644 (file)
@@ -3,53 +3,6 @@
 
 #include "stdint.h"
 
-// commands
-#define LCD_CLEARDISPLAY 0x01
-#define LCD_RETURNHOME 0x02
-#define LCD_ENTRYMODESET 0x04
-#define LCD_DISPLAYCONTROL 0x08
-#define LCD_CURSORSHIFT 0x10
-#define LCD_FUNCTIONSET 0x20
-#define LCD_SETCGRAMADDR 0x40
-#define LCD_SETDDRAMADDR 0x80
-
-// flags for display entry mode
-#define LCD_ENTRYRIGHT 0x00
-#define LCD_ENTRYLEFT 0x02
-#define LCD_ENTRYSHIFTINCREMENT 0x01
-#define LCD_ENTRYSHIFTDECREMENT 0x00
-
-// flags for display on/off control
-#define LCD_DISPLAYON 0x04
-#define LCD_DISPLAYOFF 0x00
-#define LCD_CURSORON 0x02
-#define LCD_CURSOROFF 0x00
-#define LCD_BLINKON 0x01
-#define LCD_BLINKOFF 0x00
-
-// flags for display/cursor shift
-#define LCD_DISPLAYMOVE 0x08
-#define LCD_CURSORMOVE 0x00
-#define LCD_MOVERIGHT 0x04
-#define LCD_MOVELEFT 0x00
-
-// flags for function set
-#define LCD_8BITMODE 0x10
-#define LCD_4BITMODE 0x00
-#define LCD_2LINE 0x08
-#define LCD_1LINE 0x00
-#define LCD_5x10DOTS 0x04
-#define LCD_5x8DOTS 0x00
-
-// flags for backlight control
-#define LCD_BACKLIGHT 0x08
-#define LCD_NOBACKLIGHT 0x00
-
-// specific LED assignments
-#define LED_FAN_ON    1
-#define LED_HOTEND_ON 2
-#define LED_BED_ON    3
-
 // Standard directional button bits
 #define BUTTON_SELECT 0x01
 #define BUTTON_RIGHT  0x02
 #define BUTTON_AUX1   0x40
 #define BUTTON_AUX2   0x80
 
+// specific LED assignments
+#define LED_FAN_ON    1
+#define LED_HOTEND_ON 2
+#define LED_BED_ON    3
+
 class Panel;
 
 class LcdBase {
index 0c6eeb6..18e1027 100644 (file)
@@ -1,14 +1,57 @@
-/*  
+/*
 This file is part of Smoothie (http://smoothieware.org/). The motion control part is heavily based on Grbl (https://github.com/simen/grbl).
 Smoothie is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
 Smoothie is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
-You should have received a copy of the GNU General Public License along with Smoothie. If not, see <http://www.gnu.org/licenses/>. 
+You should have received a copy of the GNU General Public License along with Smoothie. If not, see <http://www.gnu.org/licenses/>.
 */
 #include "Smoothiepanel.h"
 #include "smoothiepanel/LCDBang.h"
 
 #include "smoothiepanel/Colors.h"
 
+// commands
+#define LCD_CLEARDISPLAY 0x01
+#define LCD_RETURNHOME 0x02
+#define LCD_ENTRYMODESET 0x04
+#define LCD_DISPLAYCONTROL 0x08
+#define LCD_CURSORSHIFT 0x10
+#define LCD_FUNCTIONSET 0x20
+#define LCD_SETCGRAMADDR 0x40
+#define LCD_SETDDRAMADDR 0x80
+
+// flags for display entry mode
+#define LCD_ENTRYRIGHT 0x00
+#define LCD_ENTRYLEFT 0x02
+#define LCD_ENTRYSHIFTINCREMENT 0x01
+#define LCD_ENTRYSHIFTDECREMENT 0x00
+
+// flags for display on/off control
+#define LCD_DISPLAYON 0x04
+#define LCD_DISPLAYOFF 0x00
+#define LCD_CURSORON 0x02
+#define LCD_CURSOROFF 0x00
+#define LCD_BLINKON 0x01
+#define LCD_BLINKOFF 0x00
+
+// flags for display/cursor shift
+#define LCD_DISPLAYMOVE 0x08
+#define LCD_CURSORMOVE 0x00
+#define LCD_MOVERIGHT 0x04
+#define LCD_MOVELEFT 0x00
+
+// flags for function set
+#define LCD_8BITMODE 0x10
+#define LCD_4BITMODE 0x00
+#define LCD_2LINE 0x08
+#define LCD_1LINE 0x00
+#define LCD_5x10DOTS 0x04
+#define LCD_5x8DOTS 0x00
+
+// flags for backlight control
+#define LCD_BACKLIGHT 0x08
+#define LCD_NOBACKLIGHT 0x00
+
+
 #define LCD_WRITE       0x00
 #define LCD_READ        0x01
 #define LCD_ACK         0x01
@@ -149,7 +192,7 @@ void Smoothiepanel::setLedBrightness(int led, int val){
     }
 }
 
-// cycle the buzzer pin at a certain frequency (hz) for a certain duration (ms) 
+// cycle the buzzer pin at a certain frequency (hz) for a certain duration (ms)
 void Smoothiepanel::buzz(long duration, uint16_t freq) {
     const int expander = PCA9505_ADDRESS | this->i2c_address;
     char cmd[2];
@@ -233,7 +276,7 @@ int Smoothiepanel::readEncoderDelta() {
        static uint8_t old_AB = 0;
     int8_t state;
        old_AB <<= 2;                   //remember previous state
-       old_AB |= ( this->encoder_a_pin.get() + ( this->encoder_b_pin.get() * 2 ) );  //add current state 
+       old_AB |= ( this->encoder_a_pin.get() + ( this->encoder_b_pin.get() * 2 ) );  //add current state
     state = enc_states[(old_AB&0x0f)];
     if(state != 0){
         this->encoder_hue += state;
@@ -416,14 +459,14 @@ void Smoothiepanel::setBackLED(uint8_t v) {
 void Smoothiepanel::send(uint8_t value, uint8_t mode) {
 #ifdef USE_FASTMODE
        // polls for ready. not sure on I2C this is any faster
-       
+
        // set Data pins as input
        char data[2];
        data[0]= MCP23017_IODIRB;
        data[1]= 0x1E;
        i2c->write(this->i2c_address, data, 2);
        uint8_t b= _backlightBits >> 8;
-       burstBits8b((M17_BIT_RW>>8)|b); // RW hi,RS lo 
+       burstBits8b((M17_BIT_RW>>8)|b); // RW hi,RS lo
        char busy;
        data[0] = MCP23017_GPIOB;
        do {
@@ -439,17 +482,17 @@ void Smoothiepanel::send(uint8_t value, uint8_t mode) {
        data[0]= MCP23017_IODIRB;
        data[1]= 0x00;
        i2c->write(this->i2c_address, data, 2);
-       burstBits8b(b); // RW lo 
+       burstBits8b(b); // RW lo
 
 #else
 //     wait_us(320);
 #endif
-       
+
        // BURST SPEED, OH MY GOD
        // the (now High Speed!) I/O expander pinout
-       //  B7 B6 B5 B4 B3 B2 B1 B0 A7 A6 A5 A4 A3 A2 A1 A0 - MCP23017 
-       //  15 14 13 12 11 10 9  8  7  6  5  4  3  2  1  0  
-       //  RS RW EN D4 D5 D6 D7 B  G  R     B4 B3 B2 B1 B0 
+       //  B7 B6 B5 B4 B3 B2 B1 B0 A7 A6 A5 A4 A3 A2 A1 A0 - MCP23017
+       //  15 14 13 12 11 10 9  8  7  6  5  4  3  2  1  0
+       //  RS RW EN D4 D5 D6 D7 B  G  R     B4 B3 B2 B1 B0
 
        // n.b. RW bit stays LOW to write
        uint8_t buf = _backlightBits >> 8;
@@ -458,7 +501,7 @@ void Smoothiepanel::send(uint8_t value, uint8_t mode) {
        if (value & 0x20) buf |= M17_BIT_D5 >> 8;
        if (value & 0x40) buf |= M17_BIT_D6 >> 8;
        if (value & 0x80) buf |= M17_BIT_D7 >> 8;
-       
+
        if (mode) buf |= (M17_BIT_RS|M17_BIT_EN) >> 8; // RS+EN
        else buf |= M17_BIT_EN >> 8; // EN
 
@@ -475,7 +518,7 @@ void Smoothiepanel::send(uint8_t value, uint8_t mode) {
        if (value & 0x02) buf |= M17_BIT_D5 >> 8;
        if (value & 0x04) buf |= M17_BIT_D6 >> 8;
        if (value & 0x08) buf |= M17_BIT_D7 >> 8;
-       
+
        if (mode) buf |= (M17_BIT_RS|M17_BIT_EN) >> 8; // RS+EN
        else buf |= M17_BIT_EN >> 8; // EN
 
index a1e75a2..4c8e0a8 100644 (file)
@@ -1,4 +1,4 @@
-/*  
+/*
       This file is part of Smoothie (http://smoothieware.org/). The motion control part is heavily based on Grbl (https://github.com/simen/grbl).
       Smoothie is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
       Smoothie is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
@@ -7,7 +7,7 @@
 Much of this was copied from LiquidTWI2
   LiquidTWI2 High Performance i2c LCD driver for MCP23008 & MCP23017
   hacked by Sam C. Lin / http://www.lincomatic.com
-  from 
+  from
    LiquidTWI by Matt Falcon (FalconFour) / http://falconfour.com
    logic gleaned from Adafruit RGB LCD Shield library
 */
@@ -19,15 +19,10 @@ Much of this was copied from LiquidTWI2
 #include "Button.h"
 #include "smoothiepanel/Wiichuck.h"
 
-using namespace std;
-#include <vector>
-#include <string>
-#include <cstdio>
-#include <cstdarg>
 
 // Smoothiepanel specific settings
 
-// readButtons() will only return these bit values 
+// readButtons() will only return these bit values
 //#define ALL_BUTTON_BITS (BUTTON_AUX2|BUTTON_AUX1|BUTTON_SELECT)
 
 
@@ -122,7 +117,7 @@ class Smoothiepanel : public LcdBase {
 
         Pin interrupt_pin;
         Pin encoder_a_pin;
-        Pin encoder_b_pin;    
+        Pin encoder_b_pin;
         Wiichuck* wii;
         bool wii_connected;
         bool encoder_changed;
index 3846f7f..3e95b3e 100644 (file)
@@ -75,6 +75,48 @@ You should have received a copy of the GNU General Public License along with Smo
 #define M17_BIT_B1 0x0002
 #define M17_BIT_B0 0x0001
 
+// commands
+#define LCD_CLEARDISPLAY 0x01
+#define LCD_RETURNHOME 0x02
+#define LCD_ENTRYMODESET 0x04
+#define LCD_DISPLAYCONTROL 0x08
+#define LCD_CURSORSHIFT 0x10
+#define LCD_FUNCTIONSET 0x20
+#define LCD_SETCGRAMADDR 0x40
+#define LCD_SETDDRAMADDR 0x80
+
+// flags for display entry mode
+#define LCD_ENTRYRIGHT 0x00
+#define LCD_ENTRYLEFT 0x02
+#define LCD_ENTRYSHIFTINCREMENT 0x01
+#define LCD_ENTRYSHIFTDECREMENT 0x00
+
+// flags for display on/off control
+#define LCD_DISPLAYON 0x04
+#define LCD_DISPLAYOFF 0x00
+#define LCD_CURSORON 0x02
+#define LCD_CURSOROFF 0x00
+#define LCD_BLINKON 0x01
+#define LCD_BLINKOFF 0x00
+
+// flags for display/cursor shift
+#define LCD_DISPLAYMOVE 0x08
+#define LCD_CURSORMOVE 0x00
+#define LCD_MOVERIGHT 0x04
+#define LCD_MOVELEFT 0x00
+
+// flags for function set
+#define LCD_8BITMODE 0x10
+#define LCD_4BITMODE 0x00
+#define LCD_2LINE 0x08
+#define LCD_1LINE 0x00
+#define LCD_5x10DOTS 0x04
+#define LCD_5x8DOTS 0x00
+
+// flags for backlight control
+#define LCD_BACKLIGHT 0x08
+#define LCD_NOBACKLIGHT 0x00
+
 VikiLCD::VikiLCD() {
     // I2C com
     int i2c_pins = THEKERNEL->config->value(panel_checksum, i2c_pins_checksum)->by_default(3)->as_number();