t2:port_usb_poweron

port_usb_poweron


port_usb_poweron - Power on an USB input port

Description


void port_usb_poweron(uint8 port);

Switch on the power of the USB input port identified by the argument.

This command does not affects ports that are operating in output mode (USB device).

Parameters


  • port: An valid USB input port identifier, accordingly table 1.
Table 1
Index Port Designator
1 PORT_USB_A
2 PORT_USB_B
0 PORT_USB_C
3 PORT_USB_D

Return Value


No value is returned.

Examples


Example #1 port_usb_poweron() example

#include <keyboard.gph>
 
bool power_status;
 
main {
    // F5 switches OFF the power of INPUT-B
    if(key_status(KEY_F5) && power_status) {
        port_usb_poweroff(PORT_USB_B);
        power_status = 0;
    }
    // and F6 switches ON the power of INPUT-B
    else if(key_status(KEY_F6) && !power_status) {
        port_usb_poweron(PORT_USB_B);
        power_status = 1;
    }
}

See Also

t2/port_usb_poweron.txt · Last modified: 2017/03/26 06:25 by J2Kbr