From dfc7a710d46a3bd430442fc36273bee7d7e51c85 Mon Sep 17 00:00:00 2001 From: Mihai Tudor Panu Date: Thu, 8 Dec 2016 15:10:36 -0800 Subject: [PATCH] firmata: extended data types on pins to allow subplatform usage Signed-off-by: Mihai Tudor Panu --- src/ecs1030/ecs1030.cxx | 2 +- src/ecs1030/ecs1030.hpp | 2 +- src/groveultrasonic/groveultrasonic.cxx | 2 +- src/groveultrasonic/groveultrasonic.hpp | 2 +- src/hcsr04/hcsr04.cxx | 2 +- src/hcsr04/hcsr04.hpp | 2 +- src/hx711/hx711.cxx | 2 +- src/hx711/hx711.hpp | 2 +- src/ili9341/ili9341.cxx | 2 +- src/ili9341/ili9341.hpp | 2 +- src/lcd/lcm1602.cxx | 4 ++-- src/lcd/lcm1602.hpp | 4 ++-- src/lcd/sainsmartks.cxx | 6 +++--- src/lcd/sainsmartks.hpp | 6 +++--- src/lcm1602/lcm1602.cxx | 4 ++-- src/lcm1602/lcm1602.hpp | 4 ++-- src/lpd8806/lpd8806.cxx | 2 +- src/lpd8806/lpd8806.hpp | 2 +- src/my9221/grovecircularled.cxx | 2 +- src/my9221/grovecircularled.hpp | 2 +- src/my9221/groveledbar.cxx | 2 +- src/my9221/groveledbar.hpp | 2 +- src/my9221/my9221.cxx | 2 +- src/my9221/my9221.hpp | 2 +- src/nrf24l01/nrf24l01.cxx | 4 ++-- src/nrf24l01/nrf24l01.hpp | 4 ++-- src/rf22/rf22.cxx | 2 +- src/rf22/rf22.hpp | 2 +- src/ssd1351/ssd1351.cxx | 2 +- src/ssd1351/ssd1351.hpp | 2 +- src/st7735/st7735.cxx | 2 +- src/st7735/st7735.hpp | 2 +- src/ultrasonic/ultrasonic.cxx | 2 +- src/ultrasonic/ultrasonic.hpp | 2 +- 34 files changed, 44 insertions(+), 44 deletions(-) diff --git a/src/ecs1030/ecs1030.cxx b/src/ecs1030/ecs1030.cxx index ff72f701..4995f24f 100644 --- a/src/ecs1030/ecs1030.cxx +++ b/src/ecs1030/ecs1030.cxx @@ -32,7 +32,7 @@ using namespace upm; -ECS1030::ECS1030 (uint8_t pinNumber) { +ECS1030::ECS1030 (int pinNumber) { m_dataPinCtx = mraa_aio_init(pinNumber); if (m_dataPinCtx == NULL) { throw std::invalid_argument(std::string(__FUNCTION__) + diff --git a/src/ecs1030/ecs1030.hpp b/src/ecs1030/ecs1030.hpp index 29deb4ab..dec1b982 100644 --- a/src/ecs1030/ecs1030.hpp +++ b/src/ecs1030/ecs1030.hpp @@ -83,7 +83,7 @@ class ECS1030 { * * @param pinNumber Number of the data pin */ - ECS1030 (uint8_t pinNumber); + ECS1030 (int pinNumber); /** * ECS1030 object destructor; basically, it closes the GPIO. diff --git a/src/groveultrasonic/groveultrasonic.cxx b/src/groveultrasonic/groveultrasonic.cxx index dc9830d0..3c7d3f27 100644 --- a/src/groveultrasonic/groveultrasonic.cxx +++ b/src/groveultrasonic/groveultrasonic.cxx @@ -33,7 +33,7 @@ using namespace upm; -GroveUltraSonic::GroveUltraSonic (uint8_t pin) { +GroveUltraSonic::GroveUltraSonic (int pin) { m_name = "GroveUltraSonic"; mraa_init(); diff --git a/src/groveultrasonic/groveultrasonic.hpp b/src/groveultrasonic/groveultrasonic.hpp index 89c13f92..2bd74610 100644 --- a/src/groveultrasonic/groveultrasonic.hpp +++ b/src/groveultrasonic/groveultrasonic.hpp @@ -69,7 +69,7 @@ class GroveUltraSonic { * * @param pin pin for triggering the sensor for distance and for receiving pulse response */ - GroveUltraSonic (uint8_t pin); + GroveUltraSonic (int pin); /** * GroveUltraSonic object destructor. diff --git a/src/hcsr04/hcsr04.cxx b/src/hcsr04/hcsr04.cxx index 052f1c0f..03f1acad 100644 --- a/src/hcsr04/hcsr04.cxx +++ b/src/hcsr04/hcsr04.cxx @@ -38,7 +38,7 @@ using namespace upm; -HCSR04::HCSR04 (uint8_t triggerPin, uint8_t echoPin) { +HCSR04::HCSR04 (int triggerPin, int echoPin) { m_name = "HCSR04"; m_triggerPinCtx = mraa_gpio_init (triggerPin); diff --git a/src/hcsr04/hcsr04.hpp b/src/hcsr04/hcsr04.hpp index 95721dfa..b77b9724 100644 --- a/src/hcsr04/hcsr04.hpp +++ b/src/hcsr04/hcsr04.hpp @@ -65,7 +65,7 @@ class HCSR04 { * @param fptr Function pointer to handle rising-edge and * falling-edge interrupts */ - HCSR04 (uint8_t triggerPin, uint8_t echoPin); + HCSR04 (int triggerPin, int echoPin); /** * HCSR04 object destructor */ diff --git a/src/hx711/hx711.cxx b/src/hx711/hx711.cxx index cf6c987c..fe660883 100644 --- a/src/hx711/hx711.cxx +++ b/src/hx711/hx711.cxx @@ -30,7 +30,7 @@ using namespace upm; using namespace std; -HX711::HX711(uint8_t data, uint8_t sck, uint8_t gain) { +HX711::HX711(int data, int sck, uint8_t gain) { mraa_result_t error = MRAA_SUCCESS; this->m_dataPinCtx = mraa_gpio_init(data); diff --git a/src/hx711/hx711.hpp b/src/hx711/hx711.hpp index 4047fbc9..b006bdbe 100644 --- a/src/hx711/hx711.hpp +++ b/src/hx711/hx711.hpp @@ -63,7 +63,7 @@ namespace upm { * @param gain Defines the gain factor * Valid values are 128 or 64 for channel A; channel B works with a 32-gain factor only */ - HX711(uint8_t data, uint8_t sck, uint8_t gain = 128); + HX711(int data, int sck, uint8_t gain = 128); /** * HX711 destructor diff --git a/src/ili9341/ili9341.cxx b/src/ili9341/ili9341.cxx index 22e23506..3ebbd5bb 100644 --- a/src/ili9341/ili9341.cxx +++ b/src/ili9341/ili9341.cxx @@ -37,7 +37,7 @@ using namespace upm; -ILI9341::ILI9341(uint8_t csLCD, uint8_t csSD, uint8_t dc, uint8_t rst) : +ILI9341::ILI9341(int csLCD, int csSD, int dc, int rst) : GFX(ILI9341_TFTWIDTH, ILI9341_TFTHEIGHT), m_csLCDPinCtx(csLCD), m_csSDPinCtx(csSD), m_dcPinCtx(dc), m_rstPinCtx(rst), m_spi(0) { diff --git a/src/ili9341/ili9341.hpp b/src/ili9341/ili9341.hpp index 1e95ec1e..920adaaa 100644 --- a/src/ili9341/ili9341.hpp +++ b/src/ili9341/ili9341.hpp @@ -159,7 +159,7 @@ namespace upm { * @param dc Data/command pin * @param rst Reset pin */ - ILI9341(uint8_t csLCD, uint8_t csSD, uint8_t dc, uint8_t rst); + ILI9341(int csLCD, int csSD, int dc, int rst); /** * Returns the name of the component diff --git a/src/lcd/lcm1602.cxx b/src/lcd/lcm1602.cxx index 38fa046f..2d98c151 100644 --- a/src/lcd/lcm1602.cxx +++ b/src/lcd/lcm1602.cxx @@ -100,8 +100,8 @@ Lcm1602::Lcm1602(int bus_in, int addr_in, bool isExpander, home(); } -Lcm1602::Lcm1602(uint8_t rs, uint8_t enable, uint8_t d0, - uint8_t d1, uint8_t d2, uint8_t d3, +Lcm1602::Lcm1602(int rs, int enable, int d0, + int d1, int d2, int d3, uint8_t numColumns, uint8_t numRows) : m_numColumns(numColumns), m_numRows(numRows), m_i2c_lcd_control(0), diff --git a/src/lcd/lcm1602.hpp b/src/lcd/lcm1602.hpp index e004db67..49c20f7d 100644 --- a/src/lcd/lcm1602.hpp +++ b/src/lcd/lcm1602.hpp @@ -97,8 +97,8 @@ class Lcm1602 : public LCD * @param numColumns Number of columns the display has. Default 16. * @param numRows Number of rows the display has. Default 2. */ - Lcm1602(uint8_t rs, uint8_t enable, - uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3, + Lcm1602(int rs, int enable, + int d0, int d1, int d2, int d3, uint8_t numColumns = 16, uint8_t numRows = 2); /** diff --git a/src/lcd/sainsmartks.cxx b/src/lcd/sainsmartks.cxx index f65311d6..ef3469bb 100644 --- a/src/lcd/sainsmartks.cxx +++ b/src/lcd/sainsmartks.cxx @@ -29,9 +29,9 @@ using namespace upm; -SAINSMARTKS::SAINSMARTKS(uint8_t rs, uint8_t enable, - uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3, - uint8_t keypad) +SAINSMARTKS::SAINSMARTKS(int rs, int enable, + int d0, int d1, int d2, int d3, + int keypad) : Lcm1602(rs, enable, d0, d1, d2, d3), m_aioKeypad(keypad) { diff --git a/src/lcd/sainsmartks.hpp b/src/lcd/sainsmartks.hpp index f51dd2a6..091ffeb4 100644 --- a/src/lcd/sainsmartks.hpp +++ b/src/lcd/sainsmartks.hpp @@ -69,9 +69,9 @@ namespace upm * @param d3 data 3 pin * @param keypad analog pin of the keypad */ - SAINSMARTKS(uint8_t rs=8, uint8_t enable=9, - uint8_t d0=4, uint8_t d1=5, uint8_t d2=6, uint8_t d3=7, - uint8_t keypad=0); + SAINSMARTKS(int rs=8, int enable=9, + int d0=4, int d1=5, int d2=6, int d3=7, + int keypad=0); /** * SAINSMARTKS destructor */ diff --git a/src/lcm1602/lcm1602.cxx b/src/lcm1602/lcm1602.cxx index 1af9f3b8..2ce7f1f0 100644 --- a/src/lcm1602/lcm1602.cxx +++ b/src/lcm1602/lcm1602.cxx @@ -49,8 +49,8 @@ Lcm1602::Lcm1602(int bus_in, int addr_in, bool isExpander, ": lcm1602_i2c_init failed"); } -Lcm1602::Lcm1602(uint8_t rs, uint8_t enable, uint8_t d0, - uint8_t d1, uint8_t d2, uint8_t d3, +Lcm1602::Lcm1602(int rs, int enable, int d0, + int d1, int d2, int d3, uint8_t numColumns, uint8_t numRows) : m_lcm1602(lcm1602_gpio_init(rs, enable, d0, d1, d2, d3, numColumns, numRows)) diff --git a/src/lcm1602/lcm1602.hpp b/src/lcm1602/lcm1602.hpp index 0b336be4..5f017096 100644 --- a/src/lcm1602/lcm1602.hpp +++ b/src/lcm1602/lcm1602.hpp @@ -99,8 +99,8 @@ namespace upm * @param numColumns Number of columns the display has. Default 16. * @param numRows Number of rows the display has. Default 2. */ - Lcm1602(uint8_t rs, uint8_t enable, - uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3, + Lcm1602(int rs, int enable, + int d0, int d1, int d2, int d3, uint8_t numColumns = 16, uint8_t numRows = 2); /** diff --git a/src/lpd8806/lpd8806.cxx b/src/lpd8806/lpd8806.cxx index e50320f6..7872f7f6 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_spi(0), m_csnPinCtx(csn) { +LPD8806::LPD8806 (uint16_t pixelCount, int csn) :m_spi(0), m_csnPinCtx(csn) { mraa::Result error = mraa::SUCCESS; m_name = "LPD8806"; diff --git a/src/lpd8806/lpd8806.hpp b/src/lpd8806/lpd8806.hpp index cc8f7e4c..4fa57227 100644 --- a/src/lpd8806/lpd8806.hpp +++ b/src/lpd8806/lpd8806.hpp @@ -65,7 +65,7 @@ class LPD8806 { * @param pixelCount Number of pixels in the strip * @param csn Chip select pin */ - LPD8806 (uint16_t pixelCount, uint8_t csn); + LPD8806 (uint16_t pixelCount, int csn); /** * LPD8806 object destructor; basically, it frees the allocated diff --git a/src/my9221/grovecircularled.cxx b/src/my9221/grovecircularled.cxx index 87c245c0..d5538fee 100644 --- a/src/my9221/grovecircularled.cxx +++ b/src/my9221/grovecircularled.cxx @@ -44,7 +44,7 @@ using namespace upm; using namespace std; -GroveCircularLED::GroveCircularLED (uint8_t dataPin, uint8_t clockPin) +GroveCircularLED::GroveCircularLED (int dataPin, int clockPin) : MY9221(dataPin, clockPin, 2) { // auto refresh by default diff --git a/src/my9221/grovecircularled.hpp b/src/my9221/grovecircularled.hpp index 6ac03a79..d12f0deb 100644 --- a/src/my9221/grovecircularled.hpp +++ b/src/my9221/grovecircularled.hpp @@ -67,7 +67,7 @@ namespace upm { * @param dataPin Data pin * @param clockPin Clock pin */ - GroveCircularLED(uint8_t dataPin, uint8_t clockPin); + GroveCircularLED(int dataPin, int clockPin); /** * GroveCircularLED destructor diff --git a/src/my9221/groveledbar.cxx b/src/my9221/groveledbar.cxx index 1ea29f79..734f09a7 100644 --- a/src/my9221/groveledbar.cxx +++ b/src/my9221/groveledbar.cxx @@ -44,7 +44,7 @@ using namespace upm; using namespace std; -GroveLEDBar::GroveLEDBar (uint8_t dataPin, uint8_t clockPin, int instances) +GroveLEDBar::GroveLEDBar (int dataPin, int clockPin, int instances) : MY9221(dataPin, clockPin, instances) { // auto refresh by default diff --git a/src/my9221/groveledbar.hpp b/src/my9221/groveledbar.hpp index 719174f2..3891475f 100644 --- a/src/my9221/groveledbar.hpp +++ b/src/my9221/groveledbar.hpp @@ -73,7 +73,7 @@ namespace upm { * @param clockPin Clock pin * @param instances Number of daisy-chained Grove LED Bars, default 1 */ - GroveLEDBar(uint8_t dataPin, uint8_t clockPin, int instances=1); + GroveLEDBar(int dataPin, int clockPin, int instances=1); /** * GroveLEDBar destructor diff --git a/src/my9221/my9221.cxx b/src/my9221/my9221.cxx index 736c47a1..c842b338 100644 --- a/src/my9221/my9221.cxx +++ b/src/my9221/my9221.cxx @@ -44,7 +44,7 @@ using namespace upm; using namespace std; -MY9221::MY9221 (uint8_t dataPin, uint8_t clockPin, int instances) : +MY9221::MY9221 (int dataPin, int clockPin, int instances) : m_my9221(my9221_init(dataPin, clockPin, instances)) { if (!m_my9221) diff --git a/src/my9221/my9221.hpp b/src/my9221/my9221.hpp index 45d4066f..43bc400a 100644 --- a/src/my9221/my9221.hpp +++ b/src/my9221/my9221.hpp @@ -54,7 +54,7 @@ namespace upm { * @param clockPin Clock pin * @param instances Number of daisy-chained my9221s, default 1 */ - MY9221(uint8_t dataPin, uint8_t clockPin, int instances=1); + MY9221(int dataPin, int clockPin, int instances=1); /** * MY9221 destructor diff --git a/src/nrf24l01/nrf24l01.cxx b/src/nrf24l01/nrf24l01.cxx index 6481c075..8efaa51c 100644 --- a/src/nrf24l01/nrf24l01.cxx +++ b/src/nrf24l01/nrf24l01.cxx @@ -34,14 +34,14 @@ using namespace upm; -NRF24L01::NRF24L01 (uint8_t cs, uint8_t ce) +NRF24L01::NRF24L01 (int cs, int ce) :m_spi(0), m_csnPinCtx(cs), m_cePinCtx(ce) { init (cs, ce); } void -NRF24L01::init (uint8_t chip_select, uint8_t chip_enable) { +NRF24L01::init (int chip_select, int chip_enable) { mraa::Result error = mraa::SUCCESS; m_csn = chip_select; diff --git a/src/nrf24l01/nrf24l01.hpp b/src/nrf24l01/nrf24l01.hpp index e0ec66ce..d73e2199 100644 --- a/src/nrf24l01/nrf24l01.hpp +++ b/src/nrf24l01/nrf24l01.hpp @@ -192,7 +192,7 @@ class NRF24L01 { * * @param cs Chip select pin */ - NRF24L01 (uint8_t cs, uint8_t ce); + NRF24L01 (int cs, int ce); /** * Returns the name of the component @@ -208,7 +208,7 @@ class NRF24L01 { * @param chipSelect Sets up the chip select pin * @param chipEnable Sets up the chip enable pin */ - void init (uint8_t chipSelect, uint8_t chipEnable); + void init (int chipSelect, int chipEnable); /** * Configures the NRF24L01 transceiver diff --git a/src/rf22/rf22.cxx b/src/rf22/rf22.cxx index e3bb9d5b..3b33e05c 100644 --- a/src/rf22/rf22.cxx +++ b/src/rf22/rf22.cxx @@ -75,7 +75,7 @@ static const RF22::ModemConfig MODEM_CONFIG_TABLE[] = }; -RF22::RF22(uint8_t spiBus, uint8_t slaveSelectPin, uint8_t interruptPin) +RF22::RF22(int spiBus, int slaveSelectPin, int interruptPin) { _idleMode = RF22_XTON; // Default idle state is READY mode _mode = RF22_MODE_IDLE; // We start up in idle mode diff --git a/src/rf22/rf22.hpp b/src/rf22/rf22.hpp index 3a103697..ca686be3 100644 --- a/src/rf22/rf22.hpp +++ b/src/rf22/rf22.hpp @@ -521,7 +521,7 @@ public: * accessing it. Default is 10 or the normal SS pin for Arduino * @param[in] interruptPin The interrupt pin number to use. Default is 2 */ - RF22(uint8_t spiBus = 0, uint8_t slaveSelectPin = 10, uint8_t interruptPin = 2); + RF22(int spiBus = 0, int slaveSelectPin = 10, int interruptPin = 2); /** * Destructor. diff --git a/src/ssd1351/ssd1351.cxx b/src/ssd1351/ssd1351.cxx index ab4e1f30..650fa3aa 100644 --- a/src/ssd1351/ssd1351.cxx +++ b/src/ssd1351/ssd1351.cxx @@ -35,7 +35,7 @@ using namespace upm; using namespace std; -SSD1351::SSD1351 (uint8_t oc, uint8_t dc, uint8_t rst) : +SSD1351::SSD1351 (int oc, int dc, int rst) : GFX(SSD1351WIDTH, SSD1351HEIGHT), m_spi(0), m_oc(oc), m_dc(dc), m_rst(rst) { diff --git a/src/ssd1351/ssd1351.hpp b/src/ssd1351/ssd1351.hpp index 4462fcaa..26ee450b 100644 --- a/src/ssd1351/ssd1351.hpp +++ b/src/ssd1351/ssd1351.hpp @@ -112,7 +112,7 @@ class SSD1351 : public GFX{ * @param dc Data/command pin * @param rst Reset pin */ - SSD1351 (uint8_t oc, uint8_t dc, uint8_t rst); + SSD1351 (int oc, int dc, int rst); /** * SSD1351 object destructor diff --git a/src/st7735/st7735.cxx b/src/st7735/st7735.cxx index d8ca1133..480103de 100644 --- a/src/st7735/st7735.cxx +++ b/src/st7735/st7735.cxx @@ -34,7 +34,7 @@ using namespace upm; -ST7735::ST7735 (uint8_t csLCD, uint8_t cSD, uint8_t rs, uint8_t rst) +ST7735::ST7735 (int csLCD, int cSD, int rs, int rst) : GFX (160, 128, m_map, font), m_spi(0), m_csLCDPinCtx(csLCD), m_cSDPinCtx(cSD), m_rSTPinCtx(rst), m_rSPinCtx(rs) { diff --git a/src/st7735/st7735.hpp b/src/st7735/st7735.hpp index 084a16c2..06b3e103 100644 --- a/src/st7735/st7735.hpp +++ b/src/st7735/st7735.hpp @@ -527,7 +527,7 @@ class ST7735 : public GFX { * @param rs Data/command pin * @param rst Reset pin */ - ST7735 (uint8_t csLCD, uint8_t cSD, uint8_t rs, uint8_t rst); + ST7735 (int csLCD, int cSD, int rs, int rst); /** * Returns the name of the component diff --git a/src/ultrasonic/ultrasonic.cxx b/src/ultrasonic/ultrasonic.cxx index b9f0bbe0..5dc11bf6 100644 --- a/src/ultrasonic/ultrasonic.cxx +++ b/src/ultrasonic/ultrasonic.cxx @@ -33,7 +33,7 @@ using namespace upm; -UltraSonic::UltraSonic (uint8_t pin) { +UltraSonic::UltraSonic (int pin) { m_name = "UltraSonic"; mraa_init(); diff --git a/src/ultrasonic/ultrasonic.hpp b/src/ultrasonic/ultrasonic.hpp index bd703313..c6dee1d5 100644 --- a/src/ultrasonic/ultrasonic.hpp +++ b/src/ultrasonic/ultrasonic.hpp @@ -67,7 +67,7 @@ class UltraSonic { * * @param pin pin for triggering the sensor for distance and for receiving pulse response */ - UltraSonic (uint8_t pin); + UltraSonic (int pin); /** * UltraSonic object destructor.