diff --git a/src/ad8232/ad8232.hpp b/src/ad8232/ad8232.hpp index f4eaf7e0..35f32d1f 100644 --- a/src/ad8232/ad8232.hpp +++ b/src/ad8232/ad8232.hpp @@ -97,9 +97,9 @@ namespace upm { int value(); private: - mraa::Aio m_aioOUT; mraa::Gpio m_gpioLOPlus; mraa::Gpio m_gpioLOMinus; + mraa::Aio m_aioOUT; float m_aref; int m_ares; diff --git a/src/bmx055/bma250e.hpp b/src/bmx055/bma250e.hpp index 1da207f6..227d2858 100644 --- a/src/bmx055/bma250e.hpp +++ b/src/bmx055/bma250e.hpp @@ -1418,12 +1418,12 @@ namespace upm { mraa::I2c *m_i2c; mraa::Spi *m_spi; - // spi chip select - mraa::Gpio *m_gpioCS; - mraa::Gpio *m_gpioIntr1; mraa::Gpio *m_gpioIntr2; + // spi chip select + mraa::Gpio *m_gpioCS; + uint8_t m_addr; RESOLUTION_T m_resolution; diff --git a/src/bmx055/bmg160.hpp b/src/bmx055/bmg160.hpp index 2c7c0046..ca68e343 100644 --- a/src/bmx055/bmg160.hpp +++ b/src/bmx055/bmg160.hpp @@ -1185,12 +1185,12 @@ namespace upm { mraa::I2c *m_i2c; mraa::Spi *m_spi; - // spi chip select - mraa::Gpio *m_gpioCS; - mraa::Gpio *m_gpioIntr1; mraa::Gpio *m_gpioIntr2; + // spi chip select + mraa::Gpio *m_gpioCS; + uint8_t m_addr; // SPI chip select diff --git a/src/bmx055/bmm150.hpp b/src/bmx055/bmm150.hpp index 5967bf59..b9ec7db8 100644 --- a/src/bmx055/bmm150.hpp +++ b/src/bmx055/bmm150.hpp @@ -552,12 +552,12 @@ namespace upm { mraa::I2c *m_i2c; mraa::Spi *m_spi; - // spi chip select - mraa::Gpio *m_gpioCS; - mraa::Gpio *m_gpioIntr; mraa::Gpio *m_gpioDR; + // spi chip select + mraa::Gpio *m_gpioCS; + uint8_t m_addr; OPERATION_MODE_T m_opmode; diff --git a/src/cwlsxxa/cwlsxxa.hpp b/src/cwlsxxa/cwlsxxa.hpp index d22030f8..596c64ae 100644 --- a/src/cwlsxxa/cwlsxxa.hpp +++ b/src/cwlsxxa/cwlsxxa.hpp @@ -156,13 +156,14 @@ namespace upm { protected: - // temperature and humidity are optional features of this transmitter - mraa::Aio *m_aioTemp; - mraa::Aio *m_aioHum; - // CO2 reporting is always supported mraa::Aio m_aioCO2; + // temperature and humidity are optional features of this transmitter + mraa::Aio *m_aioHum; + mraa::Aio *m_aioTemp; + + private: float m_aref; float m_rResistor; diff --git a/src/hdxxvxta/hdxxvxta.hpp b/src/hdxxvxta/hdxxvxta.hpp index ebe71ff0..04da0642 100644 --- a/src/hdxxvxta/hdxxvxta.hpp +++ b/src/hdxxvxta/hdxxvxta.hpp @@ -141,11 +141,11 @@ namespace upm { protected: + mraa::Aio m_aioHum; + // temperature is an optional feature of the humidity transmitter mraa::Aio *m_aioTemp; - mraa::Aio m_aioHum; - private: float m_aref; int m_aResTemp; diff --git a/src/lcd/lcm1602.cxx b/src/lcd/lcm1602.cxx index b640b2b2..38fa046f 100644 --- a/src/lcd/lcm1602.cxx +++ b/src/lcd/lcm1602.cxx @@ -42,10 +42,10 @@ using namespace upm; Lcm1602::Lcm1602(int bus_in, int addr_in, bool isExpander, uint8_t numColumns, uint8_t numRows) : + m_numColumns(numColumns), m_numRows(numRows), m_i2c_lcd_control(new mraa::I2c(bus_in)), m_gpioRS(0), m_gpioEnable(0), m_gpioD0(0), - m_gpioD1(0), m_gpioD2(0), m_gpioD3(0), - m_numColumns(numColumns), m_numRows(numRows) + m_gpioD1(0), m_gpioD2(0), m_gpioD3(0) { mraa::Result error = mraa::SUCCESS; m_name = "Lcm1602 (I2C)"; @@ -103,11 +103,11 @@ Lcm1602::Lcm1602(int bus_in, int addr_in, bool isExpander, Lcm1602::Lcm1602(uint8_t rs, uint8_t enable, uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3, uint8_t numColumns, uint8_t numRows) : + m_numColumns(numColumns), m_numRows(numRows), m_i2c_lcd_control(0), m_gpioRS(new mraa::Gpio(rs)), m_gpioEnable(new mraa::Gpio(enable)), m_gpioD0(new mraa::Gpio(d0)), m_gpioD1(new mraa::Gpio(d1)), - m_gpioD2(new mraa::Gpio(d2)), m_gpioD3(new mraa::Gpio(d3)), - m_numColumns(numColumns), m_numRows(numRows) + m_gpioD2(new mraa::Gpio(d2)), m_gpioD3(new mraa::Gpio(d3)) { m_name = "Lcm1602 (4-bit GPIO)"; m_isI2C = false; diff --git a/src/my9221/my9221.hpp b/src/my9221/my9221.hpp index f70d9f61..732aeaaa 100644 --- a/src/my9221/my9221.hpp +++ b/src/my9221/my9221.hpp @@ -136,6 +136,9 @@ namespace upm { unsigned int m_instances; + mraa::Gpio m_gpioData; + mraa::Gpio m_gpioClk; + // an array of uint16_t's representing our bit states (on/off) // intensities. Only the low 8 bits are used, but in the future // 16bit support can work here as well. @@ -143,9 +146,6 @@ namespace upm { uint16_t m_commandWord; - mraa::Gpio m_gpioClk; - mraa::Gpio m_gpioData; - private: }; diff --git a/src/pn532/pn532.hpp b/src/pn532/pn532.hpp index acd78b5c..f5bfb85f 100644 --- a/src/pn532/pn532.hpp +++ b/src/pn532/pn532.hpp @@ -469,9 +469,9 @@ namespace upm { TAG_TYPE_T tagType(); protected: - mraa::I2c m_i2c; mraa::Gpio m_gpioIRQ; mraa::Gpio m_gpioReset; + mraa::I2c m_i2c; bool readAck(); bool isReady(); diff --git a/src/rgbringcoder/rgbringcoder.cxx b/src/rgbringcoder/rgbringcoder.cxx index 4a48314f..ebd093e0 100644 --- a/src/rgbringcoder/rgbringcoder.cxx +++ b/src/rgbringcoder/rgbringcoder.cxx @@ -32,10 +32,10 @@ using namespace std; using namespace upm; -RGBRingCoder::RGBRingCoder(int en, int latch, int clear, int clk, int dat, - int sw, int encA, int encB, int red, +RGBRingCoder::RGBRingCoder(int en, int latch, int clear, int clk, int dat, + int sw, int encA, int encB, int red, int green, int blue) : - m_gpioEn(en), m_gpioLatch(latch), m_gpioClear(clear), m_gpioClock(clk), + m_gpioEn(en), m_gpioLatch(latch), m_gpioClear(clear), m_gpioClock(clk), m_gpioData(dat), m_gpioSwitch(sw), m_gpioEncA(encA), m_gpioEncB(encB), m_pwmRed(red), m_pwmGreen(green), m_pwmBlue(blue) { @@ -48,15 +48,15 @@ RGBRingCoder::RGBRingCoder(int en, int latch, int clear, int clk, int dat, // latch m_gpioLatch.dir(mraa::DIR_OUT); m_gpioLatch.write(0); - + // clear, HIGH m_gpioClear.dir(mraa::DIR_OUT); m_gpioLatch.write(1); - + // clock m_gpioClock.dir(mraa::DIR_OUT); m_gpioClock.write(0); - + // data m_gpioData.dir(mraa::DIR_OUT); m_gpioData.write(0); @@ -65,7 +65,7 @@ RGBRingCoder::RGBRingCoder(int en, int latch, int clear, int clk, int dat, m_gpioSwitch.dir(mraa::DIR_IN); m_gpioSwitch.mode(mraa::MODE_HIZ); // no pullup m_gpioSwitch.write(0); - + // ecoder A interrupt m_gpioEncA.dir(mraa::DIR_IN); m_gpioEncA.mode(mraa::MODE_PULLUP); @@ -136,7 +136,7 @@ void RGBRingCoder::interruptHandler(void *ctx) // First, find the newEncoderState. This'll be a 2-bit value // the msb is the state of the B pin. The lsb is the state // of the A pin on the encoder. - newEncoderState = (This->m_gpioEncB.read()<<1) | + newEncoderState = (This->m_gpioEncB.read()<<1) | (This->m_gpioEncA.read()); // Now we pair oldEncoderState with new encoder state diff --git a/src/rgbringcoder/rgbringcoder.hpp b/src/rgbringcoder/rgbringcoder.hpp index 5675c4fc..1970f7b5 100644 --- a/src/rgbringcoder/rgbringcoder.hpp +++ b/src/rgbringcoder/rgbringcoder.hpp @@ -57,7 +57,7 @@ namespace upm { * * The device requires 11 pins, 3 of which must be PWM-capable * (for the RGB LEDs). - * + * * @image html rgbringcoder.jpg * @snippet rgbringcoder.cxx Interesting */ @@ -80,7 +80,7 @@ namespace upm { * @param green RGB green LED PWM * @param blue RGB blue LED PWM */ - RGBRingCoder(int en, int latch, int clear, int clk, int dat, int sw, + RGBRingCoder(int en, int latch, int clear, int clk, int dat, int sw, int encA, int encB, int red, int green, int blue); /** @@ -98,26 +98,26 @@ namespace upm { */ void setRingLEDS(uint16_t bits); - /* + /** * Returns the state of the button * * @return True if the button is pressed, false otherwise */ bool getButtonState(); - /* + /* * Gets the current rotary encoder counter value * * @return Current counter value */ int getEncoderPosition() { return m_counter; }; - /* + /** * Sets the encoder counter to 0 */ void clearEncoderPosition() { m_counter = 0; }; - /* + /** * Sets the intensity of the red, green, and blue LEDs. Values can * be between 0.0 and 1.0. Lower is brighter, higher is dimmer. * @@ -128,7 +128,7 @@ namespace upm { void setRGBLED(float r, float g, float b); private: - + mraa::Gpio m_gpioEn; mraa::Gpio m_gpioLatch; @@ -138,17 +138,15 @@ namespace upm { mraa::Gpio m_gpioSwitch; + mraa::Gpio m_gpioEncA; + mraa::Gpio m_gpioEncB; + mraa::Pwm m_pwmRed; mraa::Pwm m_pwmGreen; mraa::Pwm m_pwmBlue; - mraa::Gpio m_gpioEncA; - mraa::Gpio m_gpioEncB; - static void interruptHandler(void *ctx); volatile int m_counter; }; } - - diff --git a/src/st7735/st7735.hpp b/src/st7735/st7735.hpp index 4d80400c..9f47eb30 100644 --- a/src/st7735/st7735.hpp +++ b/src/st7735/st7735.hpp @@ -511,7 +511,7 @@ const unsigned char font[] = { * @con spi * * @brief API for the ST7735 LCD - * + * * This module defines the interface for the ST7735 display library * * @image html st7735.jpg @@ -625,13 +625,13 @@ class ST7735 : public GFX { uint8_t m_map[160 * 128 * 2]; /**< Screens buffer */ private: - mraa::Spi m_spi; uint8_t m_spiBuffer[32]; - + mraa::Gpio m_csLCDPinCtx; mraa::Gpio m_cSDPinCtx; mraa::Gpio m_rSTPinCtx; mraa::Gpio m_rSPinCtx; + mraa::Spi m_spi; std::string m_name; }; diff --git a/src/vcap/vcap.cxx b/src/vcap/vcap.cxx index 955fee6b..93182710 100644 --- a/src/vcap/vcap.cxx +++ b/src/vcap/vcap.cxx @@ -38,7 +38,7 @@ using namespace std; (((_val) < (_min)) ? (_min) : (((_val) > (_max)) ? (_max) : (_val))) VCAP::VCAP(string videoDev) : - m_buffer(0), m_fd(-1) + m_fd(-1), m_buffer(0) { memset(&m_caps, 0, sizeof(struct v4l2_capability)); memset(&m_format, 0, sizeof(struct v4l2_format)); diff --git a/src/vcap/vcap.hpp b/src/vcap/vcap.hpp index 9b222d76..cfc53ff4 100644 --- a/src/vcap/vcap.hpp +++ b/src/vcap/vcap.hpp @@ -163,7 +163,7 @@ namespace upm { { m_debugging = enable; }; - + protected: // open the device and check that it meats minimum requirements bool initVideoDevice(); @@ -180,13 +180,13 @@ namespace upm { // does the actual capture bool doCaptureImage(); - + private: // internal ioctl int xioctl(int fd, int request, void* argp); - + std::string m_videoDevice; - + // our file descriptor to the video device int m_fd; @@ -210,5 +210,3 @@ namespace upm { bool m_debugging; }; } - -