upm  0.4.1
Sensor/Actuator repository for libmraa (v0.8.0)
grovecircularled.h
1 /*
2  * Author: Jun Kato and Yevgeniy Kiveisha <yevgeniy.kiveisha@intel.com>
3  * Contributions: Jon Trulson <jtrulson@ics.com>
4  * Copyright (c) 2014 Intel Corporation.
5  *
6  * This module is based on the my9221 driver
7  *
8  * Permission is hereby granted, free of charge, to any person obtaining
9  * a copy of this software and associated documentation files (the
10  * "Software"), to deal in the Software without restriction, including
11  * without limitation the rights to use, copy, modify, merge, publish,
12  * distribute, sublicense, and/or sell copies of the Software, and to
13  * permit persons to whom the Software is furnished to do so, subject to
14  * the following conditions:
15  *
16  * The above copyright notice and this permission notice shall be
17  * included in all copies or substantial portions of the Software.
18  *
19  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
22  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
23  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
24  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
25  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26  */
27 #pragma once
28 
29 #include <string>
30 #include <mraa/aio.hpp>
31 #include <mraa/common.hpp>
32 
33 #include <mraa/gpio.hpp>
34 
35 #define MAX_BIT_PER_BLOCK 16
36 #define CMDMODE 0x0000
37 #define BIT_HIGH 0x00ff
38 #define BIT_LOW 0x0000
39 
40 #define HIGH 1
41 #define LOW 0
42 
43 namespace upm {
44 
69  public:
76  GroveCircularLED (uint8_t di, uint8_t dcki);
77 
84  mraa::Result setLevel (uint8_t level, bool direction=true);
85 
91  mraa::Result setSpinner (uint8_t position);
92 
98  mraa::Result setStatus (bool status[24]);
99 
103  std::string name()
104  {
105  return m_name;
106  }
107  private:
108  mraa::Result lockData ();
109  mraa::Result send16bitBlock (short data);
110 
111  std::string m_name;
112  mraa::Gpio m_clkPinCtx;
113  mraa::Gpio m_dataPinCtx;
114  };
115 
116 }
std::string name()
Definition: grovecircularled.h:103
mraa::Result setStatus(bool status[24])
Definition: grovecircularled.cxx:99
API for the Grove Circular LED module.
Definition: grovecircularled.h:68
GroveCircularLED(uint8_t di, uint8_t dcki)
Definition: grovecircularled.cxx:38
Definition: a110x.h:33
mraa::Result setLevel(uint8_t level, bool direction=true)
Definition: grovecircularled.cxx:74
mraa::Result setSpinner(uint8_t position)
Definition: grovecircularled.cxx:59