├── README.md ├── .gitmodules ├── web ├── page │ ├── jquery-2.1.4.min.js.gz │ ├── example.js │ ├── index.html │ └── menuinterface.js ├── Makefile ├── md5.h ├── mfsmaker.c ├── pushtodev.c ├── md5.c └── execute_reflash.c ├── Makefile ├── user ├── i2sduplex.h ├── custom_commands.c ├── user_main.c ├── pin_mux_register.h ├── dmastuff.h ├── i2sduplex.c └── slc_register.h ├── user.cfg ├── LICENSE └── hardware ├── kelvindmmwifi-cache.lib ├── kelvindmmwifi.pro ├── kelvindmmwifi.net ├── kelvindmmwifi.bak ├── kelvindmmwifi.sch └── kelvindmmwifi-F.Cu.ps /README.md: -------------------------------------------------------------------------------- 1 | Giving it a shot. May not succeed! 2 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "esp82xx"] 2 | path = esp82xx 3 | url = https://github.com/cnlohr/esp82xx 4 | -------------------------------------------------------------------------------- /web/page/jquery-2.1.4.min.js.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnlohr/kelvindmmwifi/HEAD/web/page/jquery-2.1.4.min.js.gz -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | include user.cfg 2 | -include esp82xx/common.mf 3 | -include esp82xx/main.mf 4 | 5 | % : 6 | $(warning This is the empty rule. Something went wrong.) 7 | @true 8 | 9 | ifndef TARGET 10 | $(info Modules were not checked out... use git clone --recursive in the future. Pulling now.) 11 | $(shell git submodule update --init --recursive) 12 | endif 13 | 14 | # Example for a custom rule. 15 | # Most of the build is handled in main.mf 16 | .PHONY : showvars 17 | showvars: 18 | $(foreach v, $(.VARIABLES), $(info $(v) = $($(v)))) 19 | true 20 | 21 | -------------------------------------------------------------------------------- /user/i2sduplex.h: -------------------------------------------------------------------------------- 1 | //Copyright 2016 <>< Charles Lohr, See LICENSE file. 2 | 3 | #ifndef _I2SDUPLEX_TEST 4 | #define _I2SDUPLEX_TEST 5 | 6 | 7 | //Stuff that should be for the header: 8 | 9 | #include 10 | 11 | #define DMABUFFERDEPTH 3 12 | #define I2SDMABUFLEN (32) 13 | #define LINE32LEN I2SDMABUFLEN 14 | #define RX_NUM (I2SDMABUFLEN) 15 | 16 | extern uint32_t i2sBDRX[I2SDMABUFLEN*DMABUFFERDEPTH]; 17 | extern uint32_t i2sBDTX[I2SDMABUFLEN*DMABUFFERDEPTH]; 18 | 19 | extern int fxcycle; 20 | extern int erx, etx; 21 | 22 | void ICACHE_FLASH_ATTR testi2s_init(); 23 | 24 | #endif 25 | 26 | -------------------------------------------------------------------------------- /user/custom_commands.c: -------------------------------------------------------------------------------- 1 | //Copyright 2015 <>< Charles Lohr, see LICENSE file. 2 | 3 | #include 4 | #include 5 | 6 | void ICACHE_FLASH_ATTR ReinitSettings() 7 | { 8 | } 9 | 10 | void ICACHE_FLASH_ATTR SettingsLoaded() 11 | { 12 | } 13 | 14 | 15 | int ICACHE_FLASH_ATTR CustomCommand(char * buffer, int retsize, char *pusrdata, unsigned short len) 16 | { 17 | char * buffend = buffer; 18 | 19 | switch( pusrdata[1] ) 20 | { 21 | case 'C': case 'c': //Custom command test 22 | { 23 | buffend += ets_sprintf( buffend, "CC" ); 24 | return buffend-buffer; 25 | } 26 | } 27 | return -1; 28 | } 29 | -------------------------------------------------------------------------------- /user.cfg: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # User Options 3 | ############################################################################### 4 | 5 | CHIP = 8266 6 | IP = 192.168.4.1 # does not actually set the IP in firmware 7 | PORT = /dev/ttyUSB0 # could also be /dev/ttyACM0 8 | WEB_PORT = 80 9 | COM_PORT = 7777 10 | BACKEND_PORT = 7878 11 | PAGE_OFFSET = 65536 # 1048576 12 | 13 | SRCS += user/i2sduplex.c 14 | 15 | FWBURNFLAGS = -b 1000000 16 | 17 | SDK_DEFAULT = $(HOME)/esp8266/esp-open-sdk 18 | ESP_GCC_VERS = 4.8.5 19 | 20 | OPTS += -DICACHE_FLASH 21 | #OPTS += -DVERIFY_FLASH_WRITE 22 | #OPTS += -DDEBUG 23 | #OPTS += -DNET_MAXTRIES=10 24 | #OPTS += -DNET_TIMEOUT=3.0 25 | #OPTS += -DFREQ=12500 26 | 27 | PAGE_TITLE = esp82xx-basic 28 | PAGE_SCRIPTS = $(wildcard page/*.js) # include all javascrpts in ./web/page/ 29 | PAGE_HEADING = Welcome to the basic Web-GUI 30 | PAGE_INFO = This is the basic web interface for esp82xx-series chips 31 | 32 | -------------------------------------------------------------------------------- /web/page/example.js: -------------------------------------------------------------------------------- 1 | //Copyright (C) 2016 <>< Charles Lohr, see LICENSE file for more info. 2 | // 3 | //This particular file may be licensed under the MIT/x11, New BSD or ColorChord Licenses. 4 | 5 | function initExample() { 6 | var menItm = ` 7 | 8 |
9 |

I'm an example feature found in ./web/page/feature.example.js.

10 |
11 |

 

12 |
13 | 14 | `; 15 | $('#MainMenu > tbody:last').after( menItm ); 16 | 17 | $('#InfoBtn').click( function(e) { 18 | $('#InfoBtn').val('Getting data...'); 19 | $('#InfoDspl').html(' '); 20 | QueueOperation( "I", clbInfoBtn ); // Send info request to ESP 21 | }); 22 | } 23 | 24 | window.addEventListener("load", initExample, false); 25 | 26 | 27 | // Handle request previously sent on button click 28 | function clbInfoBtn(req,data) { 29 | $('#InfoBtn').val('Display Info'); 30 | $('#InfoDspl').html('Info returned from esp:
'+ data); 31 | } 32 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 CNLohr 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /web/Makefile: -------------------------------------------------------------------------------- 1 | include ../user.cfg 2 | include ../esp82xx/common.mf 3 | 4 | .PHONY : all clean push 5 | all : execute_reflash push 6 | 7 | CC = gcc 8 | CFLAGS = $(OPTS) 9 | LDLIBS = -lusb-1.0 10 | PAGE_SCRIPT = $(foreach s, $(call uniq, $(notdir $(wildcard page/jquery*gz) menuinterface.js $(PAGE_SCRIPTS))), ) 11 | 12 | mfsmaker : mfsmaker.c 13 | pushtodev : pushtodev.c 14 | execute_reflash : execute_reflash.c md5.c 15 | 16 | mfsmaker pushtodev execute_reflash : 17 | $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) -lusb-1.0 18 | 19 | page.mpfs : mfsmaker $(wildcard page/*) Makefile 20 | $(RM) -r tmp 21 | $(CP) -r page tmp 22 | # Inception level over 9000 for poor man's template substitution 23 | $(info bla$ ${\n} blubb) 24 | $(foreach p, $(filter PAGE_%,$(.VARIABLES)) $(filter PROJECT_%,$(.VARIABLES)) VERSSTR, \ 25 | sed -i "s/{{$(p)}}/$$(echo -n '$($(p))' | sed -e 's/[\/&"]/\\&/g')/" tmp/index.html && \ 26 | ) true 27 | ./mfsmaker tmp page.mpfs 28 | 29 | push : pushtodev page.mpfs 30 | ./pushtodev $(IP) $(PAGE_OFFSET) page.mpfs 31 | 32 | usbpush : pushtodev page.mpfs 33 | ./pushtodev USB $(PAGE_OFFSET) page.mpfs 34 | 35 | clean : 36 | $(RM) mfsmaker page.mpfs pushtodev execute_reflash tmp/* 37 | -------------------------------------------------------------------------------- /web/md5.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This is an OpenSSL-compatible implementation of the RSA Data Security, Inc. 3 | * MD5 Message-Digest Algorithm (RFC 1321). 4 | * 5 | * Homepage: 6 | * http://openwall.info/wiki/people/solar/software/public-domain-source-code/md5 7 | * 8 | * Author: 9 | * Alexander Peslyak, better known as Solar Designer 10 | * 11 | * This software was written by Alexander Peslyak in 2001. No copyright is 12 | * claimed, and the software is hereby placed in the public domain. 13 | * In case this attempt to disclaim copyright and place the software in the 14 | * public domain is deemed null and void, then the software is 15 | * Copyright (c) 2001 Alexander Peslyak and it is hereby released to the 16 | * general public under the following terms: 17 | * 18 | * Redistribution and use in source and binary forms, with or without 19 | * modification, are permitted. 20 | * 21 | * There's ABSOLUTELY NO WARRANTY, express or implied. 22 | * 23 | * See md5.c for more information. 24 | */ 25 | 26 | #ifdef HAVE_OPENSSL 27 | #include 28 | #elif !defined(_MD5_H) 29 | #define _MD5_H 30 | 31 | /* Any 32-bit or wider unsigned integer data type will do */ 32 | typedef unsigned int MD5_u32plus; 33 | 34 | typedef struct { 35 | MD5_u32plus lo, hi; 36 | MD5_u32plus a, b, c, d; 37 | unsigned char buffer[64]; 38 | MD5_u32plus block[16]; 39 | } MD5_CTX; 40 | 41 | extern void MD5_Init(MD5_CTX *ctx); 42 | extern void MD5_Update(MD5_CTX *ctx, const void *data, unsigned long size); 43 | extern void MD5_Final(unsigned char *result, MD5_CTX *ctx); 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /web/page/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | {{PAGE_TITLE}} 4 | {{PAGE_SCRIPT}} 5 | 6 | 15 | 16 | 17 |

{{PAGE_HEADING}}


18 | 19 | 20 | 21 | 22 | 26 | 27 | 28 | 29 | 30 | 31 |

Copyright (C) 2015-2016 <>< Charles Lohr, See LICENSE file for more info.

32 |

github-logo 33 | {{PROJECT_NAME}} 34 | {{VERSSTR}}

35 |
36 |
...
37 | 38 | 39 | -------------------------------------------------------------------------------- /user/user_main.c: -------------------------------------------------------------------------------- 1 | //Copyright 2015 <>< Charles Lohr, see LICENSE file. 2 | 3 | #include "mem.h" 4 | #include "c_types.h" 5 | #include "user_interface.h" 6 | #include "ets_sys.h" 7 | #include 8 | #include "osapi.h" 9 | #include "espconn.h" 10 | #include "i2sduplex.h" 11 | #include 12 | #include 13 | #include 14 | 15 | #define PORT 7777 16 | 17 | #define procTaskPrio 0 18 | #define procTaskQueueLen 1 19 | 20 | static volatile os_timer_t some_timer; 21 | static struct espconn *pUdpServer; 22 | 23 | 24 | //int ICACHE_FLASH_ATTR StartMDNS(); 25 | 26 | void user_rf_pre_init(void) 27 | { 28 | //nothing. 29 | } 30 | 31 | char * strcat( char * dest, char * src ) 32 | { 33 | return strcat(dest, src ); 34 | } 35 | 36 | 37 | 38 | //Tasks that happen all the time. 39 | 40 | os_event_t procTaskQueue[procTaskQueueLen]; 41 | 42 | 43 | static void ICACHE_FLASH_ATTR procTask(os_event_t *events) 44 | { 45 | CSTick( 0 ); 46 | system_os_post(procTaskPrio, 0, 0 ); 47 | } 48 | 49 | //Timer event. 50 | static void ICACHE_FLASH_ATTR myTimer(void *arg) 51 | { 52 | //printf( "%d %d %d %08x %08x\n", fxcycle, etx, erx, i2sBDRX[0], i2sBDRX[I2SDMABUFLEN-1] ); 53 | 54 | CSTick( 1 ); 55 | } 56 | 57 | 58 | //Called when new packet comes in. 59 | static void ICACHE_FLASH_ATTR 60 | udpserver_recv(void *arg, char *pusrdata, unsigned short len) 61 | { 62 | struct espconn *pespconn = (struct espconn *)arg; 63 | 64 | uart0_sendStr("X"); 65 | } 66 | 67 | void ICACHE_FLASH_ATTR charrx( uint8_t c ) 68 | { 69 | //Called from UART. 70 | } 71 | 72 | void ICACHE_FLASH_ATTR user_init(void) 73 | { 74 | uart_init(BIT_RATE_115200, BIT_RATE_115200); 75 | ets_delay_us(200000 ); 76 | uart0_sendStr("\r\nesp8266 ws2812 driver\r\n"); 77 | 78 | // int opm = wifi_get_opmode(); 79 | // if( opm == 1 ) need_to_switch_opmode = 120; 80 | // wifi_set_opmode_current(2); 81 | //Uncomment this to force a system restore. 82 | // system_restore(); 83 | 84 | CSSettingsLoad( 0 ); 85 | CSPreInit(); 86 | 87 | pUdpServer = (struct espconn *)os_zalloc(sizeof(struct espconn)); 88 | ets_memset( pUdpServer, 0, sizeof( struct espconn ) ); 89 | espconn_create( pUdpServer ); 90 | pUdpServer->type = ESPCONN_UDP; 91 | pUdpServer->proto.udp = (esp_udp *)os_zalloc(sizeof(esp_udp)); 92 | pUdpServer->proto.udp->local_port = 7777; 93 | espconn_regist_recvcb(pUdpServer, udpserver_recv); 94 | 95 | if( espconn_create( pUdpServer ) ) 96 | { 97 | while(1) { uart0_sendStr( "\r\nFAULT\r\n" ); } 98 | } 99 | 100 | CSInit(); 101 | 102 | SetServiceName( "i2sdup" ); 103 | AddMDNSName( "cn8266" ); 104 | AddMDNSName( "ws2812" ); 105 | AddMDNSService( "_http._tcp", "An ESP8266 Webserver", 80 ); 106 | AddMDNSService( "_cn8266._udp", "ESP8266 Backend", 7878 ); 107 | 108 | //Add a process 109 | system_os_task(procTask, procTaskPrio, procTaskQueue, procTaskQueueLen); 110 | 111 | //Timer example 112 | os_timer_disarm(&some_timer); 113 | os_timer_setfn(&some_timer, (os_timer_func_t *)myTimer, NULL); 114 | os_timer_arm(&some_timer, 100, 1); 115 | 116 | testi2s_init(); 117 | 118 | system_update_cpu_freq( SYS_CPU_80MHZ ); 119 | 120 | system_os_post(procTaskPrio, 0, 0 ); 121 | } 122 | 123 | 124 | //There is no code in this project that will cause reboots if interrupts are disabled. 125 | void EnterCritical() 126 | { 127 | } 128 | 129 | void ExitCritical() 130 | { 131 | } 132 | 133 | 134 | -------------------------------------------------------------------------------- /web/mfsmaker.c: -------------------------------------------------------------------------------- 1 | 2 | //Copyright 2015 <>< Charles Lohr Under the MIT/x11 License, NewBSD License or 3 | // ColorChord License. You Choose. 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | #define SPI_FLASH_SEC_SIZE 4096 12 | #define MFS_STARTFLASHSECTOR 0x100 13 | #define MFS_START (MFS_STARTFLASHSECTOR*SPI_FLASH_SEC_SIZE) 14 | #define MFS_SECTOR 256 15 | #define MFS_FILENAMELEN 32-8 16 | #define ENTRIES 8192 17 | 18 | #define ENDIAN(x) x//htonl 19 | 20 | struct MFSFileEntry 21 | { 22 | char name[MFS_FILENAMELEN]; 23 | uint32_t start; //From beginning of mfs thing. 24 | uint32_t len; 25 | } mfsfat[ENTRIES]; 26 | 27 | unsigned char mfsdata[131072*8]; 28 | 29 | unsigned long fatpointer = 0; 30 | unsigned long datapointer = 0; 31 | 32 | int main( int argc, char ** argv ) 33 | { 34 | int i; 35 | DIR *d; 36 | struct dirent *dir; 37 | 38 | if( argc != 3 ) 39 | { 40 | fprintf( stderr, "Error: [tool] [directory to pack] [output packed .dat file]\n" ); 41 | return -1; 42 | } 43 | 44 | d = opendir( argv[1] ); 45 | 46 | if (!d) 47 | { 48 | fprintf( stderr, "Error: cannot open folder for packing.\n" ); 49 | return -2; 50 | } 51 | 52 | 53 | memcpy( mfsfat[fatpointer].name, "MPFSMPFS", 8 ); 54 | mfsfat[fatpointer].start = 0; 55 | mfsfat[fatpointer].len = 0; 56 | fatpointer++; 57 | 58 | 59 | while ((dir = readdir(d)) != NULL) 60 | { 61 | if( dir->d_type & DT_REG ) 62 | { 63 | char thisfile[1024]; 64 | struct stat buf; 65 | int dlen = strlen( dir->d_name ); 66 | int sprret = snprintf( thisfile, 1023, "%s/%s", argv[1], dir->d_name ); 67 | 68 | if( sprret > 1023 || sprret < 1 ) 69 | { 70 | fprintf( stderr, "Error processing \"%s\" (snprintf)\n", dir->d_name ); 71 | continue; 72 | } 73 | 74 | int statret = stat( thisfile, &buf ); 75 | 76 | if( statret ) 77 | { 78 | fprintf( stderr, "Error processing \"%s\" (stat)\n", dir->d_name ); 79 | continue; 80 | } 81 | 82 | if( dlen >= MFS_FILENAMELEN ) 83 | { 84 | fprintf( stderr, "Warning: Fle \"%s\" too long.\n", dir->d_name ); 85 | continue; 86 | } 87 | if( fatpointer > ENTRIES ) 88 | { 89 | fprintf( stderr, "Warning: Not enough entries to fit \"%s\".\n", dir->d_name ); 90 | continue; 91 | } 92 | 93 | if( buf.st_size + datapointer > sizeof( mfsdata ) ) 94 | { 95 | fprintf( stderr, "Error: no space left.\n" ); 96 | return -1; 97 | } 98 | 99 | memcpy( mfsfat[fatpointer].name, dir->d_name, dlen ); 100 | mfsfat[fatpointer].start = datapointer; 101 | mfsfat[fatpointer].len = ENDIAN( buf.st_size ); 102 | fatpointer++; 103 | 104 | if( buf.st_size ) 105 | { 106 | FILE * f = fopen( thisfile, "rb" ); 107 | if( !f ) 108 | { 109 | fprintf( stderr, "Error: cannot open \"%s\" for reading.\n", dir->d_name ); 110 | return -9; 111 | } 112 | fread( &mfsdata[datapointer], 1, buf.st_size, f ); 113 | fclose( f ); 114 | int rs = buf.st_size; 115 | rs = (rs+1+MFS_SECTOR)&(~(MFS_SECTOR-1)); 116 | datapointer += rs; 117 | printf( "%s: %d (%ld)\n", thisfile, rs, datapointer ); 118 | } 119 | } 120 | } 121 | 122 | closedir(d); 123 | 124 | int rs = (fatpointer+1)*sizeof(struct MFSFileEntry); 125 | rs = (rs+1+MFS_SECTOR)&(~(MFS_SECTOR-1)); 126 | for( i = 0; i < fatpointer; i++ ) 127 | { 128 | mfsfat[i].start = ENDIAN(mfsfat[i].start + rs ); 129 | } 130 | 131 | printf( "%d %ld\n", rs, datapointer ); 132 | 133 | FILE * f = fopen( argv[2], "w" ); 134 | 135 | if( !f || ferror( f ) ) 136 | { 137 | fprintf( stderr, "Error: cannot open \"%s\" for writing.\n", argv[2] ); 138 | } 139 | fwrite( mfsfat, rs, 1, f ); 140 | fwrite( mfsdata, datapointer, 1, f ); 141 | fclose( f ); 142 | 143 | return 0; 144 | } 145 | 146 | 147 | -------------------------------------------------------------------------------- /hardware/kelvindmmwifi-cache.lib: -------------------------------------------------------------------------------- 1 | EESchema-LIBRARY Version 2.3 2 | #encoding utf-8 3 | # 4 | # +3V3 5 | # 6 | DEF +3V3 #PWR 0 0 Y Y 1 F P 7 | F0 "#PWR" 0 -150 50 H I C CNN 8 | F1 "+3V3" 0 140 50 H V C CNN 9 | F2 "" 0 0 50 H V C CNN 10 | F3 "" 0 0 50 H V C CNN 11 | ALIAS +3.3V 12 | DRAW 13 | P 2 0 1 0 -30 50 0 100 N 14 | P 2 0 1 0 0 0 0 100 N 15 | P 2 0 1 0 0 100 30 50 N 16 | X +3V3 1 0 0 0 U 50 50 1 1 W N 17 | ENDDRAW 18 | ENDDEF 19 | # 20 | # +5V 21 | # 22 | DEF +5V #PWR 0 0 Y Y 1 F P 23 | F0 "#PWR" 0 -150 50 H I C CNN 24 | F1 "+5V" 0 140 50 H V C CNN 25 | F2 "" 0 0 50 H V C CNN 26 | F3 "" 0 0 50 H V C CNN 27 | DRAW 28 | P 2 0 1 0 -30 50 0 100 N 29 | P 2 0 1 0 0 0 0 100 N 30 | P 2 0 1 0 0 100 30 50 N 31 | X +5V 1 0 0 0 U 50 50 1 1 W N 32 | ENDDRAW 33 | ENDDEF 34 | # 35 | # AP1117 36 | # 37 | DEF AP1117 U 0 30 Y Y 1 F N 38 | F0 "U" 100 -250 50 H V C CNN 39 | F1 "AP1117" 0 250 50 H V C CNN 40 | F2 "TO_SOT_Packages_SMD:SOT-223" 0 -350 50 H I C CNN 41 | F3 "" 100 -250 50 H V C CNN 42 | ALIAS AP111715 AP111718 AP111725 AP111733 AP111750 43 | $FPLIST 44 | SOT-223* 45 | $ENDFPLIST 46 | DRAW 47 | S -200 -200 200 200 0 1 10 f 48 | X GND/ADJ 1 0 -300 100 U 50 50 1 1 W 49 | X VO 2 300 0 100 L 50 50 1 1 w 50 | X VI 3 -300 0 100 R 50 50 1 1 W 51 | X VO 4 300 0 100 L 50 50 1 1 w N 52 | ENDDRAW 53 | ENDDEF 54 | # 55 | # C 56 | # 57 | DEF C C 0 10 N Y 1 F N 58 | F0 "C" 25 100 50 H V L CNN 59 | F1 "C" 25 -100 50 H V L CNN 60 | F2 "" 38 -150 50 H V C CNN 61 | F3 "" 0 0 50 H V C CNN 62 | $FPLIST 63 | C? 64 | C_????_* 65 | C_???? 66 | SMD*_c 67 | Capacitor* 68 | $ENDFPLIST 69 | DRAW 70 | P 2 0 1 20 -80 -30 80 -30 N 71 | P 2 0 1 20 -80 30 80 30 N 72 | X ~ 1 0 150 110 D 50 50 1 1 P 73 | X ~ 2 0 -150 110 U 50 50 1 1 P 74 | ENDDRAW 75 | ENDDEF 76 | # 77 | # COMP-MIC7721 78 | # 79 | DEF COMP-MIC7721 U 0 40 Y Y 1 F N 80 | F0 "U" -100 200 60 H V C CNN 81 | F1 "COMP-MIC7721" 0 400 60 H V C CNN 82 | F2 "" -100 -100 60 H I C CNN 83 | F3 "" -100 -100 60 H I C CNN 84 | DRAW 85 | S -200 150 200 -150 0 1 0 f 86 | X OUT 1 -400 100 200 R 50 50 1 1 I 87 | X V+ 2 -400 0 200 R 50 50 1 1 I 88 | X IN+ 3 -400 -100 200 R 50 50 1 1 I 89 | X IN- 4 400 -100 200 L 50 50 1 1 I 90 | X V- 5 400 100 200 L 50 50 1 1 I 91 | ENDDRAW 92 | ENDDEF 93 | # 94 | # CONN_1 95 | # 96 | DEF ~CONN_1 P 0 30 N N 1 F N 97 | F0 "P" 80 0 40 H V L CNN 98 | F1 "CONN_1" 0 55 30 H I C CNN 99 | F2 "" 0 0 60 H V C CNN 100 | F3 "" 0 0 60 H V C CNN 101 | DRAW 102 | C 0 0 31 0 1 0 N 103 | P 2 0 1 0 -30 0 -50 0 N 104 | X 1 1 -150 0 100 R 60 60 1 1 P 105 | ENDDRAW 106 | ENDDEF 107 | # 108 | # CONN_7 109 | # 110 | DEF CONN_7 P 0 40 Y N 1 F N 111 | F0 "P" -30 0 60 V V C CNN 112 | F1 "CONN_7" 70 0 60 V V C CNN 113 | F2 "" 0 0 60 H V C CNN 114 | F3 "" 0 0 60 H V C CNN 115 | DRAW 116 | S -100 350 150 -350 0 1 0 N 117 | X P1 1 -350 300 250 R 50 50 1 1 P I 118 | X P2 2 -350 200 250 R 50 50 1 1 P I 119 | X P3 3 -350 100 250 R 50 50 1 1 P I 120 | X P4 4 -350 0 250 R 50 50 1 1 P I 121 | X P5 5 -350 -100 250 R 50 50 1 1 P I 122 | X P6 6 -350 -200 250 R 50 50 1 1 P I 123 | X P7 7 -350 -300 250 R 50 50 1 1 P I 124 | ENDDRAW 125 | ENDDEF 126 | # 127 | # ESP12E 128 | # 129 | DEF ESP12E ESP 0 40 Y Y 1 F N 130 | F0 "ESP" 300 600 60 H V C CNN 131 | F1 "ESP12E" -300 600 60 H V C CNN 132 | F2 "" 50 -250 60 H V C CNN 133 | F3 "" 50 -250 60 H V C CNN 134 | DRAW 135 | S -500 750 500 -450 0 1 0 f 136 | X REST 1 -800 450 300 R 50 50 1 1 I 137 | X ADC 2 -800 350 300 R 50 50 1 1 I 138 | X CH_PD 3 -800 250 300 R 50 50 1 1 I 139 | X GPIO16 4 -800 150 300 R 50 50 1 1 I 140 | X GPIO14 5 -800 50 300 R 50 50 1 1 I 141 | X GPIO12 6 -800 -50 300 R 50 50 1 1 I 142 | X GPIO13 7 -800 -150 300 R 50 50 1 1 I 143 | X VCC 8 -800 -250 300 R 50 50 1 1 I 144 | X MTDO 9 -250 -750 300 U 50 50 1 1 I 145 | X MTDI 10 -150 -750 300 U 50 50 1 1 I 146 | X GPIO5 20 800 250 300 L 50 50 1 1 I 147 | X SD_3 11 -50 -750 300 U 50 50 1 1 I 148 | X RXD 21 800 350 300 L 50 50 1 1 I 149 | X MTMS 12 50 -750 300 U 50 50 1 1 I 150 | X TXD 22 800 450 300 L 50 50 1 1 I 151 | X MTCK 13 150 -750 300 U 50 50 1 1 I 152 | X SD_2 14 250 -750 300 U 50 50 1 1 I 153 | X GND 15 800 -250 300 L 50 50 1 1 I 154 | X GPIO15 16 800 -150 300 L 50 50 1 1 I 155 | X GPIO2 17 800 -50 300 L 50 50 1 1 I 156 | X GPIO0 18 800 50 300 L 50 50 1 1 I 157 | X GPIO4 19 800 150 300 L 50 50 1 1 I 158 | ENDDRAW 159 | ENDDEF 160 | # 161 | # GND 162 | # 163 | DEF GND #PWR 0 0 Y Y 1 F P 164 | F0 "#PWR" 0 -250 50 H I C CNN 165 | F1 "GND" 0 -150 50 H V C CNN 166 | F2 "" 0 0 50 H V C CNN 167 | F3 "" 0 0 50 H V C CNN 168 | DRAW 169 | P 6 0 1 0 0 0 0 -50 50 -50 0 -100 -50 -50 0 -50 N 170 | X GND 1 0 0 0 D 50 50 1 1 W N 171 | ENDDRAW 172 | ENDDEF 173 | # 174 | # R 175 | # 176 | DEF R R 0 0 N Y 1 F N 177 | F0 "R" 80 0 50 V V C CNN 178 | F1 "R" 0 0 50 V V C CNN 179 | F2 "" -70 0 50 V V C CNN 180 | F3 "" 0 0 50 H V C CNN 181 | $FPLIST 182 | R_* 183 | Resistor_* 184 | $ENDFPLIST 185 | DRAW 186 | S -40 -100 40 100 0 1 10 N 187 | X ~ 1 0 150 50 D 50 50 1 1 P 188 | X ~ 2 0 -150 50 U 50 50 1 1 P 189 | ENDDRAW 190 | ENDDEF 191 | # 192 | #End Library 193 | -------------------------------------------------------------------------------- /user/pin_mux_register.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) Espressif System 2010 - 2012 3 | * 4 | */ 5 | 6 | #ifndef _PIN_MUX_H_ 7 | #define _PIN_MUX_H_ 8 | 9 | #define PERIPHS_IO_MUX 0x60000800 10 | 11 | #define PERIPHS_IO_MUX_FUNC 0x13 12 | #define PERIPHS_IO_MUX_FUNC_S 4 13 | #define PERIPHS_IO_MUX_PULLUP BIT7 14 | #define PERIPHS_IO_MUX_PULLDWN BIT6 15 | #define PERIPHS_IO_MUX_SLEEP_PULLUP BIT3 16 | #define PERIPHS_IO_MUX_SLEEP_PULLDWN BIT2 17 | #define PERIPHS_IO_MUX_SLEEP_OE BIT1 18 | #define PERIPHS_IO_MUX_OE BIT0 19 | 20 | #define PERIPHS_IO_MUX_CONF_U (PERIPHS_IO_MUX + 0x00) 21 | #define SPI0_CLK_EQU_SYS_CLK BIT8 22 | #define SPI1_CLK_EQU_SYS_CLK BIT9 23 | 24 | #define PERIPHS_IO_MUX_MTDI_U (PERIPHS_IO_MUX + 0x04) 25 | #define FUNC_MTDI 0 26 | #define FUNC_I2SI_DATA 1 27 | #define FUNC_HSPIQ_MISO 2 28 | #define FUNC_GPIO12 3 29 | #define FUNC_UART0_DTR 4 30 | 31 | #define PERIPHS_IO_MUX_MTCK_U (PERIPHS_IO_MUX + 0x08) 32 | #define FUNC_MTCK 0 33 | #define FUNC_I2SI_BCK 1 34 | #define FUNC_HSPID_MOSI 2 35 | #define FUNC_GPIO13 3 36 | #define FUNC_UART0_CTS 4 37 | 38 | #define PERIPHS_IO_MUX_MTMS_U (PERIPHS_IO_MUX + 0x0C) 39 | #define FUNC_MTMS 0 40 | #define FUNC_I2SI_WS 1 41 | #define FUNC_HSPI_CLK 2 42 | #define FUNC_GPIO14 3 43 | #define FUNC_UART0_DSR 4 44 | 45 | #define PERIPHS_IO_MUX_MTDO_U (PERIPHS_IO_MUX + 0x10) 46 | #define FUNC_MTDO 0 47 | #define FUNC_I2SO_BCK 1 48 | #define FUNC_HSPI_CS0 2 49 | #define FUNC_GPIO15 3 50 | #define FUNC_U0RTS 4 51 | #define FUNC_UART0_RTS 4 52 | 53 | #define PERIPHS_IO_MUX_U0RXD_U (PERIPHS_IO_MUX + 0x14) 54 | #define FUNC_U0RXD 0 55 | #define FUNC_I2SO_DATA 1 56 | #define FUNC_GPIO3 3 57 | #define FUNC_CLK_XTAL_BK 4 58 | 59 | #define PERIPHS_IO_MUX_U0TXD_U (PERIPHS_IO_MUX + 0x18) 60 | #define FUNC_U0TXD 0 61 | #define FUNC_SPICS1 1 62 | #define FUNC_GPIO1 3 63 | #define FUNC_CLK_RTC_BK 4 64 | 65 | #define PERIPHS_IO_MUX_SD_CLK_U (PERIPHS_IO_MUX + 0x1c) 66 | #define FUNC_SDCLK 0 67 | #define FUNC_SPICLK 1 68 | #define FUNC_GPIO6 3 69 | #define UART1_CTS 4 70 | 71 | #define PERIPHS_IO_MUX_SD_DATA0_U (PERIPHS_IO_MUX + 0x20) 72 | #define FUNC_SDDATA0 0 73 | #define FUNC_SPIQ_MISO 1 74 | #define FUNC_GPIO7 3 75 | #define FUNC_U1TXD 4 76 | #define FUNC_UART1_TXD 4 77 | 78 | #define PERIPHS_IO_MUX_SD_DATA1_U (PERIPHS_IO_MUX + 0x24) 79 | #define FUNC_SDDATA1 0 80 | #define FUNC_SPID_MOSI 1 81 | #define FUNC_GPIO8 3 82 | #define FUNC_U1RXD 4 83 | #define FUNC_UART1_RXD 4 84 | 85 | #define PERIPHS_IO_MUX_SD_DATA2_U (PERIPHS_IO_MUX + 0x28) 86 | #define FUNC_SDDATA2 0 87 | #define FUNC_SPIHD 1 88 | #define FUNC_GPIO9 3 89 | #define UFNC_HSPIHD 4 90 | 91 | #define PERIPHS_IO_MUX_SD_DATA3_U (PERIPHS_IO_MUX + 0x2c) 92 | #define FUNC_SDDATA3 0 93 | #define FUNC_SPIWP 1 94 | #define FUNC_GPIO10 3 95 | #define FUNC_HSPIWP 4 96 | 97 | #define PERIPHS_IO_MUX_SD_CMD_U (PERIPHS_IO_MUX + 0x30) 98 | #define FUNC_SDCMD 0 99 | #define FUNC_SPICS0 1 100 | #define FUNC_GPIO11 3 101 | #define U1RTS 4 102 | #define UART1_RTS 4 103 | 104 | #define PERIPHS_IO_MUX_GPIO0_U (PERIPHS_IO_MUX + 0x34) 105 | #define FUNC_GPIO0 0 106 | #define FUNC_SPICS2 1 107 | #define FUNC_CLK_OUT 4 108 | 109 | #define PERIPHS_IO_MUX_GPIO2_U (PERIPHS_IO_MUX + 0x38) 110 | #define FUNC_GPIO2 0 111 | #define FUNC_I2SO_WS 1 112 | #define FUNC_U1TXD_BK 2 113 | #define FUNC_UART1_TXD_BK 2 114 | #define FUNC_U0TXD_BK 4 115 | #define FUNC_UART0_TXD_BK 4 116 | 117 | #define PERIPHS_IO_MUX_GPIO4_U (PERIPHS_IO_MUX + 0x3C) 118 | #define FUNC_GPIO4 0 119 | #define FUNC_CLK_XTAL 1 120 | 121 | #define PERIPHS_IO_MUX_GPIO5_U (PERIPHS_IO_MUX + 0x40) 122 | #define FUNC_GPIO5 0 123 | #define FUNC_CLK_RTC 1 124 | 125 | #define PIN_PULLUP_DIS(PIN_NAME) CLEAR_PERI_REG_MASK(PIN_NAME, PERIPHS_IO_MUX_PULLUP) 126 | #define PIN_PULLUP_EN(PIN_NAME) SET_PERI_REG_MASK(PIN_NAME, PERIPHS_IO_MUX_PULLUP) 127 | 128 | //XXX THIS LOOKS WRONG. 129 | 130 | #undef PIN_FUNC_SELECT 131 | 132 | #define PIN_FUNC_SELECT(PIN_NAME, FUNC) do { \ 133 | CLEAR_PERI_REG_MASK(PIN_NAME, (PERIPHS_IO_MUX_FUNC< 5 | #include "user_interface.h" 6 | #include "pin_mux_register.h" 7 | #include "dmastuff.h" 8 | #include "i2sduplex.h" 9 | #include 10 | #include 11 | 12 | 13 | 14 | //These contol the speed at which the bus comms. 15 | #define WS_I2S_BCK 8 //Can't be less than 1. 16 | #define WS_I2S_DIV 80000 17 | 18 | //I2S DMA buffer descriptors 19 | static struct sdio_queue i2sBufDescRX[DMABUFFERDEPTH]; 20 | static struct sdio_queue i2sBufDescTX[DMABUFFERDEPTH]; 21 | uint32_t i2sBDRX[I2SDMABUFLEN*DMABUFFERDEPTH]; 22 | uint32_t i2sBDTX[I2SDMABUFLEN*DMABUFFERDEPTH]; 23 | int fxcycle; 24 | int erx, etx; 25 | 26 | LOCAL void slc_isr(void) { 27 | //portBASE_TYPE HPTaskAwoken=0; 28 | struct sdio_queue *finishedDesc; 29 | uint32 slc_intr_status; 30 | int x; 31 | fxcycle++; 32 | 33 | slc_intr_status = READ_PERI_REG(SLC_INT_STATUS); 34 | //clear all intr flags 35 | WRITE_PERI_REG(SLC_INT_CLR, 0xffffffff);//slc_intr_status); 36 | 37 | //printf( "%08x\n", slc_intr_status ); 38 | if ( (slc_intr_status & SLC_RX_EOF_INT_ST)) 39 | { 40 | finishedDesc=(struct sdio_queue*)READ_PERI_REG(SLC_RX_EOF_DES_ADDR); 41 | 42 | etx++; //I know it's wacky, but the nomeclature is backwards, this is for TX packets in here. 43 | } 44 | if ( (slc_intr_status & SLC_TX_EOF_INT_ST)) 45 | { 46 | finishedDesc=(struct sdio_queue*)READ_PERI_REG(SLC_TX_EOF_DES_ADDR); 47 | 48 | uint32_t * data = finishedDesc->buf_ptr; 49 | int i; 50 | for( i = 0; i < I2SDMABUFLEN; i++ ) 51 | { 52 | printf( "%1d", data[i]>>31 ); 53 | } 54 | 55 | //finishedDesc=finishedDesc->next_link_ptr; 56 | 57 | //Don't know why - but this MUST be done, otherwise everything comes to a screeching halt. 58 | finishedDesc->owner=1; 59 | 60 | //Nomaclature weird. this is actually RX packets. 61 | erx++; 62 | } 63 | 64 | 65 | 66 | } 67 | 68 | //Initialize I2S subsystem for DMA circular buffer use 69 | void ICACHE_FLASH_ATTR testi2s_init() { 70 | int x, y; 71 | //Bits are shifted out 72 | 73 | //Initialize DMA buffer descriptors in such a way that they will form a circular 74 | //buffer. 75 | 76 | for (x=0; x< Charles Lohr Under the MIT/x11 License, NewBSD License or 3 | // ColorChord License. You Choose. 4 | 5 | #include 6 | #include 7 | #include 8 | #if defined (__unix__) || (defined (__APPLE__) && defined (__MACH__)) 9 | #include 10 | #include 11 | #endif 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | 19 | struct libusb_device_handle *devh = NULL; 20 | 21 | #define USB_SIZE 128 22 | #define sector_SIZE 4096 23 | #ifndef NET_MAXTRIES 24 | #define NET_MAXTRIES 10 // In seconds, may be fractional 25 | #endif 26 | #ifndef NET_TIMEOUT 27 | #define NET_TIMEOUT 3.0 // In seconds, may be fractional 28 | #endif 29 | int sockfd; 30 | char recvline[10000]; 31 | 32 | int use_usb = 0; 33 | int sendsize_max = 1024; //For USB it will be smaller 34 | struct sockaddr_in servaddr,cliaddr; 35 | 36 | int SendData( uint8_t * buffer, int len ) 37 | { 38 | if( use_usb ) 39 | { 40 | int r1 = libusb_control_transfer( devh, 41 | 0x00, //reqtype (0x80 = Device->PC, 0x00 = PC->Device) 42 | 0xA6, //request 43 | 0x0100, //wValue 44 | 0x0000, //wIndex 45 | buffer, 46 | len, //wLength (more like max length) 47 | 1000 ); 48 | } 49 | else 50 | { 51 | return sendto( sockfd, buffer, len, MSG_NOSIGNAL, (struct sockaddr *)&servaddr,sizeof(servaddr)); 52 | } 53 | } 54 | 55 | 56 | int PushMatch( const char * match ) 57 | { 58 | if( use_usb ) 59 | { 60 | int tries = 0; 61 | for( tries = 0; tries < NET_MAXTRIES; tries++ ) 62 | { 63 | usleep( 1000 ); 64 | 65 | int r2 = libusb_control_transfer( devh, 66 | 0x80, //reqtype (0x80 = in, 0x00 = out) 67 | 0xA7, //request 68 | 0x0100, //wValue 69 | 0x0000, //wIndex 70 | recvline, //wLength (more like max length) 71 | USB_SIZE, 72 | 1000 ); 73 | 74 | if( r2 < 0 ) continue; 75 | 76 | recvline[r2] = 0; 77 | 78 | if( strncmp( recvline, match, strlen( match ) ) == 0 ) //XXX? Should this be memcmp? 79 | { 80 | return 0; 81 | } 82 | 83 | usleep( 20000 ); 84 | } 85 | return 1; 86 | } 87 | else 88 | { 89 | struct timeval tva, tvb; 90 | gettimeofday( &tva, 0 ); 91 | float diff = 0.0; 92 | while( diff < NET_TIMEOUT ) 93 | { 94 | struct pollfd ufds; 95 | ufds.fd = sockfd; 96 | ufds.events = POLLIN; 97 | int rv = poll(&ufds, 1, 500); 98 | if( rv > 0 ) 99 | { 100 | // tbuf = recvline; 101 | int n=recvfrom(sockfd,recvline,10000,0,NULL,NULL); 102 | if( strncmp( recvline, match, strlen( match ) ) == 0 ) 103 | { 104 | return 0; 105 | } 106 | } 107 | gettimeofday( &tvb, 0 ); 108 | diff = tvb.tv_sec - tva.tv_sec + 1e-6*(tvb.tv_usec - tva.tv_usec); 109 | } 110 | return 1; 111 | } 112 | } 113 | 114 | 115 | int main(int argc, char**argv) 116 | { 117 | int n; 118 | char sendline[1000]; 119 | // char recvline[1000]; 120 | 121 | if (argc != 4) 122 | { 123 | printf("usage: pushtodev [IP address] [address offset] [file]\n"); 124 | exit(-1); 125 | } 126 | 127 | int offset = atoi( argv[2] ); 128 | const char * file = argv[3]; 129 | 130 | if( offset <= 0 ) 131 | { 132 | fprintf( stderr, "Error: Cannot write to address 0 or before.\n" ); 133 | exit(-2); 134 | } 135 | 136 | FILE * f = fopen( file, "rb" ); 137 | if( !f || feof( f ) ) 138 | { 139 | fprintf( stderr, "Error: cannot open file.\n" ); 140 | exit(-3); 141 | } 142 | 143 | 144 | if( strcmp( argv[1], "USB" ) == 0 ) 145 | { 146 | int r; 147 | use_usb = 1; 148 | printf( "Connecting by USB\n" ); 149 | fprintf( stderr, "WARNING: USB BURNING IS EXPERIMENTAL AND LIKELY TO CHANGE\n" ); 150 | if( libusb_init(NULL) < 0 ) 151 | { 152 | fprintf( stderr, "Error: Could not initialize libUSB\n" ); 153 | return -1; 154 | } 155 | 156 | 157 | devh = libusb_open_device_with_vid_pid( NULL, 0xabcd, 0x8266 ); 158 | if( !devh ) 159 | { 160 | fprintf( stderr, "Error: Cannot find USB device.\n" ); 161 | return -1; 162 | } 163 | 164 | libusb_detach_kernel_driver( devh, 0 ); 165 | 166 | if( (r=libusb_claim_interface(devh, 0)) < 0 ) 167 | { 168 | fprintf(stderr, "usb_claim_interface error %d\n", r); 169 | return -1; 170 | } 171 | printf( "Connected.\n" ); 172 | //USB is attached 173 | sendsize_max = USB_SIZE; 174 | } 175 | else 176 | { 177 | sockfd=socket(AF_INET,SOCK_DGRAM,0); 178 | 179 | bzero(&servaddr,sizeof(servaddr)); 180 | servaddr.sin_family = AF_INET; 181 | servaddr.sin_addr.s_addr=inet_addr(argv[1]); 182 | servaddr.sin_port=htons(BACKEND_PORT); 183 | } 184 | 185 | int devo = 0; 186 | int lastsector_block = -1; 187 | int resend_times = 0; 188 | int r; 189 | while( !feof( f ) ) 190 | { 191 | int tries; 192 | int thissuccess; 193 | char buffer[1024]; 194 | char bufferout[1600]; 195 | int reads = fread( buffer, 1, sendsize_max, f ); 196 | int sendplace = offset + devo; 197 | int sendsize = reads; 198 | if( sendsize == 0 ) break; 199 | 200 | #ifdef SECTOR 201 | int sector = sendplace / sector_SIZE; 202 | if( sector != lastsector_block ) 203 | { 204 | char se[64]; 205 | int sel = sprintf( se, "FE%d\r\n", sector ); 206 | 207 | thissuccess = 0; 208 | for( tries = 0; tries < NET_MAXTRIES; tries++ ) 209 | { 210 | char match[75]; 211 | printf( "Erase: %d\n", sector ); 212 | SendData( se, sel ); 213 | sprintf( match, "FE%d", sector ); 214 | 215 | if( PushMatch(match) == 0 ) { thissuccess = 1; break; } 216 | printf( "Retry.\n" ); 217 | } 218 | if( !thissuccess ) 219 | { 220 | fprintf( stderr, "Error: Timeout in communications.\n" ); 221 | exit( -6 ); 222 | } 223 | 224 | lastsector_block = sector; 225 | } 226 | #else //block 227 | 228 | int block = sendplace / 65536; 229 | if( block != lastsector_block ) 230 | { 231 | char se[64]; 232 | int sel = sprintf( se, "FB%d\r\n", block ); 233 | 234 | thissuccess = 0; 235 | for( tries = 0; tries < 10; tries++ ) 236 | { 237 | char match[75]; 238 | printf( "Erase: %d\n", block ); 239 | SendData( se, sel ); 240 | sprintf( match, "FB%d", block ); 241 | 242 | if( PushMatch(match) == 0 ) { thissuccess = 1; break; } 243 | printf( "Retry.\n" ); 244 | } 245 | if( !thissuccess ) 246 | { 247 | fprintf( stderr, "Error: Timeout in communications.\n" ); 248 | exit( -6 ); 249 | } 250 | 251 | lastsector_block = block; 252 | } 253 | #endif 254 | resend_times = 0; 255 | resend: 256 | r = sprintf( bufferout, "FW%d\t%d\t", sendplace, sendsize ); 257 | //printf( "bufferout: %d %d %s\n", sendplace, sendsize, bufferout ); 258 | printf( "." ); fflush( stdout ); 259 | memcpy( bufferout + r, buffer, sendsize ); 260 | 261 | 262 | thissuccess = 0; 263 | for( tries = 0; tries < 10; tries++ ) 264 | { 265 | char match[75]; 266 | SendData( bufferout, reads + r ); 267 | sprintf( match, "FW%d", sendplace ); 268 | 269 | if( PushMatch(match) == 0 ) { thissuccess = 1; break; } 270 | printf( "Retry.\n" ); 271 | } 272 | if( !thissuccess ) 273 | { 274 | fprintf( stderr, "Error: Timeout in communications.\n" ); 275 | exit( -6 ); 276 | } 277 | 278 | /* 279 | printf( "Verifying..." ); 280 | fflush( stdout ); 281 | 282 | int r = sprintf( bufferout, "FR%d:%d", sendplace, sendsize ); 283 | bufferout[r] = 0; 284 | 285 | thissuccess = 0; 286 | for( tries = 0; tries < 10; tries++ ) 287 | { 288 | char match[1600]; 289 | sendto( sockfd, bufferout, r, MSG_NOSIGNAL, (struct sockaddr *)&servaddr,sizeof(servaddr)); 290 | devo += reads; 291 | sprintf( match, "FR%08d", sendplace ); 292 | 293 | if( PushMatch(match) == 0 ) { 294 | 295 | //Check data... 296 | //printf( "RR:%s\n", recvline ); 297 | char * colon1 = strchr( recvline, ':' ); 298 | char * colon2 = (colon1)?strchr( colon1+1, ':' ):0; 299 | //printf( "::%p %p \"%s\"\n", colon1, colon2,recvline ); 300 | if( colon2 ) 301 | { 302 | if( memcmp( colon2+1, buffer, sendsize ) == 0 ) 303 | thissuccess = 1; 304 | } 305 | 306 | if( !thissuccess ) 307 | { 308 | if( resend_times > 2 ) 309 | { 310 | break; 311 | } 312 | resend_times++; 313 | goto resend; 314 | } 315 | break; 316 | } 317 | printf( "Retry.\n" ); 318 | } 319 | if( !thissuccess ) 320 | { 321 | fprintf( stderr, "Error: Fault verifying.\n" ); 322 | exit( -6 ); 323 | } 324 | */ 325 | devo += reads; 326 | 327 | } 328 | 329 | printf( "Send done.\n" ); 330 | return 0; 331 | } 332 | -------------------------------------------------------------------------------- /hardware/kelvindmmwifi.pro: -------------------------------------------------------------------------------- 1 | update=Sun 05 Feb 2017 06:58:16 PM EST 2 | version=1 3 | last_client=kicad 4 | [pcbnew] 5 | version=1 6 | LastNetListRead= 7 | UseCmpFile=1 8 | PadDrill=0.600000000000 9 | PadDrillOvalY=0.600000000000 10 | PadSizeH=1.500000000000 11 | PadSizeV=1.500000000000 12 | PcbTextSizeV=1.500000000000 13 | PcbTextSizeH=1.500000000000 14 | PcbTextThickness=0.300000000000 15 | ModuleTextSizeV=1.000000000000 16 | ModuleTextSizeH=1.000000000000 17 | ModuleTextSizeThickness=0.150000000000 18 | SolderMaskClearance=0.000000000000 19 | SolderMaskMinWidth=0.000000000000 20 | DrawSegmentWidth=0.200000000000 21 | BoardOutlineThickness=0.100000000000 22 | ModuleOutlineThickness=0.150000000000 23 | [cvpcb] 24 | version=1 25 | NetIExt=net 26 | [general] 27 | version=1 28 | [eeschema] 29 | version=1 30 | LibDir= 31 | [eeschema/libraries] 32 | LibName1=power 33 | LibName2=device 34 | LibName3=transistors 35 | LibName4=conn 36 | LibName5=linear 37 | LibName6=regul 38 | LibName7=74xx 39 | LibName8=cmos4000 40 | LibName9=adc-dac 41 | LibName10=memory 42 | LibName11=xilinx 43 | LibName12=microcontrollers 44 | LibName13=dsp 45 | LibName14=microchip 46 | LibName15=analog_switches 47 | LibName16=motorola 48 | LibName17=texas 49 | LibName18=intel 50 | LibName19=audio 51 | LibName20=interface 52 | LibName21=digital-audio 53 | LibName22=philips 54 | LibName23=display 55 | LibName24=cypress 56 | LibName25=siliconi 57 | LibName26=opto 58 | LibName27=atmel 59 | LibName28=contrib 60 | LibName29=valves 61 | LibName30=/home/youtube/electrical/kicad/2.4GHZ_2450FB15L0001 62 | LibName31=/home/youtube/electrical/kicad/6multi 63 | LibName32=/home/youtube/electrical/kicad/23lc1024 64 | LibName33=/home/youtube/electrical/kicad/25q40b 65 | LibName34=/home/youtube/electrical/kicad/74hc390 66 | LibName35=/home/youtube/electrical/kicad/74hc4067 67 | LibName36=/home/youtube/electrical/kicad/1206network 68 | LibName37=/home/youtube/electrical/kicad/4427 69 | LibName38=/home/youtube/electrical/kicad/5050RGB 70 | LibName39=/home/youtube/electrical/kicad/7805 71 | LibName40=/home/youtube/electrical/kicad/7805to220 72 | LibName41=/home/youtube/electrical/kicad/a4447sljtr 73 | LibName42=/home/youtube/electrical/kicad/ad9216 74 | LibName43=/home/youtube/electrical/kicad/adc-ltc2450 75 | LibName44=/home/youtube/electrical/kicad/ak5358b 76 | LibName45=/home/youtube/electrical/kicad/ap1117 77 | LibName46=/home/youtube/electrical/kicad/atmega48_88_168_328_tqfp32 78 | LibName47=/home/youtube/electrical/kicad/atmega1284rfr2 79 | LibName48=/home/youtube/electrical/kicad/atmegax8pb 80 | LibName49=/home/youtube/electrical/kicad/atmegaxu2 81 | LibName50=/home/youtube/electrical/kicad/atmel_kk 82 | LibName51=/home/youtube/electrical/kicad/attiny441 83 | LibName52=/home/youtube/electrical/kicad/attiny441-qfn 84 | LibName53=/home/youtube/electrical/kicad/attinyx4 85 | LibName54=/home/youtube/electrical/kicad/attinyx5 86 | LibName55=/home/youtube/electrical/kicad/atx_power 87 | LibName56=/home/youtube/electrical/kicad/avr6pin 88 | LibName57=/home/youtube/electrical/kicad/avr_usb_3v3-cache 89 | LibName58=/home/youtube/electrical/kicad/BELFuse_Ethernet 90 | LibName59=/home/youtube/electrical/kicad/bluetoothedpa 91 | LibName60=/home/youtube/electrical/kicad/bmp085 92 | LibName61=/home/youtube/electrical/kicad/bmp280 93 | LibName62=/home/youtube/electrical/kicad/bridge-MB2S-TP 94 | LibName63=/home/youtube/electrical/kicad/can_sn65hvd251qdrq1 95 | LibName64=/home/youtube/electrical/kicad/cap1128 96 | LibName65=/home/youtube/electrical/kicad/cd4021 97 | LibName66=/home/youtube/electrical/kicad/choke 98 | LibName67=/home/youtube/electrical/kicad/cp2104 99 | LibName68=/home/youtube/electrical/kicad/crystal-4p 100 | LibName69=/home/youtube/electrical/kicad/cyusb3012 101 | LibName70=/home/youtube/electrical/kicad/diode-to-277-3 102 | LibName71=/home/youtube/electrical/kicad/dmp2240udm 103 | LibName72=/home/youtube/electrical/kicad/ds2438z 104 | LibName73=/home/youtube/electrical/kicad/dualopamp 105 | LibName74=/home/youtube/electrical/kicad/enc424j600 106 | LibName75=/home/youtube/electrical/kicad/esp12e 107 | LibName76=/home/youtube/electrical/kicad/esp32 108 | LibName77=/home/youtube/electrical/kicad/esp8266ex 109 | LibName78=/home/youtube/electrical/kicad/esp8266-wi07-6 110 | LibName79=/home/youtube/electrical/kicad/exb-a 111 | LibName80=/home/youtube/electrical/kicad/flipflop-sn74lvc1g175 112 | LibName81=/home/youtube/electrical/kicad/ft600q 113 | LibName82=/home/youtube/electrical/kicad/halleffect-tcs20dlr 114 | LibName83=/home/youtube/electrical/kicad/hv9910c 115 | LibName84=/home/youtube/electrical/kicad/ir2101 116 | LibName85=/home/youtube/electrical/kicad/isl3177 117 | LibName86=/home/youtube/electrical/kicad/isol_adum1201brz 118 | LibName87=/home/youtube/electrical/kicad/jfet-n_sot-23 119 | LibName88=/home/youtube/electrical/kicad/ksz8081rn 120 | LibName89=/home/youtube/electrical/kicad/l6470 121 | LibName90=/home/youtube/electrical/kicad/l6470-powerso36 122 | LibName91=/home/youtube/electrical/kicad/l6474 123 | LibName92=/home/youtube/electrical/kicad/lan8720a 124 | LibName93=/home/youtube/electrical/kicad/lis3mdl 125 | LibName94=/home/youtube/electrical/kicad/lm386 126 | LibName95=/home/youtube/electrical/kicad/LNK3202 127 | LibName96=/home/youtube/electrical/kicad/lsm9ds0 128 | LibName97=/home/youtube/electrical/kicad/lsm9ds1 129 | LibName98=/home/youtube/electrical/kicad/lsm303c 130 | LibName99=/home/youtube/electrical/kicad/lsm303d 131 | LibName100=/home/youtube/electrical/kicad/lsm303dlhc 132 | LibName101=/home/youtube/electrical/kicad/LSM9DS1 133 | LibName102=/home/youtube/electrical/kicad/ltc2471cms 134 | LibName103=/home/youtube/electrical/kicad/ltv-846s 135 | LibName104=/home/youtube/electrical/kicad/lvt-816s 136 | LibName105=/home/youtube/electrical/kicad/mag3110 137 | LibName106=/home/youtube/electrical/kicad/max3010x 138 | LibName107=/home/youtube/electrical/kicad/max31855 139 | LibName108=/home/youtube/electrical/kicad/mcp1803 140 | LibName109=/home/youtube/electrical/kicad/mcp1804 141 | LibName110=/home/youtube/electrical/kicad/mcp1824_ct 142 | LibName111=/home/youtube/electrical/kicad/mcp23008-qfn 143 | LibName112=/home/youtube/electrical/kicad/mcp23008-soic 144 | LibName113=/home/youtube/electrical/kicad/memi2c_m24m02-dr 145 | LibName114=/home/youtube/electrical/kicad/mfrc522 146 | LibName115=/home/youtube/electrical/kicad/mic550x-reg 147 | LibName116=/home/youtube/electrical/kicad/microsd_1050270001 148 | LibName117=/home/youtube/electrical/kicad/mma8653fc-accel 149 | LibName118=/home/youtube/electrical/kicad/mmpq2907a 150 | LibName119=/home/youtube/electrical/kicad/mosdriver_ncp5901bmntbg 151 | LibName120=/home/youtube/electrical/kicad/mosfet-lfpak56 152 | LibName121=/home/youtube/electrical/kicad/mosfetx2vdfn8 153 | LibName122=/home/youtube/electrical/kicad/mos_n_w_diode 154 | LibName123=/home/youtube/electrical/kicad/mos_p_d2 155 | LibName124=/home/youtube/electrical/kicad/mpl3115a2 156 | LibName125=/home/youtube/electrical/kicad/mpu-9250 157 | LibName126=/home/youtube/electrical/kicad/ms5611-01ba03 158 | LibName127=/home/youtube/electrical/kicad/neon14 159 | LibName128=/home/youtube/electrical/kicad/network0606 160 | LibName129=/home/youtube/electrical/kicad/nor-nc7sz02p5x 161 | LibName130=/home/youtube/electrical/kicad/npn-2222 162 | LibName131=/home/youtube/electrical/kicad/opa832 163 | LibName132=/home/youtube/electrical/kicad/opamp_mcp6001t 164 | LibName133=/home/youtube/electrical/kicad/opto2-ltv-826s 165 | LibName134=/home/youtube/electrical/kicad/opto-logic-tlp2361 166 | LibName135=/home/youtube/electrical/kicad/ov2640_ribbon 167 | LibName136=/home/youtube/electrical/kicad/pcb_bom 168 | LibName137=/home/youtube/electrical/kicad/pfetsot223 169 | LibName138=/home/youtube/electrical/kicad/pfetwsmini6-f1-b 170 | LibName139=/home/youtube/electrical/kicad/photomos 171 | LibName140=/home/youtube/electrical/kicad/pl140c 172 | LibName141=/home/youtube/electrical/kicad/pnp-sot23 173 | LibName142=/home/youtube/electrical/kicad/protect_ncp360snt1g 174 | LibName143=/home/youtube/electrical/kicad/pusb2x4y 175 | LibName144=/home/youtube/electrical/kicad/pwrcnv_nxe1s0305mc-r7 176 | LibName145=/home/youtube/electrical/kicad/resonator6smd 177 | LibName146=/home/youtube/electrical/kicad/rn-cay16-f4 178 | LibName147=/home/youtube/electrical/kicad/rs485-isl3170 179 | LibName148=/home/youtube/electrical/kicad/sp485cn 180 | LibName149=/home/youtube/electrical/kicad/sp3010-04utg 181 | LibName150=/home/youtube/electrical/kicad/stbc08-battcharger 182 | LibName151=/home/youtube/electrical/kicad/stm32f207 183 | LibName152=/home/youtube/electrical/kicad/stm32f301 184 | LibName153=/home/youtube/electrical/kicad/stm32f303 185 | LibName154=/home/youtube/electrical/kicad/stm32f303_32 186 | LibName155=/home/youtube/electrical/kicad/stm32f407_100 187 | LibName156=/home/youtube/electrical/kicad/tactile 188 | LibName157=/home/youtube/electrical/kicad/tcs3x7x 189 | LibName158=/home/youtube/electrical/kicad/tlv320adc3101 190 | LibName159=/home/youtube/electrical/kicad/tlv711 191 | LibName160=/home/youtube/electrical/kicad/tusb2077a 192 | LibName161=/home/youtube/electrical/kicad/tvs2-wurth-82400102 193 | LibName162=/home/youtube/electrical/kicad/tvs-2x 194 | LibName163=/home/youtube/electrical/kicad/tvs-bidirection 195 | LibName164=/home/youtube/electrical/kicad/um5k1ntr 196 | LibName165=/home/youtube/electrical/kicad/usb3-gsb443133hr 197 | LibName166=/home/youtube/electrical/kicad/usbmicrob-10118194-0001lf 198 | LibName167=/home/youtube/electrical/kicad/usb-prot-ip4220cz6 199 | LibName168=/home/youtube/electrical/kicad/ws2812b 200 | LibName169=/home/youtube/electrical/kicad/ws_switch 201 | LibName170=/home/youtube/electrical/kicad/xfrmr2x2 202 | LibName171=/home/youtube/electrical/kicad/zener-sot23-3 203 | LibName172=/home/youtube/electrical/kicad/comp-mic7721 204 | -------------------------------------------------------------------------------- /web/md5.c: -------------------------------------------------------------------------------- 1 | /* 2 | * This is an OpenSSL-compatible implementation of the RSA Data Security, Inc. 3 | * MD5 Message-Digest Algorithm (RFC 1321). 4 | * 5 | * Homepage: 6 | * http://openwall.info/wiki/people/solar/software/public-domain-source-code/md5 7 | * 8 | * Author: 9 | * Alexander Peslyak, better known as Solar Designer 10 | * 11 | * This software was written by Alexander Peslyak in 2001. No copyright is 12 | * claimed, and the software is hereby placed in the public domain. 13 | * In case this attempt to disclaim copyright and place the software in the 14 | * public domain is deemed null and void, then the software is 15 | * Copyright (c) 2001 Alexander Peslyak and it is hereby released to the 16 | * general public under the following terms: 17 | * 18 | * Redistribution and use in source and binary forms, with or without 19 | * modification, are permitted. 20 | * 21 | * There's ABSOLUTELY NO WARRANTY, express or implied. 22 | * 23 | * (This is a heavily cut-down "BSD license".) 24 | * 25 | * This differs from Colin Plumb's older public domain implementation in that 26 | * no exactly 32-bit integer data type is required (any 32-bit or wider 27 | * unsigned integer data type will do), there's no compile-time endianness 28 | * configuration, and the function prototypes match OpenSSL's. No code from 29 | * Colin Plumb's implementation has been reused; this comment merely compares 30 | * the properties of the two independent implementations. 31 | * 32 | * The primary goals of this implementation are portability and ease of use. 33 | * It is meant to be fast, but not as fast as possible. Some known 34 | * optimizations are not included to reduce source code size and avoid 35 | * compile-time configuration. 36 | */ 37 | 38 | #ifndef HAVE_OPENSSL 39 | 40 | #include 41 | 42 | #include "md5.h" 43 | 44 | /* 45 | * The basic MD5 functions. 46 | * 47 | * F and G are optimized compared to their RFC 1321 definitions for 48 | * architectures that lack an AND-NOT instruction, just like in Colin Plumb's 49 | * implementation. 50 | */ 51 | #define F(x, y, z) ((z) ^ ((x) & ((y) ^ (z)))) 52 | #define G(x, y, z) ((y) ^ ((z) & ((x) ^ (y)))) 53 | #define H(x, y, z) (((x) ^ (y)) ^ (z)) 54 | #define H2(x, y, z) ((x) ^ ((y) ^ (z))) 55 | #define I(x, y, z) ((y) ^ ((x) | ~(z))) 56 | 57 | /* 58 | * The MD5 transformation for all four rounds. 59 | */ 60 | #define STEP(f, a, b, c, d, x, t, s) \ 61 | (a) += f((b), (c), (d)) + (x) + (t); \ 62 | (a) = (((a) << (s)) | (((a) & 0xffffffff) >> (32 - (s)))); \ 63 | (a) += (b); 64 | 65 | /* 66 | * SET reads 4 input bytes in little-endian byte order and stores them 67 | * in a properly aligned word in host byte order. 68 | * 69 | * The check for little-endian architectures that tolerate unaligned 70 | * memory accesses is just an optimization. Nothing will break if it 71 | * doesn't work. 72 | */ 73 | #if defined(__i386__) || defined(__x86_64__) || defined(__vax__) 74 | #define SET(n) \ 75 | (*(MD5_u32plus *)&ptr[(n) * 4]) 76 | #define GET(n) \ 77 | SET(n) 78 | #else 79 | #define SET(n) \ 80 | (ctx->block[(n)] = \ 81 | (MD5_u32plus)ptr[(n) * 4] | \ 82 | ((MD5_u32plus)ptr[(n) * 4 + 1] << 8) | \ 83 | ((MD5_u32plus)ptr[(n) * 4 + 2] << 16) | \ 84 | ((MD5_u32plus)ptr[(n) * 4 + 3] << 24)) 85 | #define GET(n) \ 86 | (ctx->block[(n)]) 87 | #endif 88 | 89 | /* 90 | * This processes one or more 64-byte data blocks, but does NOT update 91 | * the bit counters. There are no alignment requirements. 92 | */ 93 | static const void *body(MD5_CTX *ctx, const void *data, unsigned long size) 94 | { 95 | const unsigned char *ptr; 96 | MD5_u32plus a, b, c, d; 97 | MD5_u32plus saved_a, saved_b, saved_c, saved_d; 98 | 99 | ptr = (const unsigned char *)data; 100 | 101 | a = ctx->a; 102 | b = ctx->b; 103 | c = ctx->c; 104 | d = ctx->d; 105 | 106 | do { 107 | saved_a = a; 108 | saved_b = b; 109 | saved_c = c; 110 | saved_d = d; 111 | 112 | /* Round 1 */ 113 | STEP(F, a, b, c, d, SET(0), 0xd76aa478, 7) 114 | STEP(F, d, a, b, c, SET(1), 0xe8c7b756, 12) 115 | STEP(F, c, d, a, b, SET(2), 0x242070db, 17) 116 | STEP(F, b, c, d, a, SET(3), 0xc1bdceee, 22) 117 | STEP(F, a, b, c, d, SET(4), 0xf57c0faf, 7) 118 | STEP(F, d, a, b, c, SET(5), 0x4787c62a, 12) 119 | STEP(F, c, d, a, b, SET(6), 0xa8304613, 17) 120 | STEP(F, b, c, d, a, SET(7), 0xfd469501, 22) 121 | STEP(F, a, b, c, d, SET(8), 0x698098d8, 7) 122 | STEP(F, d, a, b, c, SET(9), 0x8b44f7af, 12) 123 | STEP(F, c, d, a, b, SET(10), 0xffff5bb1, 17) 124 | STEP(F, b, c, d, a, SET(11), 0x895cd7be, 22) 125 | STEP(F, a, b, c, d, SET(12), 0x6b901122, 7) 126 | STEP(F, d, a, b, c, SET(13), 0xfd987193, 12) 127 | STEP(F, c, d, a, b, SET(14), 0xa679438e, 17) 128 | STEP(F, b, c, d, a, SET(15), 0x49b40821, 22) 129 | 130 | /* Round 2 */ 131 | STEP(G, a, b, c, d, GET(1), 0xf61e2562, 5) 132 | STEP(G, d, a, b, c, GET(6), 0xc040b340, 9) 133 | STEP(G, c, d, a, b, GET(11), 0x265e5a51, 14) 134 | STEP(G, b, c, d, a, GET(0), 0xe9b6c7aa, 20) 135 | STEP(G, a, b, c, d, GET(5), 0xd62f105d, 5) 136 | STEP(G, d, a, b, c, GET(10), 0x02441453, 9) 137 | STEP(G, c, d, a, b, GET(15), 0xd8a1e681, 14) 138 | STEP(G, b, c, d, a, GET(4), 0xe7d3fbc8, 20) 139 | STEP(G, a, b, c, d, GET(9), 0x21e1cde6, 5) 140 | STEP(G, d, a, b, c, GET(14), 0xc33707d6, 9) 141 | STEP(G, c, d, a, b, GET(3), 0xf4d50d87, 14) 142 | STEP(G, b, c, d, a, GET(8), 0x455a14ed, 20) 143 | STEP(G, a, b, c, d, GET(13), 0xa9e3e905, 5) 144 | STEP(G, d, a, b, c, GET(2), 0xfcefa3f8, 9) 145 | STEP(G, c, d, a, b, GET(7), 0x676f02d9, 14) 146 | STEP(G, b, c, d, a, GET(12), 0x8d2a4c8a, 20) 147 | 148 | /* Round 3 */ 149 | STEP(H, a, b, c, d, GET(5), 0xfffa3942, 4) 150 | STEP(H2, d, a, b, c, GET(8), 0x8771f681, 11) 151 | STEP(H, c, d, a, b, GET(11), 0x6d9d6122, 16) 152 | STEP(H2, b, c, d, a, GET(14), 0xfde5380c, 23) 153 | STEP(H, a, b, c, d, GET(1), 0xa4beea44, 4) 154 | STEP(H2, d, a, b, c, GET(4), 0x4bdecfa9, 11) 155 | STEP(H, c, d, a, b, GET(7), 0xf6bb4b60, 16) 156 | STEP(H2, b, c, d, a, GET(10), 0xbebfbc70, 23) 157 | STEP(H, a, b, c, d, GET(13), 0x289b7ec6, 4) 158 | STEP(H2, d, a, b, c, GET(0), 0xeaa127fa, 11) 159 | STEP(H, c, d, a, b, GET(3), 0xd4ef3085, 16) 160 | STEP(H2, b, c, d, a, GET(6), 0x04881d05, 23) 161 | STEP(H, a, b, c, d, GET(9), 0xd9d4d039, 4) 162 | STEP(H2, d, a, b, c, GET(12), 0xe6db99e5, 11) 163 | STEP(H, c, d, a, b, GET(15), 0x1fa27cf8, 16) 164 | STEP(H2, b, c, d, a, GET(2), 0xc4ac5665, 23) 165 | 166 | /* Round 4 */ 167 | STEP(I, a, b, c, d, GET(0), 0xf4292244, 6) 168 | STEP(I, d, a, b, c, GET(7), 0x432aff97, 10) 169 | STEP(I, c, d, a, b, GET(14), 0xab9423a7, 15) 170 | STEP(I, b, c, d, a, GET(5), 0xfc93a039, 21) 171 | STEP(I, a, b, c, d, GET(12), 0x655b59c3, 6) 172 | STEP(I, d, a, b, c, GET(3), 0x8f0ccc92, 10) 173 | STEP(I, c, d, a, b, GET(10), 0xffeff47d, 15) 174 | STEP(I, b, c, d, a, GET(1), 0x85845dd1, 21) 175 | STEP(I, a, b, c, d, GET(8), 0x6fa87e4f, 6) 176 | STEP(I, d, a, b, c, GET(15), 0xfe2ce6e0, 10) 177 | STEP(I, c, d, a, b, GET(6), 0xa3014314, 15) 178 | STEP(I, b, c, d, a, GET(13), 0x4e0811a1, 21) 179 | STEP(I, a, b, c, d, GET(4), 0xf7537e82, 6) 180 | STEP(I, d, a, b, c, GET(11), 0xbd3af235, 10) 181 | STEP(I, c, d, a, b, GET(2), 0x2ad7d2bb, 15) 182 | STEP(I, b, c, d, a, GET(9), 0xeb86d391, 21) 183 | 184 | a += saved_a; 185 | b += saved_b; 186 | c += saved_c; 187 | d += saved_d; 188 | 189 | ptr += 64; 190 | } while (size -= 64); 191 | 192 | ctx->a = a; 193 | ctx->b = b; 194 | ctx->c = c; 195 | ctx->d = d; 196 | 197 | return ptr; 198 | } 199 | 200 | void MD5_Init(MD5_CTX *ctx) 201 | { 202 | ctx->a = 0x67452301; 203 | ctx->b = 0xefcdab89; 204 | ctx->c = 0x98badcfe; 205 | ctx->d = 0x10325476; 206 | 207 | ctx->lo = 0; 208 | ctx->hi = 0; 209 | } 210 | 211 | void MD5_Update(MD5_CTX *ctx, const void *data, unsigned long size) 212 | { 213 | MD5_u32plus saved_lo; 214 | unsigned long used, available; 215 | 216 | saved_lo = ctx->lo; 217 | if ((ctx->lo = (saved_lo + size) & 0x1fffffff) < saved_lo) 218 | ctx->hi++; 219 | ctx->hi += size >> 29; 220 | 221 | used = saved_lo & 0x3f; 222 | 223 | if (used) { 224 | available = 64 - used; 225 | 226 | if (size < available) { 227 | memcpy(&ctx->buffer[used], data, size); 228 | return; 229 | } 230 | 231 | memcpy(&ctx->buffer[used], data, available); 232 | data = (const unsigned char *)data + available; 233 | size -= available; 234 | body(ctx, ctx->buffer, 64); 235 | } 236 | 237 | if (size >= 64) { 238 | data = body(ctx, data, size & ~(unsigned long)0x3f); 239 | size &= 0x3f; 240 | } 241 | 242 | memcpy(ctx->buffer, data, size); 243 | } 244 | 245 | void MD5_Final(unsigned char *result, MD5_CTX *ctx) 246 | { 247 | unsigned long used, available; 248 | 249 | used = ctx->lo & 0x3f; 250 | 251 | ctx->buffer[used++] = 0x80; 252 | 253 | available = 64 - used; 254 | 255 | if (available < 8) { 256 | memset(&ctx->buffer[used], 0, available); 257 | body(ctx, ctx->buffer, 64); 258 | used = 0; 259 | available = 64; 260 | } 261 | 262 | memset(&ctx->buffer[used], 0, available - 8); 263 | 264 | ctx->lo <<= 3; 265 | ctx->buffer[56] = ctx->lo; 266 | ctx->buffer[57] = ctx->lo >> 8; 267 | ctx->buffer[58] = ctx->lo >> 16; 268 | ctx->buffer[59] = ctx->lo >> 24; 269 | ctx->buffer[60] = ctx->hi; 270 | ctx->buffer[61] = ctx->hi >> 8; 271 | ctx->buffer[62] = ctx->hi >> 16; 272 | ctx->buffer[63] = ctx->hi >> 24; 273 | 274 | body(ctx, ctx->buffer, 64); 275 | 276 | result[0] = ctx->a; 277 | result[1] = ctx->a >> 8; 278 | result[2] = ctx->a >> 16; 279 | result[3] = ctx->a >> 24; 280 | result[4] = ctx->b; 281 | result[5] = ctx->b >> 8; 282 | result[6] = ctx->b >> 16; 283 | result[7] = ctx->b >> 24; 284 | result[8] = ctx->c; 285 | result[9] = ctx->c >> 8; 286 | result[10] = ctx->c >> 16; 287 | result[11] = ctx->c >> 24; 288 | result[12] = ctx->d; 289 | result[13] = ctx->d >> 8; 290 | result[14] = ctx->d >> 16; 291 | result[15] = ctx->d >> 24; 292 | 293 | memset(ctx, 0, sizeof(*ctx)); 294 | } 295 | 296 | #endif 297 | -------------------------------------------------------------------------------- /web/execute_reflash.c: -------------------------------------------------------------------------------- 1 | //Copyright 2015 <>< Charles Lohr Under the MIT/x11 License, NewBSD License or 2 | // ColorChord License. You Choose. 3 | 4 | #include 5 | #include 6 | #include 7 | #if defined (__unix__) || (defined (__APPLE__) && defined (__MACH__)) 8 | #include 9 | #include 10 | #endif 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include "md5.h" 17 | #include 18 | 19 | struct libusb_device_handle *devh = NULL; 20 | 21 | 22 | 23 | #define BLOCK_SIZE 65536 24 | #define SECTOR_SIZE 4096 25 | #define PADDING 1024 26 | #ifndef NET_MAXTRIES 27 | #define NET_MAXTRIES 10 // In seconds, may be fractional 28 | #endif 29 | #ifndef NET_TIMEOUT 30 | #define NET_TIMEOUT 3.0 // In seconds, may be fractional 31 | #endif 32 | 33 | int sendsize_max = PADDING; 34 | int use_usb = 0; 35 | 36 | 37 | int sockfd; 38 | struct sockaddr_in servaddr,cliaddr; 39 | 40 | int SendData( uint8_t * buffer, int len ) 41 | { 42 | if( use_usb ) 43 | { 44 | int tries = 0; 45 | int r1; 46 | retry: 47 | r1 = libusb_control_transfer( devh, 48 | 0x00, //reqtype (0x80 = Device->PC, 0x00 = PC->Device) 49 | 0xA6, //request 50 | 0x0100, //wValue 51 | 0x0000, //wIndex 52 | buffer, 53 | len, //wLength (more like max length) 54 | 100 ); 55 | if( r1 != len ) 56 | { 57 | printf( "X" ); fflush( stdout ); 58 | tries++; 59 | if( tries < 10 ) 60 | goto retry; 61 | } 62 | return r1; 63 | //printf( "((Sent: %d/%d %c%c))", r1, len, buffer[0], buffer[1] ); 64 | } 65 | else 66 | { 67 | return sendto( sockfd, buffer, len, MSG_NOSIGNAL, (struct sockaddr *)&servaddr,sizeof(servaddr)); 68 | } 69 | } 70 | 71 | 72 | int PushMatch( const char * match ) 73 | { 74 | if( use_usb ) 75 | { 76 | char recvline[10000]; 77 | int tries = 0; 78 | for( tries = 0; tries < NET_MAXTRIES; tries++ ) 79 | { 80 | usleep( 500 ); 81 | 82 | int r2 = libusb_control_transfer( devh, 83 | 0x80, //reqtype (0x80 = in, 0x00 = out) 84 | 0xA7, //request 85 | 0x0100, //wValue 86 | 0x0000, //wIndex 87 | recvline, //wLength (more like max length) 88 | 128, 89 | 100 ); 90 | 91 | if( r2 < 0 ) continue; 92 | 93 | recvline[r2] = 0; 94 | 95 | if( strncmp( recvline, match, strlen( match ) ) == 0 ) //XXX? Should this be memcmp? 96 | { 97 | return 0; 98 | } 99 | 100 | usleep( 1000 ); 101 | } 102 | return 1; 103 | } 104 | else 105 | { 106 | struct timeval tva, tvb; 107 | gettimeofday( &tva, 0 ); 108 | double diff = 0.0; 109 | while( diff < NET_TIMEOUT ) 110 | { 111 | struct pollfd ufds; 112 | ufds.fd = sockfd; 113 | ufds.events = POLLIN; 114 | int rv = poll(&ufds, 1, 100); 115 | if( rv > 0 ) 116 | { 117 | char recvline[10000]; 118 | int n=recvfrom(sockfd,recvline,10000,0,NULL,NULL); 119 | // printf( "%s === %s\n", recvline, match ); 120 | if( strncmp( recvline, match, strlen( match ) ) == 0 ) 121 | { 122 | printf( "Ok - " ); fflush( stdout ); 123 | return 0; 124 | } 125 | } 126 | gettimeofday( &tvb, 0 ); 127 | diff = tvb.tv_sec - tva.tv_sec + 1e-6*(tvb.tv_usec - tva.tv_usec); 128 | } 129 | return 1; 130 | } 131 | } 132 | 133 | uint32_t Push( uint32_t offset, const char * file ) 134 | { 135 | char sendline[1000]; 136 | char recvline[1000]; 137 | 138 | if( offset <= 0 ) 139 | { 140 | fprintf( stderr, "Error: Cannot write to address 0 or before.\n" ); 141 | exit(-2); 142 | } 143 | 144 | FILE * f = fopen( file, "rb" ); 145 | if( !f || feof( f ) ) 146 | { 147 | fprintf( stderr, "Error: cannot open file.\n" ); 148 | exit(-3); 149 | } 150 | 151 | 152 | 153 | int devo = 0; 154 | int lastblock = -1; 155 | int keep_padding = 0; 156 | int retdevo = 0; 157 | while( keep_padding || !feof( f ) ) 158 | { 159 | int tries; 160 | int thissuccess; 161 | char buffer[PADDING]; 162 | char bufferout[2000]; 163 | 164 | int reads = fread( buffer, 1, sendsize_max, f ); 165 | int sendplace = offset + devo; 166 | int sendsize = sendsize_max; 167 | int block = sendplace / BLOCK_SIZE; 168 | 169 | memset( buffer + reads, 0, sendsize-reads ); 170 | 171 | if( block != lastblock ) 172 | { 173 | char se[64]; 174 | int sel = sprintf( se, "FB%d\r\n", block ); 175 | 176 | thissuccess = 0; 177 | for( tries = 0; tries < NET_MAXTRIES; tries++ ) 178 | { 179 | char match[75]; 180 | //printf( "Erase: %d\n", block ); 181 | printf( "B" ); fflush( stdout ); 182 | SendData( se, sel ); 183 | usleep(130000); //Sleep a while when erasing blocks. 184 | sprintf( match, "FB%d", block ); 185 | if( PushMatch(match) == 0 ) { thissuccess = 1; break; } 186 | printf( "Retry.\n" ); 187 | } 188 | if( !thissuccess ) 189 | { 190 | fprintf( stderr, "Error: Timeout in communications.\n" ); 191 | exit( -6 ); 192 | } 193 | 194 | lastblock = block; 195 | } 196 | 197 | 198 | int r = sprintf( bufferout, "FW%d\t%d\t", sendplace, sendsize ); 199 | //printf( "FW: %d\n", sendplace ); 200 | memcpy( bufferout + r, buffer, sendsize ); 201 | 202 | //printf( "bufferout: %d %d\n", sendplace, sendsize ); 203 | printf( "." ); fflush( stdout ); 204 | 205 | thissuccess = 0; 206 | for( tries = 0; tries < 10; tries++ ) 207 | { 208 | char match[75]; 209 | SendData( bufferout, sendsize + r ); 210 | sprintf( match, "FW%d", sendplace ); 211 | 212 | if( PushMatch(match) == 0 ) { thissuccess = 1; break; } 213 | printf( "Retry.\n" ); 214 | } 215 | if( !thissuccess ) 216 | { 217 | fprintf( stderr, "Error: Timeout in communications.\n" ); 218 | exit( -6 ); 219 | } 220 | 221 | if( reads != 0 ) 222 | { 223 | devo += sendsize; 224 | retdevo = devo; 225 | } 226 | 227 | //Tricky: If we are using a smaller sendsize than the pad size, keep padding with 0's. 228 | if( PADDING!=sendsize && (devo & (PADDING-1)) && feof( f ) ) 229 | { 230 | keep_padding = 1; 231 | if( reads == 0 ) 232 | devo += sendsize; 233 | } 234 | else 235 | { 236 | keep_padding = 0; 237 | } 238 | } 239 | 240 | return retdevo; 241 | } 242 | 243 | void ComputeMD5WithKey( char * md5retText, const char * filename, const char * key ) 244 | { 245 | uint8_t retmd5[16]; 246 | MD5_CTX ctx; 247 | FILE * f = fopen( filename, "rb" ); 248 | if( !f ) 249 | { 250 | fprintf( stderr, "Error opening %s\n", filename ); 251 | exit( -9 ); 252 | } 253 | 254 | fseek( f, 0, SEEK_END ); 255 | int l = ftell( f ); 256 | printf("MD5 Size: %d\n", l ); 257 | int padl = ((l-1) / sendsize_max)*sendsize_max+sendsize_max; 258 | printf("MD5 Pad: %d\n", padl ); 259 | fseek( f, 0, SEEK_SET ); 260 | uint8_t data[padl]; 261 | fread( data, l, 1, f ); 262 | fclose( f ); 263 | 264 | memset( data+l, 0, padl-l ); 265 | MD5_Init( &ctx ); 266 | if( !strlen(key) ) 267 | MD5_Update( &ctx, key, strlen( key ) ); 268 | MD5_Update( &ctx, data, padl ); 269 | MD5_Final( retmd5, &ctx ); 270 | 271 | for( l = 0; l < 16; l++ ) 272 | { 273 | sprintf( md5retText + l*2, "%02x", retmd5[l] ); 274 | } 275 | 276 | return; 277 | } 278 | 279 | uint32_t roundup( uint32_t r ) 280 | { 281 | return ((r-1)&(~0xFFF))+0x1000; 282 | } 283 | 284 | 285 | int main(int argc, char**argv) 286 | { 287 | int n; 288 | 289 | char sendline[1000]; 290 | char recvline[1000]; 291 | 292 | char md5_f1[48]; 293 | char md5_f2[48]; 294 | 295 | if (argc < 4 ) 296 | { 297 | printf("usage: pushtodev [IP address] [file_lower] [file_upper] [key (optional)]\n"); 298 | exit(-1); 299 | } 300 | 301 | const char * file1 = argv[2]; 302 | const char * file2 = argv[3]; 303 | 304 | 305 | 306 | if( strcmp( argv[1], "USB" ) == 0 ) 307 | { 308 | int r; 309 | use_usb = 1; 310 | printf( "Connecting by USB\n" ); 311 | fprintf( stderr, "WARNING: USB BURNING IS EXPERIMENTAL AND LIKELY TO CHANGE\n" ); 312 | if( libusb_init(NULL) < 0 ) 313 | { 314 | fprintf( stderr, "Error: Could not initialize libUSB\n" ); 315 | return -1; 316 | } 317 | 318 | 319 | devh = libusb_open_device_with_vid_pid( NULL, 0xabcd, 0x8266 ); 320 | if( !devh ) 321 | { 322 | fprintf( stderr, "Error: Cannot find USB device.\n" ); 323 | return -1; 324 | } 325 | 326 | libusb_detach_kernel_driver( devh, 0 ); //Mouse? 327 | libusb_detach_kernel_driver( devh, 1 ); //Keyboard? 328 | 329 | printf( "Connected.\n" ); 330 | //USB is attached 331 | sendsize_max = 128; 332 | } 333 | else 334 | { 335 | sockfd=socket(AF_INET,SOCK_DGRAM,0); 336 | 337 | bzero(&servaddr,sizeof(servaddr)); 338 | servaddr.sin_family = AF_INET; 339 | servaddr.sin_addr.s_addr=inet_addr(argv[1]); 340 | servaddr.sin_port=htons(BACKEND_PORT); 341 | } 342 | 343 | uint32_t fs1 = Push( 0x080000, file1 ); 344 | uint32_t fs2 = Push( 0x0c0000, file2 ); 345 | 346 | if( !fs1 || !fs2 ) 347 | { 348 | fprintf( stderr, "Error: File size not acceptable.\n" ); 349 | return 0; 350 | } 351 | 352 | const char * dat = ""; 353 | if( argc == 5 ) 354 | { 355 | dat = argv[4]; 356 | } 357 | 358 | ComputeMD5WithKey( md5_f1, file1, dat ); 359 | ComputeMD5WithKey( md5_f2, file2, dat ); 360 | 361 | printf( "%s %s\n", md5_f1, md5_f2 ); 362 | 363 | //FM[from_address]\t[to_address]\t[size]\t[MD5(key+data)]\t[from_address]\t[to_address]\t[size]\t[MD5(key+data)] 364 | 365 | char cmd[1024]; 366 | 367 | sprintf( cmd, "FM%d\t%d\t%d\t%s\t%d\t%d\t%d\t%s\n", 368 | 0x080000, 369 | 0x000000, 370 | fs1, //roundup( fs1 ), 371 | md5_f1, 372 | 0x0C0000, 373 | 0x040000, 374 | fs2, //roundup( fs2 ), 375 | md5_f2 ); 376 | 377 | printf( "Issuing: %s\n", cmd ); 378 | SendData( cmd, strlen(cmd) ); 379 | usleep(10000); 380 | SendData( cmd, strlen(cmd) ); 381 | 382 | struct pollfd ufds; 383 | ufds.fd = sockfd; 384 | ufds.events = POLLIN; 385 | int rv = poll(&ufds, 1, 100); 386 | if( rv > 0 ) 387 | { 388 | char recvline[10000]; 389 | int n=recvfrom(sockfd,recvline,10000,0,NULL,NULL); 390 | 391 | printf( "Response: %s\n",recvline ); 392 | return 0; 393 | } 394 | else 395 | { 396 | printf( "Timeout. Good? Maybe?\n" ); 397 | return 0; 398 | } 399 | 400 | return 0; 401 | } 402 | 403 | 404 | -------------------------------------------------------------------------------- /user/slc_register.h: -------------------------------------------------------------------------------- 1 | //Generated at 2012-10-23 19:55:03 2 | /* 3 | * Copyright (c) 2010 - 2011 Espressif System 4 | * 5 | */ 6 | 7 | #ifndef SLC_REGISTER_H_ 8 | #define SLC_REGISTER_H_ 9 | 10 | #define REG_SLC_BASE 0x60000B00 11 | //version value:32'h091700 12 | 13 | #define SLC_CONF0 (REG_SLC_BASE + 0x0) 14 | #ifndef ESP_MAC_5 15 | #define SLC_MODE 0x00000003 16 | #define SLC_MODE_S 12 17 | #endif 18 | #define SLC_DATA_BURST_EN (BIT(9)) 19 | #define SLC_DSCR_BURST_EN (BIT(8)) 20 | #define SLC_RX_NO_RESTART_CLR (BIT(7)) 21 | #define SLC_RX_AUTO_WRBACK (BIT(6)) 22 | #define SLC_RX_LOOP_TEST (BIT(5)) 23 | #define SLC_TX_LOOP_TEST (BIT(4)) 24 | #define SLC_AHBM_RST (BIT(3)) 25 | #define SLC_AHBM_FIFO_RST (BIT(2)) 26 | #define SLC_RXLINK_RST (BIT(1)) 27 | #define SLC_TXLINK_RST (BIT(0)) 28 | 29 | #define SLC_INT_RAW (REG_SLC_BASE + 0x4) 30 | #define SLC_TX_DSCR_EMPTY_INT_RAW (BIT(21)) 31 | #define SLC_RX_DSCR_ERR_INT_RAW (BIT(20)) 32 | #define SLC_TX_DSCR_ERR_INT_RAW (BIT(19)) 33 | #define SLC_TOHOST_INT_RAW (BIT(18)) 34 | #define SLC_RX_EOF_INT_RAW (BIT(17)) 35 | #define SLC_RX_DONE_INT_RAW (BIT(16)) 36 | #define SLC_TX_EOF_INT_RAW (BIT(15)) 37 | #define SLC_TX_DONE_INT_RAW (BIT(14)) 38 | #define SLC_TOKEN1_1TO0_INT_RAW (BIT(13)) 39 | #define SLC_TOKEN0_1TO0_INT_RAW (BIT(12)) 40 | #define SLC_TX_OVF_INT_RAW (BIT(11)) 41 | #define SLC_RX_UDF_INT_RAW (BIT(10)) 42 | #define SLC_TX_START_INT_RAW (BIT(9)) 43 | #define SLC_RX_START_INT_RAW (BIT(8)) 44 | #define SLC_FRHOST_BIT7_INT_RAW (BIT(7)) 45 | #define SLC_FRHOST_BIT6_INT_RAW (BIT(6)) 46 | #define SLC_FRHOST_BIT5_INT_RAW (BIT(5)) 47 | #define SLC_FRHOST_BIT4_INT_RAW (BIT(4)) 48 | #define SLC_FRHOST_BIT3_INT_RAW (BIT(3)) 49 | #define SLC_FRHOST_BIT2_INT_RAW (BIT(2)) 50 | #define SLC_FRHOST_BIT1_INT_RAW (BIT(1)) 51 | #define SLC_FRHOST_BIT0_INT_RAW (BIT(0)) 52 | 53 | #define SLC_INT_STATUS (REG_SLC_BASE + 0x8) 54 | #define SLC_TX_DSCR_EMPTY_INT_ST (BIT(21)) 55 | #define SLC_RX_DSCR_ERR_INT_ST (BIT(20)) 56 | #define SLC_TX_DSCR_ERR_INT_ST (BIT(19)) 57 | #define SLC_TOHOST_INT_ST (BIT(18)) 58 | #define SLC_RX_EOF_INT_ST (BIT(17)) 59 | #define SLC_RX_DONE_INT_ST (BIT(16)) 60 | #define SLC_TX_EOF_INT_ST (BIT(15)) 61 | #define SLC_TX_DONE_INT_ST (BIT(14)) 62 | #define SLC_TOKEN1_1TO0_INT_ST (BIT(13)) 63 | #define SLC_TOKEN0_1TO0_INT_ST (BIT(12)) 64 | #define SLC_TX_OVF_INT_ST (BIT(11)) 65 | #define SLC_RX_UDF_INT_ST (BIT(10)) 66 | #define SLC_TX_START_INT_ST (BIT(9)) 67 | #define SLC_RX_START_INT_ST (BIT(8)) 68 | #define SLC_FRHOST_BIT7_INT_ST (BIT(7)) 69 | #define SLC_FRHOST_BIT6_INT_ST (BIT(6)) 70 | #define SLC_FRHOST_BIT5_INT_ST (BIT(5)) 71 | #define SLC_FRHOST_BIT4_INT_ST (BIT(4)) 72 | #define SLC_FRHOST_BIT3_INT_ST (BIT(3)) 73 | #define SLC_FRHOST_BIT2_INT_ST (BIT(2)) 74 | #define SLC_FRHOST_BIT1_INT_ST (BIT(1)) 75 | #define SLC_FRHOST_BIT0_INT_ST (BIT(0)) 76 | 77 | #define SLC_INT_ENA (REG_SLC_BASE + 0xC) 78 | #define SLC_TX_DSCR_EMPTY_INT_ENA (BIT(21)) 79 | #define SLC_RX_DSCR_ERR_INT_ENA (BIT(20)) 80 | #define SLC_TX_DSCR_ERR_INT_ENA (BIT(19)) 81 | #define SLC_TOHOST_INT_ENA (BIT(18)) 82 | #define SLC_RX_EOF_INT_ENA (BIT(17)) 83 | #define SLC_RX_DONE_INT_ENA (BIT(16)) 84 | #define SLC_TX_EOF_INT_ENA (BIT(15)) 85 | #define SLC_TX_DONE_INT_ENA (BIT(14)) 86 | #define SLC_TOKEN1_1TO0_INT_ENA (BIT(13)) 87 | #define SLC_TOKEN0_1TO0_INT_ENA (BIT(12)) 88 | #define SLC_TX_OVF_INT_ENA (BIT(11)) 89 | #define SLC_RX_UDF_INT_ENA (BIT(10)) 90 | #define SLC_TX_START_INT_ENA (BIT(9)) 91 | #define SLC_RX_START_INT_ENA (BIT(8)) 92 | #define SLC_FRHOST_BIT7_INT_ENA (BIT(7)) 93 | #define SLC_FRHOST_BIT6_INT_ENA (BIT(6)) 94 | #define SLC_FRHOST_BIT5_INT_ENA (BIT(5)) 95 | #define SLC_FRHOST_BIT4_INT_ENA (BIT(4)) 96 | #define SLC_FRHOST_BIT3_INT_ENA (BIT(3)) 97 | #define SLC_FRHOST_BIT2_INT_ENA (BIT(2)) 98 | #define SLC_FRHOST_BIT1_INT_ENA (BIT(1)) 99 | #define SLC_FRHOST_BIT0_INT_ENA (BIT(0)) 100 | 101 | #define SLC_FRHOST_BIT_INT_ENA_ALL 0xff 102 | 103 | #define SLC_INT_CLR (REG_SLC_BASE + 0x10) 104 | #define SLC_TX_DSCR_EMPTY_INT_CLR (BIT(21)) 105 | #define SLC_RX_DSCR_ERR_INT_CLR (BIT(20)) 106 | #define SLC_TX_DSCR_ERR_INT_CLR (BIT(19)) 107 | #define SLC_TOHOST_INT_CLR (BIT(18)) 108 | #define SLC_RX_EOF_INT_CLR (BIT(17)) 109 | #define SLC_RX_DONE_INT_CLR (BIT(16)) 110 | #define SLC_TX_EOF_INT_CLR (BIT(15)) 111 | #define SLC_TX_DONE_INT_CLR (BIT(14)) 112 | #define SLC_TOKEN1_1TO0_INT_CLR (BIT(13)) 113 | #define SLC_TOKEN0_1TO0_INT_CLR (BIT(12)) 114 | #define SLC_TX_OVF_INT_CLR (BIT(11)) 115 | #define SLC_RX_UDF_INT_CLR (BIT(10)) 116 | #define SLC_TX_START_INT_CLR (BIT(9)) 117 | #define SLC_RX_START_INT_CLR (BIT(8)) 118 | #define SLC_FRHOST_BIT7_INT_CLR (BIT(7)) 119 | #define SLC_FRHOST_BIT6_INT_CLR (BIT(6)) 120 | #define SLC_FRHOST_BIT5_INT_CLR (BIT(5)) 121 | #define SLC_FRHOST_BIT4_INT_CLR (BIT(4)) 122 | #define SLC_FRHOST_BIT3_INT_CLR (BIT(3)) 123 | #define SLC_FRHOST_BIT2_INT_CLR (BIT(2)) 124 | #define SLC_FRHOST_BIT1_INT_CLR (BIT(1)) 125 | #define SLC_FRHOST_BIT0_INT_CLR (BIT(0)) 126 | 127 | #define SLC_RX_STATUS (REG_SLC_BASE + 0x14) 128 | #define SLC_RX_EMPTY (BIT(1)) 129 | #define SLC_RX_FULL (BIT(0)) 130 | 131 | #define SLC_RX_FIFO_PUSH (REG_SLC_BASE + 0x18) 132 | #define SLC_RXFIFO_PUSH (BIT(16)) 133 | #define SLC_RXFIFO_WDATA 0x000001FF 134 | #define SLC_RXFIFO_WDATA_S 0 135 | 136 | #define SLC_TX_STATUS (REG_SLC_BASE + 0x1C) 137 | #define SLC_TX_EMPTY (BIT(1)) 138 | #define SLC_TX_FULL (BIT(0)) 139 | 140 | #define SLC_TX_FIFO_POP (REG_SLC_BASE + 0x20) 141 | #define SLC_TXFIFO_POP (BIT(16)) 142 | #define SLC_TXFIFO_RDATA 0x000007FF 143 | #define SLC_TXFIFO_RDATA_S 0 144 | 145 | #define SLC_RX_LINK (REG_SLC_BASE + 0x24) 146 | #define SLC_RXLINK_PARK (BIT(31)) 147 | #define SLC_RXLINK_RESTART (BIT(30)) 148 | #define SLC_RXLINK_START (BIT(29)) 149 | #define SLC_RXLINK_STOP (BIT(28)) 150 | #define SLC_RXLINK_DESCADDR_MASK 0x000FFFFF 151 | #define SLC_RXLINK_ADDR_S 0 152 | 153 | #define SLC_TX_LINK (REG_SLC_BASE + 0x28) 154 | #define SLC_TXLINK_PARK (BIT(31)) 155 | #define SLC_TXLINK_RESTART (BIT(30)) 156 | #define SLC_TXLINK_START (BIT(29)) 157 | #define SLC_TXLINK_STOP (BIT(28)) 158 | #define SLC_TXLINK_DESCADDR_MASK 0x000FFFFF 159 | #define SLC_TXLINK_ADDR_S 0 160 | 161 | #define SLC_INTVEC_TOHOST (REG_SLC_BASE + 0x2C) 162 | #define SLC_TOHOST_INTVEC 0x000000FF 163 | #define SLC_TOHOST_INTVEC_S 0 164 | 165 | #define SLC_TOKEN0 (REG_SLC_BASE + 0x30) 166 | #define SLC_TOKEN0_MASK 0x00000FFF 167 | #define SLC_TOKEN0_S 16 168 | #define SLC_TOKEN0_LOCAL_INC_MORE (BIT(14)) 169 | #define SLC_TOKEN0_LOCAL_INC (BIT(13)) 170 | #define SLC_TOKEN0_LOCAL_WR (BIT(12)) 171 | #define SLC_TOKEN0_LOCAL_WDATA_MASK 0x00000FFF 172 | #define SLC_TOKEN0_LOCAL_WDATA_S 0 173 | 174 | #define SLC_TOKEN1 (REG_SLC_BASE + 0x34) 175 | #define SLC_TOKEN1_MASK 0x00000FFF 176 | #define SLC_TOKEN1_S 16 177 | #define SLC_TOKEN1_LOCAL_INC_MORE (BIT(14)) 178 | #define SLC_TOKEN1_LOCAL_INC (BIT(13)) 179 | #define SLC_TOKEN1_LOCAL_WR (BIT(12)) 180 | #define SLC_TOKEN1_LOCAL_WDATA 0x00000FFF 181 | #define SLC_TOKEN1_LOCAL_WDATA_S 0 182 | 183 | #define SLC_CONF1 (REG_SLC_BASE + 0x38) 184 | #define SLC_STATE0 (REG_SLC_BASE + 0x3C) 185 | #define SLC_STATE1 (REG_SLC_BASE + 0x40) 186 | 187 | #define SLC_BRIDGE_CONF (REG_SLC_BASE + 0x44) 188 | #ifndef ESP_MAC_5 189 | #define SLC_TX_PUSH_IDLE_NUM 0x0000FFFF 190 | #define SLC_TX_PUSH_IDLE_NUM_S 16 191 | #define SLC_TX_DUMMY_MODE (BIT(12)) 192 | #endif 193 | #define SLC_FIFO_MAP_ENA 0x0000000F 194 | #define SLC_FIFO_MAP_ENA_S 8 195 | #define SLC_TXEOF_ENA 0x0000003F 196 | #define SLC_TXEOF_ENA_S 0 197 | 198 | #define SLC_RX_EOF_DES_ADDR (REG_SLC_BASE + 0x48) 199 | #define SLC_TX_EOF_DES_ADDR (REG_SLC_BASE + 0x4C) 200 | #define SLC_FROM_HOST_LAST_DESC SLC_TX_EOF_DES_ADDR 201 | #define SLC_TO_HOST_LAST_DESC SLC_RX_EOF_DES_ADDR 202 | 203 | #define SLC_RX_EOF_BFR_DES_ADDR (REG_SLC_BASE + 0x50) 204 | #define SLC_AHB_TEST (REG_SLC_BASE + 0x54) 205 | #define SLC_AHB_TESTADDR 0x00000003 206 | #define SLC_AHB_TESTADDR_S 4 207 | #define SLC_AHB_TESTMODE 0x00000007 208 | #define SLC_AHB_TESTMODE_S 0 209 | 210 | #define SLC_SDIO_ST (REG_SLC_BASE + 0x58) 211 | #define SLC_BUS_ST 0x00000007 212 | #define SLC_BUS_ST_S 12 213 | #define SLC_SDIO_WAKEUP (BIT(8)) 214 | #define SLC_FUNC_ST 0x0000000F 215 | #define SLC_FUNC_ST_S 4 216 | #define SLC_CMD_ST 0x00000007 217 | #define SLC_CMD_ST_S 0 218 | 219 | #define SLC_RX_DSCR_CONF (REG_SLC_BASE + 0x5C) 220 | #ifdef ESP_MAC_5 221 | #define SLC_INFOR_NO_REPLACE (BIT(9)) 222 | #define SLC_TOKEN_NO_REPLACE (BIT(8)) 223 | #define SLC_POP_IDLE_CNT 0x000000FF 224 | #else 225 | #define SLC_RX_FILL_EN (BIT(20)) 226 | #define SLC_RX_EOF_MODE (BIT(19)) 227 | #define SLC_RX_FILL_MODE (BIT(18)) 228 | #define SLC_INFOR_NO_REPLACE (BIT(17)) 229 | #define SLC_TOKEN_NO_REPLACE (BIT(16)) 230 | #define SLC_POP_IDLE_CNT 0x0000FFFF 231 | #endif 232 | #define SLC_POP_IDLE_CNT_S 0 233 | 234 | #define SLC_TXLINK_DSCR (REG_SLC_BASE + 0x60) 235 | #define SLC_TXLINK_DSCR_BF0 (REG_SLC_BASE + 0x64) 236 | #define SLC_TXLINK_DSCR_BF1 (REG_SLC_BASE + 0x68) 237 | #define SLC_RXLINK_DSCR (REG_SLC_BASE + 0x6C) 238 | #define SLC_RXLINK_DSCR_BF0 (REG_SLC_BASE + 0x70) 239 | #define SLC_RXLINK_DSCR_BF1 (REG_SLC_BASE + 0x74) 240 | #define SLC_DATE (REG_SLC_BASE + 0x78) 241 | #define SLC_ID (REG_SLC_BASE + 0x7C) 242 | 243 | #define SLC_HOST_CONF_W0 (REG_SLC_BASE + 0x80 + 0x14) 244 | #define SLC_HOST_CONF_W1 (REG_SLC_BASE + 0x80 + 0x18) 245 | #define SLC_HOST_CONF_W2 (REG_SLC_BASE + 0x80 + 0x20) 246 | #define SLC_HOST_CONF_W3 (REG_SLC_BASE + 0x80 + 0x24) 247 | #define SLC_HOST_CONF_W4 (REG_SLC_BASE + 0x80 + 0x28) 248 | 249 | #define SLC_HOST_INTR_ST (REG_SLC_BASE + 0x80 + 0x1c) 250 | #define SLC_HOST_INTR_CLR (REG_SLC_BASE + 0x80 + 0x30) 251 | #define SLC_HOST_INTR_SOF_BIT (BIT(12)) 252 | 253 | #define SLC_HOST_INTR_ENA (REG_SLC_BASE + 0x80 + 0x34) 254 | #define SLC_RX_NEW_PACKET_INT_ENA (BIT23) 255 | #define SLC_HOST_TOHOST_BIT0_INT_ENA (BIT0) 256 | #define SLC_HOST_CONF_W5 (REG_SLC_BASE + 0x80 + 0x3C) 257 | #define SLC_HOST_INTR_RAW (REG_SLC_BASE + 0x80 + 0x8) 258 | #define SLC_HOST_INTR_ENA_BIT (BIT(23)) 259 | //[15:12]: 0x3ff9xxxx -- 0b01 from_host 260 | // 0x3ffaxxxx -- 0b10 general 261 | // 0x3ffbxxxx -- 0b11 to_host 262 | #define SLC_DATA_ADDR_CLEAR_MASK (~(0xf<<12)) 263 | #define SLC_FROM_HOST_ADDR_MASK (0x1<<12) 264 | #define SLC_TO_HOST_ADDR_MASK (0x3<<12) 265 | 266 | #define SLC_SET_FROM_HOST_ADDR_MASK(v) do { \ 267 | (v) &= SLC_DATA_ADDR_CLEAR_MASK; \ 268 | (v) |= SLC_FROM_HOST_ADDR_MASK; \ 269 | } while(0); 270 | 271 | #define SLC_SET_TO_HOST_ADDR_MASK(v) do { \ 272 | (v) &= SLC_DATA_ADDR_CLEAR_MASK; \ 273 | (v) |= SLC_TO_HOST_ADDR_MASK; \ 274 | } while(0); 275 | 276 | 277 | #define SLC_TX_DESC_DEBUG_REG 0x3ff0002c //[15:0] set to 0xcccc 278 | 279 | 280 | #endif // SLC_REGISTER_H_INCLUDED 281 | 282 | -------------------------------------------------------------------------------- /hardware/kelvindmmwifi.net: -------------------------------------------------------------------------------- 1 | (export (version D) 2 | (design 3 | (source /home/youtube/git/kelvindmmwifi/hardware/kelvindmmwifi.sch) 4 | (date "Sun 05 Feb 2017 07:30:09 PM EST") 5 | (tool "Eeschema 4.0.5-e0-6337~49~ubuntu16.04.1") 6 | (sheet (number 1) (name /) (tstamps /) 7 | (title_block 8 | (title) 9 | (company) 10 | (rev) 11 | (date) 12 | (source kelvindmmwifi.sch) 13 | (comment (number 1) (value "")) 14 | (comment (number 2) (value "")) 15 | (comment (number 3) (value "")) 16 | (comment (number 4) (value ""))))) 17 | (components 18 | (comp (ref ESP1) 19 | (value ESP12E) 20 | (footprint ESP12E) 21 | (libsource (lib esp12e) (part ESP12E)) 22 | (sheetpath (names /) (tstamps /)) 23 | (tstamp 5897BC42)) 24 | (comp (ref U2) 25 | (value AP1117) 26 | (footprint TO_SOT_Packages_SMD:SOT-223) 27 | (libsource (lib regul) (part AP1117)) 28 | (sheetpath (names /) (tstamps /)) 29 | (tstamp 5897BC6C)) 30 | (comp (ref R2) 31 | (value 10k) 32 | (footprint C_0805) 33 | (libsource (lib device) (part R)) 34 | (sheetpath (names /) (tstamps /)) 35 | (tstamp 5897BD51)) 36 | (comp (ref R1) 37 | (value 10k) 38 | (footprint C_0805) 39 | (libsource (lib device) (part R)) 40 | (sheetpath (names /) (tstamps /)) 41 | (tstamp 5897BDCA)) 42 | (comp (ref P8) 43 | (value PGM_ETC) 44 | (footprint Pin_Header_Straight_1x07_Pitch2.54mm) 45 | (libsource (lib 5050RGB) (part CONN_7)) 46 | (sheetpath (names /) (tstamps /)) 47 | (tstamp 5897C067)) 48 | (comp (ref P7) 49 | (value ADC) 50 | (footprint SMTPIN.1) 51 | (libsource (lib 5050RGB) (part CONN_1)) 52 | (sheetpath (names /) (tstamps /)) 53 | (tstamp 5897BFD3)) 54 | (comp (ref P6) 55 | (value 3V3) 56 | (footprint SMTPIN.1) 57 | (libsource (lib 5050RGB) (part CONN_1)) 58 | (sheetpath (names /) (tstamps /)) 59 | (tstamp 5897C03F)) 60 | (comp (ref P5) 61 | (value GND) 62 | (footprint SMTPIN.1) 63 | (libsource (lib 5050RGB) (part CONN_1)) 64 | (sheetpath (names /) (tstamps /)) 65 | (tstamp 5897C119)) 66 | (comp (ref P3) 67 | (value V+) 68 | (footprint SMTPIN.1) 69 | (libsource (lib 5050RGB) (part CONN_1)) 70 | (sheetpath (names /) (tstamps /)) 71 | (tstamp 5897C262)) 72 | (comp (ref P4) 73 | (value OUT) 74 | (footprint SMTPIN.1) 75 | (libsource (lib 5050RGB) (part CONN_1)) 76 | (sheetpath (names /) (tstamps /)) 77 | (tstamp 5897C4D0)) 78 | (comp (ref P1) 79 | (value IN+) 80 | (footprint SMTPIN.1) 81 | (libsource (lib 5050RGB) (part CONN_1)) 82 | (sheetpath (names /) (tstamps /)) 83 | (tstamp 5897C54A)) 84 | (comp (ref P2) 85 | (value IN-) 86 | (footprint SMTPIN.1) 87 | (libsource (lib 5050RGB) (part CONN_1)) 88 | (sheetpath (names /) (tstamps /)) 89 | (tstamp 5897C5B4)) 90 | (comp (ref C1) 91 | (value 10u) 92 | (footprint C_0805) 93 | (libsource (lib device) (part C)) 94 | (sheetpath (names /) (tstamps /)) 95 | (tstamp 5897C79D)) 96 | (comp (ref C4) 97 | (value .1) 98 | (footprint C_0805) 99 | (libsource (lib device) (part C)) 100 | (sheetpath (names /) (tstamps /)) 101 | (tstamp 5897D035)) 102 | (comp (ref C3) 103 | (value .1) 104 | (footprint C_0805) 105 | (libsource (lib device) (part C)) 106 | (sheetpath (names /) (tstamps /)) 107 | (tstamp 5897D18A)) 108 | (comp (ref C2) 109 | (value 10u) 110 | (footprint C_0805) 111 | (libsource (lib device) (part C)) 112 | (sheetpath (names /) (tstamps /)) 113 | (tstamp 5897D22A)) 114 | (comp (ref R3) 115 | (value 10k) 116 | (footprint C_0805) 117 | (libsource (lib device) (part R)) 118 | (sheetpath (names /) (tstamps /)) 119 | (tstamp 5897DBC9)) 120 | (comp (ref U1) 121 | (value COMP-MIC7721) 122 | (footprint SOT-23-5) 123 | (libsource (lib comp-mic7721) (part COMP-MIC7721)) 124 | (sheetpath (names /) (tstamps /)) 125 | (tstamp 5897DF60))) 126 | (libparts 127 | (libpart (lib regul) (part AP1117) 128 | (aliases 129 | (alias AP111715) 130 | (alias AP111718) 131 | (alias AP111725) 132 | (alias AP111733) 133 | (alias AP111750)) 134 | (description "1A Low Dropout regulator, positive, adjustable output, NRND") 135 | (docs http://www.diodes.com/datasheets/AP1117.pdf) 136 | (footprints 137 | (fp SOT-223*)) 138 | (fields 139 | (field (name Reference) U) 140 | (field (name Value) AP1117) 141 | (field (name Footprint) TO_SOT_Packages_SMD:SOT-223)) 142 | (pins 143 | (pin (num 1) (name GND/ADJ) (type power_in)) 144 | (pin (num 2) (name VO) (type power_out)) 145 | (pin (num 3) (name VI) (type power_in)) 146 | (pin (num 4) (name VO) (type power_out)))) 147 | (libpart (lib device) (part C) 148 | (description "Unpolarized capacitor") 149 | (footprints 150 | (fp C?) 151 | (fp C_????_*) 152 | (fp C_????) 153 | (fp SMD*_c) 154 | (fp Capacitor*)) 155 | (fields 156 | (field (name Reference) C) 157 | (field (name Value) C)) 158 | (pins 159 | (pin (num 1) (name ~) (type passive)) 160 | (pin (num 2) (name ~) (type passive)))) 161 | (libpart (lib comp-mic7721) (part COMP-MIC7721) 162 | (fields 163 | (field (name Reference) U) 164 | (field (name Value) COMP-MIC7721)) 165 | (pins 166 | (pin (num 1) (name OUT) (type input)) 167 | (pin (num 2) (name V+) (type input)) 168 | (pin (num 3) (name IN+) (type input)) 169 | (pin (num 4) (name IN-) (type input)) 170 | (pin (num 5) (name V-) (type input)))) 171 | (libpart (lib 5050RGB) (part CONN_1) 172 | (fields 173 | (field (name Reference) P) 174 | (field (name Value) CONN_1)) 175 | (pins 176 | (pin (num 1) (name 1) (type passive)))) 177 | (libpart (lib 5050RGB) (part CONN_7) 178 | (fields 179 | (field (name Reference) P) 180 | (field (name Value) CONN_7)) 181 | (pins 182 | (pin (num 1) (name P1) (type passive)) 183 | (pin (num 2) (name P2) (type passive)) 184 | (pin (num 3) (name P3) (type passive)) 185 | (pin (num 4) (name P4) (type passive)) 186 | (pin (num 5) (name P5) (type passive)) 187 | (pin (num 6) (name P6) (type passive)) 188 | (pin (num 7) (name P7) (type passive)))) 189 | (libpart (lib esp12e) (part ESP12E) 190 | (fields 191 | (field (name Reference) ESP) 192 | (field (name Value) ESP12E)) 193 | (pins 194 | (pin (num 1) (name REST) (type input)) 195 | (pin (num 2) (name ADC) (type input)) 196 | (pin (num 3) (name CH_PD) (type input)) 197 | (pin (num 4) (name GPIO16) (type input)) 198 | (pin (num 5) (name GPIO14) (type input)) 199 | (pin (num 6) (name GPIO12) (type input)) 200 | (pin (num 7) (name GPIO13) (type input)) 201 | (pin (num 8) (name VCC) (type input)) 202 | (pin (num 9) (name MTDO) (type input)) 203 | (pin (num 10) (name MTDI) (type input)) 204 | (pin (num 11) (name SD_3) (type input)) 205 | (pin (num 12) (name MTMS) (type input)) 206 | (pin (num 13) (name MTCK) (type input)) 207 | (pin (num 14) (name SD_2) (type input)) 208 | (pin (num 15) (name GND) (type input)) 209 | (pin (num 16) (name GPIO15) (type input)) 210 | (pin (num 17) (name GPIO2) (type input)) 211 | (pin (num 18) (name GPIO0) (type input)) 212 | (pin (num 19) (name GPIO4) (type input)) 213 | (pin (num 20) (name GPIO5) (type input)) 214 | (pin (num 21) (name RXD) (type input)) 215 | (pin (num 22) (name TXD) (type input)))) 216 | (libpart (lib device) (part R) 217 | (description Resistor) 218 | (footprints 219 | (fp R_*) 220 | (fp Resistor_*)) 221 | (fields 222 | (field (name Reference) R) 223 | (field (name Value) R)) 224 | (pins 225 | (pin (num 1) (name ~) (type passive)) 226 | (pin (num 2) (name ~) (type passive))))) 227 | (libraries 228 | (library (logical device) 229 | (uri /usr/share/kicad/library/device.lib)) 230 | (library (logical regul) 231 | (uri /usr/share/kicad/library/regul.lib)) 232 | (library (logical 5050RGB) 233 | (uri /home/youtube/electrical/kicad/5050RGB.lib)) 234 | (library (logical esp12e) 235 | (uri /home/youtube/electrical/kicad/esp12e.lib)) 236 | (library (logical comp-mic7721) 237 | (uri /home/youtube/electrical/kicad/comp-mic7721.lib))) 238 | (nets 239 | (net (code 1) (name +3V3) 240 | (node (ref R3) (pin 2)) 241 | (node (ref C2) (pin 1)) 242 | (node (ref P6) (pin 1)) 243 | (node (ref U2) (pin 4)) 244 | (node (ref U2) (pin 2)) 245 | (node (ref R2) (pin 2)) 246 | (node (ref ESP1) (pin 1)) 247 | (node (ref R1) (pin 2)) 248 | (node (ref ESP1) (pin 3)) 249 | (node (ref ESP1) (pin 8))) 250 | (net (code 2) (name +5V) 251 | (node (ref C3) (pin 1)) 252 | (node (ref U2) (pin 3)) 253 | (node (ref U1) (pin 2)) 254 | (node (ref C4) (pin 1)) 255 | (node (ref P8) (pin 7)) 256 | (node (ref P3) (pin 1)) 257 | (node (ref C1) (pin 1))) 258 | (net (code 3) (name "Net-(P1-Pad1)") 259 | (node (ref U1) (pin 3)) 260 | (node (ref P1) (pin 1))) 261 | (net (code 4) (name "Net-(P2-Pad1)") 262 | (node (ref U1) (pin 4)) 263 | (node (ref P2) (pin 1))) 264 | (net (code 5) (name GND) 265 | (node (ref U2) (pin 1)) 266 | (node (ref C1) (pin 2)) 267 | (node (ref C2) (pin 2)) 268 | (node (ref P8) (pin 6)) 269 | (node (ref C4) (pin 2)) 270 | (node (ref P5) (pin 1)) 271 | (node (ref U1) (pin 5)) 272 | (node (ref ESP1) (pin 15)) 273 | (node (ref ESP1) (pin 16)) 274 | (node (ref C3) (pin 2))) 275 | (net (code 6) (name "Net-(ESP1-Pad2)") 276 | (node (ref P7) (pin 1)) 277 | (node (ref ESP1) (pin 2))) 278 | (net (code 7) (name "Net-(ESP1-Pad6)") 279 | (node (ref ESP1) (pin 6)) 280 | (node (ref P4) (pin 1)) 281 | (node (ref U1) (pin 1)) 282 | (node (ref R3) (pin 1))) 283 | (net (code 8) (name "Net-(ESP1-Pad19)") 284 | (node (ref P8) (pin 4)) 285 | (node (ref ESP1) (pin 19))) 286 | (net (code 9) (name "Net-(ESP1-Pad14)") 287 | (node (ref ESP1) (pin 14))) 288 | (net (code 10) (name "Net-(ESP1-Pad17)") 289 | (node (ref ESP1) (pin 17)) 290 | (node (ref R1) (pin 1))) 291 | (net (code 11) (name "Net-(ESP1-Pad13)") 292 | (node (ref ESP1) (pin 13))) 293 | (net (code 12) (name "Net-(ESP1-Pad22)") 294 | (node (ref P8) (pin 1)) 295 | (node (ref ESP1) (pin 22))) 296 | (net (code 13) (name "Net-(ESP1-Pad12)") 297 | (node (ref ESP1) (pin 12))) 298 | (net (code 14) (name "Net-(ESP1-Pad21)") 299 | (node (ref P8) (pin 2)) 300 | (node (ref ESP1) (pin 21))) 301 | (net (code 15) (name "Net-(ESP1-Pad11)") 302 | (node (ref ESP1) (pin 11))) 303 | (net (code 16) (name "Net-(ESP1-Pad10)") 304 | (node (ref ESP1) (pin 10))) 305 | (net (code 17) (name "Net-(ESP1-Pad9)") 306 | (node (ref ESP1) (pin 9))) 307 | (net (code 18) (name "Net-(ESP1-Pad7)") 308 | (node (ref ESP1) (pin 7))) 309 | (net (code 19) (name "Net-(ESP1-Pad5)") 310 | (node (ref ESP1) (pin 5))) 311 | (net (code 20) (name "Net-(ESP1-Pad4)") 312 | (node (ref ESP1) (pin 4))) 313 | (net (code 21) (name "Net-(ESP1-Pad20)") 314 | (node (ref P8) (pin 3)) 315 | (node (ref ESP1) (pin 20))) 316 | (net (code 22) (name "Net-(ESP1-Pad18)") 317 | (node (ref R2) (pin 1)) 318 | (node (ref P8) (pin 5)) 319 | (node (ref ESP1) (pin 18))))) -------------------------------------------------------------------------------- /hardware/kelvindmmwifi.bak: -------------------------------------------------------------------------------- 1 | EESchema Schematic File Version 2 2 | LIBS:power 3 | LIBS:device 4 | LIBS:transistors 5 | LIBS:conn 6 | LIBS:linear 7 | LIBS:regul 8 | LIBS:74xx 9 | LIBS:cmos4000 10 | LIBS:adc-dac 11 | LIBS:memory 12 | LIBS:xilinx 13 | LIBS:microcontrollers 14 | LIBS:dsp 15 | LIBS:microchip 16 | LIBS:analog_switches 17 | LIBS:motorola 18 | LIBS:texas 19 | LIBS:intel 20 | LIBS:audio 21 | LIBS:interface 22 | LIBS:digital-audio 23 | LIBS:philips 24 | LIBS:display 25 | LIBS:cypress 26 | LIBS:siliconi 27 | LIBS:opto 28 | LIBS:atmel 29 | LIBS:contrib 30 | LIBS:valves 31 | LIBS:2.4GHZ_2450FB15L0001 32 | LIBS:6multi 33 | LIBS:23lc1024 34 | LIBS:25q40b 35 | LIBS:74hc390 36 | LIBS:74hc4067 37 | LIBS:1206network 38 | LIBS:4427 39 | LIBS:5050RGB 40 | LIBS:7805 41 | LIBS:7805to220 42 | LIBS:a4447sljtr 43 | LIBS:ad9216 44 | LIBS:adc-ltc2450 45 | LIBS:ak5358b 46 | LIBS:ap1117 47 | LIBS:atmega48_88_168_328_tqfp32 48 | LIBS:atmega1284rfr2 49 | LIBS:atmegax8pb 50 | LIBS:atmegaxu2 51 | LIBS:atmel_kk 52 | LIBS:attiny441 53 | LIBS:attiny441-qfn 54 | LIBS:attinyx4 55 | LIBS:attinyx5 56 | LIBS:atx_power 57 | LIBS:avr6pin 58 | LIBS:avr_usb_3v3-cache 59 | LIBS:BELFuse_Ethernet 60 | LIBS:bluetoothedpa 61 | LIBS:bmp085 62 | LIBS:bmp280 63 | LIBS:bridge-MB2S-TP 64 | LIBS:can_sn65hvd251qdrq1 65 | LIBS:cap1128 66 | LIBS:cd4021 67 | LIBS:choke 68 | LIBS:cp2104 69 | LIBS:crystal-4p 70 | LIBS:cyusb3012 71 | LIBS:diode-to-277-3 72 | LIBS:dmp2240udm 73 | LIBS:ds2438z 74 | LIBS:dualopamp 75 | LIBS:enc424j600 76 | LIBS:esp12e 77 | LIBS:esp32 78 | LIBS:esp8266ex 79 | LIBS:esp8266-wi07-6 80 | LIBS:exb-a 81 | LIBS:flipflop-sn74lvc1g175 82 | LIBS:ft600q 83 | LIBS:halleffect-tcs20dlr 84 | LIBS:hv9910c 85 | LIBS:ir2101 86 | LIBS:isl3177 87 | LIBS:isol_adum1201brz 88 | LIBS:jfet-n_sot-23 89 | LIBS:ksz8081rn 90 | LIBS:l6470 91 | LIBS:l6470-powerso36 92 | LIBS:l6474 93 | LIBS:lan8720a 94 | LIBS:lis3mdl 95 | LIBS:lm386 96 | LIBS:LNK3202 97 | LIBS:lsm9ds0 98 | LIBS:lsm9ds1 99 | LIBS:lsm303c 100 | LIBS:lsm303d 101 | LIBS:lsm303dlhc 102 | LIBS:LSM9DS1 103 | LIBS:ltc2471cms 104 | LIBS:ltv-846s 105 | LIBS:lvt-816s 106 | LIBS:mag3110 107 | LIBS:max3010x 108 | LIBS:max31855 109 | LIBS:mcp1803 110 | LIBS:mcp1804 111 | LIBS:mcp1824_ct 112 | LIBS:mcp23008-qfn 113 | LIBS:mcp23008-soic 114 | LIBS:memi2c_m24m02-dr 115 | LIBS:mfrc522 116 | LIBS:mic550x-reg 117 | LIBS:microsd_1050270001 118 | LIBS:mma8653fc-accel 119 | LIBS:mmpq2907a 120 | LIBS:mosdriver_ncp5901bmntbg 121 | LIBS:mosfet-lfpak56 122 | LIBS:mosfetx2vdfn8 123 | LIBS:mos_n_w_diode 124 | LIBS:mos_p_d2 125 | LIBS:mpl3115a2 126 | LIBS:mpu-9250 127 | LIBS:ms5611-01ba03 128 | LIBS:neon14 129 | LIBS:network0606 130 | LIBS:nor-nc7sz02p5x 131 | LIBS:npn-2222 132 | LIBS:opa832 133 | LIBS:opamp_mcp6001t 134 | LIBS:opto2-ltv-826s 135 | LIBS:opto-logic-tlp2361 136 | LIBS:ov2640_ribbon 137 | LIBS:pcb_bom 138 | LIBS:pfetsot223 139 | LIBS:pfetwsmini6-f1-b 140 | LIBS:photomos 141 | LIBS:pl140c 142 | LIBS:pnp-sot23 143 | LIBS:protect_ncp360snt1g 144 | LIBS:pusb2x4y 145 | LIBS:pwrcnv_nxe1s0305mc-r7 146 | LIBS:resonator6smd 147 | LIBS:rn-cay16-f4 148 | LIBS:rs485-isl3170 149 | LIBS:sp485cn 150 | LIBS:sp3010-04utg 151 | LIBS:stbc08-battcharger 152 | LIBS:stm32f207 153 | LIBS:stm32f301 154 | LIBS:stm32f303 155 | LIBS:stm32f303_32 156 | LIBS:stm32f407_100 157 | LIBS:tactile 158 | LIBS:tcs3x7x 159 | LIBS:tlv320adc3101 160 | LIBS:tlv711 161 | LIBS:tusb2077a 162 | LIBS:tvs2-wurth-82400102 163 | LIBS:tvs-2x 164 | LIBS:tvs-bidirection 165 | LIBS:um5k1ntr 166 | LIBS:usb3-gsb443133hr 167 | LIBS:usbmicrob-10118194-0001lf 168 | LIBS:usb-prot-ip4220cz6 169 | LIBS:ws2812b 170 | LIBS:ws_switch 171 | LIBS:xfrmr2x2 172 | LIBS:zener-sot23-3 173 | LIBS:comp-mic7721 174 | LIBS:kelvindmmwifi-cache 175 | EELAYER 25 0 176 | EELAYER END 177 | $Descr A4 11693 8268 178 | encoding utf-8 179 | Sheet 1 1 180 | Title "" 181 | Date "" 182 | Rev "" 183 | Comp "" 184 | Comment1 "" 185 | Comment2 "" 186 | Comment3 "" 187 | Comment4 "" 188 | $EndDescr 189 | $Comp 190 | L ESP12E ESP1 191 | U 1 1 5897BC42 192 | P 4350 2050 193 | F 0 "ESP1" H 4650 2650 60 0000 C CNN 194 | F 1 "ESP12E" H 4050 2650 60 0000 C CNN 195 | F 2 "ESP12E" H 4400 1800 60 0000 C CNN 196 | F 3 "" H 4400 1800 60 0000 C CNN 197 | 1 4350 2050 198 | 1 0 0 -1 199 | $EndComp 200 | $Comp 201 | L AP1117 U2 202 | U 1 1 5897BC6C 203 | P 3250 3400 204 | F 0 "U2" H 3350 3150 50 0000 C CNN 205 | F 1 "AP1117" H 3250 3650 50 0000 C CNN 206 | F 2 "TO_SOT_Packages_SMD:SOT-223" H 3250 3050 50 0001 C CNN 207 | F 3 "" H 3350 3150 50 0000 C CNN 208 | 1 3250 3400 209 | 1 0 0 -1 210 | $EndComp 211 | $Comp 212 | L R R2 213 | U 1 1 5897BD51 214 | P 6150 2150 215 | F 0 "R2" V 6230 2150 50 0000 C CNN 216 | F 1 "10k" V 6150 2150 50 0000 C CNN 217 | F 2 "C_0805" V 6080 2150 50 0000 C CNN 218 | F 3 "" H 6150 2150 50 0000 C CNN 219 | 1 6150 2150 220 | 1 0 0 -1 221 | $EndComp 222 | $Comp 223 | L R R1 224 | U 1 1 5897BDCA 225 | P 5950 2250 226 | F 0 "R1" V 6030 2250 50 0000 C CNN 227 | F 1 "10k" V 5950 2250 50 0000 C CNN 228 | F 2 "C_0805" V 5880 2250 50 0000 C CNN 229 | F 3 "" H 5950 2250 50 0000 C CNN 230 | 1 5950 2250 231 | 1 0 0 -1 232 | $EndComp 233 | Wire Wire Line 234 | 6150 2000 5150 2000 235 | Wire Wire Line 236 | 5950 2100 5150 2100 237 | $Comp 238 | L +3.3V #PWR11 239 | U 1 1 5897BE48 240 | P 3550 3400 241 | F 0 "#PWR11" H 3550 3250 50 0001 C CNN 242 | F 1 "+3.3V" H 3550 3540 50 0000 C CNN 243 | F 2 "" H 3550 3400 50 0000 C CNN 244 | F 3 "" H 3550 3400 50 0000 C CNN 245 | 1 3550 3400 246 | 0 1 1 0 247 | $EndComp 248 | $Comp 249 | L +5V #PWR3 250 | U 1 1 5897BE66 251 | P 2950 3400 252 | F 0 "#PWR3" H 2950 3250 50 0001 C CNN 253 | F 1 "+5V" H 2950 3540 50 0000 C CNN 254 | F 2 "" H 2950 3400 50 0000 C CNN 255 | F 3 "" H 2950 3400 50 0000 C CNN 256 | 1 2950 3400 257 | 0 -1 -1 0 258 | $EndComp 259 | $Comp 260 | L GND #PWR5 261 | U 1 1 5897BF47 262 | P 3250 3700 263 | F 0 "#PWR5" H 3250 3450 50 0001 C CNN 264 | F 1 "GND" H 3250 3550 50 0000 C CNN 265 | F 2 "" H 3250 3700 50 0000 C CNN 266 | F 3 "" H 3250 3700 50 0000 C CNN 267 | 1 3250 3700 268 | 1 0 0 -1 269 | $EndComp 270 | $Comp 271 | L +3.3V #PWR18 272 | U 1 1 5897BF6D 273 | P 6150 2300 274 | F 0 "#PWR18" H 6150 2150 50 0001 C CNN 275 | F 1 "+3.3V" H 6150 2440 50 0000 C CNN 276 | F 2 "" H 6150 2300 50 0000 C CNN 277 | F 3 "" H 6150 2300 50 0000 C CNN 278 | 1 6150 2300 279 | -1 0 0 1 280 | $EndComp 281 | $Comp 282 | L +3.3V #PWR15 283 | U 1 1 5897BF8C 284 | P 5950 2400 285 | F 0 "#PWR15" H 5950 2250 50 0001 C CNN 286 | F 1 "+3.3V" H 5950 2540 50 0000 C CNN 287 | F 2 "" H 5950 2400 50 0000 C CNN 288 | F 3 "" H 5950 2400 50 0000 C CNN 289 | 1 5950 2400 290 | -1 0 0 1 291 | $EndComp 292 | Wire Wire Line 293 | 5150 2200 5250 2200 294 | Wire Wire Line 295 | 5250 2200 5250 2450 296 | Wire Wire Line 297 | 5250 2300 5150 2300 298 | $Comp 299 | L GND #PWR14 300 | U 1 1 5897BFEC 301 | P 5250 2450 302 | F 0 "#PWR14" H 5250 2200 50 0001 C CNN 303 | F 1 "GND" H 5250 2300 50 0000 C CNN 304 | F 2 "" H 5250 2450 50 0000 C CNN 305 | F 3 "" H 5250 2450 50 0000 C CNN 306 | 1 5250 2450 307 | 1 0 0 -1 308 | $EndComp 309 | Connection ~ 5250 2300 310 | $Comp 311 | L CONN_7 P8 312 | U 1 1 5897C067 313 | P 7100 1900 314 | F 0 "P8" V 7070 1900 60 0000 C CNN 315 | F 1 "PGM_ETC" V 7170 1900 60 0000 C CNN 316 | F 2 "Pin_Header_Straight_1x07_Pitch2.54mm" H 7100 1900 60 0000 C CNN 317 | F 3 "" H 7100 1900 60 0000 C CNN 318 | 1 7100 1900 319 | 1 0 0 -1 320 | $EndComp 321 | Wire Wire Line 322 | 6750 1600 5150 1600 323 | Wire Wire Line 324 | 5150 1700 6750 1700 325 | Wire Wire Line 326 | 5150 1800 6750 1800 327 | Wire Wire Line 328 | 5150 1900 6750 1900 329 | Wire Wire Line 330 | 6100 2000 6100 1950 331 | Wire Wire Line 332 | 6100 1950 6450 1950 333 | Wire Wire Line 334 | 6450 1950 6450 2000 335 | Wire Wire Line 336 | 6450 2000 6750 2000 337 | Connection ~ 6100 2000 338 | $Comp 339 | L GND #PWR21 340 | U 1 1 5897C1FC 341 | P 6750 2100 342 | F 0 "#PWR21" H 6750 1850 50 0001 C CNN 343 | F 1 "GND" H 6750 1950 50 0000 C CNN 344 | F 2 "" H 6750 2100 50 0000 C CNN 345 | F 3 "" H 6750 2100 50 0000 C CNN 346 | 1 6750 2100 347 | 0 1 1 0 348 | $EndComp 349 | $Comp 350 | L +5V #PWR22 351 | U 1 1 5897C21F 352 | P 6750 2200 353 | F 0 "#PWR22" H 6750 2050 50 0001 C CNN 354 | F 1 "+5V" H 6750 2340 50 0000 C CNN 355 | F 2 "" H 6750 2200 50 0000 C CNN 356 | F 3 "" H 6750 2200 50 0000 C CNN 357 | 1 6750 2200 358 | 0 -1 -1 0 359 | $EndComp 360 | $Comp 361 | L +3.3V #PWR8 362 | U 1 1 5897BF0D 363 | P 3550 1600 364 | F 0 "#PWR8" H 3550 1450 50 0001 C CNN 365 | F 1 "+3.3V" H 3550 1740 50 0000 C CNN 366 | F 2 "" H 3550 1600 50 0000 C CNN 367 | F 3 "" H 3550 1600 50 0000 C CNN 368 | 1 3550 1600 369 | 0 -1 -1 0 370 | $EndComp 371 | $Comp 372 | L +3.3V #PWR9 373 | U 1 1 5897BF42 374 | P 3550 1800 375 | F 0 "#PWR9" H 3550 1650 50 0001 C CNN 376 | F 1 "+3.3V" H 3550 1940 50 0000 C CNN 377 | F 2 "" H 3550 1800 50 0000 C CNN 378 | F 3 "" H 3550 1800 50 0000 C CNN 379 | 1 3550 1800 380 | 0 -1 -1 0 381 | $EndComp 382 | Wire Wire Line 383 | 3550 1700 3300 1700 384 | $Comp 385 | L CONN_1 P7 386 | U 1 1 5897BFD3 387 | P 3150 1700 388 | F 0 "P7" H 3230 1700 40 0000 L CNN 389 | F 1 "ADC" H 3150 1755 30 0001 C CNN 390 | F 2 "SMTPIN.1" H 3150 1700 60 0000 C CNN 391 | F 3 "" H 3150 1700 60 0000 C CNN 392 | 1 3150 1700 393 | -1 0 0 1 394 | $EndComp 395 | $Comp 396 | L CONN_1 P6 397 | U 1 1 5897C03F 398 | P 3150 1500 399 | F 0 "P6" H 3230 1500 40 0000 L CNN 400 | F 1 "3V3" H 3150 1555 30 0001 C CNN 401 | F 2 "SMTPIN.1" H 3150 1500 60 0000 C CNN 402 | F 3 "" H 3150 1500 60 0000 C CNN 403 | 1 3150 1500 404 | -1 0 0 1 405 | $EndComp 406 | $Comp 407 | L +3.3V #PWR7 408 | U 1 1 5897C07B 409 | P 3300 1500 410 | F 0 "#PWR7" H 3300 1350 50 0001 C CNN 411 | F 1 "+3.3V" H 3300 1640 50 0000 C CNN 412 | F 2 "" H 3300 1500 50 0000 C CNN 413 | F 3 "" H 3300 1500 50 0000 C CNN 414 | 1 3300 1500 415 | 0 1 1 0 416 | $EndComp 417 | $Comp 418 | L GND #PWR6 419 | U 1 1 5897C0EE 420 | P 3300 1300 421 | F 0 "#PWR6" H 3300 1050 50 0001 C CNN 422 | F 1 "GND" H 3300 1150 50 0000 C CNN 423 | F 2 "" H 3300 1300 50 0000 C CNN 424 | F 3 "" H 3300 1300 50 0000 C CNN 425 | 1 3300 1300 426 | 0 -1 -1 0 427 | $EndComp 428 | $Comp 429 | L CONN_1 P5 430 | U 1 1 5897C119 431 | P 3150 1300 432 | F 0 "P5" H 3230 1300 40 0000 L CNN 433 | F 1 "GND" H 3150 1355 30 0001 C CNN 434 | F 2 "SMTPIN.1" H 3150 1300 60 0000 C CNN 435 | F 3 "" H 3150 1300 60 0000 C CNN 436 | 1 3150 1300 437 | -1 0 0 1 438 | $EndComp 439 | $Comp 440 | L GND #PWR2 441 | U 1 1 5897C1B8 442 | P 2700 2700 443 | F 0 "#PWR2" H 2700 2450 50 0001 C CNN 444 | F 1 "GND" H 2700 2550 50 0000 C CNN 445 | F 2 "" H 2700 2700 50 0000 C CNN 446 | F 3 "" H 2700 2700 50 0000 C CNN 447 | 1 2700 2700 448 | 1 0 0 -1 449 | $EndComp 450 | $Comp 451 | L CONN_1 P3 452 | U 1 1 5897C262 453 | P 2600 1600 454 | F 0 "P3" H 2680 1600 40 0000 L CNN 455 | F 1 "V+" H 2600 1655 30 0001 C CNN 456 | F 2 "SMTPIN.1" H 2600 1600 60 0000 C CNN 457 | F 3 "" H 2600 1600 60 0000 C CNN 458 | 1 2600 1600 459 | 0 -1 -1 0 460 | $EndComp 461 | Wire Wire Line 462 | 2600 1900 2600 1750 463 | Wire Wire Line 464 | 2600 1800 2500 1800 465 | Wire Wire Line 466 | 2500 1800 2500 1700 467 | Connection ~ 2600 1800 468 | $Comp 469 | L +5V #PWR1 470 | U 1 1 5897C34D 471 | P 2500 1700 472 | F 0 "#PWR1" H 2500 1550 50 0001 C CNN 473 | F 1 "+5V" H 2500 1840 50 0000 C CNN 474 | F 2 "" H 2500 1700 50 0000 C CNN 475 | F 3 "" H 2500 1700 50 0000 C CNN 476 | 1 2500 1700 477 | 0 -1 -1 0 478 | $EndComp 479 | $Comp 480 | L CONN_1 P4 481 | U 1 1 5897C4D0 482 | P 2700 1650 483 | F 0 "P4" H 2780 1650 40 0000 L CNN 484 | F 1 "OUT" H 2700 1705 30 0001 C CNN 485 | F 2 "SMTPIN.1" H 2700 1650 60 0000 C CNN 486 | F 3 "" H 2700 1650 60 0000 C CNN 487 | 1 2700 1650 488 | 0 -1 -1 0 489 | $EndComp 490 | $Comp 491 | L CONN_1 P1 492 | U 1 1 5897C54A 493 | P 2350 1900 494 | F 0 "P1" H 2430 1900 40 0000 L CNN 495 | F 1 "IN+" H 2350 1955 30 0001 C CNN 496 | F 2 "SMTPIN.1" H 2350 1900 60 0000 C CNN 497 | F 3 "" H 2350 1900 60 0000 C CNN 498 | 1 2350 1900 499 | -1 0 0 1 500 | $EndComp 501 | $Comp 502 | L CONN_1 P2 503 | U 1 1 5897C5B4 504 | P 2350 2700 505 | F 0 "P2" H 2430 2700 40 0000 L CNN 506 | F 1 "IN-" H 2350 2755 30 0001 C CNN 507 | F 2 "SMTPIN.1" H 2350 2700 60 0000 C CNN 508 | F 3 "" H 2350 2700 60 0000 C CNN 509 | 1 2350 2700 510 | -1 0 0 1 511 | $EndComp 512 | $Comp 513 | L +3.3V #PWR10 514 | U 1 1 5897C705 515 | P 3550 2300 516 | F 0 "#PWR10" H 3550 2150 50 0001 C CNN 517 | F 1 "+3.3V" H 3550 2440 50 0000 C CNN 518 | F 2 "" H 3550 2300 50 0000 C CNN 519 | F 3 "" H 3550 2300 50 0000 C CNN 520 | 1 3550 2300 521 | -1 0 0 1 522 | $EndComp 523 | $Comp 524 | L +5V #PWR19 525 | U 1 1 5897C744 526 | P 6400 3150 527 | F 0 "#PWR19" H 6400 3000 50 0001 C CNN 528 | F 1 "+5V" H 6400 3290 50 0000 C CNN 529 | F 2 "" H 6400 3150 50 0000 C CNN 530 | F 3 "" H 6400 3150 50 0000 C CNN 531 | 1 6400 3150 532 | 1 0 0 -1 533 | $EndComp 534 | $Comp 535 | L GND #PWR20 536 | U 1 1 5897C776 537 | P 6400 3450 538 | F 0 "#PWR20" H 6400 3200 50 0001 C CNN 539 | F 1 "GND" H 6400 3300 50 0000 C CNN 540 | F 2 "" H 6400 3450 50 0000 C CNN 541 | F 3 "" H 6400 3450 50 0000 C CNN 542 | 1 6400 3450 543 | 1 0 0 -1 544 | $EndComp 545 | $Comp 546 | L C C1 547 | U 1 1 5897C79D 548 | P 6400 3300 549 | F 0 "C1" H 6425 3400 50 0000 L CNN 550 | F 1 "10u" H 6425 3200 50 0000 L CNN 551 | F 2 "C_0805" H 6438 3150 50 0000 C CNN 552 | F 3 "" H 6400 3300 50 0000 C CNN 553 | 1 6400 3300 554 | 1 0 0 -1 555 | $EndComp 556 | Wire Wire Line 557 | 2700 1900 2700 1800 558 | Wire Wire Line 559 | 2700 1850 3200 1850 560 | Wire Wire Line 561 | 3200 1850 3200 2100 562 | Wire Wire Line 563 | 3150 2100 3550 2100 564 | Connection ~ 2700 1850 565 | $Comp 566 | L +5V #PWR23 567 | U 1 1 5897D029 568 | P 6800 3150 569 | F 0 "#PWR23" H 6800 3000 50 0001 C CNN 570 | F 1 "+5V" H 6800 3290 50 0000 C CNN 571 | F 2 "" H 6800 3150 50 0000 C CNN 572 | F 3 "" H 6800 3150 50 0000 C CNN 573 | 1 6800 3150 574 | 1 0 0 -1 575 | $EndComp 576 | $Comp 577 | L GND #PWR24 578 | U 1 1 5897D02F 579 | P 6800 3450 580 | F 0 "#PWR24" H 6800 3200 50 0001 C CNN 581 | F 1 "GND" H 6800 3300 50 0000 C CNN 582 | F 2 "" H 6800 3450 50 0000 C CNN 583 | F 3 "" H 6800 3450 50 0000 C CNN 584 | 1 6800 3450 585 | 1 0 0 -1 586 | $EndComp 587 | $Comp 588 | L C C4 589 | U 1 1 5897D035 590 | P 6800 3300 591 | F 0 "C4" H 6825 3400 50 0000 L CNN 592 | F 1 ".1" H 6825 3200 50 0000 L CNN 593 | F 2 "C_0805" H 6838 3150 50 0000 C CNN 594 | F 3 "" H 6800 3300 50 0000 C CNN 595 | 1 6800 3300 596 | 1 0 0 -1 597 | $EndComp 598 | $Comp 599 | L +5V #PWR16 600 | U 1 1 5897D17E 601 | P 6100 3150 602 | F 0 "#PWR16" H 6100 3000 50 0001 C CNN 603 | F 1 "+5V" H 6100 3290 50 0000 C CNN 604 | F 2 "" H 6100 3150 50 0000 C CNN 605 | F 3 "" H 6100 3150 50 0000 C CNN 606 | 1 6100 3150 607 | 1 0 0 -1 608 | $EndComp 609 | $Comp 610 | L GND #PWR17 611 | U 1 1 5897D184 612 | P 6100 3450 613 | F 0 "#PWR17" H 6100 3200 50 0001 C CNN 614 | F 1 "GND" H 6100 3300 50 0000 C CNN 615 | F 2 "" H 6100 3450 50 0000 C CNN 616 | F 3 "" H 6100 3450 50 0000 C CNN 617 | 1 6100 3450 618 | 1 0 0 -1 619 | $EndComp 620 | $Comp 621 | L C C3 622 | U 1 1 5897D18A 623 | P 6100 3300 624 | F 0 "C3" H 6125 3400 50 0000 L CNN 625 | F 1 ".1" H 6125 3200 50 0000 L CNN 626 | F 2 "C_0805" H 6138 3150 50 0000 C CNN 627 | F 3 "" H 6100 3300 50 0000 C CNN 628 | 1 6100 3300 629 | 1 0 0 -1 630 | $EndComp 631 | $Comp 632 | L GND #PWR13 633 | U 1 1 5897D224 634 | P 4950 3450 635 | F 0 "#PWR13" H 4950 3200 50 0001 C CNN 636 | F 1 "GND" H 4950 3300 50 0000 C CNN 637 | F 2 "" H 4950 3450 50 0000 C CNN 638 | F 3 "" H 4950 3450 50 0000 C CNN 639 | 1 4950 3450 640 | 1 0 0 -1 641 | $EndComp 642 | $Comp 643 | L C C2 644 | U 1 1 5897D22A 645 | P 4950 3300 646 | F 0 "C2" H 4975 3400 50 0000 L CNN 647 | F 1 "10u" H 4975 3200 50 0000 L CNN 648 | F 2 "C_0805" H 4988 3150 50 0000 C CNN 649 | F 3 "" H 4950 3300 50 0000 C CNN 650 | 1 4950 3300 651 | 1 0 0 -1 652 | $EndComp 653 | $Comp 654 | L +3.3V #PWR12 655 | U 1 1 5897D377 656 | P 4950 3150 657 | F 0 "#PWR12" H 4950 3000 50 0001 C CNN 658 | F 1 "+3.3V" H 4950 3290 50 0000 C CNN 659 | F 2 "" H 4950 3150 50 0000 C CNN 660 | F 3 "" H 4950 3150 50 0000 C CNN 661 | 1 4950 3150 662 | 1 0 0 -1 663 | $EndComp 664 | $Comp 665 | L R R3 666 | U 1 1 5897DBC9 667 | P 3150 2250 668 | F 0 "R3" V 3230 2250 50 0000 C CNN 669 | F 1 "10k" V 3150 2250 50 0000 C CNN 670 | F 2 "C_0805" V 3080 2250 50 0000 C CNN 671 | F 3 "" H 3150 2250 50 0000 C CNN 672 | 1 3150 2250 673 | 1 0 0 -1 674 | $EndComp 675 | Connection ~ 3200 2100 676 | $Comp 677 | L +3.3V #PWR4 678 | U 1 1 5897DCCB 679 | P 3150 2400 680 | F 0 "#PWR4" H 3150 2250 50 0001 C CNN 681 | F 1 "+3.3V" H 3150 2540 50 0000 C CNN 682 | F 2 "" H 3150 2400 50 0000 C CNN 683 | F 3 "" H 3150 2400 50 0000 C CNN 684 | 1 3150 2400 685 | -1 0 0 1 686 | $EndComp 687 | $Comp 688 | L COMP-MIC7721 U1 689 | U 1 1 5897DF60 690 | P 2600 2300 691 | F 0 "U1" H 2500 2500 60 0000 C CNN 692 | F 1 "COMP-MIC7721" H 2600 2700 60 0000 C CNN 693 | F 2 "SOT-23-5" H 2500 2200 60 0001 C CNN 694 | F 3 "" H 2500 2200 60 0001 C CNN 695 | 1 2600 2300 696 | 0 1 1 0 697 | $EndComp 698 | $EndSCHEMATC 699 | -------------------------------------------------------------------------------- /hardware/kelvindmmwifi.sch: -------------------------------------------------------------------------------- 1 | EESchema Schematic File Version 2 2 | LIBS:power 3 | LIBS:device 4 | LIBS:transistors 5 | LIBS:conn 6 | LIBS:linear 7 | LIBS:regul 8 | LIBS:74xx 9 | LIBS:cmos4000 10 | LIBS:adc-dac 11 | LIBS:memory 12 | LIBS:xilinx 13 | LIBS:microcontrollers 14 | LIBS:dsp 15 | LIBS:microchip 16 | LIBS:analog_switches 17 | LIBS:motorola 18 | LIBS:texas 19 | LIBS:intel 20 | LIBS:audio 21 | LIBS:interface 22 | LIBS:digital-audio 23 | LIBS:philips 24 | LIBS:display 25 | LIBS:cypress 26 | LIBS:siliconi 27 | LIBS:opto 28 | LIBS:atmel 29 | LIBS:contrib 30 | LIBS:valves 31 | LIBS:2.4GHZ_2450FB15L0001 32 | LIBS:6multi 33 | LIBS:23lc1024 34 | LIBS:25q40b 35 | LIBS:74hc390 36 | LIBS:74hc4067 37 | LIBS:1206network 38 | LIBS:4427 39 | LIBS:5050RGB 40 | LIBS:7805 41 | LIBS:7805to220 42 | LIBS:a4447sljtr 43 | LIBS:ad9216 44 | LIBS:adc-ltc2450 45 | LIBS:ak5358b 46 | LIBS:ap1117 47 | LIBS:atmega48_88_168_328_tqfp32 48 | LIBS:atmega1284rfr2 49 | LIBS:atmegax8pb 50 | LIBS:atmegaxu2 51 | LIBS:atmel_kk 52 | LIBS:attiny441 53 | LIBS:attiny441-qfn 54 | LIBS:attinyx4 55 | LIBS:attinyx5 56 | LIBS:atx_power 57 | LIBS:avr6pin 58 | LIBS:avr_usb_3v3-cache 59 | LIBS:BELFuse_Ethernet 60 | LIBS:bluetoothedpa 61 | LIBS:bmp085 62 | LIBS:bmp280 63 | LIBS:bridge-MB2S-TP 64 | LIBS:can_sn65hvd251qdrq1 65 | LIBS:cap1128 66 | LIBS:cd4021 67 | LIBS:choke 68 | LIBS:cp2104 69 | LIBS:crystal-4p 70 | LIBS:cyusb3012 71 | LIBS:diode-to-277-3 72 | LIBS:dmp2240udm 73 | LIBS:ds2438z 74 | LIBS:dualopamp 75 | LIBS:enc424j600 76 | LIBS:esp12e 77 | LIBS:esp32 78 | LIBS:esp8266ex 79 | LIBS:esp8266-wi07-6 80 | LIBS:exb-a 81 | LIBS:flipflop-sn74lvc1g175 82 | LIBS:ft600q 83 | LIBS:halleffect-tcs20dlr 84 | LIBS:hv9910c 85 | LIBS:ir2101 86 | LIBS:isl3177 87 | LIBS:isol_adum1201brz 88 | LIBS:jfet-n_sot-23 89 | LIBS:ksz8081rn 90 | LIBS:l6470 91 | LIBS:l6470-powerso36 92 | LIBS:l6474 93 | LIBS:lan8720a 94 | LIBS:lis3mdl 95 | LIBS:lm386 96 | LIBS:LNK3202 97 | LIBS:lsm9ds0 98 | LIBS:lsm9ds1 99 | LIBS:lsm303c 100 | LIBS:lsm303d 101 | LIBS:lsm303dlhc 102 | LIBS:LSM9DS1 103 | LIBS:ltc2471cms 104 | LIBS:ltv-846s 105 | LIBS:lvt-816s 106 | LIBS:mag3110 107 | LIBS:max3010x 108 | LIBS:max31855 109 | LIBS:mcp1803 110 | LIBS:mcp1804 111 | LIBS:mcp1824_ct 112 | LIBS:mcp23008-qfn 113 | LIBS:mcp23008-soic 114 | LIBS:memi2c_m24m02-dr 115 | LIBS:mfrc522 116 | LIBS:mic550x-reg 117 | LIBS:microsd_1050270001 118 | LIBS:mma8653fc-accel 119 | LIBS:mmpq2907a 120 | LIBS:mosdriver_ncp5901bmntbg 121 | LIBS:mosfet-lfpak56 122 | LIBS:mosfetx2vdfn8 123 | LIBS:mos_n_w_diode 124 | LIBS:mos_p_d2 125 | LIBS:mpl3115a2 126 | LIBS:mpu-9250 127 | LIBS:ms5611-01ba03 128 | LIBS:neon14 129 | LIBS:network0606 130 | LIBS:nor-nc7sz02p5x 131 | LIBS:npn-2222 132 | LIBS:opa832 133 | LIBS:opamp_mcp6001t 134 | LIBS:opto2-ltv-826s 135 | LIBS:opto-logic-tlp2361 136 | LIBS:ov2640_ribbon 137 | LIBS:pcb_bom 138 | LIBS:pfetsot223 139 | LIBS:pfetwsmini6-f1-b 140 | LIBS:photomos 141 | LIBS:pl140c 142 | LIBS:pnp-sot23 143 | LIBS:protect_ncp360snt1g 144 | LIBS:pusb2x4y 145 | LIBS:pwrcnv_nxe1s0305mc-r7 146 | LIBS:resonator6smd 147 | LIBS:rn-cay16-f4 148 | LIBS:rs485-isl3170 149 | LIBS:sp485cn 150 | LIBS:sp3010-04utg 151 | LIBS:stbc08-battcharger 152 | LIBS:stm32f207 153 | LIBS:stm32f301 154 | LIBS:stm32f303 155 | LIBS:stm32f303_32 156 | LIBS:stm32f407_100 157 | LIBS:tactile 158 | LIBS:tcs3x7x 159 | LIBS:tlv320adc3101 160 | LIBS:tlv711 161 | LIBS:tusb2077a 162 | LIBS:tvs2-wurth-82400102 163 | LIBS:tvs-2x 164 | LIBS:tvs-bidirection 165 | LIBS:um5k1ntr 166 | LIBS:usb3-gsb443133hr 167 | LIBS:usbmicrob-10118194-0001lf 168 | LIBS:usb-prot-ip4220cz6 169 | LIBS:ws2812b 170 | LIBS:ws_switch 171 | LIBS:xfrmr2x2 172 | LIBS:zener-sot23-3 173 | LIBS:comp-mic7721 174 | LIBS:kelvindmmwifi-cache 175 | EELAYER 25 0 176 | EELAYER END 177 | $Descr A4 11693 8268 178 | encoding utf-8 179 | Sheet 1 1 180 | Title "" 181 | Date "" 182 | Rev "" 183 | Comp "" 184 | Comment1 "" 185 | Comment2 "" 186 | Comment3 "" 187 | Comment4 "" 188 | $EndDescr 189 | $Comp 190 | L ESP12E ESP1 191 | U 1 1 5897BC42 192 | P 4350 2050 193 | F 0 "ESP1" H 4650 2650 60 0000 C CNN 194 | F 1 "ESP12E" H 4050 2650 60 0000 C CNN 195 | F 2 "ESP12E" H 4400 1800 60 0000 C CNN 196 | F 3 "" H 4400 1800 60 0000 C CNN 197 | 1 4350 2050 198 | 1 0 0 -1 199 | $EndComp 200 | $Comp 201 | L AP1117 U2 202 | U 1 1 5897BC6C 203 | P 3250 3400 204 | F 0 "U2" H 3350 3150 50 0000 C CNN 205 | F 1 "AP1117" H 3250 3650 50 0000 C CNN 206 | F 2 "TO_SOT_Packages_SMD:SOT-223" H 3250 3050 50 0001 C CNN 207 | F 3 "" H 3350 3150 50 0000 C CNN 208 | 1 3250 3400 209 | 1 0 0 -1 210 | $EndComp 211 | $Comp 212 | L R R2 213 | U 1 1 5897BD51 214 | P 6150 2150 215 | F 0 "R2" V 6230 2150 50 0000 C CNN 216 | F 1 "10k" V 6150 2150 50 0000 C CNN 217 | F 2 "C_0805" V 6080 2150 50 0000 C CNN 218 | F 3 "" H 6150 2150 50 0000 C CNN 219 | 1 6150 2150 220 | 1 0 0 -1 221 | $EndComp 222 | $Comp 223 | L R R1 224 | U 1 1 5897BDCA 225 | P 5950 2250 226 | F 0 "R1" V 6030 2250 50 0000 C CNN 227 | F 1 "10k" V 5950 2250 50 0000 C CNN 228 | F 2 "C_0805" V 5880 2250 50 0000 C CNN 229 | F 3 "" H 5950 2250 50 0000 C CNN 230 | 1 5950 2250 231 | 1 0 0 -1 232 | $EndComp 233 | Wire Wire Line 234 | 6150 2000 5150 2000 235 | Wire Wire Line 236 | 5950 2100 5150 2100 237 | $Comp 238 | L +3.3V #PWR11 239 | U 1 1 5897BE48 240 | P 3550 3400 241 | F 0 "#PWR11" H 3550 3250 50 0001 C CNN 242 | F 1 "+3.3V" H 3550 3540 50 0000 C CNN 243 | F 2 "" H 3550 3400 50 0000 C CNN 244 | F 3 "" H 3550 3400 50 0000 C CNN 245 | 1 3550 3400 246 | 0 1 1 0 247 | $EndComp 248 | $Comp 249 | L +5V #PWR3 250 | U 1 1 5897BE66 251 | P 2950 3400 252 | F 0 "#PWR3" H 2950 3250 50 0001 C CNN 253 | F 1 "+5V" H 2950 3540 50 0000 C CNN 254 | F 2 "" H 2950 3400 50 0000 C CNN 255 | F 3 "" H 2950 3400 50 0000 C CNN 256 | 1 2950 3400 257 | 0 -1 -1 0 258 | $EndComp 259 | $Comp 260 | L GND #PWR5 261 | U 1 1 5897BF47 262 | P 3250 3700 263 | F 0 "#PWR5" H 3250 3450 50 0001 C CNN 264 | F 1 "GND" H 3250 3550 50 0000 C CNN 265 | F 2 "" H 3250 3700 50 0000 C CNN 266 | F 3 "" H 3250 3700 50 0000 C CNN 267 | 1 3250 3700 268 | 1 0 0 -1 269 | $EndComp 270 | $Comp 271 | L +3.3V #PWR18 272 | U 1 1 5897BF6D 273 | P 6150 2300 274 | F 0 "#PWR18" H 6150 2150 50 0001 C CNN 275 | F 1 "+3.3V" H 6150 2440 50 0000 C CNN 276 | F 2 "" H 6150 2300 50 0000 C CNN 277 | F 3 "" H 6150 2300 50 0000 C CNN 278 | 1 6150 2300 279 | -1 0 0 1 280 | $EndComp 281 | $Comp 282 | L +3.3V #PWR15 283 | U 1 1 5897BF8C 284 | P 5950 2400 285 | F 0 "#PWR15" H 5950 2250 50 0001 C CNN 286 | F 1 "+3.3V" H 5950 2540 50 0000 C CNN 287 | F 2 "" H 5950 2400 50 0000 C CNN 288 | F 3 "" H 5950 2400 50 0000 C CNN 289 | 1 5950 2400 290 | -1 0 0 1 291 | $EndComp 292 | Wire Wire Line 293 | 5150 2200 5250 2200 294 | Wire Wire Line 295 | 5250 2200 5250 2450 296 | Wire Wire Line 297 | 5250 2300 5150 2300 298 | $Comp 299 | L GND #PWR14 300 | U 1 1 5897BFEC 301 | P 5250 2450 302 | F 0 "#PWR14" H 5250 2200 50 0001 C CNN 303 | F 1 "GND" H 5250 2300 50 0000 C CNN 304 | F 2 "" H 5250 2450 50 0000 C CNN 305 | F 3 "" H 5250 2450 50 0000 C CNN 306 | 1 5250 2450 307 | 1 0 0 -1 308 | $EndComp 309 | Connection ~ 5250 2300 310 | $Comp 311 | L CONN_7 P8 312 | U 1 1 5897C067 313 | P 7100 1900 314 | F 0 "P8" V 7070 1900 60 0000 C CNN 315 | F 1 "PGM_ETC" V 7170 1900 60 0000 C CNN 316 | F 2 "Pin_Header_Straight_1x07_Pitch2.54mm" H 7100 1900 60 0000 C CNN 317 | F 3 "" H 7100 1900 60 0000 C CNN 318 | 1 7100 1900 319 | 1 0 0 -1 320 | $EndComp 321 | Wire Wire Line 322 | 6750 1600 5150 1600 323 | Wire Wire Line 324 | 5150 1700 6750 1700 325 | Wire Wire Line 326 | 5150 1800 6750 1800 327 | Wire Wire Line 328 | 5150 1900 6750 1900 329 | Wire Wire Line 330 | 6100 2000 6100 1950 331 | Wire Wire Line 332 | 6100 1950 6450 1950 333 | Wire Wire Line 334 | 6450 1950 6450 2000 335 | Wire Wire Line 336 | 6450 2000 6750 2000 337 | Connection ~ 6100 2000 338 | $Comp 339 | L GND #PWR21 340 | U 1 1 5897C1FC 341 | P 6750 2100 342 | F 0 "#PWR21" H 6750 1850 50 0001 C CNN 343 | F 1 "GND" H 6750 1950 50 0000 C CNN 344 | F 2 "" H 6750 2100 50 0000 C CNN 345 | F 3 "" H 6750 2100 50 0000 C CNN 346 | 1 6750 2100 347 | 0 1 1 0 348 | $EndComp 349 | $Comp 350 | L +5V #PWR22 351 | U 1 1 5897C21F 352 | P 6750 2200 353 | F 0 "#PWR22" H 6750 2050 50 0001 C CNN 354 | F 1 "+5V" H 6750 2340 50 0000 C CNN 355 | F 2 "" H 6750 2200 50 0000 C CNN 356 | F 3 "" H 6750 2200 50 0000 C CNN 357 | 1 6750 2200 358 | 0 -1 -1 0 359 | $EndComp 360 | $Comp 361 | L +3.3V #PWR8 362 | U 1 1 5897BF0D 363 | P 3550 1600 364 | F 0 "#PWR8" H 3550 1450 50 0001 C CNN 365 | F 1 "+3.3V" H 3550 1740 50 0000 C CNN 366 | F 2 "" H 3550 1600 50 0000 C CNN 367 | F 3 "" H 3550 1600 50 0000 C CNN 368 | 1 3550 1600 369 | 0 -1 -1 0 370 | $EndComp 371 | $Comp 372 | L +3.3V #PWR9 373 | U 1 1 5897BF42 374 | P 3550 1800 375 | F 0 "#PWR9" H 3550 1650 50 0001 C CNN 376 | F 1 "+3.3V" H 3550 1940 50 0000 C CNN 377 | F 2 "" H 3550 1800 50 0000 C CNN 378 | F 3 "" H 3550 1800 50 0000 C CNN 379 | 1 3550 1800 380 | 0 -1 -1 0 381 | $EndComp 382 | Wire Wire Line 383 | 3550 1700 3300 1700 384 | $Comp 385 | L CONN_1 P7 386 | U 1 1 5897BFD3 387 | P 3150 1700 388 | F 0 "P7" H 3230 1700 40 0000 L CNN 389 | F 1 "ADC" H 3150 1755 30 0001 C CNN 390 | F 2 "SMTPIN.1" H 3150 1700 60 0000 C CNN 391 | F 3 "" H 3150 1700 60 0000 C CNN 392 | 1 3150 1700 393 | -1 0 0 1 394 | $EndComp 395 | $Comp 396 | L CONN_1 P6 397 | U 1 1 5897C03F 398 | P 3150 1500 399 | F 0 "P6" H 3230 1500 40 0000 L CNN 400 | F 1 "3V3" H 3150 1555 30 0001 C CNN 401 | F 2 "SMTPIN.1" H 3150 1500 60 0000 C CNN 402 | F 3 "" H 3150 1500 60 0000 C CNN 403 | 1 3150 1500 404 | -1 0 0 1 405 | $EndComp 406 | $Comp 407 | L +3.3V #PWR7 408 | U 1 1 5897C07B 409 | P 3300 1500 410 | F 0 "#PWR7" H 3300 1350 50 0001 C CNN 411 | F 1 "+3.3V" H 3300 1640 50 0000 C CNN 412 | F 2 "" H 3300 1500 50 0000 C CNN 413 | F 3 "" H 3300 1500 50 0000 C CNN 414 | 1 3300 1500 415 | 0 1 1 0 416 | $EndComp 417 | $Comp 418 | L GND #PWR6 419 | U 1 1 5897C0EE 420 | P 3300 1300 421 | F 0 "#PWR6" H 3300 1050 50 0001 C CNN 422 | F 1 "GND" H 3300 1150 50 0000 C CNN 423 | F 2 "" H 3300 1300 50 0000 C CNN 424 | F 3 "" H 3300 1300 50 0000 C CNN 425 | 1 3300 1300 426 | 0 -1 -1 0 427 | $EndComp 428 | $Comp 429 | L CONN_1 P5 430 | U 1 1 5897C119 431 | P 3150 1300 432 | F 0 "P5" H 3230 1300 40 0000 L CNN 433 | F 1 "GND" H 3150 1355 30 0001 C CNN 434 | F 2 "SMTPIN.1" H 3150 1300 60 0000 C CNN 435 | F 3 "" H 3150 1300 60 0000 C CNN 436 | 1 3150 1300 437 | -1 0 0 1 438 | $EndComp 439 | $Comp 440 | L GND #PWR2 441 | U 1 1 5897C1B8 442 | P 2700 2700 443 | F 0 "#PWR2" H 2700 2450 50 0001 C CNN 444 | F 1 "GND" H 2700 2550 50 0000 C CNN 445 | F 2 "" H 2700 2700 50 0000 C CNN 446 | F 3 "" H 2700 2700 50 0000 C CNN 447 | 1 2700 2700 448 | 1 0 0 -1 449 | $EndComp 450 | $Comp 451 | L CONN_1 P3 452 | U 1 1 5897C262 453 | P 2600 1600 454 | F 0 "P3" H 2680 1600 40 0000 L CNN 455 | F 1 "V+" H 2600 1655 30 0001 C CNN 456 | F 2 "SMTPIN.1" H 2600 1600 60 0000 C CNN 457 | F 3 "" H 2600 1600 60 0000 C CNN 458 | 1 2600 1600 459 | 0 -1 -1 0 460 | $EndComp 461 | Wire Wire Line 462 | 2600 1900 2600 1750 463 | Wire Wire Line 464 | 2600 1800 2500 1800 465 | Wire Wire Line 466 | 2500 1800 2500 1700 467 | Connection ~ 2600 1800 468 | $Comp 469 | L +5V #PWR1 470 | U 1 1 5897C34D 471 | P 2500 1700 472 | F 0 "#PWR1" H 2500 1550 50 0001 C CNN 473 | F 1 "+5V" H 2500 1840 50 0000 C CNN 474 | F 2 "" H 2500 1700 50 0000 C CNN 475 | F 3 "" H 2500 1700 50 0000 C CNN 476 | 1 2500 1700 477 | 0 -1 -1 0 478 | $EndComp 479 | $Comp 480 | L CONN_1 P4 481 | U 1 1 5897C4D0 482 | P 2700 1650 483 | F 0 "P4" H 2780 1650 40 0000 L CNN 484 | F 1 "OUT" H 2700 1705 30 0001 C CNN 485 | F 2 "SMTPIN.1" H 2700 1650 60 0000 C CNN 486 | F 3 "" H 2700 1650 60 0000 C CNN 487 | 1 2700 1650 488 | 0 -1 -1 0 489 | $EndComp 490 | $Comp 491 | L CONN_1 P1 492 | U 1 1 5897C54A 493 | P 2350 1900 494 | F 0 "P1" H 2430 1900 40 0000 L CNN 495 | F 1 "IN+" H 2350 1955 30 0001 C CNN 496 | F 2 "SMTPIN.1" H 2350 1900 60 0000 C CNN 497 | F 3 "" H 2350 1900 60 0000 C CNN 498 | 1 2350 1900 499 | -1 0 0 1 500 | $EndComp 501 | $Comp 502 | L CONN_1 P2 503 | U 1 1 5897C5B4 504 | P 2350 2700 505 | F 0 "P2" H 2430 2700 40 0000 L CNN 506 | F 1 "IN-" H 2350 2755 30 0001 C CNN 507 | F 2 "SMTPIN.1" H 2350 2700 60 0000 C CNN 508 | F 3 "" H 2350 2700 60 0000 C CNN 509 | 1 2350 2700 510 | -1 0 0 1 511 | $EndComp 512 | $Comp 513 | L +3.3V #PWR10 514 | U 1 1 5897C705 515 | P 3550 2300 516 | F 0 "#PWR10" H 3550 2150 50 0001 C CNN 517 | F 1 "+3.3V" H 3550 2440 50 0000 C CNN 518 | F 2 "" H 3550 2300 50 0000 C CNN 519 | F 3 "" H 3550 2300 50 0000 C CNN 520 | 1 3550 2300 521 | -1 0 0 1 522 | $EndComp 523 | $Comp 524 | L +5V #PWR19 525 | U 1 1 5897C744 526 | P 6400 3150 527 | F 0 "#PWR19" H 6400 3000 50 0001 C CNN 528 | F 1 "+5V" H 6400 3290 50 0000 C CNN 529 | F 2 "" H 6400 3150 50 0000 C CNN 530 | F 3 "" H 6400 3150 50 0000 C CNN 531 | 1 6400 3150 532 | 1 0 0 -1 533 | $EndComp 534 | $Comp 535 | L GND #PWR20 536 | U 1 1 5897C776 537 | P 6400 3450 538 | F 0 "#PWR20" H 6400 3200 50 0001 C CNN 539 | F 1 "GND" H 6400 3300 50 0000 C CNN 540 | F 2 "" H 6400 3450 50 0000 C CNN 541 | F 3 "" H 6400 3450 50 0000 C CNN 542 | 1 6400 3450 543 | 1 0 0 -1 544 | $EndComp 545 | $Comp 546 | L C C1 547 | U 1 1 5897C79D 548 | P 6400 3300 549 | F 0 "C1" H 6425 3400 50 0000 L CNN 550 | F 1 "10u" H 6425 3200 50 0000 L CNN 551 | F 2 "C_0805" H 6438 3150 50 0000 C CNN 552 | F 3 "" H 6400 3300 50 0000 C CNN 553 | 1 6400 3300 554 | 1 0 0 -1 555 | $EndComp 556 | Wire Wire Line 557 | 2700 1900 2700 1800 558 | Wire Wire Line 559 | 2700 1850 3200 1850 560 | Wire Wire Line 561 | 3200 1850 3200 2100 562 | Wire Wire Line 563 | 3150 2100 3550 2100 564 | Connection ~ 2700 1850 565 | $Comp 566 | L +5V #PWR23 567 | U 1 1 5897D029 568 | P 6800 3150 569 | F 0 "#PWR23" H 6800 3000 50 0001 C CNN 570 | F 1 "+5V" H 6800 3290 50 0000 C CNN 571 | F 2 "" H 6800 3150 50 0000 C CNN 572 | F 3 "" H 6800 3150 50 0000 C CNN 573 | 1 6800 3150 574 | 1 0 0 -1 575 | $EndComp 576 | $Comp 577 | L GND #PWR24 578 | U 1 1 5897D02F 579 | P 6800 3450 580 | F 0 "#PWR24" H 6800 3200 50 0001 C CNN 581 | F 1 "GND" H 6800 3300 50 0000 C CNN 582 | F 2 "" H 6800 3450 50 0000 C CNN 583 | F 3 "" H 6800 3450 50 0000 C CNN 584 | 1 6800 3450 585 | 1 0 0 -1 586 | $EndComp 587 | $Comp 588 | L C C4 589 | U 1 1 5897D035 590 | P 6800 3300 591 | F 0 "C4" H 6825 3400 50 0000 L CNN 592 | F 1 ".1" H 6825 3200 50 0000 L CNN 593 | F 2 "C_0805" H 6838 3150 50 0000 C CNN 594 | F 3 "" H 6800 3300 50 0000 C CNN 595 | 1 6800 3300 596 | 1 0 0 -1 597 | $EndComp 598 | $Comp 599 | L +5V #PWR16 600 | U 1 1 5897D17E 601 | P 6100 3150 602 | F 0 "#PWR16" H 6100 3000 50 0001 C CNN 603 | F 1 "+5V" H 6100 3290 50 0000 C CNN 604 | F 2 "" H 6100 3150 50 0000 C CNN 605 | F 3 "" H 6100 3150 50 0000 C CNN 606 | 1 6100 3150 607 | 1 0 0 -1 608 | $EndComp 609 | $Comp 610 | L GND #PWR17 611 | U 1 1 5897D184 612 | P 6100 3450 613 | F 0 "#PWR17" H 6100 3200 50 0001 C CNN 614 | F 1 "GND" H 6100 3300 50 0000 C CNN 615 | F 2 "" H 6100 3450 50 0000 C CNN 616 | F 3 "" H 6100 3450 50 0000 C CNN 617 | 1 6100 3450 618 | 1 0 0 -1 619 | $EndComp 620 | $Comp 621 | L C C3 622 | U 1 1 5897D18A 623 | P 6100 3300 624 | F 0 "C3" H 6125 3400 50 0000 L CNN 625 | F 1 ".1" H 6125 3200 50 0000 L CNN 626 | F 2 "C_0805" H 6138 3150 50 0000 C CNN 627 | F 3 "" H 6100 3300 50 0000 C CNN 628 | 1 6100 3300 629 | 1 0 0 -1 630 | $EndComp 631 | $Comp 632 | L GND #PWR13 633 | U 1 1 5897D224 634 | P 4950 3450 635 | F 0 "#PWR13" H 4950 3200 50 0001 C CNN 636 | F 1 "GND" H 4950 3300 50 0000 C CNN 637 | F 2 "" H 4950 3450 50 0000 C CNN 638 | F 3 "" H 4950 3450 50 0000 C CNN 639 | 1 4950 3450 640 | 1 0 0 -1 641 | $EndComp 642 | $Comp 643 | L C C2 644 | U 1 1 5897D22A 645 | P 4950 3300 646 | F 0 "C2" H 4975 3400 50 0000 L CNN 647 | F 1 "10u" H 4975 3200 50 0000 L CNN 648 | F 2 "C_0805" H 4988 3150 50 0000 C CNN 649 | F 3 "" H 4950 3300 50 0000 C CNN 650 | 1 4950 3300 651 | 1 0 0 -1 652 | $EndComp 653 | $Comp 654 | L +3.3V #PWR12 655 | U 1 1 5897D377 656 | P 4950 3150 657 | F 0 "#PWR12" H 4950 3000 50 0001 C CNN 658 | F 1 "+3.3V" H 4950 3290 50 0000 C CNN 659 | F 2 "" H 4950 3150 50 0000 C CNN 660 | F 3 "" H 4950 3150 50 0000 C CNN 661 | 1 4950 3150 662 | 1 0 0 -1 663 | $EndComp 664 | $Comp 665 | L R R3 666 | U 1 1 5897DBC9 667 | P 3150 2250 668 | F 0 "R3" V 3230 2250 50 0000 C CNN 669 | F 1 "10k" V 3150 2250 50 0000 C CNN 670 | F 2 "C_0805" V 3080 2250 50 0000 C CNN 671 | F 3 "" H 3150 2250 50 0000 C CNN 672 | 1 3150 2250 673 | 1 0 0 -1 674 | $EndComp 675 | Connection ~ 3200 2100 676 | $Comp 677 | L +3.3V #PWR4 678 | U 1 1 5897DCCB 679 | P 3150 2400 680 | F 0 "#PWR4" H 3150 2250 50 0001 C CNN 681 | F 1 "+3.3V" H 3150 2540 50 0000 C CNN 682 | F 2 "" H 3150 2400 50 0000 C CNN 683 | F 3 "" H 3150 2400 50 0000 C CNN 684 | 1 3150 2400 685 | -1 0 0 1 686 | $EndComp 687 | $Comp 688 | L COMP-MIC7721 U1 689 | U 1 1 5897DF60 690 | P 2600 2300 691 | F 0 "U1" H 2500 2500 60 0000 C CNN 692 | F 1 "COMP-MIC7721" H 2600 2700 60 0000 C CNN 693 | F 2 "SOT-23-5" H 2500 2200 60 0001 C CNN 694 | F 3 "" H 2500 2200 60 0001 C CNN 695 | 1 2600 2300 696 | 0 1 1 0 697 | $EndComp 698 | Text Notes 2200 1150 0 60 ~ 0 699 | Reference on DMM to IN-\nBUFF? to IN+ 700 | $EndSCHEMATC 701 | -------------------------------------------------------------------------------- /web/page/menuinterface.js: -------------------------------------------------------------------------------- 1 | //Copyright (C) 2015 <>< Charles Lohr, see LICENSE file for more info. 2 | // 3 | //This particular file may be licensed under the MIT/x11, New BSD or ColorChord Licenses. 4 | var wsUri = "ws://" + location.host + "/d/ws/issue"; 5 | var output; 6 | var websocket; 7 | var commsup = 0; 8 | 9 | var mpfs_start_at = 65536; //1048576; NOTE: If you select 1048576, it will override the 65536 sector, but has much more room. 10 | var flash_scratchpad_at = 524288; 11 | var flash_blocksize = 65536; 12 | var flash_sendsize = 256; 13 | //Push objects that have: 14 | // .request 15 | // .callback = function( ref (this object), data ); 16 | 17 | var workqueue = []; 18 | var wifilines = []; 19 | var workarray = {}; 20 | var lastitem; 21 | 22 | var SystemMessageTimeout = null; 23 | function IssueSystemMessage( msg ) 24 | { 25 | var elem = $( "#SystemMessage" ); 26 | elem.hide(); 27 | elem.html( "" + msg + "" ); 28 | elem.slideToggle( 'fast' ); 29 | if( SystemMessageTimeout != null ) clearTimeout(SystemMessageTimeout); 30 | SystemMessageTimeout = setTimeout( function() { SystemMessageTimeout = null; $( "#SystemMessage" ).fadeOut( 'slow' ) }, 3000 ); 31 | } 32 | 33 | function QueueOperation( command, callback ) 34 | { 35 | if( workarray[command] == 1 ) 36 | { 37 | return; 38 | } 39 | 40 | workarray[command] = 1; 41 | var vp = new Object(); 42 | vp.callback = callback; 43 | vp.request = command; 44 | workqueue.push( vp ); 45 | } 46 | 47 | did_init = false; 48 | function init() 49 | { 50 | if( did_init ) return; 51 | did_init = true; 52 | GPIOlines = ''; 53 | for(var i=0; i<16; ++i) 54 | GPIOlines += ""+ i 55 | + "" 56 | + "" 57 | + ""; 58 | 59 | $('#MainMenu > tbody:first-child').before( "\ 60 | \ 61 | \ 62 |
\ 63 |
\ 64 |
\n
" 65 | ); 66 | 67 | $('#MainMenu > tbody:last-child').after( "\ 68 | \ 69 | \ 70 |
\ 71 |
\ 72 | Current Configuration: (May deviate from default configuration, reset here if in doubt)
\ 73 | \ 74 | \ 75 | \ 76 | \ 77 | \ 78 | \ 79 | \ 80 |
Type:Station (Connect to infrastructure)
AP (Broadcast a new AP)
SSID:
PASS:
MAC: (Ignored in softAP mode)
Chan: (Ignored in Station mode)
(Automatically saves to flash)
\ 81 | Scanned Stations: \ 82 |
\ 83 | \ 84 |
\ 85 | \ 86 | \ 87 | \ 88 |
\ 89 |
\ 90 | Command: \ 91 |
\ 92 | \ 93 |
\ 94 | \ 95 | \ 96 | \ 97 |
\ 98 | " + 99 | GPIOlines 100 | + "
\ 101 | \ 102 | \ 103 | \ 104 |
\ 105 |
\ 106 |
Drop or browse for system (0x000.. 0x400...) or web (.mpfs) reflash files.
\ 107 |
" 108 | ); 109 | 110 | MakeDragDrop( "InnerSystemReflash", DragDropSystemFiles ); 111 | $("#dragndropersystem").change(function() { DragDropSystemFiles(this.files ); }); 112 | 113 | $( ".collapsible" ).each(function( index ) { 114 | if( localStorage["sh" + this.id] > 0.5 ) 115 | { 116 | $( this ).show().toggleClass( 'opened' ); 117 | // console.log( "OPEN: " + this.id ); 118 | } 119 | }); 120 | 121 | $("#custom_command_response").val( "" ); 122 | 123 | //Preclude drag and drop on rest of document in event user misses firmware boxes. 124 | donothing = function(e) {e.stopPropagation();e.preventDefault();}; 125 | $(document).on('drop', donothing ); 126 | $(document).on('dragover', donothing ); 127 | $(document).on('dragenter', donothing ); 128 | 129 | output = document.getElementById("output"); 130 | 131 | KickWifiTicker(); 132 | GPIODataTickerStart(); 133 | InitSystemTicker(); 134 | 135 | console.log( "Load complete.\n" ); 136 | Ticker(); 137 | } 138 | 139 | window.addEventListener("load", init, false); 140 | 141 | 142 | function StartWebSocket() 143 | { 144 | output.innerHTML = "Connecting..."; 145 | if( websocket ) websocket.close(); 146 | workarray = {}; 147 | workqueue = []; 148 | lastitem = null; 149 | websocket = new WebSocket(wsUri); 150 | websocket.onopen = function(evt) { onOpen(evt) }; 151 | websocket.onclose = function(evt) { onClose(evt) }; 152 | websocket.onmessage = function(evt) { onMessage(evt) }; 153 | websocket.onerror = function(evt) { onError(evt) }; 154 | } 155 | 156 | function onOpen(evt) 157 | { 158 | doSend('e' ); 159 | } 160 | 161 | function onClose(evt) 162 | { 163 | $('#SystemStatusClicker').css("color", "red" ); 164 | commsup = 0; 165 | } 166 | 167 | var msg = 0; 168 | var tickmessage = 0; 169 | var lasthz = 0; 170 | var time_since_hz = 10; //Make it realize it was disconnected to begin with. 171 | 172 | function Ticker() 173 | { 174 | setTimeout( Ticker, 1000 ); 175 | 176 | lasthz = (msg - tickmessage); 177 | tickmessage = msg; 178 | if( lasthz == 0 ) 179 | { 180 | time_since_hz++; 181 | if( time_since_hz > 3 ) 182 | { 183 | $('#SystemStatusClicker').css("color", "red" ); 184 | $('#SystemStatusClicker').prop( "value", "System Offline" ); 185 | if( commsup != 0 && !is_waiting_on_stations ) IssueSystemMessage( "Comms Lost." ); 186 | commsup = 0; 187 | StartWebSocket(); 188 | } 189 | else 190 | $('#SystemStatusClicker').prop( "value", "System " + 0 + "Hz" ); 191 | } 192 | else 193 | { 194 | time_since_hz = 0; 195 | $('#SystemStatusClicker').prop( "value", "System " + lasthz + "Hz" ); 196 | } 197 | } 198 | 199 | 200 | function onMessage(evt) 201 | { 202 | msg++; 203 | 204 | 205 | if( commsup != 1 ) 206 | { 207 | commsup = 1; 208 | $('#SystemStatusClicker').css("color", "green" ); 209 | IssueSystemMessage( "Comms Established." ); 210 | } 211 | 212 | 213 | if( lastitem ) 214 | { 215 | if( lastitem.callback ) 216 | { 217 | lastitem.callback( lastitem, evt.data ); 218 | lastitem = null; 219 | } 220 | } 221 | else 222 | { 223 | if( evt.data.length > 2 ) 224 | { 225 | var wxresp = evt.data.substr(2).split("\t"); 226 | output.innerHTML = "

Messages: " + msg + "

RSSI: " + wxresp[0] + " / IP: " + ((wxresp.length>1)?HexToIP( wxresp[1] ):"") + "

"; 227 | } 228 | } 229 | 230 | 231 | if( workqueue.length ) 232 | { 233 | var elem = workqueue.shift(); 234 | delete workarray[elem.request]; 235 | 236 | if( elem.request ) 237 | { 238 | doSend( elem.request ); 239 | lastitem = elem; 240 | return; 241 | } 242 | } 243 | 244 | doSend('wx'); //Request RSSI. 245 | } 246 | 247 | function onError(evt) 248 | { 249 | $('#SystemStatusClicker').css("color", "red" ); 250 | commsup = 0; 251 | } 252 | 253 | function doSend(message) 254 | { 255 | websocket.send(message); 256 | } 257 | 258 | function IsTabOpen( objname ) 259 | { 260 | var obj = $( "#" + objname ); 261 | var opened = obj.is( '.opened' ); 262 | return opened != 0; 263 | } 264 | 265 | function ShowHideEvent( objname ) 266 | { 267 | var obj = $( "#" + objname ); 268 | obj.slideToggle( 'fast' ).toggleClass( 'opened' ); 269 | var opened = obj.is( '.opened' ); 270 | localStorage["sh" + objname] = opened?1:0; 271 | return opened!=0; 272 | } 273 | 274 | 275 | function IssueCustomCommand() 276 | { 277 | QueueOperation( $("#custom_command").val(), function( req,data) { $("#custom_command_response").val( data ); } ); 278 | } 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | function MakeDragDrop( divname, callback ) 290 | { 291 | var obj = $("#" + divname); 292 | obj.on('dragenter', function (e) 293 | { 294 | e.stopPropagation(); 295 | e.preventDefault(); 296 | $(this).css('border', '2px solid #0B85A1'); 297 | }); 298 | 299 | obj.on('dragover', function (e) 300 | { 301 | e.stopPropagation(); 302 | e.preventDefault(); 303 | }); 304 | 305 | obj.on('dragend', function (e) 306 | { 307 | e.stopPropagation(); 308 | e.preventDefault(); 309 | $(this).css('border', '2px dotted #0B85A1'); 310 | }); 311 | 312 | obj.on('drop', function (e) 313 | { 314 | $(this).css('border', '2px dotted #0B85A1'); 315 | e.preventDefault(); 316 | var files = e.originalEvent.dataTransfer.files; 317 | 318 | //We need to send dropped files to Server 319 | callback(files); 320 | }); 321 | } 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | /////////////////////////////////////////////////////////////////////////////////////////////////////////////// 330 | ///Below here are mostly just events... 331 | 332 | var sysset = null; 333 | var snchanged = false; 334 | var sdchanged = false; 335 | 336 | var lastpeerdata = ""; 337 | 338 | function CallbackForPeers(req,data) 339 | { 340 | if( data == lastpeerdata ) return; 341 | lastpeerdata = data; 342 | var lines = data.split( "\n" ); 343 | var searchcount = 0; 344 | if( lines.length > 0 ) 345 | { 346 | var line1 = lines[0].split( "\t" ); 347 | if( line1.length > 1 ) searchcount = Number( line1[1] ); 348 | } 349 | 350 | var htm = ""; 351 | for( var i = 1; i < lines.length; i++ ) 352 | { 353 | var elems = lines[i].split( "\t" ); 354 | if( elems.length < 4 ) continue; 355 | IP = HexToIP( elems[0] ); 356 | 357 | htm += ""; 358 | } 359 | htm += "
AddressServiceNameDescription
" + IP + "" + elems[1] + "" + elems[2] + "" + elems[3] + "
"; 360 | if( searchcount == 0 ) 361 | { 362 | htm += ""; 363 | } 364 | 365 | $("#peers").html( htm ); 366 | } 367 | 368 | function SysTickBack(req,data) 369 | { 370 | var params = data.split( "\t" ); 371 | if( !snchanged ) 372 | { 373 | $("#SystemName").prop( "value", params[3] ); 374 | $("#SystemName").removeClass( "unsaved-input"); 375 | } 376 | if( !sdchanged ) 377 | { 378 | $("#SystemDescription").prop( "value", params[4] ); 379 | $("#SystemDescription").removeClass( "unsaved-input"); 380 | } 381 | $("#ServiceName").html( params[5] ); 382 | $("#FreeHeap").html( params[6] ); 383 | 384 | QueueOperation( "BL", CallbackForPeers ); 385 | } 386 | 387 | function SystemInfoTick() 388 | { 389 | if( IsTabOpen('SystemStatus') ) 390 | { 391 | QueueOperation( "I", SysTickBack ); 392 | setTimeout( SystemInfoTick, 500 ); 393 | } 394 | else 395 | { 396 | //Stop. 397 | } 398 | } 399 | 400 | function SystemChangesReset() 401 | { 402 | snchanged = false; 403 | sdchanged = false; 404 | } 405 | 406 | function SystemUncommittedChanges() 407 | { 408 | if( sdchanged || snchanged ) return true; 409 | else return false; 410 | } 411 | 412 | function InitSystemTicker() 413 | { 414 | sysset = document.getElementById( "systemsettings" ); 415 | SystemInfoTick(); 416 | sysset.innerHTML = "\ 417 |
System Name:
System Description:
Service Name:
Free Heap:
\ 418 | \ 419 | \ 420 | \ 421 | \ 422 | \ 423 |

Search for others:

\ 424 |
"; 425 | $("#SystemName").on("input propertychange paste",function(){snchanged = true; $("#SystemName").addClass( "unsaved-input"); }); 426 | $("#SystemDescription").on("input propertychange paste",function(){sdchanged = true;$("#SystemDescription").addClass( "unsaved-input"); }); 427 | } 428 | 429 | 430 | 431 | did_wifi_get_config = false; 432 | is_data_ticker_running = false; 433 | is_waiting_on_stations = false; 434 | 435 | function ScanForWifi() 436 | { 437 | QueueOperation('WS', null); 438 | is_waiting_on_stations=true; 439 | IssueSystemMessage( "Scanning for Wifi..." ); 440 | } 441 | 442 | function KickWifiTicker() 443 | { 444 | if( !is_data_ticker_running ) 445 | WifiDataTicker(); 446 | } 447 | 448 | function BSSIDClick( i ) 449 | { 450 | var tlines = wifilines[i]; 451 | document.wifisection.wifitype.value = 1; 452 | document.wifisection.wificurname.value = tlines[0].substr(1); 453 | document.wifisection.wificurpassword.value = ""; 454 | document.wifisection.wifimac.value = tlines[1]; 455 | document.wifisection.wificurchannel.value = 0; 456 | 457 | ClickOpmode( 1 ); 458 | return false; 459 | } 460 | 461 | function ClickOpmode( i ) 462 | { 463 | if( i == 1 ) 464 | { 465 | document.wifisection.wificurname.disabled = false; 466 | document.wifisection.wificurpassword.disabled = false; 467 | document.wifisection.wifimac.disabled = false; 468 | document.wifisection.wificurchannel.disabled = true; 469 | } 470 | else 471 | { 472 | document.wifisection.wificurname.disabled = false; 473 | document.wifisection.wificurpassword.disabled = true; 474 | document.wifisection.wificurpassword.value = ""; 475 | document.wifisection.wifimac.disabled = true; 476 | document.wifisection.wificurchannel.disabled = false; 477 | } 478 | } 479 | 480 | function WifiDataTicker() 481 | { 482 | if( IsTabOpen('WifiSettings') ) 483 | { 484 | is_data_ticker_running = true; 485 | 486 | if( !did_wifi_get_config ) 487 | { 488 | QueueOperation( "WI", function(req,data) 489 | { 490 | var params = data.split( "\t" ); 491 | 492 | var opmode = Number( params[0].substr(2) ); 493 | document.wifisection.wifitype.value = opmode; 494 | document.wifisection.wificurname.value = params[1]; 495 | document.wifisection.wificurpassword.value = params[2]; 496 | document.wifisection.wifimac.value = params[3]; 497 | document.wifisection.wificurchannel.value = Number( params[4] ); 498 | 499 | ClickOpmode( opmode ); 500 | did_wifi_get_config = true; 501 | } ); 502 | } 503 | 504 | QueueOperation( "WR", function(req,data) { 505 | var lines = data.split( "\n" ); 506 | var innerhtml; 507 | if( data[0] == '!' ) return; //If no APs, don't deal with list. 508 | 509 | if( lines.length < 3 ) 510 | { 511 | innerhtml = "No APs found. Did you scan?"; 512 | if( is_waiting_on_stations ) 513 | { 514 | IssueSystemMessage( "No APs found." ); 515 | is_waiting_on_stations = false; 516 | } 517 | } 518 | else 519 | { 520 | if( is_waiting_on_stations ) 521 | { 522 | IssueSystemMessage( "Scan Complete." ); 523 | is_waiting_on_stations = false; 524 | } 525 | 526 | innerhtml = "" 527 | wifilines = []; 528 | for( i = 1; i < lines.length-1; i++ ) 529 | { 530 | tlines = lines[i].split( "\t" ); 531 | wifilines.push(tlines); 532 | var bssidval = "" + tlines[1]; 533 | innerhtml += ""; 534 | } 535 | } 536 | innerhtml += "
SSIDMACRSChEnc
" + tlines[0].substr(1) + "" + bssidval + "" + tlines[2] + "" + tlines[3] + "" + tlines[4] + "
"; 537 | document.getElementById("WifiStations").innerHTML = innerhtml; 538 | } ); 539 | setTimeout( WifiDataTicker, 500 ); 540 | } 541 | else 542 | { 543 | is_data_ticker_running = 0; 544 | } 545 | } 546 | 547 | function ChangeWifiConfig() 548 | { 549 | 550 | var st = "W"; 551 | st += document.wifisection.wifitype.value; 552 | st += "\t" + document.wifisection.wificurname.value; 553 | st += "\t" + document.wifisection.wificurpassword.value; 554 | st += "\t" + document.wifisection.wifimac.value; 555 | st += "\t" + document.wifisection.wificurchannel.value; 556 | QueueOperation( st ); 557 | did_wifi_get_config = false; 558 | } 559 | 560 | 561 | 562 | 563 | function TwiddleGPIO( gp ) 564 | { 565 | var st = "GF"; 566 | st += gp; 567 | QueueOperation( st ); 568 | } 569 | 570 | function GPIOInput( gp ) 571 | { 572 | var st = "GI"; 573 | st += gp; 574 | QueueOperation( st ); 575 | } 576 | 577 | function GPIOUpdate(req,data) { 578 | var secs = data.split( "\t" ); 579 | var op = 0; 580 | var n = Number(secs[2]); 581 | var m = Number(secs[1]); 582 | 583 | for( op = 0; op < 16; op++ ) 584 | { 585 | var b = $( "#ButtonGPIO" + op ); 586 | if( b ) 587 | { 588 | if( 1< 65536 ) 750 | { 751 | $("#innersystemflashtext").html( "0x00000 needs to fit in IRAM. Too big." ); return; 752 | } 753 | 754 | if( file2.size > 262144 ) 755 | { 756 | $("#innersystemflashtext").html( "0x40000 needs to fit in 256kB. Too big." ); return; 757 | } 758 | 759 | //Files check out. Start pushing. 760 | 761 | $("#innersystemflashtext").html( "Starting." ); 762 | 763 | var reader = new FileReader(); 764 | 765 | reader.onload = function(e) { 766 | var ctx = new Object(); 767 | ctx.file1 = file1; 768 | ctx.file2 = file2; 769 | ctx.current_state = 0; 770 | PushImageTo( e.target.result, flash_scratchpad_at, SystemPushImageProgress, ctx ); 771 | } 772 | 773 | reader.readAsArrayBuffer( file[0] ); 774 | return; 775 | } 776 | else 777 | { 778 | $("#innersystemflashtext").html( "Cannot accept anything other than 1 or 2 files." ); 779 | } 780 | } 781 | 782 | 783 | 784 | 785 | 786 | 787 | 788 | 789 | 790 | function tohex8( c ) 791 | { 792 | var hex = c.toString(16); 793 | return hex.length == 1 ? "0" + hex : hex; 794 | } 795 | 796 | 797 | function HexToIP( hexstr ) 798 | { 799 | if( !hexstr ) return ""; 800 | return parseInt( hexstr.substr( 6, 2 ), 16 ) + "." + 801 | parseInt( hexstr.substr( 4, 2 ), 16 ) + "." + 802 | parseInt( hexstr.substr( 2, 2 ), 16 ) + "." + 803 | parseInt( hexstr.substr( 0, 2 ), 16 ); 804 | } 805 | 806 | function ContinueSystemFlash( fsrd, flashresponse, pushop ) 807 | { 808 | if( flashresponse[0] == '!' ) 809 | { 810 | pushop.status_callback( 0, flashresponse, pushop ); 811 | console.log( flashresponse ); 812 | return; 813 | } 814 | 815 | var cont = pushop.status_callback( 1, flashresponse, pushop ); 816 | 817 | if( !cont ) return; 818 | if( pushop.place >= pushop.padlen ) return; 819 | 820 | //If we are coming from a write, and now we need to erase the next block, do so. 821 | 822 | if( ( pushop.place % flash_blocksize ) == 0 && flashresponse[1] != 'B' ) 823 | { 824 | QueueOperation( "FB" + ((pushop.place+pushop.base_address)/flash_blocksize), function( x, y ) { ContinueSystemFlash( x, y, pushop ); } ); 825 | } 826 | else //Done erasing the next block, or coming off a write we don't need to erase? 827 | { 828 | var addy = pushop.place + pushop.base_address; 829 | var sendstr = "FX" + addy + "\t" + flash_sendsize + "\t"; 830 | for( var i = 0; i < flash_sendsize; i++ ) 831 | { 832 | sendstr += tohex8( pushop.paddata[pushop.place++] ); 833 | } 834 | QueueOperation( sendstr, function( x, y ) { ContinueSystemFlash( x, y, pushop ); } ); 835 | } 836 | } 837 | 838 | //The signature for status callback is: function AVRStatusCallback( is_ok, comment, pushop ) 839 | //If pushop.place == pushop.padlen, no further callbacks will continue, even if true is returned. 840 | //you must return "true." Returning false will cease further pushing. 841 | //This function returns an object with all properties about the transfer. 842 | //WARNING: "location" must be block (65536) aligned. 843 | function PushImageTo( arraydata, location, status_callback, ctx ) 844 | { 845 | if( location & 0xffff != 0 ) 846 | { 847 | console.log( "Error: to address not 65,536 aligned." ); 848 | return null; 849 | } 850 | 851 | var pushop = Object(); 852 | pushop.padlen = Math.floor(((arraydata.byteLength-1)/flash_sendsize)+1)*flash_sendsize; 853 | pushop.paddata = new Uint8Array( pushop.padlen, 0 ); 854 | pushop.paddata.set( new Uint8Array( arraydata ), 0 ); 855 | pushop.status_callback = status_callback; 856 | pushop.place = 0; 857 | pushop.base_address = location; 858 | pushop.ctx = ctx; 859 | 860 | ContinueSystemFlash( null, "Starting", pushop ); 861 | 862 | return pushop; 863 | } 864 | 865 | 866 | 867 | 868 | 869 | /* MD5 implementation minified from: http://blog.faultylabs.com/files/md5.js 870 | Javascript MD5 library - version 0.4 Coded (2011) by Luigi Galli - LG@4e71.org - http://faultylabs.com 871 | Thanks to: Roberto Viola The below code is PUBLIC DOMAIN - NO WARRANTY! 872 | */ 873 | "undefined"==typeof faultylabs&&(faultylabs={}),faultylabs.MD5=function(n){function r(n){var r=(n>>>0).toString(16);return"00000000".substr(0,8-r.length)+r}function t(n){for(var r=[],t=0;tt;t++)r.push(255&n),n>>>=8;return r}function o(n,r){return n<>>32-r}function a(n,r,t){return n&r|~n&t}function f(n,r,t){return t&n|~t&r}function u(n,r,t){return n^r^t}function i(n,r,t){return r^(n|~t)}function c(n,r){return n[r+3]<<24|n[r+2]<<16|n[r+1]<<8|n[r]}function s(n){for(var r=[],t=0;t=0;o--)e=arguments[o],t=255&e,e>>>=8,t<<=8,t|=255&e,e>>>=8,t<<=8,t|=255&e,e>>>=8,t<<=8,t|=e,n+=r(t);return n}function y(n){for(var r=new Array(n.length),t=0;t56){for(var s=0;64-t>s;s++)A.push(0);t=A.length%64}for(s=0;56-t>s;s++)A.push(0);A=A.concat(e(8*r));var y=1732584193,p=4023233417,g=2562383102,v=271733878,b=0,d=0,U=0,m=0;for(s=0;s