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