Seeed Grove ++  v0.0.1-2386
Linux C++ Library For Seeed Grove Devices
SG::BeagleBone Namespace Reference

Namespaces

 Detect
 The Detect namespace contains several related functions to help determine if the device where the code is running is a BeagleBone Black, BeagleBone Green, or some other type of device.
 
 USB
 Manipulate the USB Type-A port on a BeagleBone.
 

Classes

class  LEDControl
 BeagleBone LED software controller. More...
 
class  Watchdog
 BeagleBone hardware watchdog. More...
 

Typedefs

typedef std::map< SG::BeagleBone::LED, bool > PatternStep
 Every blink pattern is a vector of steps, where each step is map of LEDs to turn on and off. More...
 
typedef std::vector< SG::BeagleBone::PatternStepBlinkPattern
 Every blink pattern is a vector of steps, where each step is map of LEDs to turn on and off. More...
 

Enumerations

enum  LED {
  LED::invalid = 0,
  LED::none = 1,
  LED::all = 2,
  LED::usr0 = 10,
  LED::usr1 = 11,
  LED::usr2 = 12,
  LED::usr3 = 13,
  LED::min = usr0,
  LED::max = usr3
}
 Enumerator for the various LEDs on BeagleBone Black and BeagleBone Green. More...
 
enum  Trigger {
  Trigger::invalid = 0,
  Trigger::none,
  Trigger::nand_disk,
  Trigger::usb_gadget,
  Trigger::usb_host,
  Trigger::mmc0,
  Trigger::mmc1,
  Trigger::timer,
  Trigger::oneshot,
  Trigger::heartbeat,
  Trigger::backlight,
  Trigger::gpio,
  Trigger::cpu0,
  Trigger::default_on
}
 Enumerator for the LED trigger type to use. More...
 
enum  LEDPattern {
  LEDPattern::invalid = 0,
  LEDPattern::min = 1,
  LEDPattern::none = min,
  LEDPattern::all,
  LEDPattern::blink,
  LEDPattern::blinkOffset,
  LEDPattern::blinkSplit,
  LEDPattern::cylon,
  LEDPattern::kitt,
  LEDPattern::mergeLeft,
  LEDPattern::mergeRight,
  LEDPattern::mergeBoth,
  LEDPattern::inchwormLeft,
  LEDPattern::inchwormRight,
  LEDPattern::inchwormBoth,
  LEDPattern::insideOut,
  LEDPattern::max
}
 Several "built-in" (to this library) blink patterns that can easily be used with SG::BeagleBone::LEDControl. More...
 

Functions

std::string to_string (const Trigger trigger)
 Convert the trigger enum to the string expected in the trigger file. More...
 
Trigger default_trigger (const SG::BeagleBone::LED led)
 Return the default trigger typically used by each LED. More...
 
int index_of (const SG::BeagleBone::LED led)
 Determine the index of the specified LED. More...
 
bool is_single_LED (const SG::BeagleBone::LED led)
 Determine if the specified LED enum is a single physical LED, or a "pseudo" LED such as LED::all. More...
 
bool is_pseudo_LED (const SG::BeagleBone::LED led)
 Determine if the specified LED enum represents a "pseudo" LED, such as LED::all or LED::none. More...
 
BlinkPattern LED_invert_pattern (const BlinkPattern &pattern)
 Invert the pattern. More...
 
BlinkPattern LED_pattern_none (void)
 Turn all the lights off. More...
 
BlinkPattern LED_pattern_all (void)
 Turn all lights on. More...
 
BlinkPattern LED_pattern_blink (void)
 Blink all lights in unison. More...
 
BlinkPattern LED_pattern_blinkOffset (void)
 Blink even and odd lights. More...
 
BlinkPattern LED_pattern_blinkSplit (void)
 Blink left and right lights. More...
 
BlinkPattern LED_pattern_cylon (void)
 Multi-light sweep similar to BSG Cylons. More...
 
BlinkPattern LED_pattern_kitt (void)
 Single light sweep similar to KITT ("Knight Rider") from the 1980s. More...
 
BlinkPattern LED_pattern_mergeLeft (void)
 Lights moving from right to left. More...
 
BlinkPattern LED_pattern_mergeRight (void)
 Lights moving from left to right. More...
 
BlinkPattern LED_pattern_mergeBoth (void)
 Mix of merge left and merge right. More...
 
BlinkPattern LED_pattern_inchwormLeft (void)
 Lights moving from right to left. More...
 
