upm  0.5.1
Sensor/Actuator repository for libmraa (v0.9.1)
 All Data Structures Files Functions Variables Enumerations Enumerator Macros Groups Pages
Public Member Functions
GroveCircularLED Class Reference

API for the Grove Circular LED module. More...

Detailed Description

This is a circular LED ring based on the MY9221 chip. It is often used with a rotary encoder and has 24 controllable LEDs.

grovecircularled.jpg
// Instantiate a Grove Circular LED on D9 for data, D8 for clock
int level = 0;
while (shouldRun)
{
circle->setSpinner(level);
level = (level + 1) % 24;
usleep(100000);
}

Public Member Functions

 GroveCircularLED (uint8_t dataPin, uint8_t clockPin)
 
 ~GroveCircularLED ()
 
void setSpinner (uint8_t position)
 
void setLevel (uint8_t level, bool direction=true)
 
- Public Member Functions inherited from MY9221
 MY9221 (uint8_t dataPin, uint8_t clockPin, int instances=1)
 
 ~MY9221 ()
 
void setAutoRefresh (bool enable)
 
void setLED (int led, bool on)
 
void setLowIntensityValue (int intensity)
 
void setHighIntensityValue (int intensity)
 
void setAll ()
 
void clearAll ()
 
void refresh ()
 

Additional Inherited Members

- Static Public Attributes inherited from MY9221
static const int LEDS_PER_INSTANCE = 12
 
- Protected Member Functions inherited from MY9221
virtual void lockData ()
 
virtual void send16bitBlock (uint16_t data)
 
- Protected Attributes inherited from MY9221
bool m_autoRefresh
 
uint16_t m_lowIntensity
 
uint16_t m_highIntensity
 
unsigned int m_instances
 
uint16_t * m_bitStates
 
uint16_t m_commandWord
 
mraa::Gpio m_gpioClk
 
mraa::Gpio m_gpioData
 

Constructor & Destructor Documentation

GroveCircularLED ( uint8_t  dataPin,
uint8_t  clockPin 
)

Instantiates an GroveCircularLED object

Parameters
dataPinData pin
clockPinClock pin

Here is the call graph for this function:

GroveCircularLED destructor

Member Function Documentation

void setSpinner ( uint8_t  position)

Sets the spinner (turns off all LEDs but selected one)

Parameters
positionSelected position for the spinner (0-23)

Here is the call graph for this function:

void setLevel ( uint8_t  level,
bool  direction = true 
)

Sets the lighting status

Parameters
levelSelected level for the circular LED (0-23)
directionUp or down; up is true and default

Here is the call graph for this function:

Inheritance diagram for GroveCircularLED:
Inheritance graph
[legend]
Collaboration diagram for GroveCircularLED:
Collaboration graph
[legend]

The documentation for this class was generated from the following files: