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... | |
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.
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(). void SG::BeagleBone::USB::set | ( | const bool | turn_on | ) |
Set the power to the USB Type-A port ON
or OFF
.
References toggle().
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.
[in] | turn_on | Set to TRUE to turn the power on, FALSE to turn the power off. |
[in] | sleep_time_in_milliseconds | Determines 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:
Referenced by bb_usb(), and set().
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.
[in] | sleep_time_in_milliseconds | Determines the length of time between when the power is turned off and back on . |
void SG::BeagleBone::USB::turn_off | ( | void | ) |
Turn OFF
the power to the USB Type-A port.
Referenced by bb_usb().
void SG::BeagleBone::USB::turn_on | ( | void | ) |
Turn ON
the power to the USB Type-A port.
Referenced by bb_usb().