From d004aa68b74fb7060290b3e99798d05c3e14e116 Mon Sep 17 00:00:00 2001 From: Mihai Tudor Panu Date: Mon, 10 Apr 2017 17:17:35 -0700 Subject: [PATCH] lpd8806: added bus parameter to constructor Signed-off-by: Mihai Tudor Panu --- docs/apichanges.md | 4 ++++ examples/c++/lpd8806.cxx | 2 +- src/lpd8806/lpd8806.cxx | 2 +- src/lpd8806/lpd8806.hpp | 5 +++-- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/docs/apichanges.md b/docs/apichanges.md index 01193812..c7bb46e8 100644 --- a/docs/apichanges.md +++ b/docs/apichanges.md @@ -151,6 +151,10 @@ compatibility between releases: and Python, the examples have been modified to use these methods rather than the methods that return data in argument pointers or arrays. + + * **lpd8806** The constructor for this driver was updated to allow specifying + a SPI bus number. This is now the first parameter, the number of LEDs on the + strip is now the last (3rd) parameter instead. # v1.1.0 diff --git a/examples/c++/lpd8806.cxx b/examples/c++/lpd8806.cxx index bc1e17f7..472f36ec 100644 --- a/examples/c++/lpd8806.cxx +++ b/examples/c++/lpd8806.cxx @@ -46,7 +46,7 @@ int main(int argc, char **argv) { //! [Interesting] - sensor = new upm::LPD8806(10, 7); + sensor = new upm::LPD8806(0, 7, 10); usleep (1000000); sensor->show (); diff --git a/src/lpd8806/lpd8806.cxx b/src/lpd8806/lpd8806.cxx index 7872f7f6..37573e3e 100644 --- a/src/lpd8806/lpd8806.cxx +++ b/src/lpd8806/lpd8806.cxx @@ -32,7 +32,7 @@ using namespace upm; -LPD8806::LPD8806 (uint16_t pixelCount, int csn) :m_spi(0), m_csnPinCtx(csn) { +LPD8806::LPD8806 (int bus, int csn, uint16_t pixelCount) :m_spi(bus), m_csnPinCtx(csn) { mraa::Result error = mraa::SUCCESS; m_name = "LPD8806"; diff --git a/src/lpd8806/lpd8806.hpp b/src/lpd8806/lpd8806.hpp index dd24c432..47ea5b56 100644 --- a/src/lpd8806/lpd8806.hpp +++ b/src/lpd8806/lpd8806.hpp @@ -63,10 +63,11 @@ class LPD8806 { /** * Instantiates an LPD8806 object * - * @param pixelCount Number of pixels in the strip + * @param bus SPI bus to use * @param csn Chip select pin + * @param pixelCount Number of pixels in the strip */ - LPD8806 (uint16_t pixelCount, int csn); + LPD8806 (int bus, int csn, uint16_t pixelCount); /** * LPD8806 object destructor; basically, it frees the allocated