Hiding V-USB inside an Arduino library.

General discussions about V-USB, our firmware-only implementation of a low speed USB device on Atmel's AVR microcontrollers
Post Reply
jamesotron
Posts: 5
Joined: Fri May 13, 2011 12:31 am

Hiding V-USB inside an Arduino library.

Post by jamesotron » Fri May 13, 2011 2:17 am

Hi there.

I'm working on a device where I would like the user to be able to configure their device by way of a sketch in the Arduino IDE. I have an Arduino library which includes all the usbdrv code. I have managed to clean up all the compile warnings and errors and I have one last remaining error which is bugging my brain out:

Code: Select all

AxeIo/axeio.cpp.o: In function `controllerInit()':
/Users/jnh/Documents/Arduino/libraries/AxeIo/axeio.cpp:568: undefined reference to `usbInit()'


so axeio.h/cpp is my Arduino library, from the sketch's setup() method controllerInit() is called which in turn calls:

Code: Select all

void controllerInit() {
  blinkinatorSetup();

  wdt_enable(WDTO_1S);
  hardwareInit();

  odDebugInit();
  usbInit();

  sei();
}


Interesting that it doesn't complain about odDebugInit, just usbInit. Does anyone have any ideas of where I've gone wrong?

The complete code can be seen here: https://github.com/axeio/thinkinator_fi ... ration/lib

Daid
Rank 2
Rank 2
Posts: 55
Joined: Mon Apr 18, 2011 12:19 pm

Re: Hiding V-USB inside an Arduino library.

Post by Daid » Mon May 16, 2011 6:07 pm

First, you are using an Arduino, with the Arduino library. Which is like putting a 2 stroke engine in a Ferrari.

Secondly, you are mixing C and C++. You'll need to add

Code: Select all

extern "C" {
around the C header files.

jamesotron
Posts: 5
Joined: Fri May 13, 2011 12:31 am

Re: Hiding V-USB inside an Arduino library.

Post by jamesotron » Sun May 22, 2011 11:34 pm

Thanks. Yes, that's what I wound up doing.

Post Reply