Rev 3514 Rev 3516
1 // ====================================================================== 1 // ======================================================================
2 // USBtiny Configuration 2 // USBtiny Configuration
3 // 3 //
4 // Copyright (C) 2006 Dick Streefland 4 // Copyright (C) 2006 Dick Streefland
5 // 5 //
6 // This is free software, licensed under the terms of the GNU General 6 // This is free software, licensed under the terms of the GNU General
7 // Public License as published by the Free Software Foundation. 7 // Public License as published by the Free Software Foundation.
8 // ====================================================================== 8 // ======================================================================
9   9  
10 // The D+ and D- USB signals should be connected to two pins of the same 10 // The D+ and D- USB signals should be connected to two pins of the same
11 // I/O port. The following macros define the port letter and the input 11 // I/O port. The following macros define the port letter and the input
12 // bit numbers: 12 // bit numbers:
13 #if! defined (__AVR_ATtiny45__) -  
-   13  
14 #define USBTINY_PORT C 14 #include "config.h"
15 #define USBTINY_DPLUS 1 -  
16 #define USBTINY_DMINUS 0 -  
17 #else 15  
18 #define USBTINY_PORT B 16 #define USBTINY_PORT CONFIG_USB_PORT
19 #define USBTINY_DPLUS 2 17 #define USBTINY_DPLUS CONFIG_USB_DPLUS
20 #define USBTINY_DMINUS 0 18 #define USBTINY_DMINUS CONFIG_USB_DMINUS
21 #endif -  
22   19  
23 // The D+ signal should be connected to an interrupt input to trigger an 20 // The D+ signal should be connected to an interrupt input to trigger an
24 // interrupt at the start of a packet. When you use the same pin for the 21 // interrupt at the start of a packet. When you use the same pin for the
25 // D+ USB signal and the interrupt input, only two I/O pins are needed 22 // D+ USB signal and the interrupt input, only two I/O pins are needed
26 // for the USB interface. The following macro defines the interrupt 23 // for the USB interface. The following macro defines the interrupt
27 // number: 24 // number:
28 #define USBTINY_INT 0 25 #define USBTINY_INT 0
29   26  
30 // The power requirement of the USB device in mA, or 0 when the device 27 // The power requirement of the USB device in mA, or 0 when the device
31 // is not bus powered: 28 // is not bus powered:
32 #define USBTINY_MAX_POWER 10 29 #define USBTINY_MAX_POWER 10
33   30  
34 // The USB vendor and device IDs. These values should be unique for 31 // The USB vendor and device IDs. These values should be unique for
35 // every distinct device. You can get your own vendor ID from the USB 32 // every distinct device. You can get your own vendor ID from the USB
36 // Implementers Forum (www.usb.org) if you have a spare $1500 to kill. 33 // Implementers Forum (www.usb.org) if you have a spare $1500 to kill.
37 // Alternatively, you can buy a small range of device IDs from 34 // Alternatively, you can buy a small range of device IDs from
38 // www.voti.nl or www.mecanique.co.uk, or be naughty and use something 35 // www.voti.nl or www.mecanique.co.uk, or be naughty and use something
39 // else, like for instance product ID 0x6666, which is registered as 36 // else, like for instance product ID 0x6666, which is registered as
40 // "Prototype product Vendor ID". 37 // "Prototype product Vendor ID".
41 #define USBTINY_VENDOR_ID 0x0403 38 #define USBTINY_VENDOR_ID 0x0403
42 #define USBTINY_DEVICE_ID 0xc631 39 #define USBTINY_DEVICE_ID 0xc631
43   40  
44 // The version of the device as a 16-bit number: 256*major + minor. 41 // The version of the device as a 16-bit number: 256*major + minor.
45 #define USBTINY_DEVICE_VERSION 0x205 42 #define USBTINY_DEVICE_VERSION 0x205
46   43  
47 // The following optional macros may be used as an identification of 44 // The following optional macros may be used as an identification of
48 // your device. Undefine them when you run out of flash space. 45 // your device. Undefine them when you run out of flash space.
49 #define USBTINY_VENDOR_NAME "Till Harbaum" 46 #define USBTINY_VENDOR_NAME "Till Harbaum"
50 #define USBTINY_DEVICE_NAME "i2c-tiny-usb" 47 #define USBTINY_DEVICE_NAME "i2c-tiny-usb"
51 #undef USBTINY_SERIAL 48 #undef USBTINY_SERIAL
52   49  
53 // Define the device class, subclass and protocol. Device class 0xff 50 // Define the device class, subclass and protocol. Device class 0xff
54 // is "vendor specific". 51 // is "vendor specific".
55 #define USBTINY_DEVICE_CLASS 0xff 52 #define USBTINY_DEVICE_CLASS 0xff
56 #define USBTINY_DEVICE_SUBCLASS 0 53 #define USBTINY_DEVICE_SUBCLASS 0
57 #define USBTINY_DEVICE_PROTOCOL 0 54 #define USBTINY_DEVICE_PROTOCOL 0
58   55  
59 // Define the interface class, subclass and protocol. Interface class 56 // Define the interface class, subclass and protocol. Interface class
60 // 0xff is "vendor specific". 57 // 0xff is "vendor specific".
61 #define USBTINY_INTERFACE_CLASS 0xff 58 #define USBTINY_INTERFACE_CLASS 0xff
62 #define USBTINY_INTERFACE_SUBCLASS 0 59 #define USBTINY_INTERFACE_SUBCLASS 0
63 #define USBTINY_INTERFACE_PROTOCOL 0 60 #define USBTINY_INTERFACE_PROTOCOL 0
64   61  
65 // Normally, usb_setup() should write the reply of up to 8 bytes into the 62 // Normally, usb_setup() should write the reply of up to 8 bytes into the
66 // packet buffer, and return the reply length. When this macro is defined 63 // packet buffer, and return the reply length. When this macro is defined
67 // as 1, you have the option of returning 0xff instead. In that case, the 64 // as 1, you have the option of returning 0xff instead. In that case, the
68 // USB driver will call a function usb_in() to obtain the data to send 65 // USB driver will call a function usb_in() to obtain the data to send
69 // back to the host. This can be used to generate the data on-the-fly. 66 // back to the host. This can be used to generate the data on-the-fly.
70 #define USBTINY_CALLBACK_IN 1 67 #define USBTINY_CALLBACK_IN 1
71   68  
72 // When this macro is defined as 0, OUT packets are simply ignored. 69 // When this macro is defined as 0, OUT packets are simply ignored.
73 // When defined as 1, the function usb_out() is called for OUT packets. 70 // When defined as 1, the function usb_out() is called for OUT packets.
74 // You need this option to send data from the host to the device in 71 // You need this option to send data from the host to the device in
75 // a control transfer. 72 // a control transfer.
76 #define USBTINY_CALLBACK_OUT 1 73 #define USBTINY_CALLBACK_OUT 1
77   74  
78 // Set the macro USBTINY_ENDPOINT to 1 to add an additional endpoint, 75 // Set the macro USBTINY_ENDPOINT to 1 to add an additional endpoint,
79 // according to the values of the three other macros. 76 // according to the values of the three other macros.
80 #define USBTINY_ENDPOINT 0 77 #define USBTINY_ENDPOINT 0
81 #define USBTINY_ENDPOINT_ADDRESS 0x81 // IN endpoint #1 78 #define USBTINY_ENDPOINT_ADDRESS 0x81 // IN endpoint #1
82 #define USBTINY_ENDPOINT_TYPE 0x00 // control transfer type 79 #define USBTINY_ENDPOINT_TYPE 0x00 // control transfer type
83 #define USBTINY_ENDPOINT_INTERVAL 0 // ignored 80 #define USBTINY_ENDPOINT_INTERVAL 0 // ignored