├── .gitignore ├── .travis.yml ├── LICENSE.txt ├── Makefile ├── MemType_case.zip ├── README.md ├── adm.c ├── adm.h ├── crd.c ├── crd.h ├── documents ├── HID1_11.pdf ├── Hut1_12v2.pdf ├── MemTypeGettingStarted.pdf ├── atmel_attiny85_datasheet.pdf ├── bootloader_faq.pdf ├── design │ ├── architecture.png │ ├── architecture.svg │ ├── credential.txt │ ├── flow.png │ ├── flow.svg │ ├── genGraph.txt │ ├── uif.gv │ ├── uif.png │ ├── use_credential.png │ └── use_credential.svg ├── documentation │ ├── Makefile │ ├── diagrams │ │ ├── hw.shaape │ │ └── hw.shaape.png │ ├── memtype.adoc │ ├── memtype.html │ ├── memtype.jpg │ ├── memtype.pdf │ ├── memtype_front.jpg │ └── screenshot.png ├── flashing_guide.odt ├── flashing_guide.pdf └── usbmassbulk_10.pdf ├── fls.c ├── fls.h ├── hid_defines.c ├── hid_defines.h ├── led.c ├── led.h ├── main.c ├── noekeon.S ├── opt.c ├── opt.h ├── osccal.c ├── osccal.h ├── osccalASM.S ├── print.c ├── print.h ├── sch.c ├── sch.h ├── schematic_pcb ├── bom2groupedcsv.xsl └── electronic_design_kicad │ ├── 3d │ ├── SKQUAA.wrl │ ├── electronic_design_kicad.wrl │ └── electronic_design_kicad.xml │ ├── BOM │ ├── electronic_design_kicad.csv │ └── electronic_design_kicad.ods │ ├── SKQUAA.STEP │ ├── electronic_design_kicad-cache.bak │ ├── electronic_design_kicad-cache.bck │ ├── electronic_design_kicad-cache.dcm │ ├── electronic_design_kicad-cache.lib │ ├── electronic_design_kicad.cmp │ ├── electronic_design_kicad.kicad_pcb │ ├── electronic_design_kicad.net │ ├── electronic_design_kicad.pdf │ ├── electronic_design_kicad.pro │ ├── electronic_design_kicad.sch │ ├── electronic_design_kicad.wrl │ ├── fp-lib-table │ ├── gerbers.zip │ ├── gerbers │ ├── electronic_design_kicad-B.Cu.gbr │ ├── electronic_design_kicad-B.Mask.gbr │ ├── electronic_design_kicad-B.SilkS.gbr │ ├── electronic_design_kicad-Edge.Cuts.gbr │ ├── electronic_design_kicad-F.Cu.gbr │ ├── electronic_design_kicad-F.Mask.gbr │ ├── electronic_design_kicad-F.SilkS.gbr │ └── electronic_design_kicad.drl │ ├── gerbers_oshpark.zip │ ├── memotype.pretty │ ├── JOYSTICK.kicad_mod │ ├── LED_0603_PIPE.kicad_mod │ ├── SKRHAAE010.kicad_mod │ ├── SMD-0805.kicad_mod │ ├── SO8_200mil_wide.kicad_mod │ ├── SOIC-8-W.kicad_mod │ ├── SOIC8 200mil wide.mod │ ├── SOT-23.kicad_mod │ ├── USB_A.kicad_mod │ ├── USB_A_MALE.kicad_mod │ ├── USB_A_MALE_case_13mm.kicad_mod │ ├── electronic_design_kicad.kicad_pcb │ ├── logo.kicad_mod │ └── usbA_std_pcb.kicad_mod │ ├── shapes3D │ ├── C_0805.wrl │ ├── LED_0603.wrl │ ├── R_0805.wrl │ ├── SKQUAA.wrl │ ├── SKRHAA.wrl │ ├── SKRHAA_2.wrl │ ├── SKRHAA_3.wrl │ ├── SO-8W.wrl │ ├── SO8W.wrl │ ├── SOT-23_Inv.wrl │ ├── SOT23_3.wrl │ ├── chip_cms.wrl │ ├── cms_so8.wrl │ ├── unknown.wrl │ └── usbtypeA.wrl │ ├── zenerdual.dcm │ └── zenerdual.lib ├── supportedDevices.txt ├── tools ├── Keyboard-layouts.ods ├── mn_linux └── mn_osx ├── ucp.c ├── ucp.h ├── uib.c ├── uib.h ├── uif.c ├── uif.h ├── uncrustify └── style.cfg ├── usbconfig.h ├── usbdrv ├── Changelog.txt ├── CommercialLicense.txt ├── License.txt ├── Readme.txt ├── USB-ID-FAQ.txt ├── USB-IDs-for-free.txt ├── asmcommon.inc ├── oddebug.c ├── oddebug.h ├── usbconfig-prototype.h ├── usbdrv.c ├── usbdrv.h ├── usbdrvasm.S ├── usbdrvasm.asm ├── usbdrvasm12.inc ├── usbdrvasm128.inc ├── usbdrvasm15.inc ├── usbdrvasm16.inc ├── usbdrvasm165.inc ├── usbdrvasm18-crc.inc ├── usbdrvasm20.inc └── usbportability.h ├── usi.c ├── usi.h ├── version.h └── wiki.txt /.gitignore: -------------------------------------------------------------------------------- 1 | # Object Files 2 | *.o 3 | 4 | # Executable Files 5 | *.elf 6 | *.hex 7 | *.eep 8 | *.map 9 | 10 | # Netbeans 11 | nbproject/ 12 | 13 | # SourceInsight 14 | *.CF3 15 | *.IAB 16 | *.IAD 17 | *.IMB 18 | *.IMD 19 | *.PFI 20 | *.PO 21 | *.PR 22 | *.PRI 23 | *.PS 24 | *.WK3 25 | *.SearchResults 26 | 27 | #password configuration file 28 | password.c 29 | 30 | #Shitty files 31 | .DS_Store 32 | *.swp 33 | *.*~ 34 | 35 | # Password files inside pc_comm 36 | pc_comm/*.xml 37 | 38 | # Executable File 39 | pc_comm/hidtool 40 | build-MemTypeGUI* 41 | 42 | # Eclipse files 43 | .project 44 | .map 45 | .cproject 46 | .settings/ 47 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | --- 2 | language: c 3 | before_install: 4 | - sudo apt-get update -qq 5 | install: 6 | - sudo apt-get install -qq gcc-avr binutils-avr avr-libc 7 | script: make hex 8 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | Creative Commons Attribution 4.0 International (CC BY 4.0) 2 | 3 | You are free to: 4 | --------------- 5 | Share — copy and redistribute the material in any medium or format 6 | Adapt — remix, transform, and build upon the material 7 | for any purpose, even commercially. 8 | The licensor cannot revoke these freedoms as long as you follow the license terms. 9 | 10 | Under the following terms: 11 | ------------------------- 12 | Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use. 13 | 14 | No additional restrictions — You may not apply legal terms or technological measures that legally restrict others from doing anything the license permits. 15 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # Name: Makefile 2 | # Project: drivertest example 3 | # Author: Christian Starkjohann 4 | # Creation Date: 2008-04-07 5 | # Tabsize: 4 6 | # Copyright: (c) 2008 by OBJECTIVE DEVELOPMENT Software GmbH 7 | # License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) 8 | 9 | DEVICE = attiny85 10 | F_CPU = 16500000 # in Hz 11 | AVRDUDE = avrdude -c avrispmkII -p $(DEVICE) # edit this line for your programmer 12 | 13 | # Micronucleus tool, USE either Linux or MACOS (No windows, it sucks) 14 | ifeq ($(shell uname -s),Linux) 15 | MN = mn_linux 16 | else 17 | MN = mn_osx 18 | endif 19 | MICRONUCLEUS = sudo tools/$(MN) --run 20 | 21 | CFLAGS = -Iusbdrv -I. -DDEBUG_LEVEL=0 -DTUNE_OSCCAL=0 -DCALIBRATE_OSCCAL=0 -Wall 22 | CFLAGS += -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -ffunction-sections -fdata-sections 23 | CFLAGS += -std=gnu99 -Werror -mcall-prologues -fno-tree-scev-cprop -fno-split-wide-types 24 | OBJECTS = usbdrv/usbdrv.o usbdrv/usbdrvasm.o usbdrv/oddebug.o main.o hid_defines.o print.o adm.o uib.o uif.o sch.o opt.o fls.o usi.o ucp.o crd.o noekeon.o osccal.o led.o #osccalASM.o 25 | 26 | UNCRUSTIFY_FILES := $(wildcard *.c) 27 | 28 | COMPILE = avr-gcc -Wall -Os -DF_CPU=$(F_CPU) $(CFLAGS) -mmcu=$(DEVICE) 29 | LDFLAGS = -Wl,-Map=main.map,--relax,--gc-sections 30 | ############################################################################## 31 | # Fuse values for particular devices 32 | ############################################################################## 33 | # If your device is not listed here, go to 34 | # http://palmavr.sourceforge.net/cgi-bin/fc.cgi 35 | # and choose options for external crystal clock and no clock divider 36 | # 37 | ################################## ATMega8 ################################## 38 | # ATMega8 FUSE_L (Fuse low byte): 39 | # 0x9f = 1 0 0 1 1 1 1 1 40 | # ^ ^ \ / \--+--/ 41 | # | | | +------- CKSEL 3..0 (external >8M crystal) 42 | # | | +--------------- SUT 1..0 (crystal osc, BOD enabled) 43 | # | +------------------ BODEN (BrownOut Detector enabled) 44 | # +-------------------- BODLEVEL (2.7V) 45 | # ATMega8 FUSE_H (Fuse high byte): 46 | # 0xc9 = 1 1 0 0 1 0 0 1 <-- BOOTRST (boot reset vector at 0x0000) 47 | # ^ ^ ^ ^ ^ ^ ^------ BOOTSZ0 48 | # | | | | | +-------- BOOTSZ1 49 | # | | | | + --------- EESAVE (don't preserve EEPROM over chip erase) 50 | # | | | +-------------- CKOPT (full output swing) 51 | # | | +---------------- SPIEN (allow serial programming) 52 | # | +------------------ WDTON (WDT not always on) 53 | # +-------------------- RSTDISBL (reset pin is enabled) 54 | # 55 | ############################## ATMega48/88/168 ############################## 56 | # ATMega*8 FUSE_L (Fuse low byte): 57 | # 0xdf = 1 1 0 1 1 1 1 1 58 | # ^ ^ \ / \--+--/ 59 | # | | | +------- CKSEL 3..0 (external >8M crystal) 60 | # | | +--------------- SUT 1..0 (crystal osc, BOD enabled) 61 | # | +------------------ CKOUT (if 0: Clock output enabled) 62 | # +-------------------- CKDIV8 (if 0: divide by 8) 63 | # ATMega*8 FUSE_H (Fuse high byte): 64 | # 0xde = 1 1 0 1 1 1 1 0 65 | # ^ ^ ^ ^ ^ \-+-/ 66 | # | | | | | +------ BODLEVEL 0..2 (110 = 1.8 V) 67 | # | | | | + --------- EESAVE (preserve EEPROM over chip erase) 68 | # | | | +-------------- WDTON (if 0: watchdog always on) 69 | # | | +---------------- SPIEN (allow serial programming) 70 | # | +------------------ DWEN (debug wire enable) 71 | # +-------------------- RSTDISBL (reset pin is enabled) 72 | # 73 | ############################## ATTiny25/45/85 ############################### 74 | # ATMega*5 FUSE_L (Fuse low byte): 75 | # 0xef = 1 1 1 0 1 1 1 1 76 | # ^ ^ \+/ \--+--/ 77 | # | | | +------- CKSEL 3..0 (clock selection -> crystal @ 12 MHz) 78 | # | | +--------------- SUT 1..0 (BOD enabled, fast rising power) 79 | # | +------------------ CKOUT (clock output on CKOUT pin -> disabled) 80 | # +-------------------- CKDIV8 (divide clock by 8 -> don't divide) 81 | # ATMega*5 FUSE_H (Fuse high byte): 82 | # 0xdd = 1 1 0 1 1 1 0 1 83 | # ^ ^ ^ ^ ^ \-+-/ 84 | # | | | | | +------ BODLEVEL 2..0 (brownout trigger level -> 2.7V) 85 | # | | | | +---------- EESAVE (preserve EEPROM on Chip Erase -> not preserved) 86 | # | | | +-------------- WDTON (watchdog timer always on -> disable) 87 | # | | +---------------- SPIEN (enable serial programming -> enabled) 88 | # | +------------------ DWEN (debug wire enable) 89 | # +-------------------- RSTDISBL (disable external reset -> enabled) 90 | # 91 | ################################ ATTiny2313 ################################# 92 | # ATTiny2313 FUSE_L (Fuse low byte): 93 | # 0xef = 1 1 1 0 1 1 1 1 94 | # ^ ^ \+/ \--+--/ 95 | # | | | +------- CKSEL 3..0 (clock selection -> crystal @ 12 MHz) 96 | # | | +--------------- SUT 1..0 (BOD enabled, fast rising power) 97 | # | +------------------ CKOUT (clock output on CKOUT pin -> disabled) 98 | # +-------------------- CKDIV8 (divide clock by 8 -> don't divide) 99 | # ATTiny2313 FUSE_H (Fuse high byte): 100 | # 0xdb = 1 1 0 1 1 0 1 1 101 | # ^ ^ ^ ^ \-+-/ ^ 102 | # | | | | | +---- RSTDISBL (disable external reset -> enabled) 103 | # | | | | +-------- BODLEVEL 2..0 (brownout trigger level -> 2.7V) 104 | # | | | +-------------- WDTON (watchdog timer always on -> disable) 105 | # | | +---------------- SPIEN (enable serial programming -> enabled) 106 | # | +------------------ EESAVE (preserve EEPROM on Chip Erase -> not preserved) 107 | # +-------------------- DWEN (debug wire enable) 108 | 109 | 110 | # symbolic targets: 111 | help: 112 | @echo "This Makefile has no default rule. Use one of the following:" 113 | @echo "make hex ....... to build main.hex" 114 | @echo "make program ... to flash fuses and firmware" 115 | @echo "make flash ..... to flash the firmware (use this on metaboard)" 116 | @echo "make clean ..... to delete objects and hex file" 117 | 118 | hex: main.hex main.eep 119 | 120 | program: flash fuse 121 | 122 | # rule for uploading firmware: 123 | flash: main.hex 124 | # $(AVRDUDE) -U flash:w:main.hex:i 125 | $(MICRONUCLEUS) main.hex 126 | upload: main.hex main.eep 127 | $(AVRDUDE) -U flash:w:main.hex -U eeprom:w:main.eep -U lfuse:w:0xe1:m -U hfuse:w:0xdd:m -U efuse:w:0xfe:m -U lock:w:0xfc:m 128 | 129 | # rule for deleting dependent files (those which can be built by Make): 130 | clean: 131 | rm -f main.hex main.lst main.obj main.cof main.list main.map main.eep main.elf *.o usbdrv/*.o main.s usbdrv/oddebug.s usbdrv/usbdrv.s 132 | 133 | # Generic rule for compiling C files: 134 | .c.o: 135 | $(COMPILE) -c $< -o $@ 136 | 137 | # Generic rule for assembling Assembler source files: 138 | .S.o: 139 | $(COMPILE) -x assembler-with-cpp -c $< -o $@ 140 | # "-x assembler-with-cpp" should not be necessary since this is the default 141 | # file type for the .S (with capital S) extension. However, upper case 142 | # characters are not always preserved on Windows. To ensure WinAVR 143 | # compatibility define the file type manually. 144 | 145 | # Generic rule for compiling C to assembler, used for debugging only. 146 | .c.s: 147 | $(COMPILE) -S $< -o $@ 148 | 149 | # file targets: 150 | 151 | # Since we don't want to ship the driver multipe times, we copy it into this project: 152 | 153 | main.elf: $(OBJECTS) # usbdrv dependency only needed because we copy it 154 | $(COMPILE) $(LDFLAGS) -o main.elf $(OBJECTS) 155 | 156 | main.hex: main.elf 157 | rm -f main.hex 158 | avr-objcopy -j .text -j .data -O ihex main.elf main.hex 159 | avr-size --format=avr main.elf 160 | 161 | main.eep: main.elf 162 | rm -f main.eep 163 | avr-objcopy -j .eeprom --set-section-flags=.eeprom="alloc,load" --change-section-lma .eeprom=0 -O ihex main.elf main.eep 164 | # debugging targets: 165 | 166 | disasm: main.elf 167 | avr-objdump -d main.elf 168 | 169 | cpp: 170 | $(COMPILE) -E main.c 171 | 172 | check: $(UNCRUSTIFY_FILES) 173 | uncrustify -c uncrustify/style.cfg --no-backup $^ 174 | -------------------------------------------------------------------------------- /MemType_case.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jim17/memtype/a0345bc36f89930d7b0ac9f7d2380710c5fc1db0/MemType_case.zip -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![Build Status](https://travis-ci.org/jim17/memtype.svg?branch=develop)](https://travis-ci.org/jim17/memtype) 2 | # Memtype 3 | Open Source solution to store your passwords encrypted, having them available everywhere. 4 | 5 | 6 | -------------------------------------------------------------------------------- /adm.c: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include 4 | 5 | /* Multiplexer Selection Register Configuration */ 6 | #define adm_cfg_R ADMUX 7 | #define adm_VREF 0x00 /* [7:6],[4] Voltage Reference VCC */ 8 | #define adm_ADLAR (1 << 5) /* [5] Left Adjustment, Meaning -> ADCH [15:8] ADCL[7:6] */ 9 | #define adm_ADCCH 0x01 /* [3:0] Single Ended Channel 1 */ 10 | 11 | /* ADC Control Status Register A */ 12 | #define adm_ctrl_R0 ADCSRA 13 | #define adm_ENABLE (1 << 7) /* [7] ADC Enable ADC */ 14 | #define adm_START (1 << 6) /* [6] ADC Start conversion */ 15 | #define adm_TRG (1 << 5) /* [5] ADC Auto Trigger enable */ 16 | #define adm_VALRDY (1 << 4) /* [4] ADC Interrupt Flag (cleared with 1) */ 17 | #define adm_INTEN (0 << 3) /* [3] ADC Interrupt Enable */ 18 | #define adm_CONVTIME 0x07 /* [2:0] ADC Preescaler x128 */ 19 | 20 | /* ADC Control Status Register B */ 21 | #define adm_ctrl_R1 ADCSRB 22 | #define adm_BIN 0x00 /* [7] ADC Bipolar input mode */ 23 | #define adm_IPR 0x00 /* [5] ADC Input polarity reversal */ 24 | #define adm_TRGSRC 0x00 /* [2:0] ADC Trigger Source, 000 - Free Running Mode */ 25 | 26 | /* ADC New Value Available */ 27 | #define adm_newVal() (adm_ctrl_R0 & adm_VALRDY) 28 | 29 | /* ADC New Value Clean */ 30 | #define adm_newValClean() {adm_ctrl_R0 |= adm_VALRDY; } 31 | 32 | /* ADC Value */ 33 | #define adm_Val() (ADCH) 34 | 35 | /* Local Variable */ 36 | uint8_t adm_ADCValue; 37 | 38 | void ADM_Init(void){ 39 | DDRB &= ~(1 << 2); 40 | PORTB &= ~(1 << 2); 41 | 42 | adm_cfg_R = (adm_VREF | adm_ADLAR | adm_ADCCH); 43 | 44 | adm_ctrl_R0 = (adm_ENABLE | adm_START | adm_TRG | adm_VALRDY | adm_INTEN | adm_CONVTIME); 45 | 46 | adm_ctrl_R1 = (adm_BIN | adm_IPR | adm_TRGSRC); 47 | } 48 | 49 | void ADM_Task(void){ 50 | if (adm_newVal() > 0u) 51 | { 52 | adm_newValClean(); 53 | adm_ADCValue = adm_Val(); 54 | } 55 | } 56 | 57 | -------------------------------------------------------------------------------- /adm.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _ADM_H_ 3 | #define _ADM_H_ 4 | 5 | #include 6 | 7 | /* ADC Max value */ 8 | #define ADC_MAX (0xFFu) 9 | 10 | /* Macro Like function */ 11 | #define ADM_GetAdcValue() adm_ADCValue 12 | 13 | /* Function prototype */ 14 | void ADM_Init(void); 15 | void ADM_Task(void); 16 | 17 | extern uint8_t adm_ADCValue; 18 | 19 | #endif /* _ADM_H_ */ 20 | -------------------------------------------------------------------------------- /crd.c: -------------------------------------------------------------------------------- 1 | 2 | #include "crd.h" 3 | #include "opt.h" 4 | #include "uif.h" 5 | #include "uib.h" 6 | #include "ucp.h" 7 | #include "fls.h" 8 | #include "print.h" 9 | 10 | #define PRINTCrdFlash(x) printStr((void*)x, FLASH) 11 | #define PRINTCrdRAM(x) printStr((void*)x, RAM) 12 | 13 | // Local Function prototype 14 | static void crd_print(void); 15 | static void crd_previous(void); 16 | static void crd_next(void); 17 | static void crd_loadCredential(uint16_t cred); 18 | static uint16_t crd_findEOS(uint16_t offset); 19 | static uint8_t crd_find(uint8_t* start, uint8_t len); 20 | 21 | cipher_t cipher; 22 | 23 | // Credential structure 24 | const uint8_t credentials[MAX_CRED_FLASH_SIZE] PROGMEM = { 25 | 0x57,0x65,0x6c,0x63,0x6f,0x6d,0x65,0x00,0x3a,0x00,0x79,0x62,0x6f,0xc8,0x0f,0xeb,0x16,0x21,0x95,0xdd,0x0f,0x42,0xe5,0x33,0x9f,0xb7,0x8d,0x43,0xb4,0xaa,0xb7,0xac,0xf0,0xe3,0xc4,0x71,0xcd,0xe1,0xa2,0x4f,0x15,0x33,0x65,0x41,0x1d,0xee,0xac,0xf3,0x5c,0x00,0xd1,0x8f,0x62,0x28,0x79,0x61,0xf9,0xba,0x41,0x62,0x6f,0x75,0x74,0x00,0x72,0x00,0x16,0xdc,0x40,0xd1,0xe4,0x36,0x4d,0xa7,0x8a,0x3d,0x5c,0x19,0x94,0xe1,0x88,0xdf,0xbf,0x68,0x01,0xac,0x46,0x8c,0x4b,0x9d,0x01,0x55,0x24,0x07,0x85,0x80,0xa0,0x62,0x39,0xab,0x03,0xc8,0x84,0x64,0xfa,0xf1,0xa3,0xb7,0x74,0x7b,0xa3,0xf3,0x05,0xcb,0x52,0x6f,0x75,0x74,0x65,0x72,0x20,0x44,0x65,0x66,0x61,0x75,0x6c,0x74,0x00,0x00,0x00,0x08,0xa9,0x43,0x69,0xd2,0x61,0x54,0xe0,0x6c,0x18,0xd5,0x72,0x4b,0x0d,0xe6,0x62,0xeb,0x74,0xbb,0x43,0x3c,0x16,0x5a,0x04,0xd0,0x87,0xd0,0x35,0x36,0x66,0xca,0x72,0x00,0x00,0x00,0x00,0x00 26 | }; 27 | 28 | /* Credentials Start Message */ 29 | const char crd_startStr[] PROGMEM = CRD_START_STR; 30 | credentialEncryptedFlash_t credential; 31 | 32 | extern volatile uint8_t tempBuff[SPM_PAGESIZE]; 33 | uint8_t position = 0; 34 | uint8_t counter = 0; 35 | credPosition_t crdStart; 36 | credPosition_t crdStop; 37 | 38 | /* Init CRD */ 39 | void CRD_Init(void){ 40 | //First credential initialization 41 | crd_loadCredential(0); 42 | } 43 | 44 | /* Credentials Finite state machine [Start] */ 45 | void CRD_fsmStart(void){ 46 | UIF_state = CREDENTIALS; 47 | print_deleteStr(); 48 | crd_print(); 49 | UCP_Unlock(); 50 | } 51 | 52 | /* Credentials Finite state machine */ 53 | void CRD_fsm(uint8_t button){ 54 | 55 | print_deleteStr(); 56 | 57 | switch(button) { 58 | case LEFT: 59 | OPT_fsmStart(); 60 | break; 61 | case UP: 62 | crd_previous(); 63 | break; 64 | case RIGHT: 65 | CRD_printDetail(CRD_USER, CRD_END); 66 | break; 67 | case DOWN: 68 | crd_next(); 69 | break; 70 | default: 71 | return; 72 | } 73 | } 74 | 75 | void CRD_apply(){ 76 | if (counter >= crdStop) { 77 | return; 78 | } 79 | 80 | uint8_t size; 81 | uint8_t buffpos = (position % 16); 82 | uint8_t pending = 16-(buffpos); 83 | 84 | 85 | // STEP - 1 (decrypt), only decrypt if there's no more bytes pending in plain buffer 86 | if(buffpos == 0) 87 | { 88 | memcpy_P((void*)cipher.plain,(void*)(credential.encrypt+position), 16); 89 | noekeon_decrypt(); 90 | } 91 | 92 | // STEP - 2 find how many characters in first decrypted block 93 | size = crd_find((void*)cipher.plain+buffpos, pending); 94 | 95 | // STEP - 3 print the credentials 96 | if ( (counter >= crdStart) && (size != 0) ) 97 | { 98 | print_nStr((void*)cipher.plain+buffpos, size); 99 | } 100 | else 101 | { 102 | /* special case when the first character is \0 */ 103 | print_nStr("", 1); 104 | } 105 | 106 | if (size < pending) 107 | { 108 | counter++; 109 | position++; // add \0 110 | } 111 | 112 | position += size; 113 | } 114 | 115 | /* Writes the credential */ 116 | void CRD_printDetail(uint8_t start, uint8_t stop){ 117 | position = 0; 118 | counter = 0; 119 | crdStart = start; 120 | crdStop = stop; 121 | CRD_apply(); 122 | } 123 | 124 | static void crd_print(void){ 125 | PRINTCrdFlash(credential.name); 126 | } 127 | 128 | static void crd_previous(void){ 129 | uint16_t currentcred = (credential.name-(uint16_t)credentials); 130 | uint16_t lastcred = 0; 131 | 132 | while(credential.next != currentcred ) 133 | { 134 | lastcred = credential.next; 135 | crd_loadCredential(credential.next); 136 | } 137 | // select previous valid credential 138 | crd_loadCredential(lastcred); 139 | crd_print(); 140 | } 141 | 142 | static void crd_next(void){ 143 | // select next valid credential 144 | crd_loadCredential(credential.next); 145 | crd_print(); 146 | } 147 | 148 | /* load a credential from flash to working credential */ 149 | static void crd_loadCredential(uint16_t cred){ 150 | uint16_t offset = cred+(uint16_t)credentials; //counter 151 | 152 | credential.name = offset; 153 | offset = crd_findEOS(offset); //Find next EOS 154 | credential.next = pgm_read_word(offset); 155 | //offset = crd_findEOS(offset); //Find next EOS 156 | credential.encrypt = offset+2; 157 | } 158 | 159 | /* return EOS '\0' position + 1 */ 160 | static uint16_t crd_findEOS(uint16_t offset){ 161 | char c; 162 | uint16_t off = offset; 163 | c = pgm_read_byte(off); 164 | while(c!='\0') 165 | { 166 | off++; 167 | c = pgm_read_byte(off); 168 | } 169 | off++; 170 | return off; 171 | } 172 | 173 | /* return position of first EOS, len must be lower than 255*/ 174 | static uint8_t crd_find(uint8_t* start, uint8_t len){ 175 | uint8_t i; 176 | uint8_t* ptr = start; 177 | 178 | for(i=0; i 8 | #include 9 | 10 | #define MAX_CRED_FLASH_SIZE (2048) 11 | #define CRD_START_STR "[CREDENTIALS]" 12 | 13 | 14 | typedef struct 15 | { 16 | uint16_t name; 17 | uint16_t line1; 18 | uint16_t hop; 19 | uint16_t line2; 20 | uint16_t submit; 21 | uint16_t next; 22 | 23 | } credentialFlash_t; 24 | 25 | typedef struct 26 | { 27 | uint16_t name; // here we will store name addr 28 | uint16_t next; // here we will store next credential 29 | uint16_t encrypt; 30 | 31 | } credentialEncryptedFlash_t; 32 | 33 | typedef enum credPosition 34 | { 35 | CRD_USER = 0, 36 | CRD_HOP, 37 | CRD_PASS, 38 | CRD_SUBMIT, 39 | CRD_END 40 | } credPosition_t; 41 | 42 | extern void noekeon_decrypt(void); 43 | extern void noekeon_encrypt(void); 44 | 45 | typedef struct 46 | { 47 | uint8_t plain[16]; 48 | uint8_t key[16]; 49 | 50 | } cipher_t; 51 | 52 | extern cipher_t cipher; 53 | 54 | // Credential structure 55 | extern const uint8_t credentials[MAX_CRED_FLASH_SIZE] PROGMEM; 56 | 57 | /* Public functions */ 58 | void CRD_fsm(uint8_t button); 59 | void CRD_fsmStart(void); 60 | void CRD_Init(void); 61 | void CRD_apply(void); 62 | void CRD_printDetail(credPosition_t start, credPosition_t stop); 63 | 64 | #endif /* _CRD_H_*/ 65 | 66 | -------------------------------------------------------------------------------- /documents/HID1_11.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jim17/memtype/a0345bc36f89930d7b0ac9f7d2380710c5fc1db0/documents/HID1_11.pdf -------------------------------------------------------------------------------- /documents/Hut1_12v2.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jim17/memtype/a0345bc36f89930d7b0ac9f7d2380710c5fc1db0/documents/Hut1_12v2.pdf -------------------------------------------------------------------------------- /documents/MemTypeGettingStarted.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jim17/memtype/a0345bc36f89930d7b0ac9f7d2380710c5fc1db0/documents/MemTypeGettingStarted.pdf -------------------------------------------------------------------------------- /documents/atmel_attiny85_datasheet.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jim17/memtype/a0345bc36f89930d7b0ac9f7d2380710c5fc1db0/documents/atmel_attiny85_datasheet.pdf -------------------------------------------------------------------------------- /documents/bootloader_faq.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jim17/memtype/a0345bc36f89930d7b0ac9f7d2380710c5fc1db0/documents/bootloader_faq.pdf -------------------------------------------------------------------------------- /documents/design/architecture.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jim17/memtype/a0345bc36f89930d7b0ac9f7d2380710c5fc1db0/documents/design/architecture.png -------------------------------------------------------------------------------- /documents/design/credential.txt: -------------------------------------------------------------------------------- 1 | Credential structure 2 | ******************** 3 | 4 | name (String) 5 | line1 (String) 6 | hop (String) 7 | line2 (String) 8 | submit (String) 9 | 10 | (String) means an array of keycodes in order for HID to output keycodes. 11 | A table for conversion will be needed when credentials can be created. 12 | 13 | Description 14 | *********** 15 | 16 | name: The name to identify the credential. For example "GmailUser" 17 | 18 | line1: The first line of the credential for example "user@mail.com". 19 | Note that this can be used also with command line logins like: 20 | "ssh user@host.com" or "sftp user@host.com" with this trick 21 | the device will type the command too :) 22 | 23 | hop: The key o keys needed to move focus from first line 24 | to second line. For example in gmail that is a tab "/t", in ssh 25 | it is an enter "/n" or in some other webs it can be several tabs 26 | "/t/t/t/t" or any other key combination. “o multiplicador” 27 | 28 | line2: That is the password itself. For example "mysuperpass" or similar. 29 | 30 | 31 | submit: That's the key or keys needed to submit the credential. For example 32 | in gmail that is tab and enter "/t/n" in ssh an enter "/n" or it 33 | can be any other combination needed by your specific software. 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /documents/design/flow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jim17/memtype/a0345bc36f89930d7b0ac9f7d2380710c5fc1db0/documents/design/flow.png -------------------------------------------------------------------------------- /documents/design/genGraph.txt: -------------------------------------------------------------------------------- 1 | 2 | # Download Graphviz and execute: 3 | dot -Tpng uif.gv -o uif.png 4 | -------------------------------------------------------------------------------- /documents/design/uif.gv: -------------------------------------------------------------------------------- 1 | 2 | digraph G { 3 | rankdir=LR; 4 | 5 | uif [label="User Interface\nTask"] 6 | 7 | cred [label="CREDENTIALS"]; 8 | prev [label="previous cred"]; 9 | next [label="next cred"]; 10 | apply [label="apply cred"]; 11 | selopt [label="menu->opt"]; 12 | 13 | opt [label="OPTIONS"]; 14 | prevopt [label="previous options"]; 15 | nextopt [label="next options"]; 16 | applyopt [label="apply options"]; 17 | selcred [label="menu->cred"]; 18 | 19 | subgraph cluster_credentials { 20 | cred->prev [label=up]; 21 | prev->cred; 22 | cred->next [label=down]; 23 | next->cred; 24 | cred->apply [label=right]; 25 | apply->cred; 26 | cred->selopt [label=left]; 27 | } 28 | 29 | subgraph cluster_options { 30 | opt->prevopt [label=up]; 31 | prevopt->opt; 32 | opt->nextopt [label=down]; 33 | nextopt->opt; 34 | opt->applyopt [label=right]; 35 | applyopt->opt; 36 | opt->selcred [label=left]; 37 | } 38 | 39 | uif->cred:sw [label="menu=cred"]; 40 | uif->opt:w [label="menu=opt"]; 41 | opt:nw->uif; 42 | cred:w->uif; 43 | selcred->cred; 44 | selopt->opt; 45 | } 46 | -------------------------------------------------------------------------------- /documents/design/uif.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jim17/memtype/a0345bc36f89930d7b0ac9f7d2380710c5fc1db0/documents/design/uif.png -------------------------------------------------------------------------------- /documents/design/use_credential.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jim17/memtype/a0345bc36f89930d7b0ac9f7d2380710c5fc1db0/documents/design/use_credential.png -------------------------------------------------------------------------------- /documents/documentation/Makefile: -------------------------------------------------------------------------------- 1 | 2 | DIAGRAMS=$(wildcard diagrams/*.shaape) 3 | 4 | all: memtype.html diagrams 5 | 6 | memtype.html: memtype.adoc 7 | asciidoctor memtype.adoc 8 | 9 | diagrams: $(DIAGRAMS).png 10 | @echo Generating diagrams ... $(DIAGRAMS) 11 | 12 | $(DIAGRAMS).png: 13 | shaape $(DIAGRAMS) 14 | 15 | diagrams-clean: 16 | rm -rf diagrams/*.png 17 | clean: 18 | rm -rf *.html 19 | -------------------------------------------------------------------------------- /documents/documentation/diagrams/hw.shaape: -------------------------------------------------------------------------------- 1 | +--------+ +-------------+ 2 | | | \ / 3 | | Hello |---> \ Goodbye / 4 | | ';P' | / \ 5 | | | / \ 6 | +--------+ +-------------+ 7 | -------------------------------------------------------------------------------- /documents/documentation/diagrams/hw.shaape.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jim17/memtype/a0345bc36f89930d7b0ac9f7d2380710c5fc1db0/documents/documentation/diagrams/hw.shaape.png -------------------------------------------------------------------------------- /documents/documentation/memtype.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jim17/memtype/a0345bc36f89930d7b0ac9f7d2380710c5fc1db0/documents/documentation/memtype.jpg -------------------------------------------------------------------------------- /documents/documentation/memtype.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jim17/memtype/a0345bc36f89930d7b0ac9f7d2380710c5fc1db0/documents/documentation/memtype.pdf -------------------------------------------------------------------------------- /documents/documentation/memtype_front.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jim17/memtype/a0345bc36f89930d7b0ac9f7d2380710c5fc1db0/documents/documentation/memtype_front.jpg -------------------------------------------------------------------------------- /documents/documentation/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jim17/memtype/a0345bc36f89930d7b0ac9f7d2380710c5fc1db0/documents/documentation/screenshot.png -------------------------------------------------------------------------------- /documents/flashing_guide.odt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jim17/memtype/a0345bc36f89930d7b0ac9f7d2380710c5fc1db0/documents/flashing_guide.odt -------------------------------------------------------------------------------- /documents/flashing_guide.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jim17/memtype/a0345bc36f89930d7b0ac9f7d2380710c5fc1db0/documents/flashing_guide.pdf -------------------------------------------------------------------------------- /documents/usbmassbulk_10.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jim17/memtype/a0345bc36f89930d7b0ac9f7d2380710c5fc1db0/documents/usbmassbulk_10.pdf -------------------------------------------------------------------------------- /fls.c: -------------------------------------------------------------------------------- 1 | 2 | #include "fls.h" 3 | #include 4 | #include 5 | #include /* for sei(), cli() */ 6 | 7 | // attiny85 SPM_PAGESIZE is 64 bytes 8 | #define FLS_IS_PAGE_ALIGNED(x) ((x%SPM_PAGESIZE) == 0u) 9 | #define FLS_IS_WORD_ALIGNED(x) ((x%2) == 0u) 10 | 11 | // Local functions prototype 12 | void fls_writePage(uint16_t byteaddr); 13 | void fls_erasePage(uint16_t byteaddr); 14 | void fls_loadPage(const uint8_t* buff, uint16_t byteaddr); 15 | 16 | void fls_writePage(uint16_t byteaddr) { 17 | cli(); 18 | boot_page_write_safe(byteaddr); // will halt CPU, no waiting required 19 | sei(); 20 | } 21 | 22 | void fls_erasePage(uint16_t byteaddr){ 23 | cli(); 24 | boot_page_erase_safe(byteaddr); 25 | sei(); 26 | } 27 | 28 | void fls_loadPage(const uint8_t* buff, uint16_t byteaddr){ 29 | uint8_t i; 30 | uint16_t w; 31 | for(i=0; i SPM_PAGESIZE ) 59 | { 60 | eraseBuffEnd = SPM_PAGESIZE; 61 | } 62 | 63 | memcpy_P((void*)tempBuff,(void*)alignedStartAddr, SPM_PAGESIZE); 64 | fls_erasePage(alignedStartAddr); 65 | 66 | for(j=eraseBuffStart; j 6 | 7 | // Public function prototypes 8 | void FLS_write(uint8_t* buff, uint16_t startaddr, uint16_t size); 9 | 10 | #endif /* _FLS_H_ */ 11 | -------------------------------------------------------------------------------- /hid_defines.c: -------------------------------------------------------------------------------- 1 | #include "hid_defines.h" 2 | 3 | #ifdef NULL 4 | #undef NULL 5 | #endif 6 | #define NULL (0x00) 7 | 8 | KEYBOARD_MEM_TYPE const char keyboardLUT_ES[KEYBOARD_SIZE] ={ 9 | NULL, // 0x00 10 | NULL, // 0x01 11 | NULL, // 0x02 12 | NULL, // 0x03 13 | NULL, // 0x04 14 | NULL, // 0x05 15 | NULL, // 0x06 16 | NULL, // 0x07 17 | KEY_BACKSPACE, // 0x08 18 | KEY_TAB, // 0x09 19 | KEY_RETURN, // 0x0A 20 | NULL, // 0x0B 21 | NULL, // 0x0C 22 | KEY_RETURN, // 0x0D 23 | NULL, // 0x0E 24 | NULL, // 0x0F 25 | NULL, // 0x10 26 | NULL, // 0x11 27 | NULL, // 0x12 28 | NULL, // 0x13 29 | NULL, // 0x14 30 | NULL, // 0x15 31 | NULL, // 0x16 32 | NULL, // 0x17 33 | NULL, // 0x18 34 | NULL, // 0x19 35 | NULL, // 0x1A 36 | NULL, // 0x1B 37 | NULL, // 0x1C 38 | NULL, // 0x1D 39 | NULL, // 0x1E 40 | NULL, // 0x1F 41 | KEY_SPACE, // 0x20 42 | SHIFT_MASK|KEY_1, // 0x21 ! 43 | SHIFT_MASK|KEY_2, // 0x22 " 44 | ALTGR_MASK|KEY_3, // 0x23 # 45 | SHIFT_MASK|KEY_4, // 0x24 $ 46 | SHIFT_MASK|KEY_5, // 0x25 % 47 | SHIFT_MASK|KEY_6, // 0x26 & 48 | KEY_MINUS, // 0x27 ' 49 | SHIFT_MASK|KEY_8, // 0x28 ( 50 | SHIFT_MASK|KEY_9, // 0x29 ) 51 | SHIFT_MASK|KEY_BRACKET_RIGHT, // 0x2A * 52 | KEY_BRACKET_RIGHT, // 0x2B + 53 | KEY_COMMA, // 0x2C , 54 | KEY_SLASH, // 0x2D - 55 | KEY_PERIOD, // 0x2E . 56 | SHIFT_MASK|KEY_7, // 0x2F / 57 | KEY_0, // 0x30 0 58 | KEY_1, // 0x31 1 59 | KEY_2, // 0x32 2 60 | KEY_3, // 0x33 3 61 | KEY_4, // 0x34 4 62 | KEY_5, // 0x35 5 63 | KEY_6, // 0x36 6 64 | KEY_7, // 0x37 7 65 | KEY_8, // 0x38 8 66 | KEY_9, // 0x39 9 67 | SHIFT_MASK|KEY_PERIOD, // 0x3A : 68 | SHIFT_MASK|KEY_COMMA, // 0x3B ; 69 | KEY_EUROPE_2, // 0x3C < 70 | SHIFT_MASK|KEY_0, // 0x3D = 71 | SHIFT_MASK|KEY_EUROPE_2, // 0x3E > 72 | SHIFT_MASK|KEY_MINUS, // 0x3F ? 73 | ALTGR_MASK|KEY_2, // 0x40 @ 74 | SHIFT_MASK|KEY_A, // 0x41 A 75 | SHIFT_MASK|KEY_B, // 0x42 B 76 | SHIFT_MASK|KEY_C, // 0x43 C 77 | SHIFT_MASK|KEY_D, // 0x44 D 78 | SHIFT_MASK|KEY_E, // 0x45 E 79 | SHIFT_MASK|KEY_F, // 0x46 F 80 | SHIFT_MASK|KEY_G, // 0x47 G 81 | SHIFT_MASK|KEY_H, // 0x48 H 82 | SHIFT_MASK|KEY_I, // 0x49 I 83 | SHIFT_MASK|KEY_J, // 0x4A J 84 | SHIFT_MASK|KEY_K, // 0x4B K 85 | SHIFT_MASK|KEY_L, // 0x4C L 86 | SHIFT_MASK|KEY_M, // 0x4D M 87 | SHIFT_MASK|KEY_N, // 0x4E N 88 | SHIFT_MASK|KEY_O, // 0x4F O 89 | SHIFT_MASK|KEY_P, // 0x50 P 90 | SHIFT_MASK|KEY_Q, // 0x51 Q 91 | SHIFT_MASK|KEY_R, // 0x52 R 92 | SHIFT_MASK|KEY_S, // 0x53 S 93 | SHIFT_MASK|KEY_T, // 0x55 T 94 | SHIFT_MASK|KEY_U, // 0x55 U 95 | SHIFT_MASK|KEY_V, // 0x56 V 96 | SHIFT_MASK|KEY_W, // 0x57 W 97 | SHIFT_MASK|KEY_X, // 0x58 X 98 | SHIFT_MASK|KEY_Y, // 0x59 Y 99 | SHIFT_MASK|KEY_Z, // 0x5A Z 100 | ALTGR_MASK|KEY_BRACKET_LEFT, // 0x5B [ 101 | ALTGR_MASK|KEY_GRAVE, // 0x5C '\' 102 | ALTGR_MASK|KEY_BRACKET_RIGHT, // 0x5D ] 103 | SHIFT_MASK|KEY_BRACKET_LEFT, // 0x5E ^ 104 | SHIFT_MASK|KEY_SLASH, // 0x5F _ 105 | KEY_BRACKET_LEFT, // 0x60 ` 106 | KEY_A, // 0x61 a 107 | KEY_B, // 0x62 b 108 | KEY_C, // 0x63 c 109 | KEY_D, // 0x66 d 110 | KEY_E, // 0x65 e 111 | KEY_F, // 0x66 f 112 | KEY_G, // 0x67 g 113 | KEY_H, // 0x68 h 114 | KEY_I, // 0x69 i 115 | KEY_J, // 0x6A j 116 | KEY_K, // 0x6B k 117 | KEY_L, // 0x6C l 118 | KEY_M, // 0x6D m 119 | KEY_N, // 0x6E n 120 | KEY_O, // 0x6F o 121 | KEY_P, // 0x70 p 122 | KEY_Q, // 0x71 q 123 | KEY_R, // 0x72 r 124 | KEY_S, // 0x73 s 125 | KEY_T, // 0x75 t 126 | KEY_U, // 0x75 u 127 | KEY_V, // 0x76 v 128 | KEY_W, // 0x77 w 129 | KEY_X, // 0x78 x 130 | KEY_Y, // 0x79 y 131 | KEY_Z, // 0x7A z 132 | ALTGR_MASK|KEY_APOSTROPHE, // 0x7B { 133 | ALTGR_MASK|KEY_1, // 0x7C | 134 | ALTGR_MASK|KEY_BACKSLASH, // 0x7D } 135 | ALTGR_MASK|KEY_4, // 0x7E ~ 136 | NULL // just to have 128 bytes 137 | }; 138 | -------------------------------------------------------------------------------- /hid_defines.h: -------------------------------------------------------------------------------- 1 | #ifndef HID_DEFINES_H_ 2 | #define HID_DEFINES_H_ 3 | #include 4 | 5 | #define KEYBOARD_LAYOUT_EEPROM 1 6 | #define KEYBOARD_SIZE 128 7 | 8 | #if KEYBOARD_LAYOUT_EEPROM == 0 /* FLASH */ 9 | #include 10 | #define KEYBOARD_READ_BYTE pgm_read_byte 11 | #define KEYBOARD_MEM_TYPE PROGMEM 12 | #else /* EEPROM */ 13 | #include 14 | #define KEYBOARD_READ_BYTE eeprom_read_byte 15 | #define KEYBOARD_MEM_TYPE EEMEM 16 | #endif 17 | 18 | extern KEYBOARD_MEM_TYPE const char keyboardLUT_ES[KEYBOARD_SIZE]; 19 | 20 | #define SHIFT_MASK 0x80 21 | #define ALTGR_MASK 0x40 22 | #define KEY_CTRL 0x01 23 | #define KEY_SHIFT 0x02 24 | #define KEY_ALT 0x04 25 | #define KEY_GUI 0x08 26 | #define KEY_LEFT_CTRL 0x01 27 | #define KEY_LEFT_SHIFT 0x02 28 | #define KEY_LEFT_ALT 0x04 29 | #define KEY_LEFT_GUI 0x08 30 | #define KEY_RIGHT_CTRL 0x10 31 | #define KEY_RIGHT_SHIFT 0x20 32 | #define KEY_RIGHT_ALT 0x40 33 | #define KEY_RIGHT_GUI 0x80 34 | #define KEY_NONE 0x00 35 | #define KEY_A 0x04 36 | #define KEY_B 0x05 37 | #define KEY_C 0x06 38 | #define KEY_D 0x07 39 | #define KEY_E 0x08 40 | #define KEY_F 0x09 41 | #define KEY_G 0x0A 42 | #define KEY_H 0x0B 43 | #define KEY_I 0x0C 44 | #define KEY_J 0x0D 45 | #define KEY_K 0x0E 46 | #define KEY_L 0x0F 47 | #define KEY_M 0x10 48 | #define KEY_N 0x11 49 | #define KEY_O 0x12 50 | #define KEY_P 0x13 51 | #define KEY_Q 0x14 52 | #define KEY_R 0x15 53 | #define KEY_S 0x16 54 | #define KEY_T 0x17 55 | #define KEY_U 0x18 56 | #define KEY_V 0x19 57 | #define KEY_W 0x1A 58 | #define KEY_X 0x1B 59 | #define KEY_Y 0x1C 60 | #define KEY_Z 0x1D 61 | #define KEY_1 0x1E 62 | #define KEY_2 0x1F 63 | #define KEY_3 0x20 64 | #define KEY_4 0x21 65 | #define KEY_5 0x22 66 | #define KEY_6 0x23 67 | #define KEY_7 0x24 68 | #define KEY_8 0x25 69 | #define KEY_9 0x26 70 | #define KEY_0 0x27 71 | #define KEY_RETURN 0x28 72 | #define KEY_ESCAPE 0x29 73 | #define KEY_BACKSPACE 0x2A 74 | #define KEY_TAB 0x2B 75 | #define KEY_SPACE 0x2C 76 | #define KEY_MINUS 0x2D 77 | #define KEY_EQUAL 0x2E 78 | #define KEY_BRACKET_LEFT 0x2F 79 | #define KEY_BRACKET_RIGHT 0x30 80 | #define KEY_BACKSLASH 0x31 81 | #define KEY_EUROPE_1 0x32 82 | #define KEY_SEMICOLON 0x33 83 | #define KEY_APOSTROPHE 0x34 84 | #define KEY_GRAVE 0x35 85 | #define KEY_COMMA 0x36 86 | #define KEY_PERIOD 0x37 87 | #define KEY_SLASH 0x38 88 | #define KEY_CAPS_LOCK 0x39 89 | #define KEY_F1 0x3A // value will be used for KEY_EUROPE_2 90 | #define KEY_F2 0x3B 91 | #define KEY_F3 0x3C 92 | #define KEY_F4 0x3D 93 | #define KEY_F5 0x3E 94 | #define KEY_F6 0x3F 95 | 96 | // Keys > 0x40 can't be used directly because the ASCII mapping 97 | // table uses 0x40 as mask for ALTGR key 98 | // Remapping KEY_EUROPE_2 to KEY_F1 99 | // Remapped keys are considered in modified print.c code 100 | // The keyboard layout tables must be updated for using the remapped keys 101 | #define KEY_F7 0x40 102 | #define KEY_F8 0x41 103 | #define KEY_F9 0x42 104 | #define KEY_F10 0x43 105 | #define KEY_F11 0x44 106 | #define KEY_F12 0x45 107 | #define KEY_PRINT_SCREEN 0x46 108 | #define KEY_SCROLL_LOCK 0x47 109 | #define KEY_PAUSE 0x48 110 | #define KEY_INSERT 0x49 111 | #define KEY_HOME 0x4A 112 | #define KEY_PAGE_UP 0x4B 113 | #define KEY_DELETE 0x4C 114 | #define KEY_END 0x4D 115 | #define KEY_PAGE_DOWN 0x4E 116 | #define KEY_ARROW_RIGHT 0x4F 117 | #define KEY_ARROW_LEFT 0x50 118 | #define KEY_ARROW_DOWN 0x51 119 | #define KEY_ARROW_UP 0x52 120 | #define KEY_NUM_LOCK 0x53 121 | #define KEY_KEYPAD_DIVIDE 0x54 122 | #define KEY_KEYPAD_MULTIPLY 0x55 123 | #define KEY_KEYPAD_SUBTRACT 0x56 124 | #define KEY_KEYPAD_ADD 0x57 125 | #define KEY_KEYPAD_ENTER 0x58 126 | #define KEY_KEYPAD_1 0x59 127 | #define KEY_KEYPAD_2 0x5A 128 | #define KEY_KEYPAD_3 0x5B 129 | #define KEY_KEYPAD_4 0x5C 130 | #define KEY_KEYPAD_5 0x5D 131 | #define KEY_KEYPAD_6 0x5E 132 | #define KEY_KEYPAD_7 0x5F 133 | #define KEY_KEYPAD_8 0x60 134 | #define KEY_KEYPAD_9 0x61 135 | #define KEY_KEYPAD_0 0x62 136 | #define KEY_KEYPAD_DECIMAL 0x63 137 | #define KEY_EUROPE_2 KEY_F1 // mapped to unused key F1 (< 0x40) 138 | #define KEY_EUROPE_2_ORG 0x64 // original value 139 | #define KEY_APPLICATION 0x65 140 | #define KEY_POWER 0x66 141 | #define KEY_KEYPAD_EQUAL 0x67 142 | #define KEY_F13 0x68 143 | #define KEY_F14 0x69 144 | #define KEY_F15 0x6A 145 | #endif /* HID_DEFINES_H_ */ 146 | -------------------------------------------------------------------------------- /led.c: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include "led.h" 4 | 5 | ledStatus_t led; 6 | 7 | void LED_Task(void){ 8 | static uint8_t i = 0; 9 | 10 | if( (i++ % 16) == 0){ 11 | if(led == RED) { 12 | LED_ON(LED_RED); 13 | LED_OFF(LED_GREEN); 14 | } else if (led == GREEN){ 15 | LED_OFF(LED_RED); 16 | LED_ON(LED_GREEN); 17 | } else if (led == BLINK_BOTH){ 18 | LED_TOGGLE(LED_RED); 19 | LED_TOGGLE(LED_GREEN); 20 | }else if (led == BLINK_RED){ 21 | LED_TOGGLE(LED_RED); 22 | LED_OFF(LED_GREEN); 23 | } else if(led == BLINK_GREEN){ 24 | LED_OFF(LED_RED); 25 | LED_TOGGLE(LED_GREEN); 26 | } else{ 27 | LED_OFF(LED_RED); 28 | LED_OFF(LED_GREEN); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /led.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _LED_H_ 3 | #define _LED_H_ 4 | 5 | #define LED_DDR (DDRB) 6 | #define LED_PORT (PORTB) 7 | #define LED_RED (1) 8 | #define LED_GREEN (0) 9 | 10 | #define LED_Init() LED_OUTPUT() 11 | #define LED_OUTPUT() (LED_DDR |= (1< 2 | #include 3 | #include /* for sei() */ 4 | #include /* for _delay_ms() */ 5 | 6 | #include /* required by usbdrv.h */ 7 | #include "usbdrv.h" 8 | #include "oddebug.h" /* This is also an example for using debug macros */ 9 | #include "led.h" /* Led defines for debugging */ 10 | 11 | #include "osccal.h" 12 | #include "print.h" 13 | #include "adm.h" 14 | #include "uib.h" 15 | #include "uif.h" 16 | #include "sch.h" 17 | #include "crd.h" 18 | #include "ucp.h" 19 | 20 | PROGMEM const char usbHidReportDescriptor[USB_CFG_HID_REPORT_DESCRIPTOR_LENGTH] = { /* USB report descriptor */ 21 | 0x05, 0x01, // USAGE_PAGE (Generic Desktop) 22 | 0x09, 0x06, // USAGE (Keyboard) 23 | 0xa1, 0x01, // COLLECTION (Application) 24 | 0x85, 0x01, // REPORT_ID (1) 25 | 0x05, 0x07, // USAGE_PAGE (Keyboard) 26 | 0x19, 0xe0, // USAGE_MINIMUM (Keyboard LeftControl) 27 | 0x29, 0xe7, // USAGE_MAXIMUM (Keyboard Right GUI) 28 | 0x15, 0x00, // LOGICAL_MINIMUM (0) 29 | 0x25, 0x01, // LOGICAL_MAXIMUM (1) 30 | 0x75, 0x01, // REPORT_SIZE (1) 31 | 0x95, 0x08, // REPORT_COUNT (8) 32 | 0x81, 0x02, // INPUT (Data,Var,Abs) 33 | 0x75, 0x08, // REPORT_SIZE (8) 34 | 0x95, 0x01, // REPORT_COUNT (1) 35 | 0x15, 0x00, // LOGICAL_MINIMUM (0) 36 | 0x25, 0x65, // LOGICAL_MAXIMUM (101) 37 | 0x19, 0x00, // USAGE_MINIMUM (Reserved (no event indicated)) 38 | 0x29, 0x65, // USAGE_MAXIMUM (Keyboard Application) 39 | 0x81, 0x00, // INPUT (Data,Ary,Abs) 40 | 0xc0, // END_COLLECTION 41 | 42 | 0x06, 0x00, 0xff, // USAGE_PAGE (Generic Desktop) 43 | 0x09, 0x01, // USAGE (Vendor Usage 1) 44 | 0xa1, 0x01, // COLLECTION (Application) 45 | 0x85, 0x02, // REPORT_ID (2) 46 | 0x15, 0x00, // LOGICAL_MINIMUM (0) 47 | 0x26, 0xff, 0x00, // LOGICAL_MAXIMUM (255) 48 | 0x75, 0x08, // REPORT_SIZE (8) 49 | 0x95, 0x08, // REPORT_COUNT (8) 50 | 0x09, 0x00, // USAGE (Undefined) 51 | 0xb2, 0x02, 0x01, // FEATURE (Data,Var,Abs,Buf) 52 | 0xc0 // END_COLLECTION 53 | }; 54 | 55 | 56 | /* ------------------------------------------------------------------------- */ 57 | /* ----------------------------- USB interface ----------------------------- */ 58 | /* ------------------------------------------------------------------------- */ 59 | 60 | static uint8_t idle_rate = 500 / 4; // see HID1_11.pdf sect 7.2.4 61 | static uint8_t protocol_version = 0; // see HID1_11.pdf sect 7.2.6 62 | 63 | uchar usbFunctionWrite(uchar *data, uchar len){ 64 | UCP_Decode(data,len); //to USB Communication Protocol 65 | return 1; /* return 1 if this was the last chunk */ 66 | } 67 | 68 | uchar usbFunctionSetup(uchar data[8]){ 69 | usbRequest_t *rq = (void *)data; 70 | 71 | 72 | if ((rq->bmRequestType & USBRQ_TYPE_MASK) != USBRQ_TYPE_CLASS) { 73 | return 0; // ignore request if it's not a class specific request 74 | } 75 | // see HID1_11.pdf sect 7.2 76 | switch (rq->bRequest) 77 | { 78 | case USBRQ_HID_GET_IDLE: 79 | usbMsgPtr = &idle_rate; // send data starting from this byte 80 | return 1; // send 1 byte 81 | case USBRQ_HID_SET_IDLE: 82 | idle_rate = rq->wValue.bytes[1]; // read in idle rate 83 | return 0; // send nothing 84 | case USBRQ_HID_GET_PROTOCOL: 85 | usbMsgPtr = &protocol_version; // send data starting from this byte 86 | return 1; // send 1 byte 87 | case USBRQ_HID_SET_PROTOCOL: 88 | protocol_version = rq->wValue.bytes[1]; 89 | return 0; // send nothing 90 | case USBRQ_HID_GET_REPORT: 91 | // check for report ID then send back report 92 | if (rq->wValue.bytes[0] == 1) 93 | { 94 | usbMsgPtr = (void*)&reportBuffer; 95 | return sizeof(reportBuffer); 96 | } 97 | else if (rq->wValue.bytes[0] == 2) 98 | { 99 | UCP_Task(); /* send data to host */ 100 | usbMsgPtr = (void*)&customReport; 101 | return sizeof(customReport); 102 | } 103 | else 104 | { 105 | return 0; // no such report, send nothing 106 | } 107 | case USBRQ_HID_SET_REPORT: 108 | if (rq->wValue.bytes[0] == 2) 109 | { 110 | return USB_NO_MSG; /* call usbFunctionWrite() to read data from host */ 111 | } 112 | return 0; // no such report, send nothing 113 | default: // do not understand data, ignore 114 | return 0; // send nothing 115 | } 116 | } 117 | 118 | /* ------------------------------------------------------------------------- */ 119 | 120 | int main(void){ 121 | //cli(); /* Ensure usb interrupts enabled by bootloader alter disconnect of usb */ 122 | wdt_enable(WDTO_1S); 123 | SCH_Init(); 124 | ADM_Init(); 125 | /*UIB_Init();*/ 126 | UIF_Init(); 127 | LED_Init(); 128 | CRD_Init(); 129 | UCP_Init(); 130 | OSCCAL_Init(); 131 | 132 | /* USB Init */ 133 | usbInit(); 134 | usbDeviceDisconnect(); /* enforce re-enumeration, do this while interrupts are disabled! */ 135 | _delay_ms(500); 136 | usbDeviceConnect(); 137 | 138 | sei(); 139 | 140 | 141 | /* 1 - Keyboard report id 142 | 2 - HID feature report id 143 | reportBuffer is only used to send keyboard data so, initialize to 1 144 | */ 145 | reportBuffer.reportid = 1; 146 | 147 | for(;; ) { /* main event loop */ 148 | wdt_reset(); 149 | usbPoll(); 150 | SCH_Task(); 151 | 152 | if(usbInterruptIsReady()) { 153 | UCP_WriteTask(); 154 | LED_Task(); 155 | printUpdate(); 156 | usbSetInterrupt((void*)&reportBuffer, sizeof(reportBuffer)); 157 | } 158 | } 159 | } 160 | -------------------------------------------------------------------------------- /opt.c: -------------------------------------------------------------------------------- 1 | 2 | #include "opt.h" 3 | #include "crd.h" 4 | #include "uif.h" 5 | #include "uib.h" 6 | #include "fls.h" 7 | #include "led.h" 8 | #include "print.h" 9 | #include 10 | 11 | #define PRINTOptFlash(x) printStr((void*)pgm_read_word(&x), FLASH) 12 | /*-----------------------------START MENU CONFIGURATION */ 13 | #define MAX_OPT_SIZE (sizeof(opt_menuFp)/sizeof(fp_t)) 14 | 15 | // Local Function prototype 16 | static void opt_previous(void); 17 | static void opt_next(void); 18 | static void opt_apply(void); 19 | static void opt_lock(void); 20 | static void opt_printUser(void); 21 | static void opt_printPass(void); 22 | 23 | /*Function pointer to loop inside options Menu */ 24 | typedef void (*fp_t)(void); 25 | 26 | fp_t const opt_menuFp[] PROGMEM ={ 27 | opt_printPass,opt_printUser, 28 | }; 29 | 30 | /* Initialize function pointer to NULL */ 31 | fp_t fptr = 0; 32 | 33 | /*-------------------------- END OF MENU CONFIGURATION */ 34 | 35 | /* Options Start Message */ 36 | const char opt_startStr[] PROGMEM = OPT_START_STR; 37 | 38 | /* Options Finite state machine [Start] */ 39 | void OPT_fsmStart(void){ 40 | UIF_state = OPTIONS; 41 | UIF_optionsIndex = 0; 42 | print_deleteStr(); 43 | printStr((void*)opt_startStr, FLASH); 44 | LED_BlinkBoth(); 45 | } 46 | 47 | /* Options Finite state machine */ 48 | void OPT_fsm(uint8_t button){ 49 | 50 | switch(button) { 51 | case LEFT: 52 | opt_lock(); 53 | break; 54 | case UP: 55 | opt_previous(); 56 | break; 57 | case RIGHT: 58 | CRD_fsmStart(); 59 | break; 60 | case DOWN: 61 | opt_next(); 62 | break; 63 | default: 64 | return; 65 | } 66 | } 67 | 68 | static void opt_previous(void){ 69 | // select previous credential 70 | print_deleteStr(); 71 | UIF_increment(&UIF_optionsIndex, MAX_OPT_SIZE); 72 | opt_apply(); 73 | } 74 | 75 | static void opt_next(void){ 76 | UIF_decrement(&UIF_optionsIndex, MAX_OPT_SIZE); 77 | opt_apply(); 78 | } 79 | 80 | static void opt_apply(void){ 81 | fptr = (fp_t)pgm_read_word(&(opt_menuFp[UIF_optionsIndex])); 82 | fptr(); 83 | } 84 | 85 | 86 | static void opt_lock(void){ 87 | print_deleteStr(); 88 | UIF_Init(); 89 | LED_Off(); 90 | } 91 | 92 | static void opt_printUser(void){ 93 | print_deleteStr(); 94 | CRD_printDetail(CRD_USER, CRD_USER+1); 95 | LED_BlinkGreen(); 96 | } 97 | static void opt_printPass(void){ 98 | print_deleteStr(); 99 | CRD_printDetail(CRD_PASS, CRD_PASS+1); 100 | LED_BlinkRed(); 101 | } 102 | -------------------------------------------------------------------------------- /opt.h: -------------------------------------------------------------------------------- 1 | #ifndef _OPT_H_ 2 | #define _OPT_H_ 3 | 4 | #include 5 | 6 | #define OPT_START_STR "[DETAIL]" 7 | 8 | /* Public functions */ 9 | void OPT_fsm(uint8_t button); 10 | void OPT_fsmStart(void); 11 | 12 | #endif /* _OPT_H_*/ -------------------------------------------------------------------------------- /osccal.c: -------------------------------------------------------------------------------- 1 | 2 | #include "osccal.h" 3 | #include "usbdrv.h" 4 | #include 5 | 6 | #define OSCCAL_INVALID (0xFF) 7 | 8 | /* EEPROM OSCCAL value */ 9 | EEMEM const uint8_t OSCCAL_EEP_VALUE = 0xFF; 10 | 11 | void OSCCAL_Init(void){ 12 | // Load internal RC calibration value 13 | uint8_t calib = eeprom_read_byte(&OSCCAL_EEP_VALUE); 14 | 15 | if(calib != OSCCAL_INVALID) { 16 | OSCCAL = calib; 17 | } 18 | } 19 | 20 | void OSCCAL_Start(void){ 21 | uchar step = 128; 22 | uchar trialValue = 0, optimumValue; 23 | int x, optimumDev; 24 | int targetValue = (unsigned)(1499 * (double)F_CPU / 10.5e6 + 0.5); 25 | 26 | /* do a binary search: */ 27 | do { 28 | OSCCAL = trialValue + step; 29 | x = usbMeasureFrameLength(); // proportional to current real frequency 30 | if(x < targetValue) { // frequency still too low 31 | trialValue += step; 32 | } 33 | step >>= 1; 34 | } while(step > 0); 35 | /* We have a precision of +/- 1 for optimum OSCCAL here */ 36 | /* now do a neighborhood search for optimum value */ 37 | optimumValue = trialValue; 38 | optimumDev = x; /* this is certainly far away from optimum */ 39 | for(OSCCAL = trialValue - 1; OSCCAL <= trialValue + 1; OSCCAL++) { 40 | x = usbMeasureFrameLength() - targetValue; 41 | if(x < 0) { 42 | x = -x; 43 | } 44 | if(x < optimumDev) { 45 | optimumDev = x; 46 | optimumValue = OSCCAL; 47 | } 48 | } 49 | OSCCAL = optimumValue; 50 | 51 | eeprom_update_block((void*)&OSCCAL, (void*)&OSCCAL_EEP_VALUE,1); 52 | } 53 | -------------------------------------------------------------------------------- /osccal.h: -------------------------------------------------------------------------------- 1 | #ifndef _OSCCAL_H_ 2 | #define _OSCCAL_H_ 3 | 4 | #include 5 | 6 | /* Public functions */ 7 | extern void OSCCAL_Init(void); 8 | extern void OSCCAL_Start(void); 9 | 10 | #endif /* _OSCCAL_H_*/ 11 | -------------------------------------------------------------------------------- /osccalASM.S: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jim17/memtype/a0345bc36f89930d7b0ac9f7d2380710c5fc1db0/osccalASM.S -------------------------------------------------------------------------------- /print.c: -------------------------------------------------------------------------------- 1 | #include "print.h" 2 | #include "crd.h" 3 | 4 | #define STRBUF_SIZE (5u) 5 | 6 | typedef enum 7 | { 8 | INIT = 0, 9 | PRESSED, 10 | RELEASED, 11 | IDLE, 12 | DELETE, 13 | DELETE_PRESSED, 14 | }kbd_status_t; 15 | 16 | 17 | typedef struct 18 | { 19 | char *strPtr; 20 | uint8_t info; 21 | uint8_t len; 22 | uint8_t callback; 23 | 24 | }strPtr_t; 25 | 26 | strPtr_t strBuf[STRBUF_SIZE]; 27 | 28 | uint8_t actString; //Cadena actual 29 | uint8_t cCount = 0; //Delete counter 30 | uint8_t EOS=0; //EndOfString 31 | uint8_t debounceCount = 0; //counter 32 | keyboard_report_t reportBuffer; 33 | kbd_status_t kbd_status = INIT; 34 | 35 | /** Private Function prototype */ 36 | static void print_pressKey(char); 37 | static void print_releaseKey(void); 38 | static void print(char * str,uint8_t isRam, uint8_t len); 39 | 40 | void print_pressKey(char ascii){ 41 | //ascii to key 42 | char key = KEYBOARD_READ_BYTE((void*)(keyboardLUT_ES+ascii)); 43 | 44 | //setup reportBuffer 45 | reportBuffer.modifier = ((SHIFT_MASK) &key) >> 6; 46 | reportBuffer.modifier |= (ALTGR_MASK) &key; 47 | // remapping of KEY_EUROPE_2 to original value 48 | key = (~(SHIFT_MASK|ALTGR_MASK)) & key; 49 | if(key == KEY_EUROPE_2) { 50 | reportBuffer.keycode = KEY_EUROPE_2_ORG; 51 | } else { 52 | reportBuffer.keycode = key; 53 | } 54 | } 55 | 56 | static void print_releaseKey(void){ 57 | //Initializing 58 | reportBuffer.modifier=0; 59 | reportBuffer.keycode=0; 60 | } 61 | 62 | static void print(char * str,uint8_t isRam, uint8_t len){ 63 | uint8_t cont=0; 64 | uint8_t index; 65 | while(cont < sizeof(strBuf)) 66 | { 67 | index = (actString+cont)%STRBUF_SIZE; 68 | if(strBuf[index].info == EMPTY) 69 | { 70 | strBuf[index].info = isRam; 71 | strBuf[index].strPtr = str; 72 | strBuf[index].len = len; 73 | if(len != 0) { 74 | strBuf[index].callback = 1; 75 | } 76 | else{ 77 | strBuf[index].callback = 0; 78 | } 79 | break; 80 | } 81 | cont++; 82 | } 83 | } 84 | 85 | void printStr_RAM(char *str){ 86 | print((void*)str, RAM, 0); 87 | } 88 | 89 | void printStr_FLASH(char *str){ 90 | print((void*)str, FLASH, 0); 91 | } 92 | 93 | void print_nStr(char* str, uint8_t len){ 94 | print((void*)str, RAM, len); 95 | } 96 | 97 | void printUpdate(void){ 98 | char ascii = 0; 99 | 100 | if(strBuf[actString].info != EMPTY) 101 | { 102 | if(strBuf[actString].info == RAM) { 103 | ascii = *(strBuf[actString].strPtr); //READ CHAR 104 | }else if(strBuf[actString].info == FLASH) { 105 | ascii = pgm_read_byte(strBuf[actString].strPtr);//READ CHAR 106 | } 107 | } 108 | 109 | switch(kbd_status) { 110 | case INIT: //Initial debouncing 111 | if(debounceCount < INIT_DEBOUNCE) 112 | { 113 | print_releaseKey(); 114 | debounceCount++; 115 | 116 | }else{ 117 | kbd_status=RELEASED; 118 | debounceCount = 0; 119 | } 120 | break; 121 | case PRESSED: //We release 122 | print_releaseKey(); 123 | kbd_status = RELEASED; 124 | if(strBuf[actString].len > 0) { 125 | strBuf[actString].len--; 126 | } 127 | break; 128 | case RELEASED: //We can PROCESS CHAR 129 | 130 | if( (strBuf[actString].callback == 0) && (ascii == 0) ) //EOS 131 | { 132 | EOS=1; 133 | strBuf[actString].info = EMPTY; 134 | actString = (actString+1)%STRBUF_SIZE; 135 | } 136 | else if( (strBuf[actString].callback != 0) && (strBuf[actString].len == 0) ) 137 | { 138 | 139 | strBuf[actString].info = EMPTY; 140 | CRD_apply(); 141 | if(strBuf[actString].info == EMPTY) 142 | { 143 | EOS=1; 144 | } 145 | } 146 | else{ 147 | strBuf[actString].strPtr++; //Increment pointer 148 | 149 | //Do we have to enter IDLE state? 150 | if(ascii == SYNCHRONOUS_IDLE_KEY) 151 | { 152 | kbd_status = IDLE; 153 | }else{ 154 | print_pressKey(ascii); 155 | if(EOS==0) { //not first char 156 | cCount++; //new char to delete 157 | }else{ //first char of string 158 | EOS=0; 159 | cCount = 1; 160 | } 161 | kbd_status = PRESSED; 162 | } 163 | } 164 | break; 165 | case IDLE: 166 | if(debounceCount < IDLE_TIMEOUT) 167 | { 168 | print_releaseKey(); 169 | debounceCount++; 170 | }else{ 171 | kbd_status=RELEASED; 172 | debounceCount = 0; 173 | if(strBuf[actString].len > 0) { 174 | strBuf[actString].len--; 175 | } 176 | } 177 | break; 178 | 179 | case DELETE: 180 | if(cCount > 0) 181 | { //DELETING 182 | print_pressKey(0x08); 183 | cCount--; 184 | kbd_status=DELETE_PRESSED; 185 | }else{ //DONE ERASING 186 | print_releaseKey(); 187 | //strBuf[actString].info = EMPTY; 188 | kbd_status=RELEASED; 189 | if(EOS==0) //if half word printing 190 | { 191 | EOS=1; //INVALIDATE CURRENT TYPING 192 | strBuf[actString].info = EMPTY; 193 | actString = (actString+1)%STRBUF_SIZE; 194 | } 195 | } 196 | break; 197 | case DELETE_PRESSED: 198 | print_releaseKey(); 199 | kbd_status=DELETE; 200 | break; 201 | } 202 | } 203 | 204 | void print_deleteStr(void){ 205 | kbd_status=DELETE; 206 | } 207 | -------------------------------------------------------------------------------- /print.h: -------------------------------------------------------------------------------- 1 | #ifndef __PRINT_H__ 2 | #define __PRINT_H__ 3 | 4 | #include "hid_defines.h" 5 | #include /* required by usbdrv.h */ 6 | #include "usbdrv.h" 7 | 8 | #define SYNCHRONOUS_IDLE_KEY (0x16u) // \x16 ASCII code 9 | #define IDLE_TIMEOUT (50u) // 10ms x 250 = 500ms 10 | #define INIT_DEBOUNCE (50u) // 10ms x 50 = 500ms 11 | 12 | #define printStr(a,b) printStr_##b(a) 13 | 14 | void printUpdate(void); 15 | void printStr_RAM(char *str); 16 | void printStr_FLASH(char *str); 17 | void print_nStr(char* str, uint8_t len); 18 | void print_deleteStr(void); //deletes last string 19 | 20 | typedef struct 21 | { 22 | uint8_t reportid; 23 | uint8_t modifier; 24 | uint8_t keycode; 25 | } keyboard_report_t; 26 | 27 | extern keyboard_report_t reportBuffer; 28 | 29 | enum 30 | { 31 | EMPTY = 0, //EMPTY, can be used 32 | RAM, //STRING IN RAM 33 | FLASH, //STRING IN FLASH 34 | }; 35 | 36 | #endif /* __PRINT_H__ */ 37 | -------------------------------------------------------------------------------- /sch.c: -------------------------------------------------------------------------------- 1 | 2 | /* Task scheduler to execute tasks at a cyclic predefined time */ 3 | #include "sch.h" 4 | #include 5 | #include 6 | #include "adm.h" 7 | #include "uib.h" 8 | #include "uif.h" 9 | 10 | /* Timer 1 Config Register Configuration */ 11 | /* 16,5 Mhz /16384 = 1007 Hz, it's almost 1kHz so it's fine */ 12 | #define sch_cfg_r TCCR1 13 | #define sch_CTC (0x00u) /* [7] Clear timer/counter on compare match */ 14 | #define sch_PWM (0x00u) /* [6] Pulse width modulator enable (disabled) */ 15 | #define sch_CP (0x00u) /* [5:4] Comparator output, (disconnected from OC1A) */ 16 | #define sch_PR (0x0Fu) /* [3:0] CS13:10 = 0x0F */ 17 | 18 | /* Timer 1 Control Register */ 19 | #define sch_ctrl_r GTCCR 20 | #define sch_value (0x00u) /* [7:0] Default value, all features disabled */ 21 | 22 | /* Timer 1 Counter Register */ 23 | #define sch_timer TCNT1 24 | 25 | uint8_t sch_lastTimerVal; 26 | uint8_t sch_tick; /* incremented each 1ms */ 27 | 28 | /* Private Functions */ 29 | static void sch_Task_10ms(void){ 30 | ADM_Task(); 31 | UIB_Task(); 32 | UIF_Task(); /* UIF must be called in the same task as UIB task or higher period */ 33 | } 34 | 35 | /* Public Functions */ 36 | /* Here configure the timer to be used */ 37 | void SCH_Init(void){ 38 | sch_cfg_r = (sch_CTC) | (sch_PWM) | (sch_CP) | (sch_PR); 39 | sch_ctrl_r = (sch_value); 40 | sch_lastTimerVal = 0u; 41 | sch_tick = 0u; /* incremented each 1ms */ 42 | } 43 | 44 | /* Cyclic Task where the different tasks are executed */ 45 | void SCH_Task(void){ 46 | uint8_t sch_timer_temp = sch_timer; 47 | 48 | if(sch_lastTimerVal != sch_timer_temp) 49 | { 50 | sch_tick++; 51 | sch_lastTimerVal = sch_timer_temp; 52 | 53 | if( (sch_tick % 10) == 0 ) 54 | { 55 | sch_Task_10ms(); 56 | } 57 | } 58 | 59 | } 60 | -------------------------------------------------------------------------------- /sch.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _SCH_H_ 3 | #define _SCH_H_ 4 | 5 | /* Function prototype */ 6 | void SCH_Init(void); 7 | void SCH_Task(void); 8 | 9 | #endif /* _SCH_H_ */ 10 | 11 | -------------------------------------------------------------------------------- /schematic_pcb/bom2groupedcsv.xsl: -------------------------------------------------------------------------------- 1 | 16 | 17 | 19 | ]> 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | Reference, Quantity, Value, Footprint, Datasheet 34 | 35 | 36 | 37 | , 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | &nl; 50 | 51 | 52 | 53 | 54 | , 55 | 56 | , 57 | , 58 | , 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | , 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 87 | 88 | 89 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /schematic_pcb/electronic_design_kicad/BOM/electronic_design_kicad.csv: -------------------------------------------------------------------------------- 1 | Reference, Quantity, Value, Footprint, Datasheet, mouser, Power 2 | C1 ,1,100n,projectLib:SMD-0805,,C0805C104K5RACTU, 3 | C2 ,1,4n7,projectLib:SMD-0805,,C0805C472K5RACTU, 4 | D1 ,1,3V6,projectLib:SOT-23,,AZ23C3V6-E3-08, 5 | D2 ,1,LED GREEN,LEDs:LED_0603,,L29K-F2J1-24-Z, 6 | D3 ,1,LED RED,LEDs:LED_0603,,Q976-NR-1, 7 | IC1 ,1,ATTINY85-S,projectLib:SO8_200mil_wide,,556-ATTINY85-20SU, 8 | P1 ,1,USB_A,projectLib:USB_A_MALE,http://www.mouser.com/ds/2/215/32-744715.pdf,534-932, 9 | P2 ,1,CONN_6,projectLib:SKRHAAE010,http://www.alps.com/products/WebObjects/catalog.woa/E/HTML/MultiControl/Switch/SKRH/SKRHAAE010.html,SKRHAAE010, 10 | R1 ,1,1k5,projectLib:SMD-0805,,ERJ-6GEYJ152V,1/8W 11 | R10 R11 ,2,220R,projectLib:SMD-0805,,ERJ-6GEYJ221V,1/8W 12 | R2 R3 ,2,68R,projectLib:SMD-0805,,ERJ-6GEYJ680V,1/8W 13 | R4 R6 R7 R8 ,4,1k,projectLib:SMD-0805,,ERJ-6GEYJ102V,1/4W 14 | R5 R9 ,2,560k,projectLib:SMD-0805,,ERJ-6GEYJ564V,1/4W -------------------------------------------------------------------------------- /schematic_pcb/electronic_design_kicad/BOM/electronic_design_kicad.ods: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jim17/memtype/a0345bc36f89930d7b0ac9f7d2380710c5fc1db0/schematic_pcb/electronic_design_kicad/BOM/electronic_design_kicad.ods -------------------------------------------------------------------------------- /schematic_pcb/electronic_design_kicad/electronic_design_kicad-cache.bak: -------------------------------------------------------------------------------- 1 | EESchema-LIBRARY Version 2.3 2 | #encoding utf-8 3 | # 4 | # +5V 5 | # 6 | DEF +5V #PWR 0 40 Y Y 1 F P 7 | F0 "#PWR" 0 90 20 H I C CNN 8 | F1 "+5V" 0 90 30 H V C CNN 9 | F2 "" 0 0 60 H V C CNN 10 | F3 "" 0 0 60 H V C CNN 11 | DRAW 12 | X +5V 1 0 0 0 U 20 20 0 0 W N 13 | C 0 50 20 0 1 0 N 14 | P 4 0 1 0 0 0 0 30 0 30 0 30 N 15 | ENDDRAW 16 | ENDDEF 17 | # 18 | # ATTINY25-S 19 | # 20 | DEF ATTINY25-S IC 0 40 Y Y 1 F N 21 | F0 "IC" -1150 400 40 H V C CNN 22 | F1 "ATTINY25-S" 1000 -400 40 H V C CNN 23 | F2 "SO8-200" 950 0 35 H V C CIN 24 | F3 "" 0 0 60 H V C CNN 25 | ALIAS ATTINY45-S ATTINY85-S 26 | DRAW 27 | S -1200 350 1200 -350 0 1 10 f 28 | X PB5(~RESET~/dW/ADC0/PCINT5) 1 -1350 -250 150 R 40 40 1 1 B 29 | X PB3(XTAL1/CLKI/OC1B/ADC3/PCINT3) 2 -1350 -50 150 R 40 40 1 1 B 30 | X PB4(XTAL2/CLKO/OC1B/ADC2/PCINT4) 3 -1350 -150 150 R 40 40 1 1 B 31 | X GND 4 1350 -250 150 L 40 40 1 1 W 32 | X PB0(MOSI/DI/SDA/AIN0/OC0A/OC1A/AREF/PCINT0) 5 -1350 250 150 R 40 40 1 1 B 33 | X PB1(MISO/DO/AIN1/OC0B/OC1A/PCINT1) 6 -1350 150 150 R 40 40 1 1 B 34 | X PB2(SCK/USCK/SCL/T0/INT0/ADC1/PCINT2) 7 -1350 50 150 R 40 40 1 1 B 35 | X VCC 8 1350 250 150 L 40 40 1 1 W 36 | ENDDRAW 37 | ENDDEF 38 | # 39 | # C 40 | # 41 | DEF C C 0 10 N Y 1 F N 42 | F0 "C" 0 100 40 H V L CNN 43 | F1 "C" 6 -85 40 H V L CNN 44 | F2 "" 38 -150 30 H V C CNN 45 | F3 "" 0 0 60 H V C CNN 46 | $FPLIST 47 | SM* 48 | C? 49 | C1-1 50 | $ENDFPLIST 51 | DRAW 52 | P 2 0 1 20 -80 -30 80 -30 N 53 | P 2 0 1 20 -80 30 80 30 N 54 | X ~ 1 0 200 170 D 40 40 1 1 P 55 | X ~ 2 0 -200 170 U 40 40 1 1 P 56 | ENDDRAW 57 | ENDDEF 58 | # 59 | # CONN_6 60 | # 61 | DEF CONN_6 P 0 40 Y Y 1 F N 62 | F0 "P" -50 -50 50 V V C CNN 63 | F1 "CONN_6" 50 -50 50 V V C CNN 64 | F2 "" 0 0 60 H V C CNN 65 | F3 "" 0 0 60 H V C CNN 66 | DRAW 67 | S -100 250 100 -350 0 1 0 f 68 | X ~ 1 -400 200 300 R 60 60 1 1 P I 69 | X ~ 2 -400 100 300 R 60 60 1 1 P I 70 | X ~ 3 -400 0 300 R 60 60 1 1 P I 71 | X ~ 4 -400 -100 300 R 60 60 1 1 P I 72 | X ~ 5 -400 -200 300 R 60 60 1 1 P I 73 | X ~ 6 -400 -300 300 R 60 60 1 1 P I 74 | ENDDRAW 75 | ENDDEF 76 | # 77 | # DGND 78 | # 79 | DEF DGND #PWR 0 40 Y Y 1 F P 80 | F0 "#PWR" 0 0 40 H I C CNN 81 | F1 "DGND" 0 -70 40 H V C CNN 82 | F2 "" 0 0 60 H V C CNN 83 | F3 "" 0 0 60 H V C CNN 84 | DRAW 85 | P 4 0 1 0 -50 0 0 -50 50 0 -50 0 N 86 | X DGND 1 0 0 0 U 40 40 1 1 W N 87 | ENDDRAW 88 | ENDDEF 89 | # 90 | # R 91 | # 92 | DEF R R 0 0 N Y 1 F N 93 | F0 "R" 80 0 40 V V C CNN 94 | F1 "R" 7 1 40 V V C CNN 95 | F2 "" -70 0 30 V V C CNN 96 | F3 "" 0 0 30 H V C CNN 97 | $FPLIST 98 | R? 99 | SM0603 100 | SM0805 101 | R?-* 102 | SM1206 103 | $ENDFPLIST 104 | DRAW 105 | S -40 150 40 -150 0 1 12 N 106 | X ~ 1 0 250 100 D 60 60 1 1 P 107 | X ~ 2 0 -250 100 U 60 60 1 1 P 108 | ENDDRAW 109 | ENDDEF 110 | # 111 | # USB_A 112 | # 113 | DEF USB_A P 0 40 Y Y 1 F N 114 | F0 "P" 200 -200 50 H V C CNN 115 | F1 "USB_A" -50 200 50 H V C CNN 116 | F2 "" -50 -100 60 V V C CNN 117 | F3 "" -50 -100 60 V V C CNN 118 | $FPLIST 119 | USB* 120 | $ENDFPLIST 121 | DRAW 122 | S -250 -150 150 150 0 1 0 f 123 | S -205 -150 -195 -120 0 1 0 N 124 | S -105 -150 -95 -120 0 1 0 N 125 | S -5 -150 5 -120 0 1 0 N 126 | S 95 -150 105 -120 0 1 0 N 127 | X VCC 1 -200 -300 150 U 50 50 1 1 W 128 | X D- 2 -100 -300 150 U 50 50 1 1 P 129 | X D+ 3 0 -300 150 U 50 50 1 1 P 130 | X GND 4 100 -300 150 U 50 50 1 1 W 131 | X shield 5 300 100 150 L 50 50 1 1 P 132 | ENDDRAW 133 | ENDDEF 134 | # 135 | # ZENER_DUAL 136 | # 137 | DEF ZENER_DUAL D 0 40 N N 1 F N 138 | F0 "D" -200 -150 50 H V C CNN 139 | F1 "ZENER_DUAL" 100 -150 40 H V C CNN 140 | F2 "" 0 0 60 H V C CNN 141 | F3 "" 0 0 60 H V C CNN 142 | $FPLIST 143 | D? 144 | SO* 145 | SM* 146 | $ENDFPLIST 147 | DRAW 148 | S -200 300 150 -100 0 1 0 f 149 | P 2 0 1 0 -150 100 -100 100 N 150 | P 4 0 1 0 -50 200 -100 200 -100 0 -50 0 N 151 | P 5 0 1 0 50 0 -50 50 -50 -50 50 0 50 0 F 152 | P 5 0 1 0 50 200 -50 250 -50 150 50 200 50 200 F 153 | P 5 0 1 8 70 50 50 30 50 -30 30 -50 30 -50 N 154 | P 5 0 1 8 70 250 50 230 50 170 30 150 30 150 N 155 | X K 1 200 0 150 L 40 40 1 1 P 156 | X K 2 200 200 150 L 40 40 1 1 P 157 | X A 3 -300 100 150 R 40 40 1 1 P 158 | ENDDRAW 159 | ENDDEF 160 | # 161 | #End Library 162 | -------------------------------------------------------------------------------- /schematic_pcb/electronic_design_kicad/electronic_design_kicad-cache.bck: -------------------------------------------------------------------------------- 1 | EESchema-DOCLIB Version 2.0 2 | # 3 | #End Doc Library 4 | -------------------------------------------------------------------------------- /schematic_pcb/electronic_design_kicad/electronic_design_kicad-cache.dcm: -------------------------------------------------------------------------------- 1 | EESchema-DOCLIB Version 2.0 2 | # 3 | $CMP USB_A 4 | D A connector 5 | K USB USB_A 6 | $ENDCMP 7 | # 8 | #End Doc Library 9 | -------------------------------------------------------------------------------- /schematic_pcb/electronic_design_kicad/electronic_design_kicad-cache.lib: -------------------------------------------------------------------------------- 1 | EESchema-LIBRARY Version 2.3 2 | #encoding utf-8 3 | # 4 | # +5V 5 | # 6 | DEF +5V #PWR 0 0 Y Y 1 F P 7 | F0 "#PWR" 0 -150 50 H I C CNN 8 | F1 "+5V" 0 140 50 H V C CNN 9 | F2 "" 0 0 60 H V C CNN 10 | F3 "" 0 0 60 H V C CNN 11 | DRAW 12 | P 2 0 1 0 -30 50 0 100 N 13 | P 2 0 1 0 0 0 0 100 N 14 | P 2 0 1 0 0 100 30 50 N 15 | X +5V 1 0 0 0 U 50 50 1 1 W N 16 | ENDDRAW 17 | ENDDEF 18 | # 19 | # ATTINY25-S 20 | # 21 | DEF ATTINY25-S IC 0 40 Y Y 1 F N 22 | F0 "IC" -1150 400 40 H V C CNN 23 | F1 "ATTINY25-S" 1000 -400 40 H V C CNN 24 | F2 "SO8-200" 950 0 35 H V C CIN 25 | F3 "" 0 0 60 H V C CNN 26 | ALIAS ATTINY45-S ATTINY85-S 27 | DRAW 28 | S -1200 350 1200 -350 0 1 10 f 29 | X PB5(~RESET~/dW/ADC0/PCINT5) 1 -1350 -250 150 R 40 40 1 1 B 30 | X PB3(XTAL1/CLKI/OC1B/ADC3/PCINT3) 2 -1350 -50 150 R 40 40 1 1 B 31 | X PB4(XTAL2/CLKO/OC1B/ADC2/PCINT4) 3 -1350 -150 150 R 40 40 1 1 B 32 | X GND 4 1350 -250 150 L 40 40 1 1 W 33 | X PB0(MOSI/DI/SDA/AIN0/OC0A/OC1A/AREF/PCINT0) 5 -1350 250 150 R 40 40 1 1 B 34 | X PB1(MISO/DO/AIN1/OC0B/OC1A/PCINT1) 6 -1350 150 150 R 40 40 1 1 B 35 | X PB2(SCK/USCK/SCL/T0/INT0/ADC1/PCINT2) 7 -1350 50 150 R 40 40 1 1 B 36 | X VCC 8 1350 250 150 L 40 40 1 1 W 37 | ENDDRAW 38 | ENDDEF 39 | # 40 | # CAP 41 | # 42 | DEF CAP C 0 10 Y Y 1 F N 43 | F0 "C" 100 150 50 V V C CNN 44 | F1 "CAP" 100 -150 50 V V C CNN 45 | F2 "" 0 0 60 H V C CNN 46 | F3 "" 0 0 60 H V C CNN 47 | ALIAS C 48 | DRAW 49 | P 2 0 1 0 -150 -50 150 -50 N 50 | P 2 0 1 0 -150 50 150 50 N 51 | X ~ 1 0 250 200 D 40 40 1 1 P 52 | X ~ 2 0 -250 200 U 40 40 1 1 P 53 | ENDDRAW 54 | ENDDEF 55 | # 56 | # CONN_6 57 | # 58 | DEF CONN_6 P 0 40 Y Y 1 F N 59 | F0 "P" -50 -50 50 V V C CNN 60 | F1 "CONN_6" 50 -50 50 V V C CNN 61 | F2 "" 0 0 60 H V C CNN 62 | F3 "" 0 0 60 H V C CNN 63 | DRAW 64 | S -100 250 100 -350 0 1 0 f 65 | X ~ 1 -400 200 300 R 60 60 1 1 P I 66 | X ~ 2 -400 100 300 R 60 60 1 1 P I 67 | X ~ 3 -400 0 300 R 60 60 1 1 P I 68 | X ~ 4 -400 -100 300 R 60 60 1 1 P I 69 | X ~ 5 -400 -200 300 R 60 60 1 1 P I 70 | X ~ 6 -400 -300 300 R 60 60 1 1 P I 71 | ENDDRAW 72 | ENDDEF 73 | # 74 | # DGND 75 | # 76 | DEF DGND #PWR 0 40 Y Y 1 F P 77 | F0 "#PWR" 0 0 40 H I C CNN 78 | F1 "DGND" 0 -70 40 H V C CNN 79 | F2 "" 0 0 60 H V C CNN 80 | F3 "" 0 0 60 H V C CNN 81 | DRAW 82 | P 4 0 1 0 -50 0 0 -50 50 0 -50 0 N 83 | X DGND 1 0 0 0 U 40 40 1 1 W N 84 | ENDDRAW 85 | ENDDEF 86 | # 87 | # LED 88 | # 89 | DEF LED D 0 40 Y N 1 F N 90 | F0 "D" 0 100 50 H V C CNN 91 | F1 "LED" 0 -100 50 H V C CNN 92 | F2 "" 0 0 60 H V C CNN 93 | F3 "" 0 0 60 H V C CNN 94 | $FPLIST 95 | LED-3MM 96 | LED-5MM 97 | LED-10MM 98 | LED-0603 99 | LED-0805 100 | LED-1206 101 | LEDV 102 | $ENDFPLIST 103 | DRAW 104 | P 2 0 1 0 -50 50 -50 -50 N 105 | P 3 0 1 0 -80 -25 -125 -65 -120 -40 N 106 | P 3 0 1 0 -65 -40 -110 -80 -105 -55 N 107 | P 3 0 1 0 50 50 -50 0 50 -50 F 108 | X K 1 -200 0 150 R 40 40 1 1 P 109 | X A 2 200 0 150 L 40 40 1 1 P 110 | ENDDRAW 111 | ENDDEF 112 | # 113 | # R 114 | # 115 | DEF R R 0 0 N Y 1 F N 116 | F0 "R" 80 0 50 V V C CNN 117 | F1 "R" 0 0 50 V V C CNN 118 | F2 "" 0 0 60 H V C CNN 119 | F3 "" 0 0 60 H V C CNN 120 | DRAW 121 | S -40 150 40 -150 0 1 0 N 122 | X ~ 1 0 250 100 D 60 60 1 1 P 123 | X ~ 2 0 -250 100 U 60 60 1 1 P 124 | ENDDRAW 125 | ENDDEF 126 | # 127 | # USB_A 128 | # 129 | DEF USB_A P 0 40 Y Y 1 F N 130 | F0 "P" 200 -200 50 H V C CNN 131 | F1 "USB_A" -50 200 50 H V C CNN 132 | F2 "" -50 -100 60 V V C CNN 133 | F3 "" -50 -100 60 V V C CNN 134 | $FPLIST 135 | USB* 136 | $ENDFPLIST 137 | DRAW 138 | S -250 -150 150 150 0 1 0 N 139 | S -205 -150 -195 -120 0 1 0 N 140 | S -105 -150 -95 -120 0 1 0 N 141 | S -5 -150 5 -120 0 1 0 N 142 | S 95 -150 105 -120 0 1 0 N 143 | X VCC 1 -200 -300 150 U 50 50 1 1 W 144 | X D- 2 -100 -300 150 U 50 50 1 1 P 145 | X D+ 3 0 -300 150 U 50 50 1 1 P 146 | X GND 4 100 -300 150 U 50 50 1 1 W 147 | X shield 5 300 100 150 L 50 50 1 1 P 148 | ENDDRAW 149 | ENDDEF 150 | # 151 | # ZENER_DUAL 152 | # 153 | DEF ZENER_DUAL D 0 40 N N 1 F N 154 | F0 "D" -200 -150 50 H V C CNN 155 | F1 "ZENER_DUAL" 100 -150 40 H V C CNN 156 | F2 "" 0 0 60 H V C CNN 157 | F3 "" 0 0 60 H V C CNN 158 | $FPLIST 159 | D? 160 | SO* 161 | SM* 162 | $ENDFPLIST 163 | DRAW 164 | S -200 300 150 -100 0 1 0 f 165 | P 2 0 1 0 -150 100 -100 100 N 166 | P 4 0 1 0 -50 200 -100 200 -100 0 -50 0 N 167 | P 5 0 1 0 50 0 -50 50 -50 -50 50 0 50 0 F 168 | P 5 0 1 0 50 200 -50 250 -50 150 50 200 50 200 F 169 | P 5 0 1 8 70 50 50 30 50 -30 30 -50 30 -50 N 170 | P 5 0 1 8 70 250 50 230 50 170 30 150 30 150 N 171 | X K 1 200 0 150 L 40 40 1 1 P 172 | X K 2 200 200 150 L 40 40 1 1 P 173 | X A 3 -300 100 150 R 40 40 1 1 P 174 | ENDDRAW 175 | ENDDEF 176 | # 177 | #End Library 178 | -------------------------------------------------------------------------------- /schematic_pcb/electronic_design_kicad/electronic_design_kicad.cmp: -------------------------------------------------------------------------------- 1 | Cmp-Mod V01 Created by PcbNew date = Tue 02 Feb 2016 04:42:32 PM CET 2 | 3 | BeginCmp 4 | TimeStamp = 56905262 5 | Path = /568D5081 6 | Reference = P1; 7 | ValeurCmp = USB_A; 8 | IdModule = USB_A_MALE; 9 | EndCmp 10 | 11 | BeginCmp 12 | TimeStamp = 5467B0F9 13 | Path = 14 | Reference = area0x33; 15 | ValeurCmp = LOGO; 16 | IdModule = projectLib:logo; 17 | EndCmp 18 | 19 | BeginCmp 20 | TimeStamp = 54687AF1 21 | Path = /5432C46A 22 | Reference = C1; 23 | ValeurCmp = 100n; 24 | IdModule = projectLib:SMD-0805; 25 | EndCmp 26 | 27 | BeginCmp 28 | TimeStamp = 54687AFD 29 | Path = /546248F6 30 | Reference = D1; 31 | ValeurCmp = 3V6; 32 | IdModule = projectLib:SOT-23; 33 | EndCmp 34 | 35 | BeginCmp 36 | TimeStamp = 54687B1B 37 | Path = /5432D93B 38 | Reference = R1; 39 | ValeurCmp = 1k5; 40 | IdModule = projectLib:SMD-0805; 41 | EndCmp 42 | 43 | BeginCmp 44 | TimeStamp = 54687B27 45 | Path = /5432D997 46 | Reference = R2; 47 | ValeurCmp = 68R; 48 | IdModule = projectLib:SMD-0805; 49 | EndCmp 50 | 51 | BeginCmp 52 | TimeStamp = 54687B33 53 | Path = /5432D99D 54 | Reference = R3; 55 | ValeurCmp = 68R; 56 | IdModule = projectLib:SMD-0805; 57 | EndCmp 58 | 59 | BeginCmp 60 | TimeStamp = 54687B3F 61 | Path = /543D97EE 62 | Reference = R5; 63 | ValeurCmp = 560k; 64 | IdModule = projectLib:SMD-0805; 65 | EndCmp 66 | 67 | BeginCmp 68 | TimeStamp = 54687B4B 69 | Path = /543DDBE5 70 | Reference = R4; 71 | ValeurCmp = 1k; 72 | IdModule = projectLib:SMD-0805; 73 | EndCmp 74 | 75 | BeginCmp 76 | TimeStamp = 54687B57 77 | Path = /543DDC38 78 | Reference = R6; 79 | ValeurCmp = 1k; 80 | IdModule = projectLib:SMD-0805; 81 | EndCmp 82 | 83 | BeginCmp 84 | TimeStamp = 54687B63 85 | Path = /543DDC92 86 | Reference = R7; 87 | ValeurCmp = 1k; 88 | IdModule = projectLib:SMD-0805; 89 | EndCmp 90 | 91 | BeginCmp 92 | TimeStamp = 54687B6F 93 | Path = /543DE0DD 94 | Reference = R8; 95 | ValeurCmp = 1k; 96 | IdModule = projectLib:SMD-0805; 97 | EndCmp 98 | 99 | BeginCmp 100 | TimeStamp = 568D5B21 101 | Path = /568C61B8 102 | Reference = C2; 103 | ValeurCmp = 4n7; 104 | IdModule = projectLib:SMD-0805; 105 | EndCmp 106 | 107 | BeginCmp 108 | TimeStamp = 568D5B22 109 | Path = /5432C05B 110 | Reference = IC1; 111 | ValeurCmp = ATTINY85-S; 112 | IdModule = projectLib:SO8_200mil_wide; 113 | EndCmp 114 | 115 | BeginCmp 116 | TimeStamp = 568D5B68 117 | Path = /568C5F4F 118 | Reference = R9; 119 | ValeurCmp = 1M; 120 | IdModule = projectLib:SMD-0805; 121 | EndCmp 122 | 123 | BeginCmp 124 | TimeStamp = 568D5B91 125 | Path = /568D12B4 126 | Reference = P2; 127 | ValeurCmp = CONN_6; 128 | IdModule = projectLib:SKRHAAE010; 129 | EndCmp 130 | 131 | BeginCmp 132 | TimeStamp = 569037A4 133 | Path = /56901E90 134 | Reference = D2; 135 | ValeurCmp = LED GREEN; 136 | IdModule = LEDs:LED_0603; 137 | EndCmp 138 | 139 | BeginCmp 140 | TimeStamp = 569037B5 141 | Path = /569024A8 142 | Reference = D3; 143 | ValeurCmp = LED RED; 144 | IdModule = LEDs:LED_0603; 145 | EndCmp 146 | 147 | BeginCmp 148 | TimeStamp = 569037D3 149 | Path = /5690360A 150 | Reference = R10; 151 | ValeurCmp = 68R; 152 | IdModule = projectLib:SMD-0805; 153 | EndCmp 154 | 155 | BeginCmp 156 | TimeStamp = 569037E0 157 | Path = /569034B6 158 | Reference = R11; 159 | ValeurCmp = 68R; 160 | IdModule = projectLib:SMD-0805; 161 | EndCmp 162 | 163 | EndListe 164 | -------------------------------------------------------------------------------- /schematic_pcb/electronic_design_kicad/electronic_design_kicad.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jim17/memtype/a0345bc36f89930d7b0ac9f7d2380710c5fc1db0/schematic_pcb/electronic_design_kicad/electronic_design_kicad.pdf -------------------------------------------------------------------------------- /schematic_pcb/electronic_design_kicad/electronic_design_kicad.pro: -------------------------------------------------------------------------------- 1 | update=vie 08 ene 2016 21:35:43 CET 2 | version=1 3 | last_client=kicad 4 | [cvpcb] 5 | version=1 6 | NetIExt=net 7 | [cvpcb/libraries] 8 | EquName1=devcms 9 | [general] 10 | version=1 11 | [pcbnew] 12 | version=1 13 | LastNetListRead= 14 | UseCmpFile=1 15 | PadDrill=" 0,000000" 16 | PadDrillOvalY=" 0,000000" 17 | PadSizeH=" 12,065000" 18 | PadSizeV=" 1,270000" 19 | PcbTextSizeV=" 1,000000" 20 | PcbTextSizeH=" 1,000000" 21 | PcbTextThickness=" 0,300000" 22 | ModuleTextSizeV=" 1,000000" 23 | ModuleTextSizeH=" 1,000000" 24 | ModuleTextSizeThickness=" 0,150000" 25 | SolderMaskClearance=" 0,000000" 26 | SolderMaskMinWidth=" 0,000000" 27 | DrawSegmentWidth=" 0,200000" 28 | BoardOutlineThickness=" 0,150000" 29 | ModuleOutlineThickness=" 0,150000" 30 | [pcbnew/libraries] 31 | LibDir= 32 | LibName1=sockets 33 | LibName2=connect 34 | LibName3=discret 35 | LibName4=pin_array 36 | LibName5=divers 37 | LibName6=smd_capacitors 38 | LibName7=smd_resistors 39 | LibName8=smd_crystal&oscillator 40 | LibName9=smd_dil 41 | LibName10=smd_transistors 42 | LibName11=libcms 43 | LibName12=display 44 | LibName13=led 45 | LibName14=dip_sockets 46 | LibName15=pga_sockets 47 | LibName16=valves 48 | LibName17=key_library 49 | [eeschema] 50 | version=1 51 | LibDir= 52 | [eeschema/libraries] 53 | LibName1=conn 54 | LibName2=ESD_Protection 55 | LibName3=microchip_pic12mcu 56 | LibName4=analog_devices 57 | LibName5=display 58 | LibName6=gennum 59 | LibName7=linear 60 | LibName8=cypress 61 | LibName9=motorola 62 | LibName10=video 63 | LibName11=silabs 64 | LibName12=stm32 65 | LibName13=contrib 66 | LibName14=switches 67 | LibName15=ac-dc 68 | LibName16=microchip_pic32mcu 69 | LibName17=memory 70 | LibName18=philips 71 | LibName19=onsemi 72 | LibName20=dsp 73 | LibName21=brooktre 74 | LibName22=siliconi 75 | LibName23=hc11 76 | LibName24=power 77 | LibName25=transistors 78 | LibName26=rfcom 79 | LibName27=maxim 80 | LibName28=microchip_pic16mcu 81 | LibName29=Altera 82 | LibName30=microchip_dspic33dsc 83 | LibName31=microchip_pic10mcu 84 | LibName32=Zilog 85 | LibName33=analog_switches 86 | LibName34=dc-dc 87 | LibName35=opto 88 | LibName36=ftdi 89 | LibName37=Xicor 90 | LibName38=ir 91 | LibName39=atmel 92 | LibName40=elec-unifil 93 | LibName41=nxp_armmcu 94 | LibName42=diode 95 | LibName43=motor_drivers 96 | LibName44=cmos_ieee 97 | LibName45=Oscillators 98 | LibName46=stm8 99 | LibName47=cmos4000 100 | LibName48=regul 101 | LibName49=microchip_pic18mcu 102 | LibName50=logo 103 | LibName51=texas 104 | LibName52=valves 105 | LibName53=ttl_ieee 106 | LibName54=relays 107 | LibName55=pspice 108 | LibName56=intel 109 | LibName57=xilinx 110 | LibName58=microcontrollers 111 | LibName59=Lattice 112 | LibName60=Power_Management 113 | LibName61=74xx 114 | LibName62=transf 115 | LibName63=device 116 | LibName64=microchip 117 | LibName65=references 118 | LibName66=interface 119 | LibName67=74xgxx 120 | LibName68=powerint 121 | LibName69=nordicsemi 122 | LibName70=digital-audio 123 | LibName71=supertex 124 | LibName72=actel 125 | LibName73=audio 126 | LibName74=adc-dac 127 | -------------------------------------------------------------------------------- /schematic_pcb/electronic_design_kicad/fp-lib-table: -------------------------------------------------------------------------------- 1 | (fp_lib_table 2 | (lib (name projectLib)(type KiCad)(uri ${KIPRJMOD}/memotype.pretty)(options "")(descr "")) 3 | ) 4 | -------------------------------------------------------------------------------- /schematic_pcb/electronic_design_kicad/gerbers.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jim17/memtype/a0345bc36f89930d7b0ac9f7d2380710c5fc1db0/schematic_pcb/electronic_design_kicad/gerbers.zip -------------------------------------------------------------------------------- /schematic_pcb/electronic_design_kicad/gerbers/electronic_design_kicad-B.Cu.gbr: -------------------------------------------------------------------------------- 1 | G04 #@! TF.FileFunction,Copper,L2,Bot,Signal* 2 | %FSLAX46Y46*% 3 | G04 Gerber Fmt 4.6, Leading zero omitted, Abs format (unit mm)* 4 | G04 Created by KiCad (PCBNEW 0.201510311201+6287~30~ubuntu14.04.1-product) date sáb 11 jun 2016 22:07:05 CEST* 5 | %MOMM*% 6 | G01* 7 | G04 APERTURE LIST* 8 | %ADD10C,0.020000*% 9 | %ADD11C,1.500000*% 10 | %ADD12O,3.000000X1.100000*% 11 | %ADD13R,0.797560X0.797560*% 12 | %ADD14C,0.900000*% 13 | %ADD15C,0.508000*% 14 | %ADD16C,0.254000*% 15 | %ADD17C,0.381000*% 16 | G04 APERTURE END LIST* 17 | D10* 18 | D11* 19 | X142969000Y-178857000D03* 20 | X142969000Y-181357000D03* 21 | X142969000Y-183357000D03* 22 | X142969000Y-185857000D03* 23 | D12* 24 | X140869000Y-176507000D03* 25 | X140869000Y-188207000D03* 26 | D13* 27 | X156130700Y-182410000D03* 28 | X157629300Y-182410000D03* 29 | D10* 30 | G36* 31 | X147477639Y-186336575D02* 32 | X146063425Y-184922361D01* 33 | X147336217Y-183649569D01* 34 | X148750431Y-185063783D01* 35 | X147477639Y-186336575D01* 36 | X147477639Y-186336575D01* 37 | G37* 38 | G36* 39 | X153063783Y-180750431D02* 40 | X151649569Y-179336217D01* 41 | X152922361Y-178063425D01* 42 | X154336575Y-179477639D01* 43 | X153063783Y-180750431D01* 44 | X153063783Y-180750431D01* 45 | G37* 46 | G36* 47 | X151844024Y-186566384D02* 48 | X150889430Y-185611790D01* 49 | X151596536Y-184904684D01* 50 | X152551130Y-185859278D01* 51 | X151844024Y-186566384D01* 52 | X151844024Y-186566384D01* 53 | G37* 54 | G36* 55 | X146788210Y-181510570D02* 56 | X145833616Y-180555976D01* 57 | X146540722Y-179848870D01* 58 | X147495316Y-180803464D01* 59 | X146788210Y-181510570D01* 60 | X146788210Y-181510570D01* 61 | G37* 62 | G36* 63 | X152851651Y-185558757D02* 64 | X151897057Y-184604163D01* 65 | X152604163Y-183897057D01* 66 | X153558757Y-184851651D01* 67 | X152851651Y-185558757D01* 68 | X152851651Y-185558757D01* 69 | G37* 70 | G36* 71 | X147795837Y-180502943D02* 72 | X146841243Y-179548349D01* 73 | X147548349Y-178841243D01* 74 | X148502943Y-179795837D01* 75 | X147795837Y-180502943D01* 76 | X147795837Y-180502943D01* 77 | G37* 78 | G36* 79 | X153859278Y-184551130D02* 80 | X152904684Y-183596536D01* 81 | X153611790Y-182889430D01* 82 | X154566384Y-183844024D01* 83 | X153859278Y-184551130D01* 84 | X153859278Y-184551130D01* 85 | G37* 86 | G36* 87 | X148803464Y-179495316D02* 88 | X147848870Y-178540722D01* 89 | X148555976Y-177833616D01* 90 | X149510570Y-178788210D01* 91 | X148803464Y-179495316D01* 92 | X148803464Y-179495316D01* 93 | G37* 94 | D14* 95 | X151400000Y-177800000D03* 96 | X154750000Y-182000000D03* 97 | X160250000Y-185000000D03* 98 | X162250000Y-184750000D03* 99 | X160800000Y-183600000D03* 100 | X161500000Y-176250000D03* 101 | X158500000Y-188500000D03* 102 | D15* 103 | X146664466Y-180679720D02* 104 | X144841746Y-178857000D01* 105 | X144841746Y-178857000D02* 106 | X142969000Y-178857000D01* 107 | X157629300Y-180429300D02* 108 | X157629300Y-182410000D01* 109 | X154562002Y-177362002D02* 110 | X157629300Y-180429300D01* 111 | X151837998Y-177362002D02* 112 | X154562002Y-177362002D01* 113 | X151400000Y-177800000D02* 114 | X151837998Y-177362002D01* 115 | D16* 116 | X152727907Y-184727907D02* 117 | X152000000Y-184000000D01* 118 | X152500000Y-182000000D02* 119 | X154750000Y-182000000D01* 120 | X152000000Y-182500000D02* 121 | X152500000Y-182000000D01* 122 | X152000000Y-184000000D02* 123 | X152000000Y-182500000D01* 124 | X153735534Y-183720280D02* 125 | X155720280Y-183720280D01* 126 | X159500000Y-185750000D02* 127 | X160250000Y-185000000D01* 128 | X157750000Y-185750000D02* 129 | X159500000Y-185750000D01* 130 | X155720280Y-183720280D02* 131 | X157750000Y-185750000D01* 132 | X162250000Y-184750000D02* 133 | X162250000Y-185000000D01* 134 | X162250000Y-185000000D02* 135 | X160250000Y-187000000D01* 136 | X152984746Y-187000000D02* 137 | X151720280Y-185735534D01* 138 | X160250000Y-187000000D02* 139 | X152984746Y-187000000D01* 140 | X157120700Y-183400000D02* 141 | X156130700Y-182410000D01* 142 | X160600000Y-183400000D02* 143 | X157120700Y-183400000D01* 144 | X160800000Y-183600000D02* 145 | X160600000Y-183400000D01* 146 | D17* 147 | X148679720Y-178664466D02* 148 | X151094186Y-176250000D01* 149 | X151094186Y-176250000D02* 150 | X161500000Y-176250000D01* 151 | D16* 152 | X150250000Y-182250000D02* 153 | X150250000Y-187000000D01* 154 | X150250000Y-187000000D02* 155 | X151750000Y-188500000D01* 156 | X154750000Y-188500000D02* 157 | X151750000Y-188500000D01* 158 | X158500000Y-188500000D02* 159 | X154750000Y-188500000D01* 160 | X150250000Y-182250000D02* 161 | X147672093Y-179672093D01* 162 | M02* 163 | -------------------------------------------------------------------------------- /schematic_pcb/electronic_design_kicad/gerbers/electronic_design_kicad-Edge.Cuts.gbr: -------------------------------------------------------------------------------- 1 | G04 #@! TF.FileFunction,Profile,NP* 2 | %FSLAX46Y46*% 3 | G04 Gerber Fmt 4.6, Leading zero omitted, Abs format (unit mm)* 4 | G04 Created by KiCad (PCBNEW 0.201510311201+6287~30~ubuntu14.04.1-product) date sáb 11 jun 2016 22:07:05 CEST* 5 | %MOMM*% 6 | G01* 7 | G04 APERTURE LIST* 8 | %ADD10C,0.020000*% 9 | %ADD11C,0.050000*% 10 | %ADD12C,0.700000*% 11 | G04 APERTURE END LIST* 12 | D10* 13 | D11* 14 | X163750000Y-175000000D02* 15 | X138250000Y-175000000D01* 16 | X163750000Y-189500000D02* 17 | X163750000Y-175000000D01* 18 | X138250000Y-189500000D02* 19 | X163750000Y-189500000D01* 20 | X138250000Y-175000000D02* 21 | X138250000Y-189500000D01* 22 | D12* 23 | X140000000Y-188200000D02* 24 | X141700000Y-188200000D01* 25 | X140000000Y-176500000D02* 26 | X141700000Y-176500000D01* 27 | M02* 28 | -------------------------------------------------------------------------------- /schematic_pcb/electronic_design_kicad/gerbers/electronic_design_kicad-F.Cu.gbr: -------------------------------------------------------------------------------- 1 | G04 #@! TF.FileFunction,Copper,L1,Top,Signal* 2 | %FSLAX46Y46*% 3 | G04 Gerber Fmt 4.6, Leading zero omitted, Abs format (unit mm)* 4 | G04 Created by KiCad (PCBNEW 0.201510311201+6287~30~ubuntu14.04.1-product) date sáb 11 jun 2016 22:07:05 CEST* 5 | %MOMM*% 6 | G01* 7 | G04 APERTURE LIST* 8 | %ADD10C,0.020000*% 9 | %ADD11C,1.500000*% 10 | %ADD12O,3.000000X1.100000*% 11 | %ADD13R,0.889000X1.397000*% 12 | %ADD14R,0.800100X1.000760*% 13 | %ADD15R,1.397000X0.889000*% 14 | %ADD16R,2.200000X0.700000*% 15 | %ADD17C,0.900000*% 16 | %ADD18C,0.508000*% 17 | %ADD19C,0.381000*% 18 | %ADD20C,0.254000*% 19 | %ADD21C,0.635000*% 20 | G04 APERTURE END LIST* 21 | D10* 22 | D11* 23 | X142969000Y-178857000D03* 24 | X142969000Y-181357000D03* 25 | X142969000Y-183357000D03* 26 | X142969000Y-185857000D03* 27 | D12* 28 | X140869000Y-176507000D03* 29 | X140869000Y-188207000D03* 30 | D13* 31 | X155152500Y-177400000D03* 32 | X153247500Y-177400000D03* 33 | D14* 34 | X146750000Y-187349820D03* 35 | X145797500Y-185150180D03* 36 | X147702500Y-185150180D03* 37 | D13* 38 | X147702500Y-178000000D03* 39 | X145797500Y-178000000D03* 40 | X145847500Y-180400000D03* 41 | X147752500Y-180400000D03* 42 | X145847500Y-182600000D03* 43 | X147752500Y-182600000D03* 44 | D15* 45 | X154500000Y-185797500D03* 46 | X154500000Y-187702500D03* 47 | D13* 48 | X157447500Y-177400000D03* 49 | X159352500Y-177400000D03* 50 | D15* 51 | X162000000Y-177847500D03* 52 | X162000000Y-179752500D03* 53 | X162250000Y-186047500D03* 54 | X162250000Y-187952500D03* 55 | X160000000Y-186047500D03* 56 | X160000000Y-187952500D03* 57 | X150000000Y-187702500D03* 58 | X150000000Y-185797500D03* 59 | D16* 60 | X150790000Y-179495000D03* 61 | X150790000Y-180765000D03* 62 | X150790000Y-182035000D03* 63 | X150790000Y-183305000D03* 64 | X158410000Y-183305000D03* 65 | X158410000Y-182035000D03* 66 | X158410000Y-180765000D03* 67 | X158410000Y-179495000D03* 68 | D15* 69 | X152250000Y-187702500D03* 70 | X152250000Y-185797500D03* 71 | X162000000Y-181647500D03* 72 | X162000000Y-183552500D03* 73 | X156750000Y-185797500D03* 74 | X156750000Y-187702500D03* 75 | D17* 76 | X151400000Y-177800000D03* 77 | X154750000Y-182000000D03* 78 | X160250000Y-185000000D03* 79 | X162250000Y-184750000D03* 80 | X160800000Y-183600000D03* 81 | X161500000Y-176250000D03* 82 | X158500000Y-188500000D03* 83 | D18* 84 | X142969000Y-178857000D02* 85 | X142969000Y-178031000D01* 86 | X144600000Y-176400000D02* 87 | X149302500Y-176400000D01* 88 | X142969000Y-178031000D02* 89 | X144600000Y-176400000D01* 90 | X155152500Y-177400000D02* 91 | X157447500Y-177400000D01* 92 | D19* 93 | X158410000Y-179495000D02* 94 | X157447500Y-178532500D01* 95 | X157447500Y-178532500D02* 96 | X157447500Y-177400000D01* 97 | X157447500Y-177400000D02* 98 | X157400000Y-177400000D01* 99 | X157400000Y-177400000D02* 100 | X156000000Y-176000000D01* 101 | X156000000Y-176000000D02* 102 | X149702500Y-176000000D01* 103 | X149702500Y-176000000D02* 104 | X149302500Y-176400000D01* 105 | X149302500Y-176400000D02* 106 | X147702500Y-178000000D01* 107 | D18* 108 | X155152500Y-177400000D02* 109 | X155152500Y-176952500D01* 110 | X153247500Y-177400000D02* 111 | X151800000Y-177400000D01* 112 | X151800000Y-177400000D02* 113 | X151400000Y-177800000D01* 114 | X150790000Y-183305000D02* 115 | X152495000Y-183305000D01* 116 | X153247500Y-182552500D02* 117 | X153247500Y-177400000D01* 118 | X152495000Y-183305000D02* 119 | X153247500Y-182552500D01* 120 | X150000000Y-185797500D02* 121 | X150000000Y-184095000D01* 122 | X150000000Y-184095000D02* 123 | X150790000Y-183305000D01* 124 | X146750000Y-187349820D02* 125 | X144461820Y-187349820D01* 126 | X144461820Y-187349820D02* 127 | X142969000Y-185857000D01* 128 | X146750000Y-187349820D02* 129 | X147900180Y-187349820D01* 130 | X147900180Y-187349820D02* 131 | X149452500Y-185797500D01* 132 | X149452500Y-185797500D02* 133 | X150000000Y-185797500D01* 134 | X150000000Y-185797500D02* 135 | X152250000Y-185797500D01* 136 | X154500000Y-187702500D02* 137 | X154155000Y-187702500D01* 138 | X154155000Y-187702500D02* 139 | X152250000Y-185797500D01* 140 | X156750000Y-187702500D02* 141 | X154500000Y-187702500D01* 142 | X145847500Y-182600000D02* 143 | X143726000Y-182600000D01* 144 | X143726000Y-182600000D02* 145 | X142969000Y-183357000D01* 146 | D19* 147 | X145797500Y-185150180D02* 148 | X145797500Y-183000000D01* 149 | X147702500Y-185150180D02* 150 | X147702500Y-184902500D01* 151 | X147702500Y-184902500D02* 152 | X146800000Y-184000000D01* 153 | X146800000Y-181352500D02* 154 | X145847500Y-180400000D01* 155 | X146800000Y-184000000D02* 156 | X146800000Y-181352500D01* 157 | D18* 158 | X145847500Y-180400000D02* 159 | X143926000Y-180400000D01* 160 | X143926000Y-180400000D02* 161 | X142969000Y-181357000D01* 162 | D19* 163 | X147702500Y-185150180D02* 164 | X147702500Y-184952500D01* 165 | D18* 166 | X145797500Y-178000000D02* 167 | X145797500Y-180250000D01* 168 | X150790000Y-180765000D02* 169 | X148117500Y-180765000D01* 170 | X148117500Y-180765000D02* 171 | X147752500Y-180400000D01* 172 | X147717500Y-180765000D02* 173 | X147702500Y-180750000D01* 174 | X150790000Y-182035000D02* 175 | X148317500Y-182035000D01* 176 | X148317500Y-182035000D02* 177 | X147752500Y-182600000D01* 178 | X158410000Y-180765000D02* 179 | X155985000Y-180765000D01* 180 | X155985000Y-180765000D02* 181 | X154750000Y-182000000D01* 182 | X154500000Y-182250000D02* 183 | X154500000Y-185797500D01* 184 | X154750000Y-182000000D02* 185 | X154500000Y-182250000D01* 186 | D20* 187 | X161500000Y-187000000D02* 188 | X160500000Y-187000000D01* 189 | X160000000Y-186500000D02* 190 | X160000000Y-186047500D01* 191 | X160500000Y-187000000D02* 192 | X160000000Y-186500000D01* 193 | X161500000Y-187000000D02* 194 | X161750000Y-187000000D01* 195 | X162250000Y-187500000D02* 196 | X162250000Y-187952500D01* 197 | X161750000Y-187000000D02* 198 | X162250000Y-187500000D01* 199 | X160000000Y-185250000D02* 200 | X160000000Y-186047500D01* 201 | X160250000Y-185000000D02* 202 | X160000000Y-185250000D01* 203 | X162250000Y-186047500D02* 204 | X162250000Y-185500000D01* 205 | X163250000Y-181002500D02* 206 | X162000000Y-179752500D01* 207 | X163250000Y-184500000D02* 208 | X163250000Y-181002500D01* 209 | X162250000Y-185500000D02* 210 | X163250000Y-184500000D01* 211 | X162250000Y-186047500D02* 212 | X162250000Y-185750000D01* 213 | X162250000Y-185750000D02* 214 | X162250000Y-184750000D01* 215 | X162000000Y-183552500D02* 216 | X160847500Y-183552500D01* 217 | X160847500Y-183552500D02* 218 | X160800000Y-183600000D01* 219 | D18* 220 | X158410000Y-182035000D02* 221 | X161612500Y-182035000D01* 222 | X161612500Y-182035000D02* 223 | X162000000Y-181647500D01* 224 | X152250000Y-187702500D02* 225 | X150000000Y-187702500D01* 226 | D20* 227 | X140869000Y-188207000D02* 228 | X144957000Y-188207000D01* 229 | X144957000Y-188207000D02* 230 | X145250000Y-188500000D01* 231 | X150000000Y-187702500D02* 232 | X149047500Y-187702500D01* 233 | X149047500Y-187702500D02* 234 | X148250000Y-188500000D01* 235 | X148250000Y-188500000D02* 236 | X145250000Y-188500000D01* 237 | X141162000Y-188500000D02* 238 | X140869000Y-188207000D01* 239 | D21* 240 | X140869000Y-176507000D02* 241 | X140819000Y-176507000D01* 242 | X140819000Y-176507000D02* 243 | X138969000Y-178357000D01* 244 | X138969000Y-178357000D02* 245 | X138969000Y-186107000D01* 246 | X138969000Y-186107000D02* 247 | X138969000Y-186307000D01* 248 | X138969000Y-186307000D02* 249 | X140869000Y-188207000D01* 250 | D19* 251 | X162000000Y-176750000D02* 252 | X162000000Y-177847500D01* 253 | X161500000Y-176250000D02* 254 | X162000000Y-176750000D01* 255 | X159352500Y-177400000D02* 256 | X161552500Y-177400000D01* 257 | X161552500Y-177400000D02* 258 | X162000000Y-177847500D01* 259 | X160000000Y-187952500D02* 260 | X159452500Y-187952500D01* 261 | X159452500Y-187952500D02* 262 | X157297500Y-185797500D01* 263 | X157297500Y-185797500D02* 264 | X156750000Y-185797500D01* 265 | D20* 266 | X160000000Y-187952500D02* 267 | X159905000Y-187952500D01* 268 | X160000000Y-187952500D02* 269 | X159452500Y-188500000D01* 270 | X159452500Y-188500000D02* 271 | X158500000Y-188500000D01* 272 | M02* 273 | -------------------------------------------------------------------------------- /schematic_pcb/electronic_design_kicad/gerbers/electronic_design_kicad.drl: -------------------------------------------------------------------------------- 1 | M48 2 | INCH,TZ 3 | T10C0.028 4 | T11C0.047 5 | T12C0.020 6 | T13C0.039 7 | % 8 | T10 9 | X060957Y-71008 10 | X062571Y-72622 11 | X055106Y-69491 12 | X055106Y-74097 13 | T11 14 | X055460Y-70889 15 | X055460Y-72700 16 | T12 17 | X059606Y-70000 18 | X060925Y-71654 19 | X062402Y-74213 20 | X063091Y-72835 21 | X063307Y-72283 22 | X063583Y-69390 23 | X063878Y-72736 24 | T13 25 | X056287Y-70416 26 | X056287Y-71400 27 | X056287Y-72188 28 | X056287Y-73172 29 | M30 30 | 31 | -------------------------------------------------------------------------------- /schematic_pcb/electronic_design_kicad/gerbers_oshpark.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jim17/memtype/a0345bc36f89930d7b0ac9f7d2380710c5fc1db0/schematic_pcb/electronic_design_kicad/gerbers_oshpark.zip -------------------------------------------------------------------------------- /schematic_pcb/electronic_design_kicad/memotype.pretty/JOYSTICK.kicad_mod: -------------------------------------------------------------------------------- 1 | (module projectLib:JOYSTICK (layer F.Cu) (tedit 546535D4) 2 | (fp_text reference P2 (at -6.1976 5.0546) (layer F.SilkS) 3 | (effects (font (size 0.65 0.65) (thickness 0.13))) 4 | ) 5 | (fp_text value JOYSTICK (at 0 -3) (layer F.SilkS) 6 | (effects (font (size 0.65 0.65) (thickness 0.13))) 7 | ) 8 | (fp_line (start -5 -2) (end -5 -1) (layer F.SilkS) (width 0.15)) 9 | (fp_line (start -5 1) (end -5 2) (layer F.SilkS) (width 0.15)) 10 | (fp_line (start 5 1) (end 5 2) (layer F.SilkS) (width 0.15)) 11 | (fp_line (start 5 -2) (end 5 -1) (layer F.SilkS) (width 0.15)) 12 | (fp_line (start -5 5) (end 5 5) (layer F.SilkS) (width 0.15)) 13 | (fp_line (start 5 -5) (end -5 -5) (layer F.SilkS) (width 0.15)) 14 | (fp_circle (center 0 0) (end 0.8 -0.8) (layer F.SilkS) (width 0.15)) 15 | (pad 5 thru_hole circle (at 5.15 0) (size 2 2) (drill 1) (layers *.Cu *.Mask F.SilkS)) 16 | (pad 2 thru_hole circle (at -5.15 0) (size 2 2) (drill 1) (layers *.Cu *.Mask F.SilkS)) 17 | (pad 1 thru_hole circle (at -5.15 -3.25) (size 2 2) (drill 1.2) (layers *.Cu *.Mask F.SilkS)) 18 | (pad 6 thru_hole circle (at 5.15 -3.25) (size 2 2) (drill 1.2) (layers *.Cu *.Mask F.SilkS)) 19 | (pad 3 thru_hole circle (at -5.15 3.25) (size 2 2) (drill 1.2) (layers *.Cu *.Mask F.SilkS)) 20 | (pad 4 thru_hole circle (at 5.15 3.25) (size 2 2) (drill 1.2) (layers *.Cu *.Mask F.SilkS)) 21 | (model ../../../../../home/borrego/mypass/schematic_pcb/electronic_design_kicad/test.wrl 22 | (at (xyz 0 0 0)) 23 | (scale (xyz 0.4 0.4 0.4)) 24 | (rotate (xyz -90 0 0)) 25 | ) 26 | (model ../../../../../home/borrego/mypass/schematic_pcb/electronic_design_kicad/SKQUAA.wrl 27 | (at (xyz 0 0 0)) 28 | (scale (xyz 0.4 0.4 0.4)) 29 | (rotate (xyz -90 0 0)) 30 | ) 31 | ) 32 | -------------------------------------------------------------------------------- /schematic_pcb/electronic_design_kicad/memotype.pretty/LED_0603_PIPE.kicad_mod: -------------------------------------------------------------------------------- 1 | (module LED_0603_PIPE (layer F.Cu) (tedit 56B0C8AB) 2 | (descr "LED 0603 smd package") 3 | (tags "LED led 0603 SMD smd SMT smt smdled SMDLED smtled SMTLED") 4 | (attr smd) 5 | (fp_text reference D3 (at -0.762 -1.27) (layer F.SilkS) 6 | (effects (font (size 0.65 0.65) (thickness 0.13))) 7 | ) 8 | (fp_text value "LED RED" (at 0.1524 1.3208) (layer F.Fab) 9 | (effects (font (size 0.65 0.65) (thickness 0.13))) 10 | ) 11 | (fp_line (start -1.8 -1.8) (end 1.8 -1.8) (layer F.SilkS) (width 0.15)) 12 | (fp_line (start 1.8 -1.8) (end 1.8 1.8) (layer F.SilkS) (width 0.15)) 13 | (fp_line (start 1.8 1.8) (end -1.8 1.8) (layer F.SilkS) (width 0.15)) 14 | (fp_line (start -1.8 1.8) (end -1.8 -1.8) (layer F.SilkS) (width 0.15)) 15 | (fp_line (start -1.1 0.55) (end 0.8 0.55) (layer F.SilkS) (width 0.15)) 16 | (fp_line (start -1.1 -0.55) (end 0.8 -0.55) (layer F.SilkS) (width 0.15)) 17 | (fp_line (start -0.2 0) (end 0.25 0) (layer F.SilkS) (width 0.15)) 18 | (fp_line (start -0.25 -0.25) (end -0.25 0.25) (layer F.SilkS) (width 0.15)) 19 | (fp_line (start -0.25 0) (end 0 -0.25) (layer F.SilkS) (width 0.15)) 20 | (fp_line (start 0 -0.25) (end 0 0.25) (layer F.SilkS) (width 0.15)) 21 | (fp_line (start 0 0.25) (end -0.25 0) (layer F.SilkS) (width 0.15)) 22 | (fp_line (start 1.4 -0.75) (end 1.4 0.75) (layer F.CrtYd) (width 0.05)) 23 | (fp_line (start 1.4 0.75) (end -1.4 0.75) (layer F.CrtYd) (width 0.05)) 24 | (fp_line (start -1.4 0.75) (end -1.4 -0.75) (layer F.CrtYd) (width 0.05)) 25 | (fp_line (start -1.4 -0.75) (end 1.4 -0.75) (layer F.CrtYd) (width 0.05)) 26 | (pad "" np_thru_hole circle (at -2.05 2.05) (size 0.7 0.7) (drill 0.7) (layers *.Cu *.Mask F.SilkS)) 27 | (pad 2 smd rect (at 0.7493 0 180) (size 0.79756 0.79756) (layers F.Cu F.Paste F.Mask)) 28 | (pad 1 smd rect (at -0.7493 0 180) (size 0.79756 0.79756) (layers F.Cu F.Paste F.Mask)) 29 | (pad "" np_thru_hole circle (at 2.05 -2.05) (size 0.7 0.7) (drill 0.7) (layers *.Cu *.Mask F.SilkS)) 30 | (model ../../../../../home/borrego/memtype/schematic_pcb/electronic_design_kicad/shapes3D/LED_0603.wrl 31 | (at (xyz 0 0 0)) 32 | (scale (xyz 1 1 1)) 33 | (rotate (xyz 0 0 180)) 34 | ) 35 | ) 36 | -------------------------------------------------------------------------------- /schematic_pcb/electronic_design_kicad/memotype.pretty/SKRHAAE010.kicad_mod: -------------------------------------------------------------------------------- 1 | (module SKRHAAE010 (layer F.Cu) (tedit 57017722) 2 | (fp_text reference P2 (at 0.274357 5.180264) (layer F.SilkS) 3 | (effects (font (size 0.65 0.65) (thickness 0.13))) 4 | ) 5 | (fp_text value CONN_6 (at 0.345068 0.159806 270) (layer F.SilkS) 6 | (effects (font (size 0.65 0.65) (thickness 0.13))) 7 | ) 8 | (fp_line (start -2.6 -3.75) (end -2.05 -3.75) (layer F.SilkS) (width 0.15)) 9 | (fp_line (start 2.6 -3.6) (end 2.05 -3.6) (layer F.SilkS) (width 0.15)) 10 | (fp_line (start -2.6 3.8) (end -2.05 3.8) (layer F.SilkS) (width 0.15)) 11 | (fp_line (start -3.75 -2.6) (end -3.75 -1.1) (layer F.SilkS) (width 0.15)) 12 | (fp_line (start -2.6 -3.75) (end -3.75 -2.6) (layer F.SilkS) (width 0.15)) 13 | (fp_line (start -2.6 3.8) (end -3.75 2.65) (layer F.SilkS) (width 0.15)) 14 | (fp_line (start -3.75 2.65) (end -3.75 1.1) (layer F.SilkS) (width 0.15)) 15 | (fp_line (start 2.6 3.75) (end 2.05 3.75) (layer F.SilkS) (width 0.15)) 16 | (fp_line (start 3.75 2.6) (end 3.75 1.1) (layer F.SilkS) (width 0.15)) 17 | (fp_line (start 2.6 3.75) (end 3.75 2.6) (layer F.SilkS) (width 0.15)) 18 | (fp_line (start 3.75 -2.45) (end 3.75 -1.1) (layer F.SilkS) (width 0.15)) 19 | (fp_line (start 2.6 -3.6) (end 3.75 -2.45) (layer F.SilkS) (width 0.15)) 20 | (pad "" smd rect (at -3.95 0) (size 1.8 2) (layers F.Cu F.Paste F.Mask)) 21 | (pad "" smd rect (at 3.95 0) (size 1.8 2) (layers F.Cu F.Paste F.Mask)) 22 | (pad 4 smd rect (at -1.425 -3.575) (size 1 1.35) (layers F.Cu F.Paste F.Mask)) 23 | (pad 1 smd rect (at -1.425 3.575) (size 1 1.35) (layers F.Cu F.Paste F.Mask)) 24 | (pad 5 smd rect (at 0 -3.575) (size 1 1.35) (layers F.Cu F.Paste F.Mask)) 25 | (pad 2 smd rect (at 0 3.575) (size 1 1.35) (layers F.Cu F.Paste F.Mask)) 26 | (pad 6 smd rect (at 1.425 -3.575) (size 1 1.35) (layers F.Cu F.Paste F.Mask)) 27 | (pad 3 smd rect (at 1.425 3.575) (size 1 1.35) (layers F.Cu F.Paste F.Mask)) 28 | (model ../../../../../home/borrego/memtype/schematic_pcb/electronic_design_kicad/shapes3D/SKRHAA_2.wrl 29 | (at (xyz 0 0 0)) 30 | (scale (xyz 0.4 0.4 0.4)) 31 | (rotate (xyz -90 0 0)) 32 | ) 33 | ) 34 | -------------------------------------------------------------------------------- /schematic_pcb/electronic_design_kicad/memotype.pretty/SMD-0805.kicad_mod: -------------------------------------------------------------------------------- 1 | (module SMD_Packages:SMD-0805 (layer F.Cu) (tedit 54666BD6) 2 | (attr smd) 3 | (fp_text reference R8 (at 2.26 0.235 90) (layer F.SilkS) 4 | (effects (font (size 0.65 0.65) (thickness 0.13))) 5 | ) 6 | (fp_text value 1k (at 0 0.381) (layer F.SilkS) 7 | (effects (font (size 0.65 0.65) (thickness 0.13))) 8 | ) 9 | (fp_circle (center -1.651 0.762) (end -1.651 0.635) (layer F.SilkS) (width 0.09906)) 10 | (fp_line (start -0.508 0.762) (end -1.524 0.762) (layer F.SilkS) (width 0.09906)) 11 | (fp_line (start -1.524 0.762) (end -1.524 -0.762) (layer F.SilkS) (width 0.09906)) 12 | (fp_line (start -1.524 -0.762) (end -0.508 -0.762) (layer F.SilkS) (width 0.09906)) 13 | (fp_line (start 0.508 -0.762) (end 1.524 -0.762) (layer F.SilkS) (width 0.09906)) 14 | (fp_line (start 1.524 -0.762) (end 1.524 0.762) (layer F.SilkS) (width 0.09906)) 15 | (fp_line (start 1.524 0.762) (end 0.508 0.762) (layer F.SilkS) (width 0.09906)) 16 | (pad 1 smd rect (at -0.9525 0) (size 0.889 1.397) (layers F.Cu F.Paste F.Mask)) 17 | (pad 2 smd rect (at 0.9525 0) (size 0.889 1.397) (layers F.Cu F.Paste F.Mask)) 18 | (model smd/chip_cms.wrl 19 | (at (xyz 0 0 0)) 20 | (scale (xyz 0.1 0.1 0.1)) 21 | (rotate (xyz 0 0 0)) 22 | ) 23 | ) 24 | -------------------------------------------------------------------------------- /schematic_pcb/electronic_design_kicad/memotype.pretty/SO8_200mil_wide.kicad_mod: -------------------------------------------------------------------------------- 1 | (module SO8_200mil_wide (layer F.Cu) (tedit 568D5591) 2 | (fp_text reference IC? (at -0.06 -6.37) (layer F.SilkS) 3 | (effects (font (size 1 1) (thickness 0.2))) 4 | ) 5 | (fp_text value VAL** (at 0.2 -0.1) (layer F.SilkS) 6 | (effects (font (size 1 1) (thickness 0.2))) 7 | ) 8 | (fp_circle (center -1.75 1.8) (end -1.4 1.8) (layer F.SilkS) (width 0.2)) 9 | (fp_line (start 2.6 -2.65) (end 2.6 2.65) (layer F.SilkS) (width 0.2)) 10 | (fp_line (start 2.6 2.65) (end -2.6 2.65) (layer F.SilkS) (width 0.2)) 11 | (fp_line (start -2.6 2.65) (end -2.6 -2.65) (layer F.SilkS) (width 0.2)) 12 | (fp_line (start -2.6 -2.65) (end 2.6 -2.65) (layer F.SilkS) (width 0.2)) 13 | (pad 1 smd rect (at -1.905 3.81) (size 0.7 2.2) (layers F.Cu F.Paste F.Mask)) 14 | (pad 2 smd rect (at -0.635 3.81) (size 0.7 2.2) (layers F.Cu F.Paste F.Mask)) 15 | (pad 3 smd rect (at 0.635 3.81) (size 0.7 2.2) (layers F.Cu F.Paste F.Mask)) 16 | (pad 4 smd rect (at 1.905 3.81) (size 0.7 2.2) (layers F.Cu F.Paste F.Mask)) 17 | (pad 5 smd rect (at 1.905 -3.81) (size 0.7 2.2) (layers F.Cu F.Paste F.Mask)) 18 | (pad 6 smd rect (at 0.635 -3.81) (size 0.7 2.2) (layers F.Cu F.Paste F.Mask)) 19 | (pad 7 smd rect (at -0.635 -3.81) (size 0.7 2.2) (layers F.Cu F.Paste F.Mask)) 20 | (pad 8 smd rect (at -1.905 -3.81) (size 0.7 2.2) (layers F.Cu F.Paste F.Mask)) 21 | ) 22 | -------------------------------------------------------------------------------- /schematic_pcb/electronic_design_kicad/memotype.pretty/SOIC-8-W.kicad_mod: -------------------------------------------------------------------------------- 1 | (module SMD_Packages:SOIC-8-W (layer F.Cu) (tedit 546784AF) 2 | (descr "module SMD SOIC SOJ 8 pins etroit") 3 | (tags "CMS SOJ") 4 | (attr smd) 5 | (fp_text reference IC1 (at 2.89 -2.715 90) (layer F.SilkS) 6 | (effects (font (size 0.65 0.65) (thickness 0.13))) 7 | ) 8 | (fp_text value ATTINY85-S (at 0 1.016) (layer F.SilkS) 9 | (effects (font (size 0.65 0.65) (thickness 0.13))) 10 | ) 11 | (fp_line (start -2.667 1.778) (end -2.667 1.905) (layer F.SilkS) (width 0.127)) 12 | (fp_line (start -2.667 1.905) (end 2.667 1.905) (layer F.SilkS) (width 0.127)) 13 | (fp_line (start 2.667 -1.905) (end -2.667 -1.905) (layer F.SilkS) (width 0.127)) 14 | (fp_line (start -2.667 -1.905) (end -2.667 1.778) (layer F.SilkS) (width 0.127)) 15 | (fp_line (start -2.667 -0.508) (end -2.159 -0.508) (layer F.SilkS) (width 0.127)) 16 | (fp_line (start -2.159 -0.508) (end -2.159 0.508) (layer F.SilkS) (width 0.127)) 17 | (fp_line (start -2.159 0.508) (end -2.667 0.508) (layer F.SilkS) (width 0.127)) 18 | (fp_line (start 2.667 -1.905) (end 2.667 1.905) (layer F.SilkS) (width 0.127)) 19 | (pad 8 smd rect (at -1.905 -2.667) (size 0.59944 1.39954) (layers F.Cu F.Paste F.Mask)) 20 | (pad 1 smd rect (at -1.905 2.667) (size 0.59944 1.39954) (layers F.Cu F.Paste F.Mask)) 21 | (pad 7 smd rect (at -0.635 -2.667) (size 0.59944 1.39954) (layers F.Cu F.Paste F.Mask)) 22 | (pad 6 smd rect (at 0.635 -2.667) (size 0.59944 1.39954) (layers F.Cu F.Paste F.Mask)) 23 | (pad 5 smd rect (at 1.905 -2.667) (size 0.59944 1.39954) (layers F.Cu F.Paste F.Mask)) 24 | (pad 2 smd rect (at -0.635 2.667) (size 0.59944 1.39954) (layers F.Cu F.Paste F.Mask)) 25 | (pad 3 smd rect (at 0.635 2.667) (size 0.59944 1.39954) (layers F.Cu F.Paste F.Mask)) 26 | (pad 4 smd rect (at 1.905 2.667) (size 0.59944 1.39954) (layers F.Cu F.Paste F.Mask)) 27 | (model smd/cms_so8.wrl 28 | (at (xyz 0 0 0)) 29 | (scale (xyz 0.5 0.32 0.5)) 30 | (rotate (xyz 0 0 0)) 31 | ) 32 | ) 33 | -------------------------------------------------------------------------------- /schematic_pcb/electronic_design_kicad/memotype.pretty/SOIC8 200mil wide.mod: -------------------------------------------------------------------------------- 1 | PCBNEW-LibModule-V1 01/06/2016 20:53:20 2 | #encoding utf-8 3 | Units mm 4 | $INDEX 5 | SOIC8 200mil wide 6 | $EndINDEX 7 | # 8 | # URL: http://kicadcloud.com/pcbModule/120 9 | # 10 | $MODULE SO8_200mil_wide 11 | Po 0 0 0 15 510FBDFB 00000000 ~~ 12 | Li SO8_200mil_wide 13 | Sc 0 14 | AR 15 | Op 0 0 0 16 | T0 -0.06 -6.37 1 1 0 0.2 N V 21 N "IC?" 17 | T1 -0.08 6.6 1 1 0 0.2 N V 21 N "VAL**" 18 | DC -1.75 1.8 -1.4 1.8 0.2 21 19 | DS -3 -5.5 3 -5.5 0.2 21 20 | DS 3 -5.5 3 5.5 0.2 21 21 | DS 3 5.5 -3 5.5 0.2 21 22 | DS -3 5.5 -3 -5.5 0.2 21 23 | DS -1.7145 2.667 -1.7145 4.064 0.1 21 24 | DS -1.7145 4.064 -2.0955 4.064 0.1 21 25 | DS -2.0955 4.064 -2.0955 2.667 0.1 21 26 | DS -0.4445 2.667 -0.4445 4.064 0.1 21 27 | DS -0.4445 4.064 -0.8255 4.064 0.1 21 28 | DS -0.8255 4.064 -0.8255 2.667 0.1 21 29 | DS 0.8255 2.667 0.8255 4.064 0.1 21 30 | DS 0.8255 4.064 0.4445 4.064 0.1 21 31 | DS 0.4445 4.064 0.4445 2.667 0.1 21 32 | DS 2.0955 2.667 2.0955 4.064 0.1 21 33 | DS 2.0955 4.064 1.7145 4.064 0.1 21 34 | DS 1.7145 4.064 1.7145 2.667 0.1 21 35 | DS -2.0955 -2.667 -2.0955 -4.064 0.1 21 36 | DS -2.0955 -4.064 -1.7145 -4.064 0.1 21 37 | DS -1.7145 -4.064 -1.7145 -2.667 0.1 21 38 | DS -0.8255 -2.667 -0.8255 -4.064 0.1 21 39 | DS -0.8255 -4.064 -0.4445 -4.064 0.1 21 40 | DS -0.4445 -4.064 -0.4445 -2.667 0.1 21 41 | DS 0.4445 -2.667 0.4445 -4.064 0.1 21 42 | DS 0.4445 -4.064 0.8255 -4.064 0.1 21 43 | DS 0.8255 -4.064 0.8255 -2.667 0.1 21 44 | DS 1.7145 -4.064 2.0955 -4.064 0.1 21 45 | DS 1.7145 -2.667 1.7145 -4.064 0.1 21 46 | DS 2.0955 -4.064 2.0955 -2.667 0.1 21 47 | DS 2.6 -2.65 2.6 2.65 0.2 21 48 | DS 2.6 2.65 -2.6 2.65 0.2 21 49 | DS -2.6 2.65 -2.6 -2.65 0.2 21 50 | DS -2.6 -2.65 2.6 -2.65 0.2 21 51 | $PAD 52 | Sh "1" R 0.7 2.2 0 0 0 53 | Dr 0 0 0 54 | At SMD N 00888000 55 | Ne 0 "" 56 | Po -1.905 3.81 57 | $EndPAD 58 | $PAD 59 | Sh "2" R 0.7 2.2 0 0 0 60 | Dr 0 0 0 61 | At SMD N 00888000 62 | Ne 0 "" 63 | Po -0.635 3.81 64 | $EndPAD 65 | $PAD 66 | Sh "3" R 0.7 2.2 0 0 0 67 | Dr 0 0 0 68 | At SMD N 00888000 69 | Ne 0 "" 70 | Po 0.635 3.81 71 | $EndPAD 72 | $PAD 73 | Sh "4" R 0.7 2.2 0 0 0 74 | Dr 0 0 0 75 | At SMD N 00888000 76 | Ne 0 "" 77 | Po 1.905 3.81 78 | $EndPAD 79 | $PAD 80 | Sh "5" R 0.7 2.2 0 0 0 81 | Dr 0 0 0 82 | At SMD N 00888000 83 | Ne 0 "" 84 | Po 1.905 -3.81 85 | $EndPAD 86 | $PAD 87 | Sh "6" R 0.7 2.2 0 0 0 88 | Dr 0 0 0 89 | At SMD N 00888000 90 | Ne 0 "" 91 | Po 0.635 -3.81 92 | $EndPAD 93 | $PAD 94 | Sh "7" R 0.7 2.2 0 0 0 95 | Dr 0 0 0 96 | At SMD N 00888000 97 | Ne 0 "" 98 | Po -0.635 -3.81 99 | $EndPAD 100 | $PAD 101 | Sh "8" R 0.7 2.2 0 0 0 102 | Dr 0 0 0 103 | At SMD N 00888000 104 | Ne 0 "" 105 | Po -1.905 -3.81 106 | $EndPAD 107 | $EndMODULE SO8_200mil_wide 108 | $EndLIBRARY 109 | -------------------------------------------------------------------------------- /schematic_pcb/electronic_design_kicad/memotype.pretty/SOT-23.kicad_mod: -------------------------------------------------------------------------------- 1 | (module SMD_Packages:SOT-23 (layer F.Cu) (tedit 546535A3) 2 | (tags SOT23) 3 | (fp_text reference D1 (at 2.286 0.127) (layer F.SilkS) 4 | (effects (font (size 0.65 0.65) (thickness 0.13))) 5 | ) 6 | (fp_text value 3V6 (at 0.0635 0) (layer F.SilkS) 7 | (effects (font (size 0.65 0.65) (thickness 0.13))) 8 | ) 9 | (fp_circle (center -1.17602 0.35052) (end -1.30048 0.44958) (layer F.SilkS) (width 0.07874)) 10 | (fp_line (start 1.27 -0.508) (end 1.27 0.508) (layer F.SilkS) (width 0.07874)) 11 | (fp_line (start -1.3335 -0.508) (end -1.3335 0.508) (layer F.SilkS) (width 0.07874)) 12 | (fp_line (start 1.27 0.508) (end -1.3335 0.508) (layer F.SilkS) (width 0.07874)) 13 | (fp_line (start -1.3335 -0.508) (end 1.27 -0.508) (layer F.SilkS) (width 0.07874)) 14 | (pad 3 smd rect (at 0 -1.09982) (size 0.8001 1.00076) (layers F.Cu F.Paste F.Mask)) 15 | (pad 2 smd rect (at 0.9525 1.09982) (size 0.8001 1.00076) (layers F.Cu F.Paste F.Mask)) 16 | (pad 1 smd rect (at -0.9525 1.09982) (size 0.8001 1.00076) (layers F.Cu F.Paste F.Mask)) 17 | (model smd\SOT23_3.wrl 18 | (at (xyz 0 0 0)) 19 | (scale (xyz 0.4 0.4 0.4)) 20 | (rotate (xyz 0 0 180)) 21 | ) 22 | ) 23 | -------------------------------------------------------------------------------- /schematic_pcb/electronic_design_kicad/memotype.pretty/USB_A.kicad_mod: -------------------------------------------------------------------------------- 1 | (module USB_A (layer F.Cu) (tedit 568D6BC3) 2 | (descr "USB A connector") 3 | (tags "USB USB_A") 4 | (fp_text reference P1 (at 0 -2.35) (layer F.SilkS) 5 | (effects (font (size 1 1) (thickness 0.15))) 6 | ) 7 | (fp_text value USB_A (at 3.83794 7.43458) (layer F.Fab) 8 | (effects (font (size 1 1) (thickness 0.15))) 9 | ) 10 | (fp_line (start -5.3 13.2) (end -5.3 -1.4) (layer F.CrtYd) (width 0.05)) 11 | (fp_line (start 11.95 -1.4) (end 11.95 13.2) (layer F.CrtYd) (width 0.05)) 12 | (fp_line (start -5.3 13.2) (end 11.95 13.2) (layer F.CrtYd) (width 0.05)) 13 | (fp_line (start -5.3 -1.4) (end 11.95 -1.4) (layer F.CrtYd) (width 0.05)) 14 | (fp_line (start 11.04986 -1.14512) (end 11.04986 12.95188) (layer F.SilkS) (width 0.15)) 15 | (fp_line (start -3.93614 12.95188) (end -3.93614 -1.14512) (layer F.SilkS) (width 0.15)) 16 | (fp_line (start 11.04986 -1.14512) (end -3.93614 -1.14512) (layer F.SilkS) (width 0.15)) 17 | (fp_line (start 11.04986 12.95188) (end -3.93614 12.95188) (layer F.SilkS) (width 0.15)) 18 | (pad 1 thru_hole circle (at 7.11286 -0.00212 270) (size 1.50114 1.50114) (drill 1.00076) (layers *.Cu *.Mask F.SilkS)) 19 | (pad 2 thru_hole circle (at 4.57286 -0.00212 270) (size 1.50114 1.50114) (drill 1.00076) (layers *.Cu *.Mask F.SilkS)) 20 | (pad 3 thru_hole circle (at 2.54086 -0.00212 270) (size 1.50114 1.50114) (drill 1.00076) (layers *.Cu *.Mask F.SilkS)) 21 | (pad 4 thru_hole circle (at 0.00086 -0.00212 270) (size 1.50114 1.50114) (drill 1.00076) (layers *.Cu *.Mask F.SilkS)) 22 | (pad 5 thru_hole circle (at 10.16086 2.66488 270) (size 2.99974 2.99974) (drill 2.30124) (layers *.Cu *.Mask F.SilkS)) 23 | (pad 5 thru_hole circle (at -3.55514 2.66488 270) (size 2.99974 2.99974) (drill 2.30124) (layers *.Cu *.Mask F.SilkS)) 24 | (model Connect.3dshapes/USB_A.wrl 25 | (at (xyz 0.14 0 0)) 26 | (scale (xyz 1 1 1)) 27 | (rotate (xyz 0 0 90)) 28 | ) 29 | ) 30 | -------------------------------------------------------------------------------- /schematic_pcb/electronic_design_kicad/memotype.pretty/USB_A_MALE.kicad_mod: -------------------------------------------------------------------------------- 1 | (module USB_A_MALE (layer F.Cu) (tedit 56B093C9) 2 | (descr "USB A connector") 3 | (tags "USB USB_A") 4 | (fp_text reference P1 (at 0 -2) (layer F.SilkS) 5 | (effects (font (size 0.65 0.65) (thickness 0.13))) 6 | ) 7 | (fp_text value USB_A (at 3.83794 2.43458) (layer F.Fab) 8 | (effects (font (size 0.65 0.65) (thickness 0.13))) 9 | ) 10 | (fp_line (start 6.8 0) (end 6.8 -6.5) (layer F.SilkS) (width 0.15)) 11 | (fp_line (start 6.8 -6.5) (end -6.8 -6.5) (layer F.SilkS) (width 0.15)) 12 | (fp_line (start -6.8 -6.5) (end -6.8 0) (layer F.SilkS) (width 0.15)) 13 | (fp_line (start -6.8 0) (end 6.8 0) (layer F.SilkS) (width 0.15)) 14 | (pad "" np_thru_hole circle (at -5.4 -7.5) (size 1.4 1.4) (drill 1.4) (layers *.Cu *.Mask F.SilkS)) 15 | (pad "" np_thru_hole circle (at 5.4 -7.5) (size 1.4 1.4) (drill 1.4) (layers *.Cu *.Mask F.SilkS)) 16 | (pad "" np_thru_hole circle (at 2.3 -2.9) (size 1.2 1.2) (drill 1.2) (layers *.Cu *.Mask F.SilkS)) 17 | (pad "" np_thru_hole circle (at -2.3 -2.9 270) (size 1.2 1.2) (drill 1.2) (layers *.Cu *.Mask F.SilkS)) 18 | (pad 1 thru_hole circle (at 3.5 -5 270) (size 1.5 1.5) (drill 1.00076) (layers *.Cu *.Mask F.SilkS)) 19 | (pad 2 thru_hole circle (at 1 -5 270) (size 1.5 1.5) (drill 1.00076) (layers *.Cu *.Mask F.SilkS)) 20 | (pad 3 thru_hole circle (at -1 -5 270) (size 1.5 1.5) (drill 1.00076) (layers *.Cu *.Mask F.SilkS)) 21 | (pad 4 thru_hole circle (at -3.5 -5 270) (size 1.5 1.5) (drill 1.00076) (layers *.Cu *.Mask F.SilkS)) 22 | (pad 5 thru_hole oval (at 5.85 -2.9) (size 1.1 3) (drill oval 0.6 2.5) (layers *.Cu *.Mask F.SilkS)) 23 | (pad 5 thru_hole oval (at -5.85 -2.9) (size 1.1 3) (drill oval 0.6 2.5) (layers *.Cu *.Mask F.SilkS)) 24 | (model ../../../../../home/borrego/memtype/schematic_pcb/electronic_design_kicad/shapes3D/usbtypeA.wrl 25 | (at (xyz 0 -0.2 0)) 26 | (scale (xyz 4 4 4)) 27 | (rotate (xyz 90 180 180)) 28 | ) 29 | ) 30 | -------------------------------------------------------------------------------- /schematic_pcb/electronic_design_kicad/memotype.pretty/USB_A_MALE_case_13mm.kicad_mod: -------------------------------------------------------------------------------- 1 | (module USB_A_MALE_case_13mm (layer F.Cu) (tedit 56924E26) 2 | (descr "USB A connector") 3 | (tags "USB USB_A") 4 | (fp_text reference P1 (at 0 -2) (layer F.SilkS) 5 | (effects (font (size 0.65 0.65) (thickness 0.13))) 6 | ) 7 | (fp_text value USB_A (at 3.83794 2.43458) (layer F.Fab) 8 | (effects (font (size 0.65 0.65) (thickness 0.13))) 9 | ) 10 | (fp_line (start 6.5 0) (end 6.5 -6.5) (layer F.SilkS) (width 0.15)) 11 | (fp_line (start 6.5 -6.5) (end -6.5 -6.5) (layer F.SilkS) (width 0.15)) 12 | (fp_line (start -6.5 -6.5) (end -6.5 0) (layer F.SilkS) (width 0.15)) 13 | (fp_line (start -6.5 0) (end 6.5 0) (layer F.SilkS) (width 0.15)) 14 | (pad "" thru_hole circle (at -5.4 -7.5) (size 1.4 1.4) (drill 1.4) (layers *.Cu *.Mask F.SilkS)) 15 | (pad "" thru_hole circle (at 5.4 -7.5) (size 1.4 1.4) (drill 1.4) (layers *.Cu *.Mask F.SilkS)) 16 | (pad "" thru_hole circle (at 2.3 -2.9) (size 1.2 1.2) (drill 1.2) (layers *.Cu *.Mask F.SilkS)) 17 | (pad "" thru_hole circle (at -2.3 -2.9 270) (size 1.2 1.2) (drill 1.2) (layers *.Cu *.Mask F.SilkS)) 18 | (pad 1 thru_hole circle (at 3.5 -5 270) (size 1.5 1.5) (drill 1.00076) (layers *.Cu *.Mask F.SilkS)) 19 | (pad 2 thru_hole circle (at 1 -5 270) (size 1.5 1.5) (drill 1.00076) (layers *.Cu *.Mask F.SilkS)) 20 | (pad 3 thru_hole circle (at -1 -5 270) (size 1.5 1.5) (drill 1.00076) (layers *.Cu *.Mask F.SilkS)) 21 | (pad 4 thru_hole circle (at -3.5 -5 270) (size 1.5 1.5) (drill 1.00076) (layers *.Cu *.Mask F.SilkS)) 22 | (pad 5 thru_hole oval (at 5.85 -2.9) (size 1.1 3) (drill oval 0.6 2.5) (layers *.Cu *.Mask F.SilkS)) 23 | (pad 5 thru_hole oval (at -5.85 -2.9) (size 1.1 3) (drill oval 0.6 2.5) (layers *.Cu *.Mask F.SilkS)) 24 | (model Connect.3dshapes/USB_A.wrl 25 | (at (xyz 0 0.2 0)) 26 | (scale (xyz 1 1 1)) 27 | (rotate (xyz 0 0 90)) 28 | ) 29 | ) 30 | -------------------------------------------------------------------------------- /schematic_pcb/electronic_design_kicad/memotype.pretty/usbA_std_pcb.kicad_mod: -------------------------------------------------------------------------------- 1 | (module projectLib:usbA_std_pcb (layer F.Cu) (tedit 5465364E) 2 | (descr "http://www.usb.org/developers/docs/ecn1.pdf Figure 6-13 .") 3 | (fp_text reference P1 (at 11.049 5.08) (layer F.SilkS) 4 | (effects (font (size 0.65 0.65) (thickness 0.13))) 5 | ) 6 | (fp_text value USB (at 4.699 5.08) (layer F.SilkS) 7 | (effects (font (size 0.65 0.65) (thickness 0.13))) 8 | ) 9 | (fp_line (start 0 -6) (end 11.75 -6) (layer F.SilkS) (width 0.15)) 10 | (fp_line (start 11.75 6) (end 0 6) (layer F.SilkS) (width 0.15)) 11 | (fp_line (start 0 6) (end 0 -6) (layer F.SilkS) (width 0.15)) 12 | (pad 1 smd rect (at 4.945 3.5) (size 7.41 1) (layers F.Cu F.Mask)) 13 | (pad 2 smd rect (at 5.445 1) (size 6.41 1) (layers F.Cu F.Mask)) 14 | (pad 3 smd rect (at 5.445 -1) (size 6.41 1) (layers F.Cu F.Mask)) 15 | (pad 4 smd rect (at 4.945 -3.5) (size 7.41 1) (layers F.Cu F.Mask)) 16 | ) 17 | -------------------------------------------------------------------------------- /schematic_pcb/electronic_design_kicad/shapes3D/SOT-23_Inv.wrl: -------------------------------------------------------------------------------- 1 | #VRML V2.0 utf8 2 | #Exported from Wings 3D 0.98.34 3 | DEF cube1 Transform { 4 | children [ 5 | Shape { 6 | appearance Appearance { 7 | material DEF couleur_035_032_032 Material { 8 | diffuseColor 0.140000 0.128736 0.128736 9 | emissiveColor 0.00000e+0 0.00000e+0 0.00000e+0 10 | specularColor 1.00000 1.00000 1.00000 11 | ambientIntensity 1.00000 12 | transparency 0.00000e+0 13 | shininess 1.00000 14 | } 15 | } 16 | geometry IndexedFaceSet { 17 | normalPerVertex TRUE 18 | colorPerVertex TRUE 19 | coord Coordinate { point [ 20 | -1.37750 -0.754558 6.47140e-2, 21 | -1.37750 -0.754558 1.08971, 22 | 1.37750 -0.754558 1.08971, 23 | 1.37750 -0.754558 6.47140e-2, 24 | -1.37750 0.754615 6.47140e-2, 25 | -1.37750 0.754615 1.08971, 26 | 1.37750 0.754615 1.08971, 27 | 1.37750 0.754615 6.47140e-2, 28 | 1.45000 -0.804558 0.649714, 29 | 1.45000 0.804615 0.649714, 30 | -1.45000 -0.804558 0.649714, 31 | -1.45000 0.804615 0.649714 ] } 32 | coordIndex [ 33 | 0, 3, 8, 10, -1, 34 | 0, 4, 7, 3, -1, 35 | 0, 10, 11, 4, -1, 36 | 1, 2, 6, 5, -1, 37 | 1, 5, 11, 10, -1, 38 | 1, 10, 8, 2, -1, 39 | 2, 8, 9, 6, -1, 40 | 3, 7, 9, 8, -1, 41 | 4, 11, 9, 7, -1, 42 | 5, 6, 9, 11, -1 ] 43 | normal Normal { vector [ 44 | -0.535285 -0.537420 -0.651652, 45 | -0.520925 -0.524573 0.673394, 46 | 0.520925 -0.524573 0.673394, 47 | 0.535285 -0.537420 -0.651652, 48 | -0.535285 0.537420 -0.651652, 49 | -0.520925 0.524573 0.673394, 50 | 0.520925 0.524573 0.673394, 51 | 0.535285 0.537420 -0.651652, 52 | 0.704965 -0.708837 2.39867e-2, 53 | 0.704965 0.708837 2.39867e-2, 54 | -0.704965 -0.708837 2.39867e-2, 55 | -0.704965 0.708837 2.39867e-2 ] } 56 | normalIndex [ 57 | 0, 3, 8, 10, -1, 58 | 0, 4, 7, 3, -1, 59 | 0, 10, 11, 4, -1, 60 | 1, 2, 6, 5, -1, 61 | 1, 5, 11, 10, -1, 62 | 1, 10, 8, 2, -1, 63 | 2, 8, 9, 6, -1, 64 | 3, 7, 9, 8, -1, 65 | 4, 11, 9, 7, -1, 66 | 5, 6, 9, 11, -1 ] 67 | color Color { color [ 68 | 0.140000 0.128736 0.128736, 69 | 0.820000 0.754023 0.754023, 70 | 1.00000 1.00000 1.00000 ] } 71 | colorIndex [ 72 | 0, 0, 0, 0, -1, 73 | 0, 0, 0, 0, -1, 74 | 0, 0, 0, 0, -1, 75 | 0, 0, 0, 0, -1, 76 | 0, 0, 0, 0, -1, 77 | 0, 0, 0, 0, -1, 78 | 0, 0, 0, 0, -1, 79 | 0, 0, 0, 0, -1, 80 | 0, 0, 0, 0, -1, 81 | 0, 0, 0, 0, -1 ] 82 | } 83 | }, 84 | Shape { 85 | appearance Appearance { 86 | material DEF couleur_209_193_193 Material { 87 | diffuseColor 0.820000 0.754023 0.754023 88 | emissiveColor 0.00000e+0 0.00000e+0 0.00000e+0 89 | specularColor 1.00000 1.00000 1.00000 90 | ambientIntensity 1.00000 91 | transparency 0.00000e+0 92 | shininess 1.00000 93 | } 94 | } 95 | geometry IndexedFaceSet { 96 | normalPerVertex TRUE 97 | colorPerVertex TRUE 98 | coord Coordinate { point [ 99 | 1.15000 1.37647 -1.02860e-2, 100 | 1.15000 1.37647 0.189714, 101 | 0.750000 1.37647 0.189714, 102 | 0.750000 1.37647 -1.02860e-2, 103 | 1.15000 0.507082 0.582523, 104 | 1.15000 0.598383 0.782523, 105 | 0.750000 0.598383 0.782523, 106 | 0.750000 0.507082 0.582523, 107 | 0.750000 1.07647 -1.02860e-2, 108 | 0.750000 1.16777 0.189714, 109 | 1.15000 1.16777 0.189714, 110 | 1.15000 1.07647 -1.02860e-2, 111 | -0.750000 1.37647 -1.02860e-2, 112 | -0.750000 1.37647 0.189714, 113 | -1.15000 1.37647 0.189714, 114 | -1.15000 1.37647 -1.02860e-2, 115 | -0.750000 0.507082 0.582523, 116 | -0.750000 0.598383 0.782523, 117 | -1.15000 0.598383 0.782523, 118 | -1.15000 0.507082 0.582523, 119 | -1.15000 1.07647 -1.02860e-2, 120 | -1.15000 1.16777 0.189714, 121 | -0.750000 1.16777 0.189714, 122 | -0.750000 1.07647 -1.02860e-2, 123 | -0.200000 -1.37647 -1.02860e-2, 124 | -0.200000 -1.37647 0.189714, 125 | 0.200000 -1.37647 0.189714, 126 | 0.200000 -1.37647 -1.02860e-2, 127 | -0.200000 -0.507082 0.582523, 128 | -0.200000 -0.598383 0.782523, 129 | 0.200000 -0.598383 0.782523, 130 | 0.200000 -0.507082 0.582523, 131 | 0.200000 -1.07647 -1.02860e-2, 132 | 0.200000 -1.16777 0.189714, 133 | -0.200000 -1.16777 0.189714, 134 | -0.200000 -1.07647 -1.02860e-2 ] } 135 | coordIndex [ 136 | 0, 1, 10, 11, -1, 137 | 0, 3, 2, 1, -1, 138 | 0, 11, 8, 3, -1, 139 | 1, 2, 9, 10, -1, 140 | 2, 3, 8, 9, -1, 141 | 4, 5, 6, 7, -1, 142 | 4, 7, 8, 11, -1, 143 | 4, 11, 10, 5, -1, 144 | 5, 10, 9, 6, -1, 145 | 6, 9, 8, 7, -1, 146 | 12, 13, 22, 23, -1, 147 | 12, 15, 14, 13, -1, 148 | 12, 23, 20, 15, -1, 149 | 13, 14, 21, 22, -1, 150 | 14, 15, 20, 21, -1, 151 | 16, 17, 18, 19, -1, 152 | 16, 19, 20, 23, -1, 153 | 16, 23, 22, 17, -1, 154 | 17, 22, 21, 18, -1, 155 | 18, 21, 20, 19, -1, 156 | 24, 25, 34, 35, -1, 157 | 24, 27, 26, 25, -1, 158 | 24, 35, 32, 27, -1, 159 | 25, 26, 33, 34, -1, 160 | 26, 27, 32, 33, -1, 161 | 28, 29, 30, 31, -1, 162 | 28, 31, 32, 35, -1, 163 | 28, 35, 34, 29, -1, 164 | 29, 34, 33, 30, -1, 165 | 30, 33, 32, 31, -1 ] 166 | normal Normal { vector [ 167 | 0.577350 0.577350 -0.577350, 168 | 0.577350 0.577350 0.577350, 169 | -0.577350 0.577350 0.577350, 170 | -0.577350 0.577350 -0.577350, 171 | 0.517308 -0.843679 -0.143520, 172 | 0.664722 -0.125289 0.736511, 173 | -0.664722 -0.125289 0.736511, 174 | -0.517308 -0.843679 -0.143520, 175 | -0.735939 -0.265383 -0.622869, 176 | -0.735939 0.265383 0.622869, 177 | 0.735939 0.265383 0.622869, 178 | 0.735939 -0.265383 -0.622869, 179 | 0.577350 0.577350 -0.577350, 180 | 0.577350 0.577350 0.577350, 181 | -0.577350 0.577350 0.577350, 182 | -0.577350 0.577350 -0.577350, 183 | 0.517308 -0.843679 -0.143520, 184 | 0.664722 -0.125289 0.736511, 185 | -0.664722 -0.125289 0.736511, 186 | -0.517308 -0.843679 -0.143520, 187 | -0.735939 -0.265383 -0.622869, 188 | -0.735939 0.265383 0.622869, 189 | 0.735939 0.265383 0.622869, 190 | 0.735939 -0.265383 -0.622869, 191 | -0.577350 -0.577350 -0.577350, 192 | -0.577350 -0.577350 0.577350, 193 | 0.577350 -0.577350 0.577350, 194 | 0.577350 -0.577350 -0.577350, 195 | -0.517308 0.843679 -0.143520, 196 | -0.664722 0.125289 0.736511, 197 | 0.664722 0.125289 0.736511, 198 | 0.517308 0.843679 -0.143520, 199 | 0.735939 0.265383 -0.622869, 200 | 0.735939 -0.265383 0.622869, 201 | -0.735939 -0.265383 0.622869, 202 | -0.735939 0.265383 -0.622869 ] } 203 | normalIndex [ 204 | 0, 1, 10, 11, -1, 205 | 0, 3, 2, 1, -1, 206 | 0, 11, 8, 3, -1, 207 | 1, 2, 9, 10, -1, 208 | 2, 3, 8, 9, -1, 209 | 4, 5, 6, 7, -1, 210 | 4, 7, 8, 11, -1, 211 | 4, 11, 10, 5, -1, 212 | 5, 10, 9, 6, -1, 213 | 6, 9, 8, 7, -1, 214 | 12, 13, 22, 23, -1, 215 | 12, 15, 14, 13, -1, 216 | 12, 23, 20, 15, -1, 217 | 13, 14, 21, 22, -1, 218 | 14, 15, 20, 21, -1, 219 | 16, 17, 18, 19, -1, 220 | 16, 19, 20, 23, -1, 221 | 16, 23, 22, 17, -1, 222 | 17, 22, 21, 18, -1, 223 | 18, 21, 20, 19, -1, 224 | 24, 25, 34, 35, -1, 225 | 24, 27, 26, 25, -1, 226 | 24, 35, 32, 27, -1, 227 | 25, 26, 33, 34, -1, 228 | 26, 27, 32, 33, -1, 229 | 28, 29, 30, 31, -1, 230 | 28, 31, 32, 35, -1, 231 | 28, 35, 34, 29, -1, 232 | 29, 34, 33, 30, -1, 233 | 30, 33, 32, 31, -1 ] 234 | color Color { color [ 235 | 0.140000 0.128736 0.128736, 236 | 0.820000 0.754023 0.754023, 237 | 1.00000 1.00000 1.00000 ] } 238 | colorIndex [ 239 | 1, 1, 1, 1, -1, 240 | 1, 1, 1, 1, -1, 241 | 1, 1, 1, 1, -1, 242 | 1, 1, 1, 1, -1, 243 | 1, 1, 1, 1, -1, 244 | 1, 1, 1, 1, -1, 245 | 1, 1, 1, 1, -1, 246 | 1, 1, 1, 1, -1, 247 | 1, 1, 1, 1, -1, 248 | 1, 1, 1, 1, -1, 249 | 1, 1, 1, 1, -1, 250 | 1, 1, 1, 1, -1, 251 | 1, 1, 1, 1, -1, 252 | 1, 1, 1, 1, -1, 253 | 1, 1, 1, 1, -1, 254 | 1, 1, 1, 1, -1, 255 | 1, 1, 1, 1, -1, 256 | 1, 1, 1, 1, -1, 257 | 1, 1, 1, 1, -1, 258 | 1, 1, 1, 1, -1, 259 | 1, 1, 1, 1, -1, 260 | 1, 1, 1, 1, -1, 261 | 1, 1, 1, 1, -1, 262 | 1, 1, 1, 1, -1, 263 | 1, 1, 1, 1, -1, 264 | 1, 1, 1, 1, -1, 265 | 1, 1, 1, 1, -1, 266 | 1, 1, 1, 1, -1, 267 | 1, 1, 1, 1, -1, 268 | 1, 1, 1, 1, -1 ] 269 | } 270 | } 271 | ] 272 | } 273 | 274 | -------------------------------------------------------------------------------- /schematic_pcb/electronic_design_kicad/shapes3D/chip_cms.wrl: -------------------------------------------------------------------------------- 1 | #VRML V2.0 utf8 2 | #Exported from Wings 3D 0.98.36 3 | DEF cube1 Transform { 4 | children [ 5 | Shape { 6 | appearance Appearance { 7 | material DEF GRAY Material { 8 | diffuseColor 0.493333 0.493333 0.493333 9 | emissiveColor 0.00000e+0 0.00000e+0 0.00000e+0 10 | specularColor 1.00000 1.00000 1.00000 11 | ambientIntensity 1.00000 12 | transparency 0.00000e+0 13 | shininess 1.00000 14 | } 15 | } 16 | geometry IndexedFaceSet { 17 | normalPerVertex TRUE 18 | coord Coordinate { point [ 19 | 3.84064 -2.09508 2.40553e-2, 20 | 3.84065 2.22492 2.40553e-2, 21 | -3.83485 -2.09507 2.40447e-2, 22 | -3.83485 2.22493 2.40447e-2, 23 | 3.84064 -2.09508 1.74406, 24 | 3.84065 2.22492 1.74406, 25 | -3.83485 -2.09507 1.74404, 26 | -3.83485 2.22493 1.74404, 27 | 3.57240 -1.79268 2.02405, 28 | 3.57241 1.92252 2.02405, 29 | -3.56661 1.92253 2.02405, 30 | -3.56661 -1.79267 2.02405 ] } 31 | coordIndex [ 32 | 0, 1, 5, 4, -1, 33 | 0, 2, 3, 1, -1, 34 | 0, 4, 6, 2, -1, 35 | 1, 3, 7, 5, -1, 36 | 2, 6, 7, 3, -1, 37 | 4, 5, 9, 8, -1, 38 | 4, 8, 11, 6, -1, 39 | 5, 7, 10, 9, -1, 40 | 6, 11, 10, 7, -1, 41 | 8, 9, 10, 11, -1 ] 42 | normal Normal { vector [ 43 | 0.577350 -0.577351 -0.577350, 44 | 0.577352 0.577350 -0.577349, 45 | -0.577350 -0.577350 -0.577351, 46 | -0.577349 0.577351 -0.577351, 47 | 0.615893 -0.600624 0.509831, 48 | 0.615894 0.600622 0.509831, 49 | -0.615896 -0.600622 0.509829, 50 | -0.615894 0.600624 0.509829, 51 | 0.275574 -0.259281 0.925652, 52 | 0.275575 0.259280 0.925652, 53 | -0.275577 0.259281 0.925652, 54 | -0.275578 -0.259280 0.925652 ] } 55 | normalIndex [ 56 | 0, 1, 5, 4, -1, 57 | 0, 2, 3, 1, -1, 58 | 0, 4, 6, 2, -1, 59 | 1, 3, 7, 5, -1, 60 | 2, 6, 7, 3, -1, 61 | 4, 5, 9, 8, -1, 62 | 4, 8, 11, 6, -1, 63 | 5, 7, 10, 9, -1, 64 | 6, 11, 10, 7, -1, 65 | 8, 9, 10, 11, -1 ] 66 | } 67 | }, 68 | Shape { 69 | appearance Appearance { 70 | material DEF metal Material { 71 | diffuseColor 1.00000 1.00000 0.786667 72 | emissiveColor 0.00000e+0 0.00000e+0 0.00000e+0 73 | specularColor 1.00000 1.00000 1.00000 74 | ambientIntensity 0.922222 75 | transparency 0.00000e+0 76 | shininess 1.00000 77 | } 78 | } 79 | geometry IndexedFaceSet { 80 | normalPerVertex TRUE 81 | coord Coordinate { point [ 82 | -3.83868 -1.87907 2.40447e-2, 83 | -3.83869 -1.87907 1.72404, 84 | -3.83868 2.00893 1.72404, 85 | -3.83868 2.00893 2.40447e-2, 86 | -4.33493 -1.87907 2.40440e-2, 87 | -4.33492 2.00893 2.40440e-2, 88 | -4.04715 -1.87907 1.72404, 89 | -4.33493 -1.87907 1.42364, 90 | -4.04714 2.00893 1.72404, 91 | -4.33492 2.00893 1.42364, 92 | 4.33306 -1.87908 2.40560e-2, 93 | 4.33306 2.00892 2.40560e-2, 94 | 3.83298 -1.87908 2.40553e-2, 95 | 3.83298 -1.87908 1.72406, 96 | 3.83298 2.00892 1.72406, 97 | 3.83299 2.00892 2.40553e-2, 98 | 4.33306 -1.87908 1.42326, 99 | 4.04489 -1.87908 1.72406, 100 | 4.33306 2.00892 1.42326, 101 | 4.04489 2.00892 1.72406 ] } 102 | coordIndex [ 103 | 0, 1, 6, 7, 4, -1, 104 | 0, 3, 2, 1, -1, 105 | 0, 4, 5, 3, -1, 106 | 1, 2, 8, 6, -1, 107 | 2, 3, 5, 9, 8, -1, 108 | 4, 7, 9, 5, -1, 109 | 6, 8, 9, 7, -1, 110 | 10, 11, 18, 16, -1, 111 | 10, 12, 15, 11, -1, 112 | 10, 16, 17, 13, 12, -1, 113 | 11, 15, 14, 19, 18, -1, 114 | 12, 13, 14, 15, -1, 115 | 13, 17, 19, 14, -1, 116 | 16, 18, 19, 17, -1 ] 117 | normal Normal { vector [ 118 | 0.577350 -0.577351 -0.577350, 119 | 0.577349 -0.577351 0.577351, 120 | 0.577350 0.577350 0.577351, 121 | 0.577352 0.577350 -0.577349, 122 | -0.577350 -0.577350 -0.577351, 123 | -0.577349 0.577351 -0.577351, 124 | -0.344898 -0.477624 0.808035, 125 | -0.816890 -0.474353 0.328147, 126 | -0.344897 0.477625 0.808035, 127 | -0.816888 0.474355 0.328147, 128 | 0.577350 -0.577351 -0.577350, 129 | 0.577352 0.577350 -0.577349, 130 | -0.577350 -0.577350 -0.577351, 131 | -0.577352 -0.577350 0.577349, 132 | -0.577350 0.577351 0.577350, 133 | -0.577349 0.577351 -0.577351, 134 | 0.816888 -0.474355 0.328150, 135 | 0.344895 -0.477625 0.808036, 136 | 0.816889 0.474353 0.328149, 137 | 0.344896 0.477624 0.808036 ] } 138 | normalIndex [ 139 | 0, 1, 6, 7, 4, -1, 140 | 0, 3, 2, 1, -1, 141 | 0, 4, 5, 3, -1, 142 | 1, 2, 8, 6, -1, 143 | 2, 3, 5, 9, 8, -1, 144 | 4, 7, 9, 5, -1, 145 | 6, 8, 9, 7, -1, 146 | 10, 11, 18, 16, -1, 147 | 10, 12, 15, 11, -1, 148 | 10, 16, 17, 13, 12, -1, 149 | 11, 15, 14, 19, 18, -1, 150 | 12, 13, 14, 15, -1, 151 | 13, 17, 19, 14, -1, 152 | 16, 18, 19, 17, -1 ] 153 | } 154 | } 155 | ] 156 | } 157 | 158 | -------------------------------------------------------------------------------- /schematic_pcb/electronic_design_kicad/zenerdual.dcm: -------------------------------------------------------------------------------- 1 | EESchema-DOCLIB Version 2.0 2 | # 3 | #End Doc Library 4 | -------------------------------------------------------------------------------- /schematic_pcb/electronic_design_kicad/zenerdual.lib: -------------------------------------------------------------------------------- 1 | EESchema-LIBRARY Version 2.3 2 | #encoding utf-8 3 | # 4 | # +5V 5 | # 6 | DEF +5V #PWR 0 40 Y Y 1 F P 7 | F0 "#PWR" 0 90 20 H I C CNN 8 | F1 "+5V" 0 90 30 H V C CNN 9 | F2 "" 0 0 60 H V C CNN 10 | F3 "" 0 0 60 H V C CNN 11 | DRAW 12 | X +5V 1 0 0 0 U 20 20 0 0 W N 13 | C 0 50 20 0 1 0 N 14 | P 4 0 1 0 0 0 0 30 0 30 0 30 N 15 | ENDDRAW 16 | ENDDEF 17 | # 18 | # ATTINY25-S 19 | # 20 | DEF ATTINY25-S IC 0 40 Y Y 1 F N 21 | F0 "IC" -1150 400 40 H V C CNN 22 | F1 "ATTINY25-S" 1000 -400 40 H V C CNN 23 | F2 "SO8-200" 950 0 35 H V C CIN 24 | F3 "" 0 0 60 H V C CNN 25 | ALIAS ATTINY45-S ATTINY85-S 26 | DRAW 27 | S -1200 350 1200 -350 0 1 10 f 28 | X PB5(~RESET~/dW/ADC0/PCINT5) 1 -1350 -250 150 R 40 40 1 1 B 29 | X PB3(XTAL1/CLKI/OC1B/ADC3/PCINT3) 2 -1350 -50 150 R 40 40 1 1 B 30 | X PB4(XTAL2/CLKO/OC1B/ADC2/PCINT4) 3 -1350 -150 150 R 40 40 1 1 B 31 | X GND 4 1350 -250 150 L 40 40 1 1 W 32 | X PB0(MOSI/DI/SDA/AIN0/OC0A/OC1A/AREF/PCINT0) 5 -1350 250 150 R 40 40 1 1 B 33 | X PB1(MISO/DO/AIN1/OC0B/OC1A/PCINT1) 6 -1350 150 150 R 40 40 1 1 B 34 | X PB2(SCK/USCK/SCL/T0/INT0/ADC1/PCINT2) 7 -1350 50 150 R 40 40 1 1 B 35 | X VCC 8 1350 250 150 L 40 40 1 1 W 36 | ENDDRAW 37 | ENDDEF 38 | # 39 | # C 40 | # 41 | DEF C C 0 10 N Y 1 F N 42 | F0 "C" 0 100 40 H V L CNN 43 | F1 "C" 6 -85 40 H V L CNN 44 | F2 "" 38 -150 30 H V C CNN 45 | F3 "" 0 0 60 H V C CNN 46 | $FPLIST 47 | SM* 48 | C? 49 | C1-1 50 | $ENDFPLIST 51 | DRAW 52 | P 2 0 1 20 -80 -30 80 -30 N 53 | P 2 0 1 20 -80 30 80 30 N 54 | X ~ 1 0 200 170 D 40 40 1 1 P 55 | X ~ 2 0 -200 170 U 40 40 1 1 P 56 | ENDDRAW 57 | ENDDEF 58 | # 59 | # CONN_4 60 | # 61 | DEF CONN_4 P 0 40 Y N 1 F N 62 | F0 "P" -50 0 50 V V C CNN 63 | F1 "CONN_4" 50 0 50 V V C CNN 64 | F2 "" 0 0 60 H V C CNN 65 | F3 "" 0 0 60 H V C CNN 66 | DRAW 67 | S -100 200 100 -200 0 1 0 N 68 | X P1 1 -350 150 250 R 50 50 1 1 P I 69 | X P2 2 -350 50 250 R 50 50 1 1 P I 70 | X P3 3 -350 -50 250 R 50 50 1 1 P I 71 | X P4 4 -350 -150 250 R 50 50 1 1 P I 72 | ENDDRAW 73 | ENDDEF 74 | # 75 | # CONN_5 76 | # 77 | DEF CONN_5 P 0 40 Y Y 1 F N 78 | F0 "P" -50 0 50 V V C CNN 79 | F1 "CONN_5" 50 0 50 V V C CNN 80 | F2 "" 0 0 60 H V C CNN 81 | F3 "" 0 0 60 H V C CNN 82 | DRAW 83 | S -100 250 100 -250 0 1 0 f 84 | X ~ 1 -400 200 300 R 60 60 1 1 P I 85 | X ~ 2 -400 100 300 R 60 60 1 1 P I 86 | X ~ 3 -400 0 300 R 60 60 1 1 P I 87 | X ~ 4 -400 -100 300 R 60 60 1 1 P I 88 | X ~ 5 -400 -200 300 R 60 60 1 1 P I 89 | ENDDRAW 90 | ENDDEF 91 | # 92 | # DGND 93 | # 94 | DEF DGND #PWR 0 40 Y Y 1 F P 95 | F0 "#PWR" 0 0 40 H I C CNN 96 | F1 "DGND" 0 -70 40 H V C CNN 97 | F2 "" 0 0 60 H V C CNN 98 | F3 "" 0 0 60 H V C CNN 99 | DRAW 100 | P 4 0 1 0 -50 0 0 -50 50 0 -50 0 N 101 | X DGND 1 0 0 0 U 40 40 1 1 W N 102 | ENDDRAW 103 | ENDDEF 104 | # 105 | # GND 106 | # 107 | DEF ~GND #PWR 0 0 Y Y 1 F P 108 | F0 "#PWR" 0 0 30 H I C CNN 109 | F1 "GND" 0 -70 30 H I C CNN 110 | F2 "" 0 0 60 H V C CNN 111 | F3 "" 0 0 60 H V C CNN 112 | DRAW 113 | P 4 0 1 0 -50 0 0 -50 50 0 -50 0 N 114 | X GND 1 0 0 0 U 30 30 1 1 W N 115 | ENDDRAW 116 | ENDDEF 117 | # 118 | # R 119 | # 120 | DEF R R 0 0 N Y 1 F N 121 | F0 "R" 80 0 40 V V C CNN 122 | F1 "R" 7 1 40 V V C CNN 123 | F2 "" -70 0 30 V V C CNN 124 | F3 "" 0 0 30 H V C CNN 125 | $FPLIST 126 | R? 127 | SM0603 128 | SM0805 129 | R?-* 130 | SM1206 131 | $ENDFPLIST 132 | DRAW 133 | S -40 150 40 -150 0 1 12 N 134 | X ~ 1 0 250 100 D 60 60 1 1 P 135 | X ~ 2 0 -250 100 U 60 60 1 1 P 136 | ENDDRAW 137 | ENDDEF 138 | # 139 | # ZENER 140 | # 141 | DEF ZENER D 0 40 N N 1 F N 142 | F0 "D" 0 100 50 H V C CNN 143 | F1 "ZENER" 0 -100 40 H V C CNN 144 | F2 "" 0 0 60 H V C CNN 145 | F3 "" 0 0 60 H V C CNN 146 | $FPLIST 147 | D? 148 | SO* 149 | SM* 150 | $ENDFPLIST 151 | DRAW 152 | P 5 0 1 0 50 0 -50 50 -50 -50 50 0 50 0 F 153 | P 5 0 1 8 70 50 50 30 50 -30 30 -50 30 -50 N 154 | X A 1 -200 0 150 R 40 40 1 1 P 155 | X K 2 200 0 150 L 40 40 1 1 P 156 | ENDDRAW 157 | ENDDEF 158 | # 159 | # ZENER_DUAL 160 | # 161 | DEF ZENER_DUAL D 0 40 N N 1 F N 162 | F0 "D" -200 -150 50 H V C CNN 163 | F1 "ZENER_DUAL" 100 -150 40 H V C CNN 164 | F2 "" 0 0 60 H V C CNN 165 | F3 "" 0 0 60 H V C CNN 166 | $FPLIST 167 | D? 168 | SO* 169 | SM* 170 | $ENDFPLIST 171 | DRAW 172 | S -200 300 150 -100 0 1 0 f 173 | P 2 0 1 0 -150 100 -100 100 N 174 | P 4 0 1 0 -50 200 -100 200 -100 0 -50 0 N 175 | P 5 0 1 0 50 0 -50 50 -50 -50 50 0 50 0 F 176 | P 5 0 1 0 50 200 -50 250 -50 150 50 200 50 200 F 177 | P 5 0 1 8 70 50 50 30 50 -30 30 -50 30 -50 N 178 | P 5 0 1 8 70 250 50 230 50 170 30 150 30 150 N 179 | X K 2 200 0 150 L 40 40 1 1 P 180 | X K 2 200 200 150 L 40 40 1 1 P 181 | X A 3 -300 100 150 R 40 40 1 1 P 182 | ENDDRAW 183 | ENDDEF 184 | # 185 | #End Library 186 | -------------------------------------------------------------------------------- /supportedDevices.txt: -------------------------------------------------------------------------------- 1 | ### PC - Linux 2 | working, exceptions: 3 | 4 | ### PC - MacOSX 5 | working, exceptions: 6 | 7 | ### PC - Windows 8 | working, exceptions: 9 | 10 | ### Android 11 | Versions Supported: 12 | 4.2.2 - rk3066 nimbo.tv dongle 13 | 4.4 - Motorola MotoG 14 | 15 | 16 | -------------------------------------------------------------------------------- /tools/Keyboard-layouts.ods: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jim17/memtype/a0345bc36f89930d7b0ac9f7d2380710c5fc1db0/tools/Keyboard-layouts.ods -------------------------------------------------------------------------------- /tools/mn_linux: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jim17/memtype/a0345bc36f89930d7b0ac9f7d2380710c5fc1db0/tools/mn_linux -------------------------------------------------------------------------------- /tools/mn_osx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jim17/memtype/a0345bc36f89930d7b0ac9f7d2380710c5fc1db0/tools/mn_osx -------------------------------------------------------------------------------- /ucp.c: -------------------------------------------------------------------------------- 1 | #include "ucp.h" 2 | #include "usi.h" 3 | #include "uif.h" 4 | #include "version.h" 5 | #include "crd.h" 6 | #include "fls.h" 7 | #include "hid_defines.h" 8 | 9 | #include 10 | #include 11 | #include 12 | 13 | /* public variables */ 14 | uint8_t UCP_state; 15 | ucp_pkt_t customReport; 16 | 17 | volatile uint8_t tempBuff[SPM_PAGESIZE]; 18 | volatile uint16_t flashWriteAddr; 19 | volatile uint8_t buffIndex; 20 | volatile uint8_t usbWrite = 0; 21 | volatile uint8_t usbWriteAccepted = 0; 22 | volatile uint8_t lockAfterSetPin=0; 23 | 24 | /* INFO Data, the first byte is for cmd */ 25 | typedef struct 26 | { 27 | uint8_t versionMajor; 28 | uint8_t versionMinor; 29 | uint8_t versionPatch; 30 | uint16_t credSize; 31 | uint16_t dummy; 32 | 33 | } info_t; 34 | 35 | const info_t INFO_data PROGMEM ={ 36 | .versionMajor = MEMTYPE_VERSION_MAJOR,.versionMinor = MEMTYPE_VERSION_MINOR,.versionPatch = MEMTYPE_VERSION_PATCH,.credSize = MAX_CRED_FLASH_SIZE,.dummy = 0 37 | }; 38 | 39 | //READ COMMAND variables 40 | uint16_t readOffset=0; 41 | uint16_t readEnd=0; 42 | uint8_t readType = 0; // 0 - Flash, 1 - RAM 43 | 44 | void UCP_Init(void){ 45 | UCP_state = DEVICE_LOCKED; 46 | return; //nothing to do yet ;) 47 | } 48 | 49 | void UCP_Task(void){ 50 | switch(UCP_state) 51 | { 52 | 53 | case WRITE_EEPROM: 54 | case IDLE: 55 | case DEVICE_LOCKED: 56 | break; 57 | case READING_CMD: 58 | UCP_state++; 59 | break; 60 | case READING: 61 | if(readOffset < readEnd) 62 | { 63 | if(readType==0) { 64 | memcpy_P((void*)&customReport.buf, (void*)(credentials+readOffset), 8); 65 | } 66 | else if (readType==1) { 67 | memcpy((void*)&customReport.buf, (void*)(readOffset), 8); 68 | } 69 | else /*if(readType==2)*/ { 70 | eeprom_read_block((void*)&customReport.buf, (void*)(readOffset), 8); 71 | } 72 | readOffset += 8; 73 | if(readOffset >= readEnd) 74 | { 75 | UCP_state = IDLE; 76 | } 77 | } 78 | else 79 | { 80 | UCP_state = IDLE; 81 | customReport.buf[0] = UCP_CMD_ERROR; 82 | customReport.buf[1] = UCP_ERR_PROTOCOL; 83 | } 84 | break; 85 | case WRITTING: 86 | if(usbWriteAccepted == 1) 87 | { 88 | usbWrite = 1; 89 | usbWriteAccepted = 0; 90 | } 91 | break; 92 | default: //should not arrive here,Ignore 93 | break; 94 | 95 | } 96 | } 97 | 98 | /* Decoding a received message */ 99 | void UCP_Decode(uint8_t *data, uint8_t len){ 100 | /* Always return the same command data except if error occour */ 101 | memcpy((void*)customReport.buf, (void*)data, sizeof(customReport.buf)); 102 | 103 | //Validate packet 104 | if(len != 8) { //UCP packets are 8 byte size 105 | customReport.buf[0]=UCP_CMD_ERROR; 106 | customReport.buf[1]=UCP_ERR_SIZE; 107 | } 108 | else if (UCP_state == DEVICE_LOCKED) 109 | { 110 | customReport.buf[0]=UCP_CMD_ERROR; 111 | customReport.buf[1]=UCP_ERR_LOCKED; 112 | } 113 | else if (UCP_state == WRITTING) 114 | { 115 | if( (usbWrite == 0) && (readOffset < readEnd)) 116 | { 117 | usbWriteAccepted = 1; // flag indicating a write must be done 118 | } 119 | else 120 | { 121 | UCP_state = IDLE; 122 | customReport.buf[0] = UCP_CMD_ERROR; 123 | customReport.buf[1] = UCP_ERR_PROTOCOL; 124 | usbWriteAccepted = 0; 125 | usbWrite = 0; 126 | } 127 | } 128 | else if (UCP_state == WRITE_EEPROM) 129 | { 130 | if(readOffset < readEnd) 131 | { 132 | eeprom_update_block ((void*)customReport.buf, (void*)readOffset, 8); 133 | readOffset += 8; 134 | /* end of WRITE */ 135 | if( readOffset >= readEnd ) 136 | { 137 | if(lockAfterSetPin){ 138 | UIF_Init(); 139 | lockAfterSetPin=0; 140 | } else{ 141 | UCP_state = IDLE; 142 | } 143 | } 144 | } 145 | else 146 | { 147 | UCP_state = IDLE; 148 | customReport.buf[0] = UCP_CMD_ERROR; 149 | customReport.buf[1] = UCP_ERR_PROTOCOL; 150 | } 151 | } 152 | else 153 | { 154 | 155 | switch(data[0]) 156 | { 157 | case UCP_CMD_RESET: 158 | break; 159 | case UCP_CMD_READ: 160 | if(UCP_state==IDLE) { //TO START READING MUST BE IDLE 161 | UCP_state = READING_CMD; 162 | readOffset = *(uint16_t*)&data[1]; 163 | readEnd = readOffset + *(uint16_t*)&data[3]; 164 | readType = *(uint8_t*)&data[5]; 165 | }else{ //PROTOCOL ERROR 166 | UCP_state = IDLE; 167 | customReport.buf[0] = UCP_CMD_ERROR; 168 | customReport.buf[1] = UCP_ERR_PROTOCOL; 169 | } 170 | break; 171 | case UCP_CMD_WRITE: 172 | if(UCP_state==IDLE) { //TO START READING MUST BE IDLE 173 | UCP_state = WRITTING; 174 | readOffset = *(uint16_t*)&data[1]; 175 | readEnd = readOffset + *(uint16_t*)&data[3]; 176 | 177 | buffIndex = 0; 178 | flashWriteAddr = (readOffset+(uint16_t)credentials); 179 | 180 | }else{ //PROTOCOL ERROR 181 | UCP_state = IDLE; 182 | customReport.buf[0] = UCP_CMD_ERROR; 183 | customReport.buf[1] = UCP_ERR_PROTOCOL; 184 | } 185 | break; 186 | case UCP_CMD_SET_PIN: 187 | UCP_state = WRITE_EEPROM; 188 | readOffset = (uint16_t)LOCK_HASH; 189 | readEnd = (uint16_t)LOCK_HASH + 16; 190 | lockAfterSetPin=1; 191 | break; 192 | case UCP_CMD_READ_PIN: 193 | UCP_state = READING_CMD; 194 | readOffset = (uint16_t)LOCK_HASH; 195 | readEnd = (uint16_t)LOCK_HASH + 16; 196 | readType = 2; /* Eeprom */ 197 | break; 198 | case UCP_CMD_KEYBOARD: 199 | UCP_state = WRITE_EEPROM; 200 | readOffset = (uint16_t)keyboardLUT_ES; 201 | readEnd = (uint16_t)keyboardLUT_ES+KEYBOARD_SIZE; 202 | break; 203 | case UCP_CMD_DATA: 204 | break; 205 | case UCP_CMD_INFO: 206 | memcpy_P((void*)&customReport.buf[1], (void*)&INFO_data, sizeof(INFO_data)); 207 | break; 208 | default: 209 | customReport.buf[0] = UCP_CMD_ERROR; 210 | customReport.buf[1] = UCP_ERR_CMD; 211 | } 212 | } 213 | 214 | } 215 | 216 | void UCP_WriteTask(void){ 217 | uint8_t i; 218 | 219 | if(usbWrite == 1) 220 | { 221 | for(i=0; i < 8; i++) 222 | { 223 | tempBuff[buffIndex++] = customReport.buf[i]; // fill the temp buffer 224 | readOffset++; 225 | 226 | // if it's aligned or end, write to avoid waste of flash cycles 227 | if( ((readOffset%SPM_PAGESIZE) == 0) || (readOffset >= readEnd) ) 228 | { 229 | FLS_write((uint8_t*)tempBuff, flashWriteAddr, buffIndex); 230 | flashWriteAddr += (buffIndex); 231 | buffIndex = 0; // resetBufferIndex 232 | 233 | /* end of WRITE */ 234 | if( readOffset >= readEnd ) 235 | { 236 | UCP_state = IDLE; 237 | /* Load Credentials Again */ 238 | CRD_Init(); 239 | break; 240 | } 241 | } 242 | } 243 | usbWrite = 0; 244 | } 245 | } 246 | -------------------------------------------------------------------------------- /ucp.h: -------------------------------------------------------------------------------- 1 | 2 | /** UCP - USB Communication Protocol api */ 3 | 4 | #ifndef _UCP_H_ 5 | #define _UCP_H_ 6 | 7 | #include 8 | #include "led.h" 9 | 10 | /* PROTOCOL COMMANDS */ 11 | #define UCP_CMD_ERROR 0x00 12 | #define UCP_CMD_RESET 0x01 13 | #define UCP_CMD_READ 0x02 14 | #define UCP_CMD_WRITE 0x03 15 | #define UCP_CMD_DATA 0x04 16 | #define UCP_CMD_INFO 0x05 17 | #define UCP_CMD_READ_RAM 0x06 18 | #define UCP_CMD_SET_PIN 0x07 19 | #define UCP_CMD_READ_PIN 0x08 20 | #define UCP_CMD_KEYBOARD 0x09 21 | 22 | /* ERROR CODES */ 23 | #define UCP_ERR 0xF0 /* generic error */ 24 | #define UCP_ERR_PACKET 0xF1 /* invalid packet */ 25 | #define UCP_ERR_CMD 0xF2 /* command error */ 26 | #define UCP_ERR_ADDR 0xF3 /* wrong address error */ 27 | #define UCP_ERR_SIZE 0xF4 /* wrong size error */ 28 | #define UCP_ERR_PROTOCOL 0xF5 /* protocol error */ 29 | #define UCP_ERR_LOCKED 0xF6 /* device is locked */ 30 | 31 | /* UCP STATES */ 32 | enum 33 | { 34 | IDLE = 0, 35 | READING_CMD, 36 | READING, 37 | WRITTING, 38 | DEVICE_LOCKED, 39 | WRITE_EEPROM, 40 | } ucpStates; 41 | 42 | /* Specific protocol */ 43 | typedef struct 44 | { 45 | uint8_t buf[8]; 46 | } ucp_pkt_t; /* basic packet */ 47 | 48 | /* Public vars */ 49 | extern uint8_t UCP_state; 50 | extern ucp_pkt_t customReport ; 51 | 52 | /* Public functions */ 53 | void UCP_Init(void); 54 | void UCP_Task(void); 55 | void UCP_Decode(uint8_t *data, uint8_t len); 56 | void UCP_WriteTask(void); 57 | 58 | /* Macros */ 59 | #define UCP_Unlock() { UCP_state = IDLE; LED_Green(); } 60 | #define UCP_Lock() { UCP_state = DEVICE_LOCKED; LED_Red(); } 61 | 62 | #endif /* _UCP_H_ */ 63 | -------------------------------------------------------------------------------- /uib.c: -------------------------------------------------------------------------------- 1 | 2 | #include "uib.h" 3 | #include "adm.h" 4 | 5 | /** User Input Interface Component */ 6 | 7 | #define NUM_OF_BUT (4u) 8 | #define ADC_SPAN (ADC_MAX/(NUM_OF_BUT)) 9 | 10 | #define RANGE1 ((1*ADC_SPAN)-(ADC_SPAN/2)) 11 | #define RANGE2 ((2*ADC_SPAN)-(ADC_SPAN/2)) 12 | #define RANGE3 ((3*ADC_SPAN)-(ADC_SPAN/2)) 13 | #define RANGE4 ((4*ADC_SPAN)-(ADC_SPAN/2)) 14 | 15 | /* Button Debounce Time */ 16 | #define uib_INIT_DEBOUNCE (5u) 17 | #define uib_SECOND_DEBOUNCE (100u) 18 | #define uib_REPEAT_DEBOUNCE (25u) /* debounce time for repeated pushes */ 19 | 20 | enum UIB_states { 21 | INIT_DEBOUNCE = 0u,SECOND_DEBOUNCE,REPEAT_DEBOUNCE, 22 | }; 23 | 24 | /* Debug Code */ 25 | #define DBG 0 26 | #if DBG 27 | #include "print.h" 28 | #define PRINT(x) printStr((void*)x, RAM); 29 | #else /* if DBG */ 30 | #define PRINT(x) 31 | #endif 32 | 33 | /* public variable */ 34 | uint8_t UIB_buttonPressed = NOT_PRESSED; 35 | uint8_t UIB_buttonChanged = 0u; 36 | static uint8_t uib_lastButtonPressed; 37 | static uint16_t uib_debounceCtr = 0u; 38 | static uint8_t uib_state = INIT_DEBOUNCE; 39 | 40 | void UIB_Task(void); 41 | 42 | static void uib_buttonChanged(void){ 43 | UIB_buttonChanged = 1u; 44 | uib_debounceCtr = 0u; 45 | } 46 | 47 | void UIB_Task(void){ 48 | uib_lastButtonPressed = UIB_buttonPressed; 49 | 50 | /* The if comparison goes from highest ADC value to the lowest one*/ 51 | if(ADM_GetAdcValue() > RANGE4) 52 | { 53 | UIB_buttonPressed = RANGE4_PRESSED; 54 | } 55 | else if(ADM_GetAdcValue() > RANGE3 ) 56 | { 57 | UIB_buttonPressed = RANGE3_PRESSED; 58 | } 59 | else if(ADM_GetAdcValue() > RANGE2) 60 | { 61 | UIB_buttonPressed = RANGE2_PRESSED; 62 | } 63 | else if(ADM_GetAdcValue() > RANGE1) 64 | { 65 | UIB_buttonPressed = RANGE1_PRESSED; 66 | } 67 | else 68 | { 69 | UIB_buttonPressed = NOT_PRESSED; 70 | } 71 | 72 | if(uib_lastButtonPressed == UIB_buttonPressed) 73 | { 74 | uib_debounceCtr++; 75 | } 76 | else 77 | { 78 | uib_state = INIT_DEBOUNCE; 79 | uib_debounceCtr = 0u; 80 | } 81 | 82 | // by default buttonChanged = 0 83 | UIB_buttonChanged = 0u; 84 | 85 | switch (uib_state) 86 | { 87 | case INIT_DEBOUNCE: 88 | if( uib_debounceCtr >= uib_INIT_DEBOUNCE ) 89 | { 90 | uib_buttonChanged(); 91 | uib_state++; 92 | } 93 | break; 94 | 95 | case SECOND_DEBOUNCE: 96 | if( uib_debounceCtr >= uib_SECOND_DEBOUNCE ) 97 | { 98 | uib_buttonChanged(); 99 | uib_state++; 100 | } 101 | break; 102 | 103 | case REPEAT_DEBOUNCE: 104 | if( uib_debounceCtr >= uib_REPEAT_DEBOUNCE ) 105 | { 106 | uib_buttonChanged(); 107 | } 108 | break; 109 | } 110 | 111 | #if DBG 112 | if(UIB_buttonChanged == 1) 113 | { 114 | switch(UIB_buttonPressed) { 115 | case LEFT: 116 | PRINT("LEFT\n"); 117 | break; 118 | case UP: 119 | PRINT("UP\n"); 120 | break; 121 | case RIGHT: 122 | PRINT("RIGHT\n"); 123 | break; 124 | case DOWN: 125 | PRINT("DOWN\n"); 126 | break; 127 | default: 128 | return; 129 | } 130 | } 131 | #endif 132 | } 133 | -------------------------------------------------------------------------------- /uib.h: -------------------------------------------------------------------------------- 1 | 2 | /** User Input Button api */ 3 | 4 | #ifndef _UIB_H_ 5 | #define _UIB_H_ 6 | 7 | #include 8 | 9 | #define RANGE4_PRESSED RIGHT 10 | #define RANGE3_PRESSED UP 11 | #define RANGE2_PRESSED DOWN 12 | #define RANGE1_PRESSED LEFT 13 | 14 | /* ADC INPUT BUTTON STATES */ 15 | enum 16 | { 17 | NOT_PRESSED = 0, 18 | DOWN, 19 | RIGHT, 20 | UP, 21 | LEFT 22 | } buttonStates; 23 | 24 | /* Public variables */ 25 | extern uint8_t UIB_buttonPressed; 26 | extern uint8_t UIB_buttonChanged; 27 | 28 | /* Public functions */ 29 | void UIB_Init(void); 30 | void UIB_Task(void); 31 | 32 | #endif /* _UIB_H_*/ 33 | -------------------------------------------------------------------------------- /uif.c: -------------------------------------------------------------------------------- 1 | 2 | #include "uif.h" 3 | #include "usi.h" 4 | #include "uib.h" 5 | #include "crd.h" 6 | #include "opt.h" 7 | #include "print.h" 8 | #include "version.h" 9 | 10 | /* public variable */ 11 | uint8_t UIF_state; 12 | uint8_t UIF_credIndex = 0; 13 | uint8_t UIF_optionsIndex = 0; 14 | uint8_t UIF_userInputIndex = 0; 15 | 16 | const char uif_initStr[] PROGMEM = MEMTYPE_VERSION_STR; 17 | 18 | void UIF_Init(void){ 19 | UIF_state = START; 20 | printStr((void*)uif_initStr, FLASH); 21 | } 22 | 23 | void UIF_Task(void){ 24 | if((UIB_buttonChanged == 1u) && (UIB_buttonPressed != NOT_PRESSED)) 25 | { 26 | switch(UIF_state) 27 | { 28 | case START: 29 | UIF_state = USER_INPUT; 30 | print_deleteStr(); 31 | USI_Init(); 32 | break; 33 | case OPTIONS: 34 | OPT_fsm(UIB_buttonPressed); 35 | break; 36 | case USER_INPUT: 37 | USI_fsm(UIB_buttonPressed); 38 | break; 39 | default: //CREDENTIALS 40 | CRD_fsm(UIB_buttonPressed); 41 | break; 42 | } 43 | } 44 | } 45 | 46 | void UIF_increment(uint8_t* val, uint8_t max){ 47 | *val = ((*val)+1) % max; 48 | } 49 | 50 | 51 | void UIF_decrement(uint8_t* val, uint8_t max){ 52 | if((*val) == 0) { 53 | *val = (max-1); 54 | } 55 | else { 56 | *val = (*val)-1; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /uif.h: -------------------------------------------------------------------------------- 1 | 2 | /** User Input Button api */ 3 | 4 | #ifndef _UIF_H_ 5 | #define _UIF_H_ 6 | 7 | #include 8 | 9 | /* UIF MENU STATES */ 10 | enum 11 | { 12 | START = 0, 13 | CREDENTIALS, 14 | OPTIONS, 15 | USER_INPUT, 16 | } menuStates; 17 | 18 | /* Public vars */ 19 | extern uint8_t UIF_state; 20 | extern uint8_t UIF_credIndex; 21 | extern uint8_t UIF_optionsIndex; 22 | extern uint8_t UIF_userInputIndex; 23 | 24 | /* Public functions */ 25 | void UIF_Init(void); 26 | void UIF_Task(void); 27 | void UIF_increment(uint8_t* val, uint8_t max); 28 | void UIF_decrement(uint8_t* val, uint8_t max); 29 | 30 | #endif /* _UIF_H_*/ 31 | -------------------------------------------------------------------------------- /usbdrv/CommercialLicense.txt: -------------------------------------------------------------------------------- 1 | V-USB Driver Software License Agreement 2 | Version 2012-07-09 3 | 4 | THIS LICENSE AGREEMENT GRANTS YOU CERTAIN RIGHTS IN A SOFTWARE. YOU CAN 5 | ENTER INTO THIS AGREEMENT AND ACQUIRE THE RIGHTS OUTLINED BELOW BY PAYING 6 | THE AMOUNT ACCORDING TO SECTION 4 ("PAYMENT") TO OBJECTIVE DEVELOPMENT. 7 | 8 | 9 | 1 DEFINITIONS 10 | 11 | 1.1 "OBJECTIVE DEVELOPMENT" shall mean OBJECTIVE DEVELOPMENT Software GmbH, 12 | Grosse Schiffgasse 1A/7, 1020 Wien, AUSTRIA. 13 | 14 | 1.2 "You" shall mean the Licensee. 15 | 16 | 1.3 "V-USB" shall mean all files included in the package distributed under 17 | the name "vusb" by OBJECTIVE DEVELOPMENT (http://www.obdev.at/vusb/) 18 | unless otherwise noted. This includes the firmware-only USB device 19 | implementation for Atmel AVR microcontrollers, some simple device examples 20 | and host side software examples and libraries. 21 | 22 | 23 | 2 LICENSE GRANTS 24 | 25 | 2.1 Source Code. OBJECTIVE DEVELOPMENT shall furnish you with the source 26 | code of V-USB. 27 | 28 | 2.2 Distribution and Use. OBJECTIVE DEVELOPMENT grants you the 29 | non-exclusive right to use, copy and distribute V-USB with your hardware 30 | product(s), restricted by the limitations in section 3 below. 31 | 32 | 2.3 Modifications. OBJECTIVE DEVELOPMENT grants you the right to modify 33 | the source code and your copy of V-USB according to your needs. 34 | 35 | 2.4 USB IDs. OBJECTIVE DEVELOPMENT furnishes you with one or two USB 36 | Product ID(s), sent to you in e-mail. These Product IDs are reserved 37 | exclusively for you. OBJECTIVE DEVELOPMENT has obtained USB Product ID 38 | ranges under the Vendor ID 5824 from Wouter van Ooijen (Van Ooijen 39 | Technische Informatica, www.voti.nl) and under the Vendor ID 8352 from 40 | Jason Kotzin (now flirc.tv, Inc.). Both owners of the Vendor IDs have 41 | obtained these IDs from the USB Implementers Forum, Inc. (www.usb.org). 42 | OBJECTIVE DEVELOPMENT disclaims all liability which might arise from the 43 | assignment of USB IDs. 44 | 45 | 2.5 USB Certification. Although not part of this agreement, we want to make 46 | it clear that you cannot become USB certified when you use V-USB or a USB 47 | Product ID assigned by OBJECTIVE DEVELOPMENT. AVR microcontrollers don't 48 | meet the electrical specifications required by the USB specification and 49 | the USB Implementers Forum certifies only members who bought a Vendor ID of 50 | their own. 51 | 52 | 53 | 3 LICENSE RESTRICTIONS 54 | 55 | 3.1 Number of Units. Only one of the following three definitions is 56 | applicable. Which one is determined by the amount you pay to OBJECTIVE 57 | DEVELOPMENT, see section 4 ("Payment") below. 58 | 59 | Hobby License: You may use V-USB according to section 2 above in no more 60 | than 5 hardware units. These units must not be sold for profit. 61 | 62 | Entry Level License: You may use V-USB according to section 2 above in no 63 | more than 150 hardware units. 64 | 65 | Professional License: You may use V-USB according to section 2 above in 66 | any number of hardware units, except for large scale production ("unlimited 67 | fair use"). Quantities below 10,000 units are not considered large scale 68 | production. If your reach quantities which are obviously large scale 69 | production, you must pay a license fee of 0.10 EUR per unit for all units 70 | above 10,000. 71 | 72 | 3.2 Rental. You may not rent, lease, or lend V-USB or otherwise encumber 73 | any copy of V-USB, or any of the rights granted herein. 74 | 75 | 3.3 Transfer. You may not transfer your rights under this Agreement to 76 | another party without OBJECTIVE DEVELOPMENT's prior written consent. If 77 | such consent is obtained, you may permanently transfer this License to 78 | another party. The recipient of such transfer must agree to all terms and 79 | conditions of this Agreement. 80 | 81 | 3.4 Reservation of Rights. OBJECTIVE DEVELOPMENT retains all rights not 82 | expressly granted. 83 | 84 | 3.5 Non-Exclusive Rights. Your license rights under this Agreement are 85 | non-exclusive. 86 | 87 | 3.6 Third Party Rights. This Agreement cannot grant you rights controlled 88 | by third parties. In particular, you are not allowed to use the USB logo or 89 | other trademarks owned by the USB Implementers Forum, Inc. without their 90 | consent. Since such consent depends on USB certification, it should be 91 | noted that V-USB will not pass certification because it does not 92 | implement checksum verification and the microcontroller ports do not meet 93 | the electrical specifications. 94 | 95 | 96 | 4 PAYMENT 97 | 98 | The payment amount depends on the variation of this agreement (according to 99 | section 3.1) into which you want to enter. Concrete prices are listed on 100 | OBJECTIVE DEVELOPMENT's web site, usually at 101 | http://www.obdev.at/vusb/license.html. You agree to pay the amount listed 102 | there to OBJECTIVE DEVELOPMENT or OBJECTIVE DEVELOPMENT's payment processor 103 | or reseller. 104 | 105 | 106 | 5 COPYRIGHT AND OWNERSHIP 107 | 108 | V-USB is protected by copyright laws and international copyright 109 | treaties, as well as other intellectual property laws and treaties. V-USB 110 | is licensed, not sold. 111 | 112 | 113 | 6 TERM AND TERMINATION 114 | 115 | 6.1 Term. This Agreement shall continue indefinitely. However, OBJECTIVE 116 | DEVELOPMENT may terminate this Agreement and revoke the granted license and 117 | USB-IDs if you fail to comply with any of its terms and conditions. 118 | 119 | 6.2 Survival of Terms. All provisions regarding secrecy, confidentiality 120 | and limitation of liability shall survive termination of this agreement. 121 | 122 | 123 | 7 DISCLAIMER OF WARRANTY AND LIABILITY 124 | 125 | LIMITED WARRANTY. V-USB IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY 126 | KIND. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, OBJECTIVE 127 | DEVELOPMENT AND ITS SUPPLIERS HEREBY DISCLAIM ALL WARRANTIES, EITHER 128 | EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 129 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE, AND 130 | NON-INFRINGEMENT, WITH REGARD TO V-USB, AND THE PROVISION OF OR FAILURE 131 | TO PROVIDE SUPPORT SERVICES. THIS LIMITED WARRANTY GIVES YOU SPECIFIC LEGAL 132 | RIGHTS. YOU MAY HAVE OTHERS, WHICH VARY FROM STATE/JURISDICTION TO 133 | STATE/JURISDICTION. 134 | 135 | LIMITATION OF LIABILITY. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, 136 | IN NO EVENT SHALL OBJECTIVE DEVELOPMENT OR ITS SUPPLIERS BE LIABLE FOR ANY 137 | SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER 138 | (INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, 139 | BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR ANY OTHER PECUNIARY 140 | LOSS) ARISING OUT OF THE USE OF OR INABILITY TO USE V-USB OR THE 141 | PROVISION OF OR FAILURE TO PROVIDE SUPPORT SERVICES, EVEN IF OBJECTIVE 142 | DEVELOPMENT HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. IN ANY 143 | CASE, OBJECTIVE DEVELOPMENT'S ENTIRE LIABILITY UNDER ANY PROVISION OF THIS 144 | AGREEMENT SHALL BE LIMITED TO THE AMOUNT ACTUALLY PAID BY YOU FOR V-USB. 145 | 146 | 147 | 8 MISCELLANEOUS TERMS 148 | 149 | 8.1 Marketing. OBJECTIVE DEVELOPMENT has the right to mention for marketing 150 | purposes that you entered into this agreement. 151 | 152 | 8.2 Entire Agreement. This document represents the entire agreement between 153 | OBJECTIVE DEVELOPMENT and you. It may only be modified in writing signed by 154 | an authorized representative of both, OBJECTIVE DEVELOPMENT and you. 155 | 156 | 8.3 Severability. In case a provision of these terms and conditions should 157 | be or become partly or entirely invalid, ineffective, or not executable, 158 | the validity of all other provisions shall not be affected. 159 | 160 | 8.4 Applicable Law. This agreement is governed by the laws of the Republic 161 | of Austria. 162 | 163 | 8.5 Responsible Courts. The responsible courts in Vienna/Austria will have 164 | exclusive jurisdiction regarding all disputes in connection with this 165 | agreement. 166 | 167 | -------------------------------------------------------------------------------- /usbdrv/Readme.txt: -------------------------------------------------------------------------------- 1 | This is the Readme file to Objective Development's firmware-only USB driver 2 | for Atmel AVR microcontrollers. For more information please visit 3 | http://www.obdev.at/vusb/ 4 | 5 | This directory contains the USB firmware only. Copy it as-is to your own 6 | project and add all .c and .S files to your project (these files are marked 7 | with an asterisk in the list below). Then copy usbconfig-prototype.h as 8 | usbconfig.h to your project and edit it according to your configuration. 9 | 10 | 11 | TECHNICAL DOCUMENTATION 12 | ======================= 13 | The technical documentation (API) for the firmware driver is contained in the 14 | file "usbdrv.h". Please read all of it carefully! Configuration options are 15 | documented in "usbconfig-prototype.h". 16 | 17 | The driver consists of the following files: 18 | Readme.txt ............. The file you are currently reading. 19 | Changelog.txt .......... Release notes for all versions of the driver. 20 | usbdrv.h ............... Driver interface definitions and technical docs. 21 | * usbdrv.c ............... High level language part of the driver. Link this 22 | module to your code! 23 | * usbdrvasm.S ............ Assembler part of the driver. This module is mostly 24 | a stub and includes one of the usbdrvasm*.S files 25 | depending on processor clock. Link this module to 26 | your code! 27 | usbdrvasm*.inc ......... Assembler routines for particular clock frequencies. 28 | Included by usbdrvasm.S, don't link it directly! 29 | asmcommon.inc .......... Common assembler routines. Included by 30 | usbdrvasm*.inc, don't link it directly! 31 | usbconfig-prototype.h .. Prototype for your own usbdrv.h file. 32 | * oddebug.c .............. Debug functions. Only used when DEBUG_LEVEL is 33 | defined to a value greater than 0. Link this module 34 | to your code! 35 | oddebug.h .............. Interface definitions of the debug module. 36 | usbportability.h ....... Header with compiler-dependent stuff. 37 | usbdrvasm.asm .......... Compatibility stub for IAR-C-compiler. Use this 38 | module instead of usbdrvasm.S when you assembler 39 | with IAR's tools. 40 | License.txt ............ Open Source license for this driver. 41 | CommercialLicense.txt .. Optional commercial license for this driver. 42 | USB-ID-FAQ.txt ......... General infos about USB Product- and Vendor-IDs. 43 | USB-IDs-for-free.txt ... List and terms of use for free shared PIDs. 44 | 45 | (*) ... These files should be linked to your project. 46 | 47 | 48 | CPU CORE CLOCK FREQUENCY 49 | ======================== 50 | We supply assembler modules for clock frequencies of 12 MHz, 12.8 MHz, 15 MHz, 51 | 16 MHz, 16.5 MHz 18 MHz and 20 MHz. Other clock rates are not supported. The 52 | actual clock rate must be configured in usbconfig.h. 53 | 54 | 12 MHz Clock 55 | This is the traditional clock rate of V-USB because it's the lowest clock 56 | rate where the timing constraints of the USB spec can be met. 57 | 58 | 15 MHz Clock 59 | Similar to 12 MHz, but some NOPs inserted. On the other hand, the higher clock 60 | rate allows for some loops which make the resulting code size somewhat smaller 61 | than the 12 MHz version. 62 | 63 | 16 MHz Clock 64 | This clock rate has been added for users of the Arduino board and other 65 | ready-made boards which come with a fixed 16 MHz crystal. It's also an option 66 | if you need the slightly higher clock rate for performance reasons. Since 67 | 16 MHz is not divisible by the USB low speed bit clock of 1.5 MHz, the code 68 | is somewhat tricky and has to insert a leap cycle every third byte. 69 | 70 | 12.8 MHz and 16.5 MHz Clock 71 | The assembler modules for these clock rates differ from the other modules 72 | because they have been built for an RC oscillator with only 1% precision. The 73 | receiver code inserts leap cycles to compensate for clock deviations. 1% is 74 | also the precision which can be achieved by calibrating the internal RC 75 | oscillator of the AVR. Please note that only AVRs with internal 64 MHz PLL 76 | oscillator can reach 16.5 MHz with the RC oscillator. This includes the very 77 | popular ATTiny25, ATTiny45, ATTiny85 series as well as the ATTiny26. Almost 78 | all AVRs can reach 12.8 MHz, although this is outside the specified range. 79 | 80 | See the EasyLogger example at http://www.obdev.at/vusb/easylogger.html for 81 | code which calibrates the RC oscillator based on the USB frame clock. 82 | 83 | 18 MHz Clock 84 | This module is closer to the USB specification because it performs an on the 85 | fly CRC check for incoming packets. Packets with invalid checksum are 86 | discarded as required by the spec. If you also implement checks for data 87 | PID toggling on application level (see option USB_CFG_CHECK_DATA_TOGGLING 88 | in usbconfig.h for more info), this ensures data integrity. Due to the CRC 89 | tables and alignment requirements, this code is bigger than modules for other 90 | clock rates. To activate this module, you must define USB_CFG_CHECK_CRC to 1 91 | and USB_CFG_CLOCK_KHZ to 18000 in usbconfig.h. 92 | 93 | 20 MHz Clock 94 | This module is for people who won't do it with less than the maximum. Since 95 | 20 MHz is not divisible by the USB low speed bit clock of 1.5 MHz, the code 96 | uses similar tricks as the 16 MHz module to insert leap cycles. 97 | 98 | 99 | USB IDENTIFIERS 100 | =============== 101 | Every USB device needs a vendor- and a product-identifier (VID and PID). VIDs 102 | are obtained from usb.org for a price of 1,500 USD. Once you have a VID, you 103 | can assign PIDs at will. 104 | 105 | Since an entry level cost of 1,500 USD is too high for most small companies 106 | and hobbyists, we provide some VID/PID pairs for free. See the file 107 | USB-IDs-for-free.txt for details. 108 | 109 | Objective Development also has some license offerings which include product 110 | IDs. See http://www.obdev.at/vusb/ for details. 111 | 112 | 113 | DEVELOPMENT SYSTEM 114 | ================== 115 | This driver has been developed and optimized for the GNU compiler version 3 116 | and 4. We recommend that you use the GNU compiler suite because it is freely 117 | available. V-USB has also been ported to the IAR compiler and assembler. It 118 | has been tested with IAR 4.10B/W32 and 4.12A/W32 on an ATmega8 with the 119 | "small" and "tiny" memory model. Not every release is tested with IAR CC and 120 | the driver may therefore fail to compile with IAR. Please note that gcc is 121 | more efficient for usbdrv.c because this module has been deliberately 122 | optimized for gcc. 123 | 124 | Gcc version 3 produces smaller code than version 4 due to new optimizing 125 | capabilities which don't always improve things on 8 bit CPUs. The code size 126 | generated by gcc 4 can be reduced with the compiler options 127 | -fno-move-loop-invariants, -fno-tree-scev-cprop and 128 | -fno-inline-small-functions in addition to -Os. On devices with more than 129 | 8k of flash memory, we also recommend the linker option --relax (written as 130 | -Wl,--relax for gcc) to convert absolute calls into relative where possible. 131 | 132 | For more information about optimizing options see: 133 | 134 | http://www.tty1.net/blog/2008-04-29-avr-gcc-optimisations_en.html 135 | 136 | These optimizations are good for gcc 4.x. Version 3.x of gcc does not support 137 | most of these options and produces good code anyway. 138 | 139 | 140 | USING V-USB FOR FREE 141 | ==================== 142 | The AVR firmware driver is published under the GNU General Public License 143 | Version 2 (GPL2) and the GNU General Public License Version 3 (GPL3). It is 144 | your choice whether you apply the terms of version 2 or version 3. 145 | 146 | If you decide for the free GPL2 or GPL3, we STRONGLY ENCOURAGE you to do the 147 | following things IN ADDITION to the obligations from the GPL: 148 | 149 | (1) Publish your entire project on a web site and drop us a note with the URL. 150 | Use the form at http://www.obdev.at/vusb/feedback.html for your submission. 151 | If you don't have a web site, you can publish the project in obdev's 152 | documentation wiki at 153 | http://www.obdev.at/goto.php?t=vusb-wiki&p=hosted-projects. 154 | 155 | (2) Adhere to minimum publication standards. Please include AT LEAST: 156 | - a circuit diagram in PDF, PNG or GIF format 157 | - full source code for the host software 158 | - a Readme.txt file in ASCII format which describes the purpose of the 159 | project and what can be found in which directories and which files 160 | - a reference to http://www.obdev.at/vusb/ 161 | 162 | (3) If you improve the driver firmware itself, please give us a free license 163 | to your modifications for our commercial license offerings. 164 | 165 | 166 | COMMERCIAL LICENSES FOR V-USB 167 | ============================= 168 | If you don't want to publish your source code under the terms of the GPL, 169 | you can simply pay money for V-USB. As an additional benefit you get 170 | USB PIDs for free, reserved exclusively to you. See the file 171 | "CommercialLicense.txt" for details. 172 | 173 | -------------------------------------------------------------------------------- /usbdrv/USB-ID-FAQ.txt: -------------------------------------------------------------------------------- 1 | Version 2012-07-09 2 | 3 | ========================== 4 | WHY DO WE NEED THESE IDs? 5 | ========================== 6 | 7 | USB is more than a low level protocol for data transport. It also defines a 8 | common set of requests which must be understood by all devices. And as part 9 | of these common requests, the specification defines data structures, the 10 | USB Descriptors, which are used to describe the properties of the device. 11 | 12 | From the perspective of an operating system, it is therefore possible to find 13 | out basic properties of a device (such as e.g. the manufacturer and the name 14 | of the device) without a device-specific driver. This is essential because 15 | the operating system can choose a driver to load based on this information 16 | (Plug-And-Play). 17 | 18 | Among the most important properties in the Device Descriptor are the USB 19 | Vendor- and Product-ID. Both are 16 bit integers. The most simple form of 20 | driver matching is based on these IDs. The driver announces the Vendor- and 21 | Product-IDs of the devices it can handle and the operating system loads the 22 | appropriate driver when the device is connected. 23 | 24 | It is obvious that this technique only works if the pair Vendor- plus 25 | Product-ID is unique: Only devices which require the same driver can have the 26 | same pair of IDs. 27 | 28 | 29 | ===================================================== 30 | HOW DOES THE USB STANDARD ENSURE THAT IDs ARE UNIQUE? 31 | ===================================================== 32 | 33 | Since it is so important that USB IDs are unique, the USB Implementers Forum, 34 | Inc. (usb.org) needs a way to enforce this legally. It is not forbidden by 35 | law to build a device and assign it any random numbers as IDs. Usb.org 36 | therefore needs an agreement to regulate the use of USB IDs. The agreement 37 | binds only parties who agreed to it, of course. Everybody else is free to use 38 | any numbers for their IDs. 39 | 40 | So how can usb.org ensure that every manufacturer of USB devices enters into 41 | an agreement with them? They do it via trademark licensing. Usb.org has 42 | registered the trademark "USB", all associated logos and related terms. If 43 | you want to put an USB logo on your product or claim that it is USB 44 | compliant, you must license these trademarks from usb.org. And this is where 45 | you enter into an agreement. See the "USB-IF Trademark License Agreement and 46 | Usage Guidelines for the USB-IF Logo" at 47 | http://www.usb.org/developers/logo_license/. 48 | 49 | Licensing the USB trademarks requires that you buy a USB Vendor-ID from 50 | usb.org (one-time fee of ca. 2,000 USD), that you become a member of usb.org 51 | (yearly fee of ca. 4,000 USD) and that you meet all the technical 52 | specifications from the USB spec. 53 | 54 | This means that most hobbyists and small companies will never be able to 55 | become USB compliant, just because membership is so expensive. And you can't 56 | be compliant with a driver based on V-USB anyway, because the AVR's port pins 57 | don't meet the electrical specifications for USB. So, in principle, all 58 | hobbyists and small companies are free to choose any random numbers for their 59 | IDs. They have nothing to lose... 60 | 61 | There is one exception worth noting, though: If you use a sub-component which 62 | implements USB, the vendor of the sub-components may guarantee USB 63 | compliance. This might apply to some or all of FTDI's solutions. 64 | 65 | 66 | ======================================================================= 67 | WHY SHOULD YOU OBTAIN USB IDs EVEN IF YOU DON'T LICENSE USB TRADEMARKS? 68 | ======================================================================= 69 | 70 | You have learned in the previous section that you are free to choose any 71 | numbers for your IDs anyway. So why not do exactly this? There is still the 72 | technical issue. If you choose IDs which are already in use by somebody else, 73 | operating systems will load the wrong drivers and your device won't work. 74 | Even if you choose IDs which are not currently in use, they may be in use in 75 | the next version of the operating system or even after an automatic update. 76 | 77 | So what you need is a pair of Vendor- and Product-IDs for which you have the 78 | guarantee that no USB compliant product uses them. This implies that no 79 | operating system will ever ship with drivers responsible for these IDs. 80 | 81 | 82 | ============================================== 83 | HOW DOES OBJECTIVE DEVELOPMENT HANDLE USB IDs? 84 | ============================================== 85 | 86 | Objective Development gives away pairs of USB-IDs with their V-USB licenses. 87 | In order to ensure that these IDs are unique, Objective Development has an 88 | agreement with the company/person who has bought the USB Vendor-ID from 89 | usb.org. This agreement ensures that a range of USB Product-IDs is reserved 90 | for assignment by Objective Development and that the owner of the Vendor-ID 91 | won't give it to anybody else. 92 | 93 | This means that you have to trust three parties to ensure uniqueness of 94 | your IDs: 95 | 96 | - Objective Development, that they don't give the same PID to more than 97 | one person. 98 | - The owner of the Vendor-ID that they don't assign PIDs from the range 99 | assigned to Objective Development to anybody else. 100 | - Usb.org that they don't assign the same Vendor-ID a second time. 101 | 102 | 103 | ================================== 104 | WHO IS THE OWNER OF THE VENDOR-ID? 105 | ================================== 106 | 107 | Objective Development has obtained ranges of USB Product-IDs under two 108 | Vendor-IDs: Under Vendor-ID 5824 from Wouter van Ooijen (Van Ooijen 109 | Technische Informatica, www.voti.nl) and under Vendor-ID 8352 from Jason 110 | Kotzin (now flirc.tv, Inc.). Both VID owners have received their Vendor-ID 111 | directly from usb.org. 112 | 113 | 114 | ========================================================================= 115 | CAN I USE USB-IDs FROM OBJECTIVE DEVELOPMENT WITH OTHER DRIVERS/HARDWARE? 116 | ========================================================================= 117 | 118 | The short answer is: Yes. All you get is a guarantee that the IDs are never 119 | assigned to anybody else. What more do you need? 120 | 121 | 122 | ============================ 123 | WHAT ABOUT SHARED ID PAIRS? 124 | ============================ 125 | 126 | Objective Development has reserved some PID/VID pairs for shared use. You 127 | have no guarantee of uniqueness for them, except that no USB compliant device 128 | uses them. In order to avoid technical problems, we must ensure that all 129 | devices with the same pair of IDs use the same driver on kernel level. For 130 | details, see the file USB-IDs-for-free.txt. 131 | 132 | 133 | ====================================================== 134 | I HAVE HEARD THAT SUB-LICENSING OF USB-IDs IS ILLEGAL? 135 | ====================================================== 136 | 137 | A 16 bit integer number cannot be protected by copyright laws. It is not 138 | sufficiently complex. And since none of the parties involved entered into the 139 | USB-IF Trademark License Agreement, we are not bound by this agreement. So 140 | there is no reason why it should be illegal to sub-license USB-IDs. 141 | 142 | 143 | ============================================= 144 | WHO IS LIABLE IF THERE ARE INCOMPATIBILITIES? 145 | ============================================= 146 | 147 | Objective Development disclaims all liabilities which might arise from the 148 | assignment of IDs. If you guarantee product features to your customers 149 | without proper disclaimer, YOU are liable for that. 150 | -------------------------------------------------------------------------------- /usbdrv/USB-IDs-for-free.txt: -------------------------------------------------------------------------------- 1 | Version 2009-08-22 2 | 3 | =========================== 4 | FREE USB-IDs FOR SHARED USE 5 | =========================== 6 | 7 | Objective Development has reserved a set of USB Product-IDs for use according 8 | to the guidelines outlined below. For more information about the concept of 9 | USB IDs please see the file USB-ID-FAQ.txt. Objective Development guarantees 10 | that the IDs listed below are not used by any USB compliant devices. 11 | 12 | 13 | ==================== 14 | MECHANISM OF SHARING 15 | ==================== 16 | 17 | From a technical point of view, two different devices can share the same USB 18 | Vendor- and Product-ID if they require the same driver on operating system 19 | level. We make use of this fact by assigning separate IDs for various device 20 | classes. On application layer, devices must be distinguished by their textual 21 | name or serial number. We offer separate sets of IDs for discrimination by 22 | textual name and for serial number. 23 | 24 | Examples for shared use of USB IDs are included with V-USB in the "examples" 25 | subdirectory. 26 | 27 | 28 | ====================================== 29 | IDs FOR DISCRIMINATION BY TEXTUAL NAME 30 | ====================================== 31 | 32 | If you use one of the IDs listed below, your device and host-side software 33 | must conform to these rules: 34 | 35 | (1) The USB device MUST provide a textual representation of the manufacturer 36 | and product identification. The manufacturer identification MUST be available 37 | at least in USB language 0x0409 (English/US). 38 | 39 | (2) The textual manufacturer identification MUST contain either an Internet 40 | domain name (e.g. "mycompany.com") registered and owned by you, or an e-mail 41 | address under your control (e.g. "myname@gmx.net"). You can embed the domain 42 | name or e-mail address in any string you like, e.g. "Objective Development 43 | http://www.obdev.at/vusb/". 44 | 45 | (3) You are responsible for retaining ownership of the domain or e-mail 46 | address for as long as any of your products are in use. 47 | 48 | (4) You may choose any string for the textual product identification, as long 49 | as this string is unique within the scope of your textual manufacturer 50 | identification. 51 | 52 | (5) Application side device look-up MUST be based on the textual manufacturer 53 | and product identification in addition to VID/PID matching. The driver 54 | matching MUST be a comparison of the entire strings, NOT a sub-string match. 55 | 56 | (6) For devices which implement a particular USB device class (e.g. HID), the 57 | operating system's default class driver MUST be used. If an operating system 58 | driver for Vendor Class devices is needed, this driver must be libusb or 59 | libusb-win32 (see http://libusb.org/ and 60 | http://libusb-win32.sourceforge.net/). 61 | 62 | Table if IDs for discrimination by textual name: 63 | 64 | PID dec (hex) | VID dec (hex) | Description of use 65 | ==============+===============+============================================ 66 | 1500 (0x05dc) | 5824 (0x16c0) | For Vendor Class devices with libusb 67 | --------------+---------------+-------------------------------------------- 68 | 1503 (0x05df) | 5824 (0x16c0) | For generic HID class devices (which are 69 | | | NOT mice, keyboards or joysticks) 70 | --------------+---------------+-------------------------------------------- 71 | 1505 (0x05e1) | 5824 (0x16c0) | For CDC-ACM class devices (modems) 72 | --------------+---------------+-------------------------------------------- 73 | 1508 (0x05e4) | 5824 (0x16c0) | For MIDI class devices 74 | --------------+---------------+-------------------------------------------- 75 | 76 | Note that Windows caches the textual product- and vendor-description for 77 | mice, keyboards and joysticks. Name-bsed discrimination is therefore not 78 | recommended for these device classes. 79 | 80 | 81 | ======================================= 82 | IDs FOR DISCRIMINATION BY SERIAL NUMBER 83 | ======================================= 84 | 85 | If you use one of the IDs listed below, your device and host-side software 86 | must conform to these rules: 87 | 88 | (1) The USB device MUST provide a textual representation of the serial 89 | number, unless ONLY the operating system's default class driver is used. 90 | The serial number string MUST be available at least in USB language 0x0409 91 | (English/US). 92 | 93 | (2) The serial number MUST start with either an Internet domain name (e.g. 94 | "mycompany.com") registered and owned by you, or an e-mail address under your 95 | control (e.g. "myname@gmx.net"), both terminated with a colon (":") character. 96 | You MAY append any string you like for further discrimination of your devices. 97 | 98 | (3) You are responsible for retaining ownership of the domain or e-mail 99 | address for as long as any of your products are in use. 100 | 101 | (5) Application side device look-up MUST be based on the serial number string 102 | in addition to VID/PID matching. The matching must start at the first 103 | character of the serial number string and include the colon character 104 | terminating your domain or e-mail address. It MAY stop anywhere after that. 105 | 106 | (6) For devices which implement a particular USB device class (e.g. HID), the 107 | operating system's default class driver MUST be used. If an operating system 108 | driver for Vendor Class devices is needed, this driver must be libusb or 109 | libusb-win32 (see http://libusb.org/ and 110 | http://libusb-win32.sourceforge.net/). 111 | 112 | (7) If ONLY the operating system's default class driver is used, e.g. for 113 | mice, keyboards, joysticks, CDC or MIDI devices and no discrimination by an 114 | application is needed, the serial number may be omitted. 115 | 116 | 117 | Table if IDs for discrimination by serial number string: 118 | 119 | PID dec (hex) | VID dec (hex) | Description of use 120 | ===============+===============+=========================================== 121 | 10200 (0x27d8) | 5824 (0x16c0) | For Vendor Class devices with libusb 122 | ---------------+---------------+------------------------------------------- 123 | 10201 (0x27d9) | 5824 (0x16c0) | For generic HID class devices (which are 124 | | | NOT mice, keyboards or joysticks) 125 | ---------------+---------------+------------------------------------------- 126 | 10202 (0x27da) | 5824 (0x16c0) | For USB Mice 127 | ---------------+---------------+------------------------------------------- 128 | 10203 (0x27db) | 5824 (0x16c0) | For USB Keyboards 129 | ---------------+---------------+------------------------------------------- 130 | 10204 (0x27dc) | 5824 (0x16c0) | For USB Joysticks 131 | ---------------+---------------+------------------------------------------- 132 | 10205 (0x27dd) | 5824 (0x16c0) | For CDC-ACM class devices (modems) 133 | ---------------+---------------+------------------------------------------- 134 | 10206 (0x27de) | 5824 (0x16c0) | For MIDI class devices 135 | ---------------+---------------+------------------------------------------- 136 | 137 | 138 | ================= 139 | ORIGIN OF USB-IDs 140 | ================= 141 | 142 | OBJECTIVE DEVELOPMENT Software GmbH has obtained all VID/PID pairs listed 143 | here from Wouter van Ooijen (see www.voti.nl) for exclusive disposition. 144 | Wouter van Ooijen has obtained the VID from the USB Implementers Forum, Inc. 145 | (see www.usb.org). The VID is registered for the company name "Van Ooijen 146 | Technische Informatica". 147 | 148 | 149 | ========== 150 | DISCLAIMER 151 | ========== 152 | 153 | OBJECTIVE DEVELOPMENT Software GmbH disclaims all liability for any 154 | problems which are caused by the shared use of these VID/PID pairs. 155 | -------------------------------------------------------------------------------- /usbdrv/asmcommon.inc: -------------------------------------------------------------------------------- 1 | /* Name: asmcommon.inc 2 | * Project: V-USB, virtual USB port for Atmel's(r) AVR(r) microcontrollers 3 | * Author: Christian Starkjohann 4 | * Creation Date: 2007-11-05 5 | * Tabsize: 4 6 | * Copyright: (c) 2007 by OBJECTIVE DEVELOPMENT Software GmbH 7 | * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) 8 | */ 9 | 10 | /* Do not link this file! Link usbdrvasm.S instead, which includes the 11 | * appropriate implementation! 12 | */ 13 | 14 | /* 15 | General Description: 16 | This file contains assembler code which is shared among the USB driver 17 | implementations for different CPU cocks. Since the code must be inserted 18 | in the middle of the module, it's split out into this file and #included. 19 | 20 | Jump destinations called from outside: 21 | sofError: Called when no start sequence was found. 22 | se0: Called when a package has been successfully received. 23 | overflow: Called when receive buffer overflows. 24 | doReturn: Called after sending data. 25 | 26 | Outside jump destinations used by this module: 27 | waitForJ: Called to receive an already arriving packet. 28 | sendAckAndReti: 29 | sendNakAndReti: 30 | sendCntAndReti: 31 | usbSendAndReti: 32 | 33 | The following macros must be defined before this file is included: 34 | .macro POP_STANDARD 35 | .endm 36 | .macro POP_RETI 37 | .endm 38 | */ 39 | 40 | #define token x1 41 | 42 | overflow: 43 | ldi x2, 1< 0 13 | 14 | #warning "Never compile production devices with debugging enabled" 15 | 16 | static void uartPutc(char c) 17 | { 18 | while(!(ODDBG_USR & (1 << ODDBG_UDRE))); /* wait for data register empty */ 19 | ODDBG_UDR = c; 20 | } 21 | 22 | static uchar hexAscii(uchar h) 23 | { 24 | h &= 0xf; 25 | if(h >= 10) 26 | h += 'a' - (uchar)10 - '0'; 27 | h += '0'; 28 | return h; 29 | } 30 | 31 | static void printHex(uchar c) 32 | { 33 | uartPutc(hexAscii(c >> 4)); 34 | uartPutc(hexAscii(c)); 35 | } 36 | 37 | void odDebug(uchar prefix, uchar *data, uchar len) 38 | { 39 | printHex(prefix); 40 | uartPutc(':'); 41 | while(len--){ 42 | uartPutc(' '); 43 | printHex(*data++); 44 | } 45 | uartPutc('\r'); 46 | uartPutc('\n'); 47 | } 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /usbdrv/oddebug.h: -------------------------------------------------------------------------------- 1 | /* Name: oddebug.h 2 | * Project: AVR library 3 | * Author: Christian Starkjohann 4 | * Creation Date: 2005-01-16 5 | * Tabsize: 4 6 | * Copyright: (c) 2005 by OBJECTIVE DEVELOPMENT Software GmbH 7 | * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) 8 | */ 9 | 10 | #ifndef __oddebug_h_included__ 11 | #define __oddebug_h_included__ 12 | 13 | /* 14 | General Description: 15 | This module implements a function for debug logs on the serial line of the 16 | AVR microcontroller. Debugging can be configured with the define 17 | 'DEBUG_LEVEL'. If this macro is not defined or defined to 0, all debugging 18 | calls are no-ops. If it is 1, DBG1 logs will appear, but not DBG2. If it is 19 | 2, DBG1 and DBG2 logs will be printed. 20 | 21 | A debug log consists of a label ('prefix') to indicate which debug log created 22 | the output and a memory block to dump in hex ('data' and 'len'). 23 | */ 24 | 25 | 26 | #ifndef F_CPU 27 | # define F_CPU 12000000 /* 12 MHz */ 28 | #endif 29 | 30 | /* make sure we have the UART defines: */ 31 | #include "usbportability.h" 32 | 33 | #ifndef uchar 34 | # define uchar unsigned char 35 | #endif 36 | 37 | #if DEBUG_LEVEL > 0 && !(defined TXEN || defined TXEN0) /* no UART in device */ 38 | # warning "Debugging disabled because device has no UART" 39 | # undef DEBUG_LEVEL 40 | #endif 41 | 42 | #ifndef DEBUG_LEVEL 43 | # define DEBUG_LEVEL 0 44 | #endif 45 | 46 | /* ------------------------------------------------------------------------- */ 47 | 48 | #if DEBUG_LEVEL > 0 49 | # define DBG1(prefix, data, len) odDebug(prefix, data, len) 50 | #else 51 | # define DBG1(prefix, data, len) 52 | #endif 53 | 54 | #if DEBUG_LEVEL > 1 55 | # define DBG2(prefix, data, len) odDebug(prefix, data, len) 56 | #else 57 | # define DBG2(prefix, data, len) 58 | #endif 59 | 60 | /* ------------------------------------------------------------------------- */ 61 | 62 | #if DEBUG_LEVEL > 0 63 | extern void odDebug(uchar prefix, uchar *data, uchar len); 64 | 65 | /* Try to find our control registers; ATMEL likes to rename these */ 66 | 67 | #if defined UBRR 68 | # define ODDBG_UBRR UBRR 69 | #elif defined UBRRL 70 | # define ODDBG_UBRR UBRRL 71 | #elif defined UBRR0 72 | # define ODDBG_UBRR UBRR0 73 | #elif defined UBRR0L 74 | # define ODDBG_UBRR UBRR0L 75 | #endif 76 | 77 | #if defined UCR 78 | # define ODDBG_UCR UCR 79 | #elif defined UCSRB 80 | # define ODDBG_UCR UCSRB 81 | #elif defined UCSR0B 82 | # define ODDBG_UCR UCSR0B 83 | #endif 84 | 85 | #if defined TXEN 86 | # define ODDBG_TXEN TXEN 87 | #else 88 | # define ODDBG_TXEN TXEN0 89 | #endif 90 | 91 | #if defined USR 92 | # define ODDBG_USR USR 93 | #elif defined UCSRA 94 | # define ODDBG_USR UCSRA 95 | #elif defined UCSR0A 96 | # define ODDBG_USR UCSR0A 97 | #endif 98 | 99 | #if defined UDRE 100 | # define ODDBG_UDRE UDRE 101 | #else 102 | # define ODDBG_UDRE UDRE0 103 | #endif 104 | 105 | #if defined UDR 106 | # define ODDBG_UDR UDR 107 | #elif defined UDR0 108 | # define ODDBG_UDR UDR0 109 | #endif 110 | 111 | static inline void odDebugInit(void) 112 | { 113 | ODDBG_UCR |= (1< 38 | #ifndef __IAR_SYSTEMS_ASM__ 39 | # include 40 | #endif 41 | 42 | #define __attribute__(arg) /* not supported on IAR */ 43 | 44 | #ifdef __IAR_SYSTEMS_ASM__ 45 | # define __ASSEMBLER__ /* IAR does not define standard macro for asm */ 46 | #endif 47 | 48 | #ifdef __HAS_ELPM__ 49 | # define PROGMEM __farflash 50 | #else 51 | # define PROGMEM __flash 52 | #endif 53 | 54 | #define USB_READ_FLASH(addr) (*(PROGMEM char *)(addr)) 55 | 56 | /* The following definitions are not needed by the driver, but may be of some 57 | * help if you port a gcc based project to IAR. 58 | */ 59 | #define cli() __disable_interrupt() 60 | #define sei() __enable_interrupt() 61 | #define wdt_reset() __watchdog_reset() 62 | #define _BV(x) (1 << (x)) 63 | 64 | /* assembler compatibility macros */ 65 | #define nop2 rjmp $+2 /* jump to next instruction */ 66 | #define XL r26 67 | #define XH r27 68 | #define YL r28 69 | #define YH r29 70 | #define ZL r30 71 | #define ZH r31 72 | #define lo8(x) LOW(x) 73 | #define hi8(x) (((x)>>8) & 0xff) /* not HIGH to allow XLINK to make a proper range check */ 74 | 75 | /* Depending on the device you use, you may get problems with the way usbdrv.h 76 | * handles the differences between devices. Since IAR does not use #defines 77 | * for MCU registers, we can't check for the existence of a particular 78 | * register with an #ifdef. If the autodetection mechanism fails, include 79 | * definitions for the required USB_INTR_* macros in your usbconfig.h. See 80 | * usbconfig-prototype.h and usbdrv.h for details. 81 | */ 82 | 83 | /* ------------------------------------------------------------------------- */ 84 | #elif __CODEVISIONAVR__ /* check for CodeVision AVR */ 85 | /* ------------------------------------------------------------------------- */ 86 | /* This port is not working (yet) */ 87 | 88 | /* #define F_CPU _MCU_CLOCK_FREQUENCY_ seems to be defined automatically */ 89 | 90 | #include 91 | #include 92 | 93 | #define __attribute__(arg) /* not supported on IAR */ 94 | 95 | #define PROGMEM __flash 96 | #define USB_READ_FLASH(addr) (*(PROGMEM char *)(addr)) 97 | 98 | #ifndef __ASSEMBLER__ 99 | static inline void cli(void) 100 | { 101 | #asm("cli"); 102 | } 103 | static inline void sei(void) 104 | { 105 | #asm("sei"); 106 | } 107 | #endif 108 | #define _delay_ms(t) delay_ms(t) 109 | #define _BV(x) (1 << (x)) 110 | #define USB_CFG_USE_SWITCH_STATEMENT 1 /* macro for if() cascase fails for unknown reason */ 111 | 112 | #define macro .macro 113 | #define endm .endmacro 114 | #define nop2 rjmp .+0 /* jump to next instruction */ 115 | 116 | /* ------------------------------------------------------------------------- */ 117 | #else /* default development environment is avr-gcc/avr-libc */ 118 | /* ------------------------------------------------------------------------- */ 119 | 120 | #include 121 | #ifdef __ASSEMBLER__ 122 | # define _VECTOR(N) __vector_ ## N /* io.h does not define this for asm */ 123 | #else 124 | # include 125 | #endif 126 | 127 | #if USB_CFG_DRIVER_FLASH_PAGE 128 | # define USB_READ_FLASH(addr) pgm_read_byte_far(((long)USB_CFG_DRIVER_FLASH_PAGE << 16) | (long)(addr)) 129 | #else 130 | # define USB_READ_FLASH(addr) pgm_read_byte(addr) 131 | #endif 132 | 133 | #define macro .macro 134 | #define endm .endm 135 | #define nop2 rjmp .+0 /* jump to next instruction */ 136 | 137 | #endif /* development environment */ 138 | 139 | /* for conveniecne, ensure that PRG_RDB exists */ 140 | #ifndef PRG_RDB 141 | # define PRG_RDB(addr) USB_READ_FLASH(addr) 142 | #endif 143 | #endif /* __usbportability_h_INCLUDED__ */ 144 | -------------------------------------------------------------------------------- /usi.c: -------------------------------------------------------------------------------- 1 | /* USI - USER INPUT state machine */ 2 | #include "usi.h" 3 | #include "uif.h" 4 | #include "uib.h" 5 | #include "crd.h" 6 | #include "ucp.h" 7 | #include "print.h" 8 | 9 | #define USI_PIN_RETRIES (2u) 10 | 11 | /** Global Data */ 12 | // PIN: 0000 default HASH 13 | const uint8_t LOCK_HASH[16] EEMEM = { 14 | 0xd4,0x4f,0xb2,0x7a,0x58,0xb4,0x27,0x4a,0x21,0xe6,0x8f,0x39,0x69,0x74,0x23,0x54 15 | }; 16 | 17 | static const char erasePin[4] PROGMEM = {'9','9','9','9'}; 18 | 19 | /** Local Data */ 20 | static char userText[16]; 21 | static char userPin[4]; 22 | static uint8_t userTextIndex; 23 | static const char USI_keys[] PROGMEM = {'0','1','2','3','4','5','6','7','8','9'}; 24 | static const char PIN_str[] PROGMEM = "PIN: "; 25 | static const char LOCKED_str[] PROGMEM = "PIN ERR"; 26 | static const char PINRESET_str[] PROGMEM = "PIN RESET to 0000"; 27 | static const uint8_t LOCK_HASH_PGM[16] PROGMEM = { 28 | 0xd4,0x4f,0xb2,0x7a,0x58,0xb4,0x27,0x4a,0x21,0xe6,0x8f,0x39,0x69,0x74,0x23,0x54 29 | }; 30 | static uint8_t pin_retries = USI_PIN_RETRIES; 31 | 32 | /** Private Function declaration */ 33 | static void usi_print(void); 34 | static void usi_previous(void); 35 | static void usi_next(void); 36 | static void usi_resetPin(void); 37 | static uint8_t usi_pinCheck(char pin[4]); 38 | 39 | void USI_Init(void){ 40 | userTextIndex = 0; 41 | UIF_userInputIndex = 0; 42 | memcpy_P((void*)userText, (void*)PIN_str, sizeof(PIN_str)); 43 | usi_print(); 44 | UCP_Lock(); 45 | } 46 | 47 | // user input finitestate machine 48 | void USI_fsm(uint8_t button){ 49 | switch(button) { 50 | case LEFT: 51 | print_deleteStr(); 52 | USI_Init(); 53 | break; 54 | case UP: 55 | print_deleteStr(); 56 | usi_next(); 57 | break; 58 | case RIGHT: 59 | print_deleteStr(); 60 | if(userTextIndex == (sizeof(userPin)-1)) // real array elements (\0) 61 | { 62 | /* Device Unlocked */ 63 | if(usi_pinCheck(userPin) == 1) 64 | { 65 | CRD_fsmStart(); 66 | } 67 | /* Device Locked */ 68 | else 69 | { 70 | 71 | 72 | if(pin_retries > 0){ 73 | printStr((void*)LOCKED_str,FLASH); 74 | pin_retries--; 75 | } else{ 76 | printStr((void*)PINRESET_str,FLASH); 77 | usi_resetPin(); 78 | pin_retries = USI_PIN_RETRIES; 79 | } 80 | 81 | userTextIndex = 0; 82 | UIF_userInputIndex = 0; 83 | userPin[0] = '0'; 84 | memcpy_P((void*)userText, (void*)PIN_str, sizeof(PIN_str)); 85 | } 86 | } 87 | else 88 | { 89 | userText[sizeof(PIN_str)-1+userTextIndex] = '*'; 90 | userTextIndex++; 91 | usi_print(); 92 | } 93 | break; 94 | case DOWN: 95 | print_deleteStr(); 96 | usi_previous(); 97 | break; 98 | default: 99 | break; 100 | } 101 | } 102 | 103 | static void usi_print(void){ 104 | userPin[userTextIndex] = pgm_read_byte(&USI_keys[UIF_userInputIndex]); 105 | userText[sizeof(PIN_str)-1+userTextIndex] = userPin[userTextIndex]; 106 | userText[sizeof(PIN_str)-1+userTextIndex+1] = 0; 107 | printStr(userText,RAM); 108 | } 109 | 110 | static void usi_previous(void){ 111 | UIF_decrement(&UIF_userInputIndex, sizeof(USI_keys)); 112 | usi_print(); 113 | } 114 | 115 | static void usi_next(void){ 116 | UIF_increment(&UIF_userInputIndex, sizeof(USI_keys)); 117 | usi_print(); 118 | } 119 | 120 | static uint8_t usi_pinCheck(char pin[4]){ 121 | uint8_t i; 122 | 123 | 124 | if ( (pin[0]==erasePin[0]) && (pin[1]==erasePin[1]) && (pin[2]==erasePin[2]) && (pin[3]==erasePin[3]) ) 125 | { 126 | usi_resetPin(); 127 | while (1) {}; 128 | } 129 | 130 | for(i=0; i<16; i++) { 131 | cipher.key[i] = pin[(i%4)]; 132 | cipher.plain[i] = pin[(i%4)]; 133 | } 134 | noekeon_encrypt(); 135 | 136 | for(i=0; i<16; i++) 137 | { 138 | if(eeprom_read_byte(LOCK_HASH+i) != cipher.plain[i]) { 139 | break; 140 | } 141 | } 142 | return i==16; 143 | } 144 | 145 | static void usi_resetPin(void){ 146 | uint8_t hash[16]; 147 | memcpy_P((void*)hash, (void*)LOCK_HASH_PGM, sizeof(LOCK_HASH_PGM)); 148 | eeprom_update_block ((void*)hash, (void*)LOCK_HASH, sizeof(hash)); 149 | } 150 | -------------------------------------------------------------------------------- /usi.h: -------------------------------------------------------------------------------- 1 | #ifndef _USI_H_ 2 | #define _USI_H_ 3 | 4 | #include 5 | #include 6 | 7 | // prototype definition 8 | void USI_fsm(uint8_t button); 9 | void USI_Init(void); 10 | 11 | // HASH 12 | extern const uint8_t LOCK_HASH[16] EEMEM; 13 | #endif 14 | -------------------------------------------------------------------------------- /version.h: -------------------------------------------------------------------------------- 1 | #ifndef _VERSION_H_ 2 | #define _VERSION_H_ 3 | 4 | #define TOSTR(x) #x 5 | #define DEFINE_TO_STR(x) TOSTR(x) 6 | 7 | #define MEMTYPE_VERSION MEMTYPE_VERSION_MAJOR.MEMTYPE_VERSION_MINOR.MEMTYPE_VERSION_PATCH 8 | #define MEMTYPE_STR MemType 9 | 10 | #define MEMTYPE_VERSION_STR DEFINE_TO_STR(MEMTYPE_STR MEMTYPE_VERSION) 11 | 12 | 13 | #define MEMTYPE_VERSION_MAJOR 3 14 | #define MEMTYPE_VERSION_MINOR 2 15 | #define MEMTYPE_VERSION_PATCH 0 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /wiki.txt: -------------------------------------------------------------------------------- 1 | **************************************************** 2 | * Generate assembly code from c code 3 | **************************************************** 4 | avr-gcc -mmcu=attiny85 -S file.c 5 | . 6 | --------------------------------------------------------------------------------