upm  1.6.0
Sensor/Actuator repository for libmraa (v1.9.0)
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  virtual 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  /* Disable implicit copy and assignment operators */
68  LP8860(const LP8860&) = delete;
69  LP8860 &operator=(const LP8860&) = delete;
70 
71  void i2cWriteByte(int reg, int value);
72  void i2cWriteBuffer(int reg, uint8_t* buf, int length);
73  uint8_t i2cReadByte(uint8_t reg);
74  void i2cReadBuffer(int reg, uint8_t* buf, int length);
75  void loadEEPROM();
76  void allowMaxCurrent();
77  bool isAvailable();
78 
79  mraa::Result status;
80  mraa::I2c* i2c;
81  int pinPower;
82 };
83 
84 
85 }
86 
int getBrightness()
Definition: lp8860.cxx:168
C++ API for the kxtj3 driver.
Definition: a110x.hpp:29
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
virtual const char * getModuleName()
Definition: lp8860.hpp:59
void setPowerOn()
Definition: lp8860.cxx:150
bool isPowered()
Definition: lp8860.cxx:144
void setBrightness(int dutyPercent)
Definition: lp8860.cxx:177