USB Power On/Off

Started by Alep, June 09, 2014, 12:37:36 AM

Previous topic - Next topic

Alep

In order to save energy with the MOD-USB3G I added the ability to turn On/Off the 3 USB
I started from pyA20-0.1.6 and in the file pyA20.c I insert  these lines

/ / GPIO 0
# define PIN_PB9 SUNXI_GPB (9)
# define PIN_PH3 SUNXI_GPH (3)
# define PIN_PH6 SUNXI_GPH (6)
Before the section
/ / GPIO 1
# define PIN_PG0 SUNXI_GPG (0)

and I insert

/ / GPIO-0
     PyModule_AddObject (module, "PIN0_1" Py_BuildValue ("i", PIN_PB9));
     PyModule_AddObject (module, "PIN0_2" Py_BuildValue ("i", PIN_PH6));
     PyModule_AddObject (module, "PIN0_3" Py_BuildValue ("i", PIN_PH3));
before of
/ / GPIO-1
     PyModule_AddObject (module, "PIN1_5" Py_BuildValue ("i", PIN_PG0));

For example now I can turn OFF (or ON)  the USB2 (lower) with the Python command "output (PIN0_3, LOW)" or "output (PIN0_3, HIGH)

instructions:
1 = USB 0 (OTG)
2 = USB 1 (Upper Usb)
3 = USB 2 (Lower Usb)

Ps sorry for my English