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

Manipulate the USB Type-A port on a BeagleBone. More...

Functions

void toggle (const bool turn_on, const size_t sleep_time_in_milliseconds)
 Turn ON or turn OFF the power to the USB Type-A port. More...
 
void toggle (const size_t sleep_time_in_milliseconds=500)
 Turn the power to the USB Type-A port OFF then back ON after a short pause. More...
 
void set (const bool turn_on)
 Set the power to the USB Type-A port ON or OFF. More...
 
void turn_on (void)
 Turn ON the power to the USB Type-A port. More...
 
void turn_off (void)
 Turn OFF the power to the USB Type-A port. More...
 

Detailed Description

Manipulate the USB Type-A port on a BeagleBone.

Power to the USB port can be turned on or turned off. Functions such as SG::BeagleBone::USB::toggle() can be used to turn power off, pause for a short time, and turn power back on. This will normally completely reset whatever type of USB device is connected.

Warning
Note that SG::BeagleBone::USB functions such as toggle(), set(), turn_on(), and turn_off() blindly toggles a specific memory location. On a non-BeagleBone computer, this likely has the ability to break things or cause corruption, depending on what happens to reside at that memory location. It is strongly suggested that a check be performed to verify that the computer is indeed a BeagleBone. For example, see SG::BeagleBone::Detect::is_beaglebone_compatible().

Function Documentation

void SG::BeagleBone::USB::set ( const bool  turn_on)

Set the power to the USB Type-A port ON or OFF.

See also
SG::BeagleBone::USB::turn_off()
SG::BeagleBone::USB::turn_on()

References toggle().

Here is the call graph for this function:

void SG::BeagleBone::USB::toggle ( const bool  turn_on,
const size_t  sleep_time_in_milliseconds 
)

Turn ON or turn OFF the power to the USB Type-A port.

Parameters
[in]turn_onSet to TRUE to turn the power on, FALSE to turn the power off.
[in]sleep_time_in_millisecondsDetermines the length of time between when the power is toggled on / off. If set to zero, the power will be set as described by turn_on and wont be toggled further. With values greater than zero, the power will first be set as described by turn_on, then the thread will pause for the given duration, followed by setting the power to the opposite of what turn_on indicates.

For example, regardless of the initial state of USB power, this code will turn the power off, pause for 1 second (1000 milliseconds), and turn the power back on:

See also
SG::BeagleBone::USB::set()
http://stackoverflow.com/questions/24039420/turn-usb-power-off-on-with-beaglebone-black-kernel-3-8
http://stackoverflow.com/questions/37086057/turn-off-power-to-a-usb-port

Referenced by bb_usb(), and set().

Here is the caller graph for this function:

void SG::BeagleBone::USB::toggle ( const size_t  sleep_time_in_milliseconds = 500)

Turn the power to the USB Type-A port OFF then back ON after a short pause.

Parameters
[in]sleep_time_in_millisecondsDetermines the length of time between when the power is turned off and back on.
See also
SG::BeagleBone::USB::set()
void SG::BeagleBone::USB::turn_off ( void  )

Turn OFF the power to the USB Type-A port.

See also
SG::BeagleBone::USB::set()
SG::BeagleBone::USB::turn_on()

Referenced by bb_usb().

Here is the caller graph for this function:

void SG::BeagleBone::USB::turn_on ( void  )

Turn ON the power to the USB Type-A port.

See also
SG::BeagleBone::USB::set()
SG::BeagleBone::USB::turn_off()

Referenced by bb_usb().

Here is the caller graph for this function: