]> git.gir.st - tmk_keyboard.git/blob - keyboard/onekey/VUSB.md
onekey: Add desc of V-USB osc calribration
[tmk_keyboard.git] / keyboard / onekey / VUSB.md
1 TMK with Xtal-less V-USB
2 ========================
3
4 TMK onekey works on ATtiny85.
5
6 $ make -f Makefile.vusb
7
8 ...
9
10 Size after:
11 text data bss dec hex filename
12 5518 14 254 5786 169a onekey_vusb.elf
13
14 -------- end --------
15
16
17 https://i.imgur.com/sNa302J.jpg
18
19
20 Program with AVRISPmkII
21 -----------------------
22 D- and D+ lines are need to be disconnected when programed.
23
24 $ avrdude -p attiny85 -c avrispmkii -U flash:w:onekey_vusb.hex
25
26
27 Xtal-less internal RC
28 ---------------------
29 http://codeandlife.com/2012/02/22/v-usb-with-attiny45-attiny85-without-a-crystal/
30
31 Configure fuses for PLL, internal RC and BOD(Brown out detection).
32
33 $ avrdude -c avrispmkii -p attiny85 -U lfuse:w:0xe1:m -U hfuse:w:0xdd:m
34
35 Set 16.5MHz to F_CPU in Makefile
36
37 F_CPU = 16500000
38
39 Add settings for calibration in usbconfig.h
40
41 diff --git a/keyboard/onekey/usbconfig.h b/keyboard/onekey/usbconfig.h
42 index e9b4f98..01e5aa6 100644
43 --- a/keyboard/onekey/usbconfig.h
44 +++ b/keyboard/onekey/usbconfig.h
45 @@ -161,7 +161,11 @@ section at the end of this file).
46 * proceed, do a return after doing your things. One possible application
47 * (besides debugging) is to flash a status LED on each packet.
48 */
49 -/* #define USB_RESET_HOOK(resetStarts) if(!resetStarts){hadUsbReset();} */
50 +#define USB_RESET_HOOK(resetStarts) if(!resetStarts){hadUsbReset();}
51 +/* http://codeandlife.com/2012/02/22/v-usb-with-attiny45-attiny85-without-a-crystal/ */
52 +#ifndef __ASSEMBLER__
53 +extern void hadUsbReset(void); // define the function for usbdrv.c
54 +#endif
55 /* This macro is a hook if you need to know when an USB RESET occurs. It has
56 * one parameter which distinguishes between the start of RESET state and its
57 * end.
58 @@ -202,7 +206,7 @@ section at the end of this file).
59 * usbFunctionWrite(). Use the global usbCurrentDataToken and a static variable
60 * for each control- and out-endpoint to check for duplicate packets.
61 */
62 -#define USB_CFG_HAVE_MEASURE_FRAME_LENGTH 0
63 +#define USB_CFG_HAVE_MEASURE_FRAME_LENGTH 1
64
65
66 Another calibration code
67 ========================
68 https://github.com/obdev/v-usb/tree/master/libs-device
Imprint / Impressum