Define SELF_POWERED in run-time

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

Define SELF_POWERED in run-time

Post by kasemann »

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

Post by larry »

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

Code: Select all

#ifdef SELF_POWERED
Post Reply