0

我在使用 v-usb 库构建项目时遇到了这个错误。下面是我的代码:

#include <avr/io.h>
#include <avr/interrupt.h>
#include <avr/wdt.h>

#include "usbdrv.h"




#include <util/delay.h>

USB_PUBLIC uchar usbFunctionSetup(uchar data[8]) {
    return 0; // do nothing for now
}

int main() {

uchar i;

wdt_enable(WDTO_1S); // enable 1s watchdog timer

usbInit();

usbDeviceDisconnect(); // enforce re-enumeration
for(i = 0; i<250; i++) { // wait 500 ms
    wdt_reset(); // keep the watchdog happy
    _delay_ms(2);
}
usbDeviceConnect();

sei(); // Enable interrupts after re-enumeration

while(1) {
    wdt_reset(); // keep the watchdog happy
    usbPoll();
}

return 0;
}

这是 usbdrv.h 中的相对部分:

 #ifndef USB_PUBLIC

 #define USB_PUBLIC

 #endif

USB_PUBLIC void usbInit(void);

USB_PUBLIC void usbPoll(void)

有人能帮我吗?

4

1 回答 1

0

我猜您忘记将 usbdrv-c 文件添加到您的 makefile 中,或者它们可能已经编译,您必须将它们作为 lib 添加到您的 make 文件中。(但是对于 v-usb 你必须添加 c 文件)

请阅读该库的文档并查看可用于 v-usb 的众多示例。

于 2015-04-24T12:57:46.310 回答