t2:port_usb_poweroff

port_usb_poweroff


port_usb_poweroff - Power off an USB input port

Description


void port_usb_poweroff(uint8 port);

Switch off 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).
The effects of port_usb_poweroff() remains after unload the script that called it, until the next power cycle. Use port_usb_poweron() to revert the effects of port_usb_poweroff().

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_poweroff() 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_poweroff.txt · Last modified: 2017/12/11 11:49 by J2Kbr