lpd8806: added bus parameter to constructor

Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
This commit is contained in:
Mihai Tudor Panu 2017-04-10 17:17:35 -07:00
parent 3aef2ea70e
commit d004aa68b7
4 changed files with 9 additions and 4 deletions

View File

@ -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

View File

@ -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 ();

View File

@ -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";

View File

@ -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