upm  1.7.1
Sensor/Actuator repository for libmraa (v2.0.0)
my9221.hpp
1 /*
2  * Author: Jon Trulson <jtrulson@ics.com>
3  * Copyright (c) 2016 Intel Corporation.
4  *
5  * These modules were rewritten, based on original work by:
6  *
7  * (original my9221/groveledbar)
8  * Author: Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
9  * Copyright (c) 2014 Intel Corporation.
10  *
11  * (grovecircularled)
12  * Author: Jun Kato and Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
13  * Contributions: Jon Trulson <jtrulson@ics.com>
14  * Copyright (c) 2014 Intel Corporation.
15  *
16  * Permission is hereby granted, free of charge, to any person obtaining
17  * a copy of this software and associated documentation files (the
18  * "Software"), to deal in the Software without restriction, including
19  * without limitation the rights to use, copy, modify, merge, publish,
20  * distribute, sublicense, and/or sell copies of the Software, and to
21  * permit persons to whom the Software is furnished to do so, subject to
22  * the following conditions:
23  *
24  * The above copyright notice and this permission notice shall be
25  * included in all copies or substantial portions of the Software.
26  *
27  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
28  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
29  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
30  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
31  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
32  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
33  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
34  */
35 #pragma once
36 
37 #include <string>
38 #include <my9221.h>
39 
40 namespace upm {
41 
47  class MY9221 {
48  public:
49 
57  MY9221(int dataPin, int clockPin, int instances=1);
58 
62  virtual ~MY9221();
63 
72  void setAutoRefresh(bool enable)
73  {
74  my9221_set_auto_refresh(m_my9221, enable);
75  }
76 
84  void setLED(int led, bool on);
85 
94  void setLowIntensityValue(int intensity);
95 
104  void setHighIntensityValue(int intensity);
105 
109  void setAll();
110 
114  void clearAll();
115 
121  void refresh();
122 
123  protected:
124 
125  my9221_context m_my9221;
126 
127  private:
128  /* Disable implicit copy and assignment operators */
129  MY9221(const MY9221&) = delete;
130  MY9221 &operator=(const MY9221&) = delete;
131  };
132 
133 }
Definition: my9221.hpp:47
MY9221(int dataPin, int clockPin, int instances=1)
Definition: my9221.cxx:47
virtual ~MY9221()
Definition: my9221.cxx:56
void setLowIntensityValue(int intensity)
Definition: my9221.cxx:66
C++ API wrapper for the bh1749 driver.
Definition: a110x.hpp:29
Definition: my9221.h:58
void refresh()
Definition: my9221.cxx:86
void setHighIntensityValue(int intensity)
Definition: my9221.cxx:71
void setLED(int led, bool on)
Definition: my9221.cxx:61
void setAll()
Definition: my9221.cxx:76
void clearAll()
Definition: my9221.cxx:81
void setAutoRefresh(bool enable)
Definition: my9221.hpp:72
void my9221_set_auto_refresh(const my9221_context dev, bool enable)
Definition: my9221.c:217
C API for the my9221 driver.