BlinkPattern LED_pattern_inchwormRight (void)
 Lights moving from left to right. More...
 
BlinkPattern LED_pattern_inchwormBoth (void)
 Mix of merge left and merge right. More...
 
BlinkPattern LED_pattern_insideOut (void)
 Blink inside lights, then outside lights. More...
 
BlinkPattern LED_get_pattern (const LEDPattern pattern)
 Return the corresponding blink pattern that corresponds to the given enum value. More...
 

Typedef Documentation

◆ BlinkPattern

Every blink pattern is a vector of steps, where each step is map of LEDs to turn on and off.

◆ PatternStep

Every blink pattern is a vector of steps, where each step is map of LEDs to turn on and off.

Enumeration Type Documentation

◆ LED

enum SG::BeagleBone::LED
strong

Enumerator for the various LEDs on BeagleBone Black and BeagleBone Green.

Enumerator
invalid 
none 
all 
usr0 

LED closest to the outside and the RESET button.

usr1 
usr2 
usr3 

LED closest to the Ethernet cable and the POWER button.

min 
max 

◆ LEDPattern

Several "built-in" (to this library) blink patterns that can easily be used with SG::BeagleBone::LEDControl.

Enumerator
invalid 
min 
none 

turn off all lights

all 

turn on all lights

blink 

all lights blink on-and-off at the exact same time

blinkOffset 

all lights blink on-and-off, but split even/odd

blinkSplit 

all lights blink on-and-off, but split left/right

cylon 

sweep multiple lights

kitt 

sweep single light

mergeLeft 

lights moving from right-to-left

mergeRight 

lights moving from left-to-right

mergeBoth 

combination of merge left and merge right

inchwormLeft 

lights moving from right-to-left

inchwormRight 

lights moving from left-to-right

inchwormBoth 

combination of inchworm left and inchworm right

insideOut 

inside lights, then outside lights

max 

◆ Trigger

Enumerator for the LED trigger type to use.

See also
https://www.kernel.org/doc/Documentation/devicetree/bindings/leds/common.txt
Enumerator
invalid 
none 

Prevents the LED from automatically changing. Use this trigger if you want to manually turn on and turn off the LED.

nand_disk 
usb_gadget 
usb_host 
mmc0 

Micro SD card is accessed.

mmc1 

Internal eMMC is accessed.

timer 
oneshot 

https://www.kernel.org/doc/Documentation/leds/ledtrig-oneshot.txt

heartbeat 

Periodic double-blink from the Linux kernel to indicate the device is still running.

backlight 
gpio 
cpu0 

Blink rate is determined by the load average.

default_on 

Function Documentation

◆ default_trigger()

Trigger SG::BeagleBone::default_trigger ( const SG::BeagleBone::LED  led)
inline

Return the default trigger typically used by each LED.

References cpu0, heartbeat, mmc0, mmc1, none, usr0, usr1, usr2, and usr3.

Referenced by SG::BeagleBone::LEDControl::set_default_trigger().

Here is the caller graph for this function:

◆ index_of()

int SG::BeagleBone::index_of ( const SG::BeagleBone::LED  led)
inline

Determine the index of the specified LED.

For example, the index of LED::usr0 is 0, while the index of LED::usr3 is 3. All other enums such as LED::all will result in -1.

References usr0, usr1, usr2, and usr3.

Referenced by SG::BeagleBone::LEDControl::get_base_path(), is_pseudo_LED(), and is_single_LED().

Here is the caller graph for this function:

◆ is_pseudo_LED()

bool SG::BeagleBone::is_pseudo_LED ( const SG::BeagleBone::LED  led)
inline

Determine if the specified LED enum represents a "pseudo" LED, such as LED::all or LED::none.

References index_of().

Referenced by SG::BeagleBone::LEDControl::get_base_path(), SG::BeagleBone::LEDControl::set_default_trigger(), SG::BeagleBone::LEDControl::set_trigger(), and SG::BeagleBone::LEDControl::toggle().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ is_single_LED()

bool SG::BeagleBone::is_single_LED ( const SG::BeagleBone::LED  led)
inline

Determine if the specified LED enum is a single physical LED, or a "pseudo" LED such as LED::all.

References index_of().

Here is the call graph for this function:

◆ LED_get_pattern()

◆ LED_invert_pattern()

SG::BeagleBone::BlinkPattern SG::BeagleBone::LED_invert_pattern ( const BlinkPattern pattern)

Invert the pattern.

Reverse all values of "on" and "off" in a pattern. For example, given the pattern LED_pattern_none(), calling this method would result in the same pattern as LED_pattern_all().

