upm  1.2.0
Sensor/Actuator repository for libmraa (v1.6.1)
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
lp8860.hpp
1 /*
2  * Author: Henry Bruce <henry.bruce@intel.com>
3  * Copyright (c) 2014 Intel Corporation.
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining
6  * a copy of this software and associated documentation files (the
7  * "Software"), to deal in the Software without restriction, including
8  * without limitation the rights to use, copy, modify, merge, publish,
9  * distribute, sublicense, and/or sell copies of the Software, and to
10  * permit persons to whom the Software is furnished to do so, subject to
11  * the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be
14  * included in all copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23  */
24 
25 #include "interfaces/iLightController.hpp"
26 #include "mraa/i2c.hpp"
27 
28 namespace upm
29 {
56 {
57 public:
58  LP8860(int gpioPower, int i2cBus);
59  ~LP8860();
60  virtual const char* getModuleName() { return "lp8860"; }
61  bool isPowered();
62  void setPowerOn();
63  void setPowerOff();
64  int getBrightness();
65  void setBrightness(int dutyPercent);
66 
67 private:
68  void i2cWriteByte(int reg, int value);
69  void i2cWriteBuffer(int reg, uint8_t* buf, int length);
70  uint8_t i2cReadByte(uint8_t reg);
71  void i2cReadBuffer(int reg, uint8_t* buf, int length);
72  void loadEEPROM();
73  void allowMaxCurrent();
74  bool isAvailable();
75 
76  mraa::Result status;
77  mraa::I2c* i2c;
78  int pinPower;
79 };
80 
81 
82 }
83 
int getBrightness()
Definition: lp8860.cxx:168
ILightController Interface for Light Controllers.
Definition: iLightController.hpp:44
API for LP8860 LED Lighting Controller.
Definition: lp8860.hpp:55
void setPowerOff()
Definition: lp8860.cxx:162
virtual const char * getModuleName()
Definition: lp8860.hpp:60
void setPowerOn()
Definition: lp8860.cxx:150
bool isPowered()
Definition: lp8860.cxx:144
void setBrightness(int dutyPercent)
Definition: lp8860.cxx:177