From c63692b5fd370fffd6484310867f1a153cc66e5d Mon Sep 17 00:00:00 2001 From: Noel Eck Date: Thu, 3 Nov 2016 10:19:14 -0700 Subject: [PATCH] Wreorder: Fixed a subset of reorder errors This commit addresses warnings emitted from -Wreorder in the C++ src. Signed-off-by: Noel Eck --- src/ili9341/ili9341.hpp | 67 ++++++++++++++++++++------------------- src/lcd/eboled.hpp | 3 +- src/lcd/jhd1313m1.cxx | 2 +- src/lcd/lcm1602.hpp | 21 ++++++------ src/lpd8806/lpd8806.cxx | 2 +- src/max31723/max31723.cxx | 2 +- src/max5487/max5487.cxx | 2 +- src/mpu9150/mpu9150.cxx | 2 +- src/nrf24l01/nrf24l01.cxx | 2 +- src/st7735/st7735.cxx | 4 +-- 10 files changed, 54 insertions(+), 53 deletions(-) diff --git a/src/ili9341/ili9341.hpp b/src/ili9341/ili9341.hpp index 23eb3f48..d9d6b473 100644 --- a/src/ili9341/ili9341.hpp +++ b/src/ili9341/ili9341.hpp @@ -160,26 +160,26 @@ namespace upm { * @param rst Reset pin */ ILI9341(uint8_t csLCD, uint8_t csSD, uint8_t dc, uint8_t rst); - + /** * Returns the name of the component */ std::string name() { return m_name; } - + /** * Initializes GPIOs used to talk to the LCD */ void initModule(); - + /** * Configures the LCD driver chip via SPI */ void configModule(); - + /** - * Sets the window size inside the screen where pixel data is + * Sets the window size inside the screen where pixel data is * written. Concrete implementation from GFX interface. * * @param x0 First coordinate @@ -187,11 +187,11 @@ namespace upm { * @param x1 Second coordinate * @param y1 Second coordinate */ - void setAddrWindow(uint16_t x0, - uint16_t y0, - uint16_t x1, + void setAddrWindow(uint16_t x0, + uint16_t y0, + uint16_t x1, uint16_t y1); - + /** * Sends a pixel color (RGB) to the driver chip. Concrete * implementation from GFX interface. @@ -211,7 +211,7 @@ namespace upm { * @param color RGB (16-bit) color (R[0-4], G[5-10], B[11-15] */ void drawFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color); - + /** * Draws a horizontal line using minimal SPI writes. * @@ -221,7 +221,7 @@ namespace upm { * @param color RGB (16-bit) color (R[0-4], G[5-10], B[11-15] */ void drawFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color); - + /** * Draw a filled rectangle. * @@ -231,33 +231,33 @@ namespace upm { * @param h Height of rectangle in pixels * @param color RGB (16-bit) color (R[0-4], G[5-10], B[11-15] */ - void fillRect(int16_t x, - int16_t y, - int16_t w, + void fillRect(int16_t x, + int16_t y, + int16_t w, int16_t h, uint16_t color); - + /** * Fill the screen with a single color. * * @param color RGB (16-bit) color (R[0-4], G[5-10], B[11-15] */ void fillScreen(uint16_t color); - + /** * Sets the screen to one of four 90 deg rotations. * * @param r Rotation setting: 0, 1, 2, 3 */ void setRotation(uint8_t r); - + /** * Invert colors on the display. * * @param i True or false to invert colors */ void invertDisplay(bool i); - + /** * Pass 8-bit R, G, B values and get back 16-bit packed color. * @@ -267,77 +267,78 @@ namespace upm { * @return 16-bit packed color (RGB) value */ uint16_t color565(uint8_t r, uint8_t g, uint8_t b); - + /** * Executes a set of commands and data. * * @param addr Pointer to the start of the commands/data section */ void executeCMDList(const uint8_t *addr); - + /** * Sends a command to the display driver via SPI. * * @param c Command to be written */ void writecommand(uint8_t c); - + /** * Sends data to the display driver via SPI * * @param d Data to be written */ void writedata(uint8_t d); - + /** * Set LCD chip select to LOW */ mraa::Result lcdCSOn(); - + /** * Set LCD chip select to HIGH */ mraa::Result lcdCSOff(); - + /** * Set SD card chip select to LOW */ mraa::Result sdCSOn(); - + /** * Set SD card chip select to HIGH */ mraa::Result sdCSOff(); - + /** * Set data/command line to HIGH */ mraa::Result dcHigh(); - + /** * Set data/command line to LOW */ mraa::Result dcLow(); - + /** * Set reset line to HIGH */ mraa::Result rstHigh(); - + /** * Set reset line to LOW */ mraa::Result rstLow(); - + private: - mraa::Spi m_spi; uint8_t m_spiBuffer[32]; - + mraa::Gpio m_csLCDPinCtx; mraa::Gpio m_csSDPinCtx; mraa::Gpio m_dcPinCtx; mraa::Gpio m_rstPinCtx; - + + mraa::Spi m_spi; + std::string m_name; }; } diff --git a/src/lcd/eboled.hpp b/src/lcd/eboled.hpp index a25b063f..6ace07c2 100644 --- a/src/lcd/eboled.hpp +++ b/src/lcd/eboled.hpp @@ -364,11 +364,10 @@ namespace upm mraa::Result setAddressingMode(displayAddressingMode mode); private: + mraa::Spi m_spi; mraa::Gpio m_gpioCD; // command(0)/data(1) mraa::Gpio m_gpioRST; // reset pin - mraa::Spi m_spi; - uint8_t m_cursorX; uint8_t m_cursorY; uint8_t m_textSize; diff --git a/src/lcd/jhd1313m1.cxx b/src/lcd/jhd1313m1.cxx index 4d83f725..3a547fb6 100644 --- a/src/lcd/jhd1313m1.cxx +++ b/src/lcd/jhd1313m1.cxx @@ -35,7 +35,7 @@ using namespace upm; Jhd1313m1::Jhd1313m1(int bus, int lcdAddress, int rgbAddress) - : m_i2c_lcd_rgb(bus), Lcm1602(bus, lcdAddress, false) + : Lcm1602(bus, lcdAddress, false), m_i2c_lcd_rgb(bus) { m_rgb_address = rgbAddress; m_name = "Jhd1313m1"; diff --git a/src/lcd/lcm1602.hpp b/src/lcd/lcm1602.hpp index 5f37cf51..3b86c0e7 100644 --- a/src/lcd/lcm1602.hpp +++ b/src/lcd/lcm1602.hpp @@ -251,10 +251,20 @@ class Lcm1602 : public LCD uint8_t m_displayControl; uint8_t m_entryDisplayMode; + mraa::I2c* m_i2c_lcd_control; + + // gpio operation + mraa::Gpio* m_gpioRS; + mraa::Gpio* m_gpioEnable; + mraa::Gpio* m_gpioD0; + mraa::Gpio* m_gpioD1; + mraa::Gpio* m_gpioD2; + mraa::Gpio* m_gpioD3; + // Display size uint8_t m_numColumns; uint8_t m_numRows; - + // Backlight uint8_t m_backlight; @@ -266,19 +276,10 @@ class Lcm1602 : public LCD virtual mraa::Result data(uint8_t data); int m_lcd_control_address; - mraa::I2c* m_i2c_lcd_control; private: // true if using i2c, false otherwise (gpio) bool m_isI2C; - - // gpio operation - mraa::Gpio* m_gpioRS; - mraa::Gpio* m_gpioEnable; - mraa::Gpio* m_gpioD0; - mraa::Gpio* m_gpioD1; - mraa::Gpio* m_gpioD2; - mraa::Gpio* m_gpioD3; }; } diff --git a/src/lpd8806/lpd8806.cxx b/src/lpd8806/lpd8806.cxx index 5593dadc..e50320f6 100644 --- a/src/lpd8806/lpd8806.cxx +++ b/src/lpd8806/lpd8806.cxx @@ -32,7 +32,7 @@ using namespace upm; -LPD8806::LPD8806 (uint16_t pixelCount, uint8_t csn) : m_csnPinCtx(csn), m_spi(0) { +LPD8806::LPD8806 (uint16_t pixelCount, uint8_t csn) :m_spi(0), m_csnPinCtx(csn) { mraa::Result error = mraa::SUCCESS; m_name = "LPD8806"; diff --git a/src/max31723/max31723.cxx b/src/max31723/max31723.cxx index 512d5b31..f78caa96 100644 --- a/src/max31723/max31723.cxx +++ b/src/max31723/max31723.cxx @@ -31,7 +31,7 @@ using namespace upm; -MAX31723::MAX31723 (int csn) : m_csnPinCtx(csn), m_spi(0) { +MAX31723::MAX31723 (int csn) : m_spi(0), m_csnPinCtx(csn) { mraa::Result error = mraa::SUCCESS; m_name = "MAX31723"; diff --git a/src/max5487/max5487.cxx b/src/max5487/max5487.cxx index f0c72634..1b89e7bf 100644 --- a/src/max5487/max5487.cxx +++ b/src/max5487/max5487.cxx @@ -31,7 +31,7 @@ using namespace upm; -MAX5487::MAX5487 (int csn) : m_csnPinCtx(csn), m_spi(0) { +MAX5487::MAX5487 (int csn) :m_spi(0), m_csnPinCtx(csn) { mraa::Result error = mraa::SUCCESS; m_name = "MAX5487"; diff --git a/src/mpu9150/mpu9150.cxx b/src/mpu9150/mpu9150.cxx index d699466b..a8b437f2 100644 --- a/src/mpu9150/mpu9150.cxx +++ b/src/mpu9150/mpu9150.cxx @@ -32,7 +32,7 @@ using namespace upm; using namespace std; MPU9150::MPU9150 (int bus, int address, int magAddress, bool enableAk8975) : - m_mag(0), MPU60X0(bus, address) + MPU60X0(bus, address), m_mag(0) { m_magAddress = magAddress; m_i2cBus = bus; diff --git a/src/nrf24l01/nrf24l01.cxx b/src/nrf24l01/nrf24l01.cxx index 57092daf..6481c075 100644 --- a/src/nrf24l01/nrf24l01.cxx +++ b/src/nrf24l01/nrf24l01.cxx @@ -35,7 +35,7 @@ using namespace upm; NRF24L01::NRF24L01 (uint8_t cs, uint8_t ce) - : m_csnPinCtx(cs), m_cePinCtx(ce), m_spi(0) + :m_spi(0), m_csnPinCtx(cs), m_cePinCtx(ce) { init (cs, ce); } diff --git a/src/st7735/st7735.cxx b/src/st7735/st7735.cxx index a666ceac..d8ca1133 100644 --- a/src/st7735/st7735.cxx +++ b/src/st7735/st7735.cxx @@ -35,8 +35,8 @@ using namespace upm; ST7735::ST7735 (uint8_t csLCD, uint8_t cSD, uint8_t rs, uint8_t rst) - : GFX (160, 128, m_map, font), m_csLCDPinCtx(csLCD), m_cSDPinCtx(cSD), - m_rSTPinCtx(rst), m_rSPinCtx(rs), m_spi(0) { + : GFX (160, 128, m_map, font), m_spi(0), m_csLCDPinCtx(csLCD), m_cSDPinCtx(cSD), + m_rSTPinCtx(rst), m_rSPinCtx(rs) { initModule (); configModule ();