upm  0.3.2
Sensor/Actuator repository for libmraa (v0.7.2)
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.h>
31 #include <mraa/gpio.h>
32 
33 #define MAX_BIT_PER_BLOCK 16
34 #define CMDMODE 0x0000
35 #define BIT_HIGH 0x00ff
36 #define BIT_LOW 0x0000
37 
38 #define HIGH 1
39 #define LOW 0
40 
41 namespace upm {
42 
67  public:
74  GroveCircularLED (uint8_t di, uint8_t dcki);
75 
80 
87  mraa_result_t setLevel (uint8_t level, bool direction=true);
88 
94  mraa_result_t setSpinner (uint8_t position);
95 
101  mraa_result_t setStatus (bool status[24]);
102 
106  std::string name()
107  {
108  return m_name;
109  }
110  private:
111  mraa_result_t lockData ();
112  mraa_result_t send16bitBlock (short data);
113 
114  std::string m_name;
115  mraa_gpio_context m_clkPinCtx;
116  mraa_gpio_context m_dataPinCtx;
117  };
118 
119 }
std::string name()
Definition: grovecircularled.h:106
mraa_result_t setStatus(bool status[24])
Definition: grovecircularled.cxx:122
API for the Grove Circular LED module.
Definition: grovecircularled.h:66
GroveCircularLED(uint8_t di, uint8_t dcki)
Definition: grovecircularled.cxx:36
Definition: a110x.h:29
~GroveCircularLED()
Definition: grovecircularled.cxx:69
mraa_result_t setLevel(uint8_t level, bool direction=true)
Definition: grovecircularled.cxx:97
mraa_result_t setSpinner(uint8_t position)
Definition: grovecircularled.cxx:82