Referenced by SG::BeagleBone::LEDControl::invert_pattern().

Here is the caller graph for this function:

◆ LED_pattern_all()

SG::BeagleBone::BlinkPattern SG::BeagleBone::LED_pattern_all ( void  )

Turn all lights on.

Referenced by LED_get_pattern().

Here is the caller graph for this function:

◆ LED_pattern_blink()

SG::BeagleBone::BlinkPattern SG::BeagleBone::LED_pattern_blink ( void  )

Blink all lights in unison.

Referenced by LED_get_pattern().

Here is the caller graph for this function:

◆ LED_pattern_blinkOffset()

SG::BeagleBone::BlinkPattern SG::BeagleBone::LED_pattern_blinkOffset ( void  )

Blink even and odd lights.

Referenced by LED_get_pattern().

Here is the caller graph for this function:

◆ LED_pattern_blinkSplit()

SG::BeagleBone::BlinkPattern SG::BeagleBone::LED_pattern_blinkSplit ( void  )

Blink left and right lights.

Referenced by LED_get_pattern().

Here is the caller graph for this function:

◆ LED_pattern_cylon()

SG::BeagleBone::BlinkPattern SG::BeagleBone::LED_pattern_cylon ( void  )

Multi-light sweep similar to BSG Cylons.

Referenced by LED_get_pattern().

Here is the caller graph for this function:

◆ LED_pattern_inchwormBoth()

SG::BeagleBone::BlinkPattern SG::BeagleBone::LED_pattern_inchwormBoth ( void  )

Mix of merge left and merge right.

References LED_pattern_inchwormLeft(), and LED_pattern_inchwormRight().

Referenced by LED_get_pattern().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ LED_pattern_inchwormLeft()

SG::BeagleBone::BlinkPattern SG::BeagleBone::LED_pattern_inchwormLeft ( void  )

Lights moving from right to left.

Referenced by LED_get_pattern(), and LED_pattern_inchwormBoth().

Here is the caller graph for this function:

◆ LED_pattern_inchwormRight()

SG::BeagleBone::BlinkPattern SG::BeagleBone::LED_pattern_inchwormRight ( void  )

Lights moving from left to right.

Referenced by LED_get_pattern(), and LED_pattern_inchwormBoth().

Here is the caller graph for this function:

◆ LED_pattern_insideOut()

SG::BeagleBone::BlinkPattern SG::BeagleBone::LED_pattern_insideOut ( void  )

Blink inside lights, then outside lights.

Referenced by LED_get_pattern().

Here is the caller graph for this function:

◆ LED_pattern_kitt()

SG::BeagleBone::BlinkPattern SG::BeagleBone::LED_pattern_kitt ( void  )

Single light sweep similar to KITT ("Knight Rider") from the 1980s.

Referenced by LED_get_pattern().

Here is the caller graph for this function:

◆ LED_pattern_mergeBoth()

SG::BeagleBone::BlinkPattern SG::BeagleBone::LED_pattern_mergeBoth ( void  )

Mix of merge left and merge right.

References LED_pattern_mergeLeft(), LED_pattern_mergeRight(), LED_pattern_none(), and none.

Referenced by LED_get_pattern().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ LED_pattern_mergeLeft()

SG::BeagleBone::BlinkPattern SG::BeagleBone::LED_pattern_mergeLeft ( void  )

Lights moving from right to left.

Referenced by LED_get_pattern(), and LED_pattern_mergeBoth().

Here is the caller graph for this function:

◆ LED_pattern_mergeRight()

SG::BeagleBone::BlinkPattern SG::BeagleBone::LED_pattern_mergeRight ( void  )

Lights moving from left to right.

Referenced by LED_get_pattern(), and LED_pattern_mergeBoth().

Here is the caller graph for this function:

◆ LED_pattern_none()

SG::BeagleBone::BlinkPattern SG::BeagleBone::LED_pattern_none ( void  )

Turn all the lights off.

Referenced by LED_get_pattern(), and LED_pattern_mergeBoth().

Here is the caller graph for this function:

◆ to_string()

std::string SG::BeagleBone::to_string ( const Trigger  trigger)
inline

Convert the trigger enum to the string expected in the trigger file.

References backlight, cpu0, default_on, gpio, heartbeat, mmc0, mmc1, nand_disk, none, oneshot, timer, usb_gadget, and usb_host.

Referenced by SG::BeagleBone::LEDControl::set_trigger().

Here is the caller graph for this function: