upm  0.8.0
Sensor/Actuator repository for libmraa (v1.1.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 "upm/iLightController.hpp"
26 #include "mraa/i2c.hpp"
27 
28 namespace upm
29 {
54 {
55 public:
56  LP8860(int gpioPower, int i2cBus);
57  ~LP8860();
58  const char* getModuleName() { return "lp8860"; }
59  bool isPowered();
60  void setPowerOn();
61  void setPowerOff();
62  int getBrightness();
63  void setBrightness(int dutyPercent);
64 
65 private:
66  void i2cWriteByte(int reg, int value);
67  void i2cWriteBuffer(int reg, uint8_t* buf, int length);
68  uint8_t i2cReadByte(uint8_t reg);
69  void i2cReadBuffer(int reg, uint8_t* buf, int length);
70  void loadEEPROM();
71  void allowMaxCurrent();
72  bool isAvailable();
73 
74  mraa::Result status;
75  mraa::I2c* i2c;
76  int pinPower;
77 };
78 
79 
80 }
81 
const char * getModuleName()
Definition: lp8860.hpp:58
int getBrightness()
Definition: lp8860.cxx:168
ILightController Interface for Light Controllers.
Definition: iLightController.hpp:44
API for LP8860 LED Lighting Controller.
Definition: lp8860.hpp:53
void setPowerOff()
Definition: lp8860.cxx:162
void setPowerOn()
Definition: lp8860.cxx:150
bool isPowered()
Definition: lp8860.cxx:144
void setBrightness(int dutyPercent)
Definition: lp8860.cxx:177