Define SELF_POWERED in run-time

Sub forums for various specialist XMOS applications. e.g. USB audio, motor control and robotics.
kasemann
Member
Posts: 11
Joined: Tue Dec 20, 2016 4:09 pm

Define SELF_POWERED in run-time

Postby kasemann » Wed Jan 18, 2017 4:42 pm

Hi

We are making a USB audio product based on the usb audio framework... Our device can run on USB Power or with a battery attached. The thing I want to do is this:

- Detect whether battery power is used with a GPIO on startup.
- Depending on the GPIO-state report myself as a self-powered (or not self-powered) device via USB

The problem is that in the USB audio framework, the SELF_POWERED flag is defined in compile-time. Can anyone tell me where I'd have to apply changes to make it dynamic?

Markus
User avatar
larry
Respected Member
Posts: 275
Joined: Fri Mar 12, 2010 6:03 pm

Postby larry » Thu Jan 19, 2017 2:43 pm

I think you'll need to write all device/configuration bytes at runtime that are currently under

Code: Select all

#ifdef SELF_POWERED

Who is online

Users browsing this forum: No registered users and 0 guests