├── esp8266_firmware ├── user_config.h ├── httpd.h ├── Makefile ├── spi.h └── uart.c ├── server ├── js │ ├── ie10-viewport-bug-workaround.js │ ├── offcanvas.js │ └── npm.js ├── fonts │ ├── glyphicons-halflings-regular.eot │ ├── glyphicons-halflings-regular.ttf │ ├── glyphicons-halflings-regular.woff │ └── glyphicons-halflings-regular.woff2 ├── config.php.sample ├── provider.php ├── auth.php ├── resources │ ├── thunder.svg │ ├── moon.svg │ ├── night_mist.svg │ ├── shower_rain.svg │ ├── snow.svg │ ├── day_mist.svg │ ├── sun.svg │ ├── moon_cloud.svg │ ├── sun_cloud.svg │ ├── light_rain.svg │ ├── clouds.svg │ ├── moon_scat_cloud.svg │ └── sun_scat_cloud.svg ├── index.php ├── css │ ├── offcanvas.css │ └── bootstrap-theme.min.css.map ├── btc.php ├── stock.php ├── currency.php ├── publibike.php ├── sbb.php ├── weather.php ├── forecast.php └── functions.php ├── stm32_application ├── sram.h ├── uart.h ├── except.c ├── except.h ├── imgdec.h ├── gde043a2.h ├── Makefile ├── link.ld ├── imgdec.c ├── sram.c ├── uart.c └── main.c ├── .gitignore ├── media ├── sleep.xcf ├── ap_setup.xcf ├── dns_error.xcf ├── dhcp_error.xcf ├── low_battery.xcf ├── invalid_image.xcf ├── connection_error.xcf ├── lost_connection.xcf ├── img-conv.py ├── compression.py ├── lost_connection.svg ├── low_battery.svg ├── connection_error.svg ├── sleep.svg ├── dhcp_error.svg └── dns_error.svg ├── stm32f10x ├── stm32f10x_flash.c ├── stm32f10x_i2c.c ├── stm32f10x_usart.c ├── include │ └── stm32f10x │ │ ├── stm32f10x.h │ │ ├── stm32f10x_conf.h │ │ ├── system_stm32f10x.h │ │ ├── stm32f10x_crc.h │ │ ├── stm32f10x_wwdg.h │ │ ├── stm32f10x_dbgmcu.h │ │ ├── stm32f10x_rtc.h │ │ ├── stm32f10x_iwdg.h │ │ ├── stm32f10x_pwr.h │ │ ├── stm32f10x_cec.h │ │ └── stm32f10x_exti.h ├── Makefile ├── stm32f10x_crc.c ├── stm32f10x_iwdg.c ├── stm32f10x_dbgmcu.c └── stm32f10x_wwdg.c └── README.md /esp8266_firmware/user_config.h: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /server/js/ie10-viewport-bug-workaround.js: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /stm32_application/sram.h: -------------------------------------------------------------------------------- 1 | 2 | void FSMC_SRAM_Init(); 3 | 4 | 5 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.o 2 | *.a 3 | *.bin 4 | *.map 5 | *.pyc 6 | *.pyo 7 | *.elf 8 | -------------------------------------------------------------------------------- /media/sleep.xcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davidgfnet/wifi_display/HEAD/media/sleep.xcf -------------------------------------------------------------------------------- /media/ap_setup.xcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davidgfnet/wifi_display/HEAD/media/ap_setup.xcf -------------------------------------------------------------------------------- /media/dns_error.xcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davidgfnet/wifi_display/HEAD/media/dns_error.xcf -------------------------------------------------------------------------------- /media/dhcp_error.xcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davidgfnet/wifi_display/HEAD/media/dhcp_error.xcf -------------------------------------------------------------------------------- /media/low_battery.xcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davidgfnet/wifi_display/HEAD/media/low_battery.xcf -------------------------------------------------------------------------------- /media/invalid_image.xcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davidgfnet/wifi_display/HEAD/media/invalid_image.xcf -------------------------------------------------------------------------------- /media/connection_error.xcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davidgfnet/wifi_display/HEAD/media/connection_error.xcf -------------------------------------------------------------------------------- /media/lost_connection.xcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davidgfnet/wifi_display/HEAD/media/lost_connection.xcf -------------------------------------------------------------------------------- /stm32f10x/stm32f10x_flash.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davidgfnet/wifi_display/HEAD/stm32f10x/stm32f10x_flash.c -------------------------------------------------------------------------------- /stm32f10x/stm32f10x_i2c.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davidgfnet/wifi_display/HEAD/stm32f10x/stm32f10x_i2c.c -------------------------------------------------------------------------------- /stm32f10x/stm32f10x_usart.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davidgfnet/wifi_display/HEAD/stm32f10x/stm32f10x_usart.c -------------------------------------------------------------------------------- /stm32_application/uart.h: -------------------------------------------------------------------------------- 1 | 2 | 3 | void USART1_Init(); 4 | void USART3_Init(); 5 | void USART1_DeInit(); 6 | 7 | 8 | -------------------------------------------------------------------------------- /stm32f10x/include/stm32f10x/stm32f10x.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davidgfnet/wifi_display/HEAD/stm32f10x/include/stm32f10x/stm32f10x.h -------------------------------------------------------------------------------- /server/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davidgfnet/wifi_display/HEAD/server/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /server/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davidgfnet/wifi_display/HEAD/server/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /server/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davidgfnet/wifi_display/HEAD/server/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /server/fonts/glyphicons-halflings-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davidgfnet/wifi_display/HEAD/server/fonts/glyphicons-halflings-regular.woff2 -------------------------------------------------------------------------------- /server/js/offcanvas.js: -------------------------------------------------------------------------------- 1 | $(document).ready(function () { 2 | $('[data-toggle="offcanvas"]').click(function () { 3 | $('.row-offcanvas').toggleClass('active') 4 | }); 5 | }); 6 | -------------------------------------------------------------------------------- /server/config.php.sample: -------------------------------------------------------------------------------- 1 | 17 | -------------------------------------------------------------------------------- /stm32f10x/include/stm32f10x/stm32f10x_conf.h: -------------------------------------------------------------------------------- 1 | #ifndef STM32F10X_CONF_H_ 2 | #define STM32F10X_CONF_H_ 3 | 4 | #include "stm32f10x/stm32f10x_dbgmcu.h" 5 | #include "stm32f10x/stm32f10x_exti.h" 6 | #include "stm32f10x/stm32f10x_gpio.h" 7 | #include "stm32f10x/stm32f10x_rcc.h" 8 | #include "stm32f10x/stm32f10x_spi.h" 9 | #include "stm32f10x/stm32f10x_usart.h" 10 | #include "stm32f10x/misc.h" 11 | 12 | #endif /* STM32F10X_CONF_H_ */ 13 | -------------------------------------------------------------------------------- /stm32_application/except.c: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include "stm32f10x/stm32f10x.h" 4 | #include "except.h" 5 | 6 | void NmISR() { 7 | while(1); 8 | } 9 | 10 | 11 | void FaultISR() { 12 | while(1); 13 | } 14 | 15 | void MPUFaultHander() { 16 | while(1); 17 | } 18 | 19 | void BusFaultHandler() { 20 | while (1); 21 | } 22 | 23 | void UsageFaultHandler() { 24 | while (1); 25 | } 26 | 27 | void IntDefaultHandler() { 28 | while (1); 29 | } 30 | 31 | 32 | -------------------------------------------------------------------------------- /esp8266_firmware/httpd.h: -------------------------------------------------------------------------------- 1 | 2 | // HTTPD backend! 3 | 4 | #define MAX_RESPONSE_LENGTH 1024 // Usally headers are around 200 bytes (without cookies) 5 | 6 | typedef unsigned (*t_httpd_callback)(char * buffer, const char * body); 7 | 8 | typedef struct { 9 | const char * path; // Path for GET/POST 10 | t_httpd_callback callback; // Callback function for hit 11 | } t_url_desc; 12 | 13 | void ICACHE_FLASH_ATTR httpd_start(int port, const t_url_desc * descriptors); 14 | 15 | -------------------------------------------------------------------------------- /server/js/npm.js: -------------------------------------------------------------------------------- 1 | // This file is autogenerated via the `commonjs` Grunt task. You can require() this file in a CommonJS environment. 2 | require('../../js/transition.js') 3 | require('../../js/alert.js') 4 | require('../../js/button.js') 5 | require('../../js/carousel.js') 6 | require('../../js/collapse.js') 7 | require('../../js/dropdown.js') 8 | require('../../js/modal.js') 9 | require('../../js/tooltip.js') 10 | require('../../js/popover.js') 11 | require('../../js/scrollspy.js') 12 | require('../../js/tab.js') 13 | require('../../js/affix.js') -------------------------------------------------------------------------------- /stm32_application/except.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file except.h 3 | * @author Tedesys Global S.L. 4 | * @date Dec 13, 2010 5 | */ 6 | 7 | #ifndef EXCEPT_H_ 8 | #define EXCEPT_H_ 9 | 10 | void NmISR(void) __attribute__ ((interrupt)); 11 | void FaultISR(void) __attribute__ ((interrupt)); 12 | void MPUFaultHander(void) __attribute__ ((interrupt)); 13 | void BusFaultHandler(void) __attribute__ ((interrupt)); 14 | void UsageFaultHandler(void) __attribute__ ((interrupt)); 15 | void IntDefaultHandler(void) __attribute__ ((interrupt)); 16 | 17 | #endif /* EXCEPT_H_ */ 18 | -------------------------------------------------------------------------------- /stm32_application/imgdec.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef IMGDEC__HH__ 3 | #define IMGDEC__HH__ 4 | 5 | typedef enum { ConsumeNext, ProduceCopy, ProduceFill } FSM_states; 6 | 7 | typedef struct { 8 | const unsigned char * ibuf; // Input buffer 9 | unsigned outptr, counter; 10 | FSM_states fsm; 11 | unsigned char last; 12 | } img_decoder; 13 | 14 | 15 | void init_decoder(img_decoder * dec, const unsigned char * buffer); 16 | unsigned char decode_sample(img_decoder * dec); 17 | 18 | void image_decode(const unsigned char * in, unsigned char * out); 19 | 20 | #endif 21 | 22 | -------------------------------------------------------------------------------- /stm32_application/gde043a2.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef __GDE943A2_H___ 3 | #define __GDE943A2_H___ 4 | 5 | // Call this before messing around with the display, it will setup GPIOs and stuff 6 | void einkd_init(int direction); 7 | void einkd_deinit(); 8 | 9 | // Power ON/OFF the screen, takes a while 10 | void einkd_PowerOn(); 11 | void einkd_PowerOff(); 12 | 13 | // Repaint the screen. Pass color buffers (should be 120000 bytes each) 14 | void einkd_refresh(const unsigned char * buffer); 15 | void einkd_refresh_compressed(const unsigned char * buffer); 16 | void einkd_clear(int color); 17 | 18 | 19 | #endif 20 | 21 | -------------------------------------------------------------------------------- /server/provider.php: -------------------------------------------------------------------------------- 1 | 25 | -------------------------------------------------------------------------------- /media/img-conv.py: -------------------------------------------------------------------------------- 1 | 2 | from compression import compress 3 | 4 | im = [ 5 | # Image goes here :) 6 | ] 7 | 8 | tftable = [3,2,1,0] 9 | 10 | res = [] 11 | for i in range(0, len(im), 4): 12 | n = tftable[im[i+0]]<<6 | tftable[im[i+1]]<<4 | tftable[im[i+2]]<<2 | tftable[im[i+3]] 13 | 14 | res.append(n) 15 | 16 | res = compress(res) 17 | nbytes = len(res) 18 | 19 | res = [ "%d," % n for n in res ] 20 | 21 | res = [ " ".join(res[i:i+16]) for i in range(0, len(res), 16) ] 22 | 23 | print 'const unsigned char varname[%d] __attribute__((section(".text"), used)) = {' % nbytes 24 | print "\n".join(res) 25 | print "};" 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /stm32_application/Makefile: -------------------------------------------------------------------------------- 1 | 2 | OBJFILES = startup.o main.o except.o gde043a2.o sram.o uart.o imgdec.o 3 | 4 | CFLAGS = -ffunction-sections -fdata-sections -DSTM32F10X_XL -O2 -ggdb -I../stm32f10x/include/ -mcpu=cortex-m3 -mthumb -mno-thumb-interwork -mfpu=vfp -msoft-float -mfix-cortex-m3-ldrd -I./images 5 | 6 | all: $(OBJFILES) 7 | arm-none-eabi-gcc -o firmware.elf $(OBJFILES) -mthumb -T link.ld -L../stm32f10x -lstm32f10x -static -nostartfiles -Wl,--gc-sections -Wl,-Map=firmware.map 8 | arm-none-eabi-objcopy -O binary firmware.elf firmware.bin 9 | 10 | %.o: %.c 11 | arm-none-eabi-gcc -o $@ -c $< $(CFLAGS) 12 | 13 | clean: 14 | rm -f $(OBJFILES) firmware.elf firmware.bin 15 | -------------------------------------------------------------------------------- /server/auth.php: -------------------------------------------------------------------------------- 1 | 17 | -------------------------------------------------------------------------------- /esp8266_firmware/Makefile: -------------------------------------------------------------------------------- 1 | CC = xtensa-lx106-elf-gcc 2 | CFLAGS = -I. -mlongcalls -std=c99 -ffunction-sections -fdata-sections -Os -DICACHE_FLASH 3 | LDLIBS = -nostdlib -Wl,--start-group -lmain -lnet80211 -lwpa -llwip -lpp -lphy -Wl,--end-group -lgcc 4 | LDFLAGS = -Teagle.app.v6.ld -Wl,--gc-sections -flto -Wl,-Map,fw.map 5 | 6 | firmware-0x00000.bin: firmware 7 | esptool.py elf2image $^ 8 | 9 | firmware: main.o uart.o httpd.o spi.o 10 | $(CC) -o firmware main.o uart.o httpd.o spi.o $(LDFLAGS) $(LDLIBS) 11 | 12 | %.o: %.c 13 | $(CC) $(CFLAGS) -c -o $@ $< 14 | 15 | flash: firmware-0x00000.bin 16 | esptool.py write_flash 0 firmware-0x00000.bin 0x40000 firmware-0x40000.bin 17 | 18 | clean: 19 | rm -f firmware main.o uart.o firmware-0x00000.bin firmware-0x400000.bin 20 | 21 | 22 | -------------------------------------------------------------------------------- /stm32f10x/Makefile: -------------------------------------------------------------------------------- 1 | 2 | OBJFILES = core_cm3.o stm32f10x_dac.o stm32f10x_i2c.o stm32f10x_tim.o \ 3 | misc.o stm32f10x_dbgmcu.o stm32f10x_iwdg.o stm32f10x_usart.o \ 4 | stm32f10x_adc.o stm32f10x_dma.o stm32f10x_pwr.o stm32f10x_wwdg.o \ 5 | stm32f10x_bkp.o stm32f10x_exti.o stm32f10x_rcc.o system_stm32f10x.o \ 6 | stm32f10x_can.o stm32f10x_flash.o stm32f10x_rtc.o \ 7 | stm32f10x_cec.o stm32f10x_fsmc.o stm32f10x_sdio.o \ 8 | stm32f10x_crc.o stm32f10x_gpio.o stm32f10x_spi.o 9 | 10 | CFLAGS = -ffunction-sections -fdata-sections -DSTM32F10X_XL -O2 -ggdb -I./include/ -mcpu=cortex-m3 -mthumb -mno-thumb-interwork -mfpu=vfp -msoft-float -mfix-cortex-m3-ldrd 11 | 12 | all: $(OBJFILES) 13 | arm-none-eabi-ar rcs libstm32f10x.a $(OBJFILES) 14 | 15 | %.o: %.c 16 | arm-none-eabi-gcc -o $@ -c $< $(CFLAGS) 17 | 18 | clean: 19 | rm -f $(OBJFILES) libstm32f10x.a 20 | -------------------------------------------------------------------------------- /media/compression.py: -------------------------------------------------------------------------------- 1 | 2 | # RLE compression: 3 | # Chunk header is one byte, decoded means: 4 | # 0XXX XXXX: The following byte is repeated XXXXXXX times + 1 (from 1 to 128) 5 | # 1XXX XXXX: Just copy the following XXXXXXX+1 bytes (means the pattern is not compressible) 6 | 7 | def countb(buf): 8 | ref = buf[0] 9 | ret = 0 10 | while ret < len(buf) and buf[ret] == ref: 11 | ret += 1 12 | 13 | return ret 14 | 15 | def compress(buf): 16 | outb = [] 17 | 18 | i = 0 19 | accum = [] 20 | while (i < len(buf)): 21 | bytec = min(countb(buf[i:]), 128) 22 | encoderle = (bytec > 3) 23 | 24 | if encoderle or len(accum) == 128: 25 | # Flush noncompressable pattern 26 | if len(accum) > 0: 27 | b = len(accum) - 1 28 | b |= 0x80 29 | outb.append(b) 30 | outb += accum 31 | accum = [] 32 | 33 | if encoderle: 34 | # Emit a runlegth 35 | outb.append(bytec-1) 36 | outb.append(buf[i]) 37 | i += bytec 38 | else: 39 | accum.append(buf[i]) 40 | i += 1 41 | 42 | # Make sure to flush it all 43 | outb += accum 44 | 45 | return outb 46 | 47 | -------------------------------------------------------------------------------- /stm32_application/link.ld: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * Linker script for STM32F103ZE 4 | */ 5 | 6 | ENTRY(ResetISR); 7 | 8 | MEMORY 9 | { 10 | FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 512K 11 | SRAM (rwx) : ORIGIN = 0x20000000, LENGTH = 64K 12 | XRAM (rwx) : ORIGIN = 0x68000000, LENGTH = 1M 13 | } 14 | 15 | SECTIONS 16 | { 17 | .text : 18 | { 19 | KEEP(*(.isr_vector)) 20 | *(.text*) 21 | *(.rodata*) 22 | } > FLASH 23 | 24 | .ARM.extab : 25 | { 26 | *(.ARM.extab* .gnu.linkonce.armextab.*) 27 | } > FLASH 28 | 29 | .ARM.exidx : 30 | { 31 | __exidx_start = .; 32 | *(.ARM.exidx* .gnu.linkonce.armexidx.*) 33 | __exidx_end = .; 34 | } > FLASH 35 | 36 | _etext = ALIGN(4); 37 | 38 | .data : AT (_etext) 39 | { 40 | . = ALIGN(4); 41 | _data = .; 42 | *(vtable) 43 | *(.data*) 44 | . = ALIGN(4); 45 | _edata = .; 46 | } > SRAM 47 | 48 | .bss (NOLOAD) : 49 | { 50 | . = ALIGN(4); 51 | _bss = .; 52 | *(.stack*) 53 | *(.bss*) 54 | *(COMMON) 55 | . = ALIGN(4); 56 | _ebss = .; 57 | } > SRAM 58 | 59 | .extdata (NOLOAD) : 60 | { 61 | *(.extdata*) 62 | } > XRAM 63 | } 64 | 65 | -------------------------------------------------------------------------------- /server/resources/thunder.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /server/resources/moon.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | E-ink wifi display 3 | ================== 4 | 5 | This project contains the software bits for a e-ink display I created. 6 | 7 | You might find some info at my website: https://www.davidgf.net/2016/06/12/wifi_display/ 8 | 9 | Contents 10 | -------- 11 | 12 | esp8266_firmware: firmware sources for the ESP, built using the xtensa toolchain and the IoT SDK (used v1.5) 13 | 14 | media: Some pictures used by the screen 15 | 16 | server: PHP hell! Contains some cool JS editor I hacked myself that allows users to design screens 17 | 18 | stm32_application: STM32F firmware that actually drives the screen (was builtin in the board!) 19 | 20 | stm32f10x: ST includes and libs used to build the stm32 firmware 21 | 22 | How to build this shit 23 | ---------------------- 24 | 25 | You will need to build the FW images with their corresponding toolchaings and flash them (shouldn't be that difficult). 26 | To reuse the display driver for another board, just redefine the macros to point to your GPIOs and you are good to go! 27 | 28 | The server should be copied to a PHP enabled server, create a config.php and fill it. Also create a screens/ dir and chmod it to be world readable/writtable. 29 | 30 | Schematics 31 | ---------- 32 | 33 | I'll update this with some schematics. The ESP uses a GPIO to power gate the STM32 (off by default) which at its turn uses three other GPIOs to power gate the various screen voltage rails. 34 | 35 | GDE043A2 36 | -------- 37 | 38 | This thing uses the Good Diplay device codenamed GDE043A2, you may find stuff googling the web. The main issue though is that there is little support and the datasheet doesn't explain a thing, check gde043a2.c to see how the driver actually works. It seems GDE060BA works all much the same (they seem to be the same device with slightly different pinouts and screen sizes, but same resolution and probably same driver). 39 | 40 | -------------------------------------------------------------------------------- /server/index.php: -------------------------------------------------------------------------------- 1 | getPixelIterator(); 40 | foreach ($it as $row => $pixels) { 41 | $orow = array(); 42 | foreach ($pixels as $column => $pixel) { 43 | $color = $pixel->getColor()["r"]; 44 | $orow[] = mapColor($color, $numc); 45 | } 46 | $it->syncIterator(); 47 | 48 | // Process output row to pack colors! 49 | for ($i = 0; $i < $im->getImageWidth(); $i += $nppb) { 50 | $color = 0; 51 | for ($j = 0; $j < $nppb; $j++) 52 | $color = ($color << $numbits) | $orow[$i+$j]; 53 | //echo chr($color); 54 | $bppimage[] = $color; 55 | } 56 | } 57 | 58 | // Compress image! 59 | $bppimage = img_compress($bppimage); 60 | foreach ($bppimage as $b) 61 | echo chr($b); 62 | 63 | die(); 64 | } 65 | 66 | ?> 67 | -------------------------------------------------------------------------------- /stm32_application/imgdec.c: -------------------------------------------------------------------------------- 1 | 2 | // Using this we compress images into 10% of the original size 3 | // cause most of them are black/white and very blocky :D 4 | 5 | #include 6 | #include "imgdec.h" 7 | 8 | // Given an input buffer that encodes an RLE image, place the 9 | // decode output at out. We know that out is exactly 200*600 bytes 10 | void image_decode(const unsigned char * in, unsigned char * out) { 11 | int outsize = 200*600; 12 | while (outsize > 0) { 13 | unsigned char h = *in++; 14 | int len = (h & 0x7F) + 1; 15 | 16 | if (h & 0x80) { 17 | memcpy(out, in, len); 18 | in += len; 19 | } 20 | else { 21 | memset(out, *in, len); 22 | in++; 23 | } 24 | 25 | out += len; 26 | outsize -= len; 27 | } 28 | } 29 | 30 | void init_decoder(img_decoder * dec, const unsigned char * buffer) { 31 | dec->ibuf = buffer; 32 | dec->outptr = 0; 33 | dec->fsm = ConsumeNext; 34 | } 35 | 36 | 37 | // Given an input buffer that encodes an RLE image, place the 38 | // decode output at out. We know that out is exactly 200*600 bytes 39 | unsigned char decode_sample(img_decoder * dec) { 40 | if (dec->outptr >= 200*600) 41 | return 0; 42 | 43 | switch (dec->fsm) { 44 | case ConsumeNext: { 45 | unsigned char h = *dec->ibuf++; 46 | dec->counter = (h & 0x7F) + 1; 47 | if (h & 0x80) { 48 | // Copy next len bytes to output 49 | dec->fsm = ProduceCopy; 50 | } 51 | else { 52 | dec->fsm = ProduceFill; 53 | dec->last = *dec->ibuf++; 54 | } 55 | // This doesn't produce a thing but guarantees that 56 | // next call will produe one byte 57 | return decode_sample(dec); 58 | }; break; 59 | case ProduceCopy: 60 | if (--dec->counter == 0) 61 | dec->fsm = ConsumeNext; 62 | dec->outptr++; 63 | return *dec->ibuf++; 64 | case ProduceFill: 65 | if (--dec->counter == 0) 66 | dec->fsm = ConsumeNext; 67 | dec->outptr++; 68 | return dec->last; 69 | }; 70 | } 71 | 72 | 73 | 74 | -------------------------------------------------------------------------------- /server/css/offcanvas.css: -------------------------------------------------------------------------------- 1 | /* 2 | * Style tweaks 3 | * -------------------------------------------------- 4 | */ 5 | html, 6 | body { 7 | overflow-x: hidden; /* Prevent scroll on narrow devices */ 8 | } 9 | body { 10 | padding-top: 70px; 11 | } 12 | footer { 13 | padding: 30px 0; 14 | } 15 | 16 | .thumbimg { 17 | border-style: solid; 18 | border-width: 1px; 19 | border-color: gray; 20 | } 21 | 22 | /* 23 | * Off Canvas 24 | * -------------------------------------------------- 25 | */ 26 | @media screen and (max-width: 767px) { 27 | .row-offcanvas { 28 | position: relative; 29 | -webkit-transition: all .25s ease-out; 30 | -o-transition: all .25s ease-out; 31 | transition: all .25s ease-out; 32 | } 33 | 34 | .row-offcanvas-right { 35 | right: 0; 36 | } 37 | 38 | .row-offcanvas-left { 39 | left: 0; 40 | } 41 | 42 | .row-offcanvas-right 43 | .sidebar-offcanvas { 44 | right: -50%; /* 6 columns */ 45 | } 46 | 47 | .row-offcanvas-left 48 | .sidebar-offcanvas { 49 | left: -50%; /* 6 columns */ 50 | } 51 | 52 | .row-offcanvas-right.active { 53 | right: 50%; /* 6 columns */ 54 | } 55 | 56 | .row-offcanvas-left.active { 57 | left: 50%; /* 6 columns */ 58 | } 59 | 60 | .sidebar-offcanvas { 61 | position: absolute; 62 | top: 0; 63 | width: 50%; /* 6 columns */ 64 | } 65 | } 66 | 67 | #playground { 68 | width: 100%; 69 | height: 600px; 70 | background: white; 71 | position: relative; 72 | } 73 | 74 | 75 | 76 | .resize-drag { 77 | color: white; 78 | font-size: 10px; 79 | font-family: sans-serif; 80 | border-radius: 4px; 81 | margin: 0px; 82 | 83 | position: absolute; 84 | top: 0; 85 | left: 0; 86 | 87 | /* This makes things *much* easier */ 88 | box-sizing: border-box; 89 | } 90 | 91 | .initially_hidden { 92 | display: none; 93 | margin-top: 1em; 94 | margin-bottom: 1em; 95 | } 96 | 97 | 98 | 99 | -------------------------------------------------------------------------------- /server/resources/night_mist.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /server/btc.php: -------------------------------------------------------------------------------- 1 | cpair = "EUR"; 16 | $this->width = 800; 17 | $this->height = 100; 18 | $this->font_size = 1; 19 | $this->font_family = "Verdana"; 20 | } 21 | 22 | public function getTunables() { 23 | return array( 24 | "currency" => array("type" => "text", "display" => "Currency Pair", "value" => $this->cpair), 25 | "font_family" => array("type" => "text", "display" => "Font Family", "value" => $this->font_family), 26 | "font_size" => array("type" => "fnum", "display" => "Font Size", "value" => $this->font_size) 27 | ); 28 | } 29 | public function setTunables($v) { 30 | $this->cpair = strtoupper($v["currency"]["value"]); 31 | $this->font_family = $v["font_family"]["value"]; 32 | $this->font_size = $v["font_size"]["value"]; 33 | } 34 | 35 | public function shape() { 36 | // Return default width/height 37 | return array( 38 | "width" => $this->width, 39 | "height" => $this->height, 40 | "resizable" => true, 41 | "keep_aspect" => false, 42 | ); 43 | } 44 | 45 | public function render() { 46 | // Gather information from fixer.io 47 | $raw = file_get_contents("https://api.bitcoinaverage.com/ticker/".$this->cpair."/"); 48 | $exchange = json_decode($raw, true); 49 | 50 | $rate = $exchange["24h_avg"]; 51 | 52 | // Generate an SVG image out of this 53 | return sprintf( 54 | ' 56 | 57 | %s/BTC %0.2f 58 | 59 | ', $this->width, $this->height, 60 | $this->font_size * $this->height, $this->font_family, 61 | $this->cpair, $rate 62 | ); 63 | } 64 | 65 | }; 66 | 67 | ?> 68 | -------------------------------------------------------------------------------- /server/stock.php: -------------------------------------------------------------------------------- 1 | stock = "GOOG"; 16 | $this->width = 800; 17 | $this->height = 100; 18 | $this->font_size = 1; 19 | $this->font_family = "Verdana"; 20 | } 21 | 22 | public function getTunables() { 23 | return array( 24 | "stock" => array("type" => "text", "display" => "Stock Name", "value" => $this->stock), 25 | "font_family" => array("type" => "text", "display" => "Font Family", "value" => $this->font_family), 26 | "font_size" => array("type" => "fnum", "display" => "Font Size", "value" => $this->font_size) 27 | ); 28 | } 29 | public function setTunables($v) { 30 | $this->stock = strtoupper($v["stock"]["value"]); 31 | $this->font_family = $v["font_family"]["value"]; 32 | $this->font_size = $v["font_size"]["value"]; 33 | } 34 | 35 | public function shape() { 36 | // Return default width/height 37 | return array( 38 | "width" => $this->width, 39 | "height" => $this->height, 40 | "resizable" => true, 41 | "keep_aspect" => false, 42 | ); 43 | } 44 | 45 | public function render() { 46 | // Gather information from yahoo 47 | $raw = file_get_contents("http://finance.google.com/finance/info?client=ig&q=".$this->stock); 48 | $raw = str_replace("//", "", $raw); 49 | $info = json_decode($raw, true); 50 | 51 | $name = $info[0]["t"]; 52 | $price = $info[0]["l"]; 53 | 54 | // Generate an SVG image out of this 55 | return sprintf( 56 | ' 58 | 59 | %s %0.3f 60 | 61 | ', $this->width, $this->height, 62 | $this->font_size * $this->height, $this->font_family, 63 | $name, $price 64 | ); 65 | } 66 | 67 | }; 68 | 69 | ?> 70 | -------------------------------------------------------------------------------- /server/currency.php: -------------------------------------------------------------------------------- 1 | cpair = "EUR/USD"; 16 | $this->width = 800; 17 | $this->height = 100; 18 | $this->font_size = 1; 19 | $this->font_family = "Verdana"; 20 | } 21 | 22 | public function getTunables() { 23 | return array( 24 | "currency" => array("type" => "text", "display" => "Currency Pair", "value" => $this->cpair), 25 | "font_family" => array("type" => "text", "display" => "Font Family", "value" => $this->font_family), 26 | "font_size" => array("type" => "fnum", "display" => "Font Size", "value" => $this->font_size) 27 | ); 28 | } 29 | public function setTunables($v) { 30 | $this->cpair = strtoupper($v["currency"]["value"]); 31 | $this->font_family = $v["font_family"]["value"]; 32 | $this->font_size = $v["font_size"]["value"]; 33 | } 34 | 35 | public function shape() { 36 | // Return default width/height 37 | return array( 38 | "width" => $this->width, 39 | "height" => $this->height, 40 | "resizable" => true, 41 | "keep_aspect" => false, 42 | ); 43 | } 44 | 45 | public function render() { 46 | // Gather information from fixer.io 47 | $from = explode("/", $this->cpair)[0]; 48 | $to = explode("/", $this->cpair)[1]; 49 | $raw = file_get_contents("http://api.fixer.io/latest?base=".$from); 50 | $exchange = json_decode($raw, true); 51 | 52 | $rate = $exchange["rates"][$to]; 53 | 54 | // Generate an SVG image out of this 55 | return sprintf( 56 | ' 58 | 59 | %s %0.3f 60 | 61 | ', $this->width, $this->height, 62 | $this->font_size * $this->height, $this->font_family, 63 | $this->cpair, $rate 64 | ); 65 | } 66 | 67 | }; 68 | 69 | ?> 70 | -------------------------------------------------------------------------------- /server/publibike.php: -------------------------------------------------------------------------------- 1 | station = 128; // Binz HB 16 | $this->width = 400; 17 | $this->height = 200; 18 | $this->font_size = 0.65; 19 | $this->font_family = "Arial"; 20 | } 21 | 22 | public function getTunables() { 23 | return array( 24 | "station" => array("type" => "fnum", "display" => "Station ID", "value" => $this->station), 25 | "font_family" => array("type" => "text", "display" => "Font Family", "value" => $this->font_family), 26 | "font_size" => array("type" => "fnum", "display" => "Font Size", "value" => $this->font_size) 27 | ); 28 | } 29 | public function setTunables($v) { 30 | $this->station = $v["station"]["value"]; 31 | $this->font_family = $v["font_family"]["value"]; 32 | $this->font_size = $v["font_size"]["value"]; 33 | } 34 | 35 | public function shape() { 36 | // Return default width/height 37 | return array( 38 | "width" => $this->width, 39 | "height" => $this->height, 40 | "resizable" => true, 41 | "keep_aspect" => false, 42 | ); 43 | } 44 | 45 | public function render() { 46 | // Gather information from OpenWeatherMap 47 | $raw = file_get_contents("https://api.publibike.ch/v1/public/stations/".$this->station); 48 | $info = json_decode($raw, true); 49 | 50 | $sname = $info["name"]; 51 | $y = $this->font_size * $this->height; 52 | $nbike = 0; $nebike = 0; 53 | for ($i = 0; $i < count($info["vehicles"]); $i++) { 54 | if ($info["vehicles"][$i]["type"]["id"] == 1) 55 | $nbike++; 56 | else 57 | $nebike++; 58 | } 59 | $ret = sprintf('%s %d/%d', $y, $y, $this->font_family, $sname, $nbike, $nebike); 60 | 61 | // Generate an SVG image out of this 62 | return sprintf('%s', 63 | $this->width, $this->height, $ret); 64 | } 65 | }; 66 | 67 | ?> 68 | -------------------------------------------------------------------------------- /stm32f10x/include/stm32f10x/system_stm32f10x.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file system_stm32f10x.h 4 | * @author MCD Application Team 5 | * @version V3.5.0 6 | * @date 11-March-2011 7 | * @brief CMSIS Cortex-M3 Device Peripheral Access Layer System Header File. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 12 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 13 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 14 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 15 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 16 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 17 | * 18 | *

© COPYRIGHT 2011 STMicroelectronics

19 | ****************************************************************************** 20 | */ 21 | 22 | /** @addtogroup CMSIS 23 | * @{ 24 | */ 25 | 26 | /** @addtogroup stm32f10x_system 27 | * @{ 28 | */ 29 | 30 | /** 31 | * @brief Define to prevent recursive inclusion 32 | */ 33 | #ifndef __SYSTEM_STM32F10X_H 34 | #define __SYSTEM_STM32F10X_H 35 | 36 | #ifdef __cplusplus 37 | extern "C" { 38 | #endif 39 | 40 | /** @addtogroup STM32F10x_System_Includes 41 | * @{ 42 | */ 43 | 44 | /** 45 | * @} 46 | */ 47 | 48 | 49 | /** @addtogroup STM32F10x_System_Exported_types 50 | * @{ 51 | */ 52 | 53 | extern uint32_t SystemCoreClock; /*!< System Clock Frequency (Core Clock) */ 54 | 55 | /** 56 | * @} 57 | */ 58 | 59 | /** @addtogroup STM32F10x_System_Exported_Constants 60 | * @{ 61 | */ 62 | 63 | /** 64 | * @} 65 | */ 66 | 67 | /** @addtogroup STM32F10x_System_Exported_Macros 68 | * @{ 69 | */ 70 | 71 | /** 72 | * @} 73 | */ 74 | 75 | /** @addtogroup STM32F10x_System_Exported_Functions 76 | * @{ 77 | */ 78 | 79 | extern void SystemInit(void); 80 | extern void SystemCoreClockUpdate(void); 81 | /** 82 | * @} 83 | */ 84 | 85 | #ifdef __cplusplus 86 | } 87 | #endif 88 | 89 | #endif /*__SYSTEM_STM32F10X_H */ 90 | 91 | /** 92 | * @} 93 | */ 94 | 95 | /** 96 | * @} 97 | */ 98 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ 99 | -------------------------------------------------------------------------------- /stm32_application/sram.c: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include 4 | 5 | // SRAM initialization for the waveshare e-ink board. 6 | // It ships an IS62WV51216BLL (1MB RAM, 512K * 16) 7 | 8 | void FSMC_SRAM_Init() { 9 | // Enable FSMC clock 10 | RCC_AHBPeriphClockCmd(RCC_AHBPeriph_FSMC, ENABLE); 11 | 12 | // Enable ports DEFG 13 | RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO | RCC_APB2Periph_GPIOD | 14 | RCC_APB2Periph_GPIOG| RCC_APB2Periph_GPIOE | RCC_APB2Periph_GPIOF, ENABLE); 15 | 16 | // Init all ports to AF_PP, this covers A19-0, D15-0, NOE, NWE, NE3, NE4, NBL0 & NBL1 17 | GPIO_InitTypeDef GPIO_InitStructure; 18 | GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; 19 | GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP; 20 | 21 | GPIO_InitStructure.GPIO_Pin = 0xff33; 22 | GPIO_Init(GPIOD, &GPIO_InitStructure); 23 | 24 | GPIO_InitStructure.GPIO_Pin = 0xFF88 | 0x3; // PE15-7, PE3 PE0 PE1 25 | GPIO_Init(GPIOE, &GPIO_InitStructure); 26 | 27 | GPIO_InitStructure.GPIO_Pin = 0xf03f; // PF15-12, PF5-0 28 | GPIO_Init(GPIOF, &GPIO_InitStructure); 29 | 30 | GPIO_InitStructure.GPIO_Pin = 0x3f | 0x1400; // PG5-0 PG12 PG10 31 | GPIO_Init(GPIOG, &GPIO_InitStructure); 32 | 33 | // Set up SRAM timings and stuff 34 | FSMC_NORSRAMTimingInitTypeDef timing; 35 | FSMC_NORSRAMInitTypeDef sram; 36 | 37 | timing.FSMC_AddressSetupTime = 6; // 3 HCLK cycles ...? 41ns? I think I should double this for safety! 38 | timing.FSMC_AddressHoldTime = 0; 39 | timing.FSMC_DataSetupTime = 6; 40 | timing.FSMC_BusTurnAroundDuration = 0; 41 | timing.FSMC_CLKDivision = 0; 42 | timing.FSMC_DataLatency = 0; 43 | timing.FSMC_AccessMode = 0; 44 | 45 | sram.FSMC_Bank = FSMC_Bank1_NORSRAM3; 46 | sram.FSMC_DataAddressMux = FSMC_DataAddressMux_Disable; 47 | sram.FSMC_MemoryType = FSMC_MemoryType_SRAM; 48 | sram.FSMC_MemoryDataWidth = 16; 49 | sram.FSMC_BurstAccessMode = FSMC_BurstAccessMode_Disable; 50 | sram.FSMC_WaitSignalPolarity = FSMC_WaitSignalPolarity_Low; 51 | sram.FSMC_WrapMode = FSMC_WrapMode_Disable; 52 | sram.FSMC_WaitSignalActive = FSMC_WaitSignalActive_BeforeWaitState; 53 | sram.FSMC_WriteOperation = FSMC_WriteOperation_Enable; 54 | sram.FSMC_WaitSignal = FSMC_WaitSignal_Disable; 55 | sram.FSMC_ExtendedMode = FSMC_ExtendedMode_Disable; 56 | sram.FSMC_WriteBurst = FSMC_WriteBurst_Disable; 57 | sram.FSMC_ReadWriteTimingStruct = &timing; 58 | sram.FSMC_WriteTimingStruct = &timing; 59 | 60 | // Setup RAM! 61 | FSMC_NORSRAMInit(&sram); 62 | 63 | // Enable it! 64 | FSMC_NORSRAMCmd(FSMC_Bank1_NORSRAM3, ENABLE); 65 | } 66 | 67 | 68 | -------------------------------------------------------------------------------- /stm32f10x/include/stm32f10x/stm32f10x_crc.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f10x_crc.h 4 | * @author MCD Application Team 5 | * @version V3.5.0 6 | * @date 11-March-2011 7 | * @brief This file contains all the functions prototypes for the CRC firmware 8 | * library. 9 | ****************************************************************************** 10 | * @attention 11 | * 12 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 13 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 14 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 15 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 16 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 17 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 18 | * 19 | *

© COPYRIGHT 2011 STMicroelectronics

20 | ****************************************************************************** 21 | */ 22 | 23 | /* Define to prevent recursive inclusion -------------------------------------*/ 24 | #ifndef __STM32F10x_CRC_H 25 | #define __STM32F10x_CRC_H 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif 30 | 31 | /* Includes ------------------------------------------------------------------*/ 32 | #include "stm32f10x.h" 33 | 34 | /** @addtogroup STM32F10x_StdPeriph_Driver 35 | * @{ 36 | */ 37 | 38 | /** @addtogroup CRC 39 | * @{ 40 | */ 41 | 42 | /** @defgroup CRC_Exported_Types 43 | * @{ 44 | */ 45 | 46 | /** 47 | * @} 48 | */ 49 | 50 | /** @defgroup CRC_Exported_Constants 51 | * @{ 52 | */ 53 | 54 | /** 55 | * @} 56 | */ 57 | 58 | /** @defgroup CRC_Exported_Macros 59 | * @{ 60 | */ 61 | 62 | /** 63 | * @} 64 | */ 65 | 66 | /** @defgroup CRC_Exported_Functions 67 | * @{ 68 | */ 69 | 70 | void CRC_ResetDR(void); 71 | uint32_t CRC_CalcCRC(uint32_t Data); 72 | uint32_t CRC_CalcBlockCRC(uint32_t pBuffer[], uint32_t BufferLength); 73 | uint32_t CRC_GetCRC(void); 74 | void CRC_SetIDRegister(uint8_t IDValue); 75 | uint8_t CRC_GetIDRegister(void); 76 | 77 | #ifdef __cplusplus 78 | } 79 | #endif 80 | 81 | #endif /* __STM32F10x_CRC_H */ 82 | /** 83 | * @} 84 | */ 85 | 86 | /** 87 | * @} 88 | */ 89 | 90 | /** 91 | * @} 92 | */ 93 | 94 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ 95 | -------------------------------------------------------------------------------- /server/resources/shower_rain.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /server/sbb.php: -------------------------------------------------------------------------------- 1 | station = 8503000; // Zurich HB 17 | $this->numdep = 5; 18 | $this->width = 400; 19 | $this->height = 200; 20 | $this->font_size = 0.65; 21 | $this->font_family = "Arial"; 22 | $this->strformat = "{time} {dest} [{train}]"; 23 | } 24 | 25 | public function getTunables() { 26 | return array( 27 | "station" => array("type" => "fnum", "display" => "Station ID", "value" => $this->station), 28 | "numdep" => array("type" => "fnum", "display" => "Board size", "value" => $this->numdep), 29 | "strformat" => array("type" => "text", "display" => "Display format", "value" => $this->strformat), 30 | "font_family" => array("type" => "text", "display" => "Font Family", "value" => $this->font_family), 31 | "font_size" => array("type" => "fnum", "display" => "Font Size", "value" => $this->font_size) 32 | ); 33 | } 34 | public function setTunables($v) { 35 | $this->station = $v["station"]["value"]; 36 | $this->numdep = $v["numdep"]["value"]; 37 | $this->strformat = $v["strformat"]["value"]; 38 | $this->font_family = $v["font_family"]["value"]; 39 | $this->font_size = $v["font_size"]["value"]; 40 | } 41 | 42 | public function shape() { 43 | // Return default width/height 44 | return array( 45 | "width" => $this->width, 46 | "height" => $this->height, 47 | "resizable" => true, 48 | "keep_aspect" => false, 49 | ); 50 | } 51 | 52 | public function render() { 53 | // Gather information from OpenWeatherMap 54 | $raw = file_get_contents("http://transport.opendata.ch/v1/stationboard?id=".$this->station); 55 | $info = json_decode($raw, true); 56 | 57 | $ret = ''; 58 | $y = $this->font_size * $this->height; 59 | for ($i = 0; $i < $this->numdep; $i++) { 60 | $zug = $info["stationboard"][$i]["name"]; 61 | $where = $info["stationboard"][$i]["to"]; 62 | $attime = date('G:i', $info["stationboard"][$i]["stop"]["departureTimestamp"]); 63 | 64 | $entrystr = str_replace("{time}", $attime, $this->strformat); 65 | $entrystr = str_replace("{dest}", $where, $entrystr); 66 | $entrystr = str_replace("{train}", $zug, $entrystr); 67 | 68 | $ret .= sprintf( 69 | '%s', 70 | 0, $y, $this->font_size * $this->height, $this->font_family, $entrystr); 71 | $y += $this->font_size * $this->height; 72 | } 73 | 74 | // Generate an SVG image out of this 75 | return sprintf('%s', 76 | $this->width, $this->height, $ret); 77 | } 78 | }; 79 | 80 | ?> 81 | -------------------------------------------------------------------------------- /server/resources/snow.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /server/weather.php: -------------------------------------------------------------------------------- 1 | location = "Barcelona,ES"; 16 | $this->width = 400; 17 | $this->height = 200; 18 | $this->font_size = 0.65; 19 | $this->font_family = "Arial"; 20 | } 21 | 22 | public function getTunables() { 23 | return array( 24 | "location" => array("type" => "text", "display" => "Location", "value" => $this->location), 25 | "font_family" => array("type" => "text", "display" => "Font Family", "value" => $this->font_family), 26 | "font_size" => array("type" => "fnum", "display" => "Font Size", "value" => $this->font_size) 27 | ); 28 | } 29 | public function setTunables($v) { 30 | $this->location = $v["location"]["value"]; 31 | $this->font_family = $v["font_family"]["value"]; 32 | $this->font_size = $v["font_size"]["value"]; 33 | } 34 | 35 | public function shape() { 36 | // Return default width/height 37 | return array( 38 | "width" => $this->width, 39 | "height" => $this->height, 40 | "resizable" => true, 41 | "keep_aspect" => true, 42 | ); 43 | } 44 | 45 | public function render() { 46 | // Gather information from OpenWeatherMap 47 | $raw = file_get_contents("http://api.openweathermap.org/data/2.5/weather?q=".$this->location."&APPID=".GlobalConfig::$weather_api_key); 48 | $weather = json_decode($raw, true); 49 | 50 | $icon = $weather["weather"][0]["icon"]; 51 | $temp = $weather["main"]["temp"] - 273.15; 52 | 53 | // Generate an SVG image out of this 54 | return sprintf( 55 | ' 57 | 58 | %d° 59 | ', $this->width, $this->height, 60 | 0.03 * $this->width, 0.05 * $this->height, 61 | 0.35 * $this->width, 0.9 * $this->height, 62 | ProviderAux::embedSVG("resources/".$this->imgmap[$icon].".svg"), 63 | $this->width, ($this->font_size/3.0 + 0.5) * $this->height, $this->font_size * $this->height, 64 | $this->font_family, 65 | round($temp) 66 | ); 67 | } 68 | 69 | // Weather code -> image mapping! 70 | public $imgmap = array( 71 | "01d" => "sun", 72 | "01n" => "moon", 73 | "02d" => "sun_cloud", 74 | "02n" => "moon_cloud", 75 | "03d" => "sun_scat_cloud", 76 | "03n" => "moon_scat_cloud", 77 | "04d" => "clouds", 78 | "04n" => "clouds", 79 | "09d" => "shower_rain", 80 | "09n" => "shower_rain", 81 | "10d" => "light_rain", 82 | "10n" => "light_rain", 83 | "11d" => "thunder", 84 | "11n" => "thunder", 85 | "13d" => "snow", 86 | "13n" => "snow", 87 | "50d" => "day_mist", 88 | "50n" => "night_mist", 89 | ); 90 | }; 91 | 92 | ?> 93 | -------------------------------------------------------------------------------- /server/resources/day_mist.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /esp8266_firmware/spi.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License (MIT) 3 | * 4 | * Copyright (c) 2015 David Ogilvy (MetalPhreak) 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be included in all 14 | * copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | * SOFTWARE. 23 | */ 24 | 25 | #ifndef SPI_APP_H 26 | #define SPI_APP_H 27 | 28 | #include "spi_register.h" 29 | #include "ets_sys.h" 30 | #include "osapi.h" 31 | //#include "uart.h" 32 | #include "os_type.h" 33 | 34 | //Define SPI hardware modules 35 | #define SPI 0 36 | #define HSPI 1 37 | 38 | #define SPI_CLK_USE_DIV 0 39 | #define SPI_CLK_80MHZ_NODIV 1 40 | 41 | #define SPI_BYTE_ORDER_HIGH_TO_LOW 1 42 | #define SPI_BYTE_ORDER_LOW_TO_HIGH 0 43 | 44 | #ifndef CPU_CLK_FREQ //Should already be defined in eagle_soc.h 45 | #define CPU_CLK_FREQ 80*1000000 46 | #endif 47 | 48 | //Define some default SPI clock settings 49 | #define SPI_CLK_PREDIV 10 50 | #define SPI_CLK_CNTDIV 2 51 | #define SPI_CLK_FREQ CPU_CLK_FREQ/(SPI_CLK_PREDIV*SPI_CLK_CNTDIV) // 80 / 20 = 4 MHz 52 | 53 | void spi_init(uint8 spi_no); 54 | void spi_mode(uint8 spi_no, uint8 spi_cpha,uint8 spi_cpol); 55 | void spi_init_gpio(uint8 spi_no, uint8 sysclk_as_spiclk); 56 | void spi_clock(uint8 spi_no, uint16 prediv, uint8 cntdiv); 57 | void spi_tx_byte_order(uint8 spi_no, uint8 byte_order); 58 | void spi_rx_byte_order(uint8 spi_no, uint8 byte_order); 59 | uint32 spi_transaction(uint8 spi_no, uint8 cmd_bits, uint16 cmd_data, uint32 addr_bits, uint32 addr_data, uint32 dout_bits, uint32 dout_data, uint32 din_bits, uint32 dummy_bits); 60 | 61 | //Expansion Macros 62 | #define spi_busy(spi_no) READ_PERI_REG(SPI_CMD(spi_no))&SPI_USR 63 | 64 | #define spi_txd(spi_no, bits, data) spi_transaction(spi_no, 0, 0, 0, 0, bits, (uint32) data, 0, 0) 65 | #define spi_tx8(spi_no, data) spi_transaction(spi_no, 0, 0, 0, 0, 8, (uint32) data, 0, 0) 66 | #define spi_tx16(spi_no, data) spi_transaction(spi_no, 0, 0, 0, 0, 16, (uint32) data, 0, 0) 67 | #define spi_tx32(spi_no, data) spi_transaction(spi_no, 0, 0, 0, 0, 32, (uint32) data, 0, 0) 68 | 69 | #define spi_rxd(spi_no, bits) spi_transaction(spi_no, 0, 0, 0, 0, 0, 0, bits, 0) 70 | #define spi_rx8(spi_no) spi_transaction(spi_no, 0, 0, 0, 0, 0, 0, 8, 0) 71 | #define spi_rx16(spi_no) spi_transaction(spi_no, 0, 0, 0, 0, 0, 0, 16, 0) 72 | #define spi_rx32(spi_no) spi_transaction(spi_no, 0, 0, 0, 0, 0, 0, 32, 0) 73 | 74 | #endif 75 | 76 | 77 | -------------------------------------------------------------------------------- /server/resources/sun.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /server/resources/moon_cloud.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | -------------------------------------------------------------------------------- /stm32f10x/include/stm32f10x/stm32f10x_wwdg.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f10x_wwdg.h 4 | * @author MCD Application Team 5 | * @version V3.5.0 6 | * @date 11-March-2011 7 | * @brief This file contains all the functions prototypes for the WWDG firmware 8 | * library. 9 | ****************************************************************************** 10 | * @attention 11 | * 12 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 13 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 14 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 15 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 16 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 17 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 18 | * 19 | *

© COPYRIGHT 2011 STMicroelectronics

20 | ****************************************************************************** 21 | */ 22 | 23 | /* Define to prevent recursive inclusion -------------------------------------*/ 24 | #ifndef __STM32F10x_WWDG_H 25 | #define __STM32F10x_WWDG_H 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif 30 | 31 | /* Includes ------------------------------------------------------------------*/ 32 | #include "stm32f10x/stm32f10x.h" 33 | 34 | /** @addtogroup STM32F10x_StdPeriph_Driver 35 | * @{ 36 | */ 37 | 38 | /** @addtogroup WWDG 39 | * @{ 40 | */ 41 | 42 | /** @defgroup WWDG_Exported_Types 43 | * @{ 44 | */ 45 | 46 | /** 47 | * @} 48 | */ 49 | 50 | /** @defgroup WWDG_Exported_Constants 51 | * @{ 52 | */ 53 | 54 | /** @defgroup WWDG_Prescaler 55 | * @{ 56 | */ 57 | 58 | #define WWDG_Prescaler_1 ((uint32_t)0x00000000) 59 | #define WWDG_Prescaler_2 ((uint32_t)0x00000080) 60 | #define WWDG_Prescaler_4 ((uint32_t)0x00000100) 61 | #define WWDG_Prescaler_8 ((uint32_t)0x00000180) 62 | #define IS_WWDG_PRESCALER(PRESCALER) (((PRESCALER) == WWDG_Prescaler_1) || \ 63 | ((PRESCALER) == WWDG_Prescaler_2) || \ 64 | ((PRESCALER) == WWDG_Prescaler_4) || \ 65 | ((PRESCALER) == WWDG_Prescaler_8)) 66 | #define IS_WWDG_WINDOW_VALUE(VALUE) ((VALUE) <= 0x7F) 67 | #define IS_WWDG_COUNTER(COUNTER) (((COUNTER) >= 0x40) && ((COUNTER) <= 0x7F)) 68 | 69 | /** 70 | * @} 71 | */ 72 | 73 | /** 74 | * @} 75 | */ 76 | 77 | /** @defgroup WWDG_Exported_Macros 78 | * @{ 79 | */ 80 | /** 81 | * @} 82 | */ 83 | 84 | /** @defgroup WWDG_Exported_Functions 85 | * @{ 86 | */ 87 | 88 | void WWDG_DeInit(void); 89 | void WWDG_SetPrescaler(uint32_t WWDG_Prescaler); 90 | void WWDG_SetWindowValue(uint8_t WindowValue); 91 | void WWDG_EnableIT(void); 92 | void WWDG_SetCounter(uint8_t Counter); 93 | void WWDG_Enable(uint8_t Counter); 94 | FlagStatus WWDG_GetFlagStatus(void); 95 | void WWDG_ClearFlag(void); 96 | 97 | #ifdef __cplusplus 98 | } 99 | #endif 100 | 101 | #endif /* __STM32F10x_WWDG_H */ 102 | 103 | /** 104 | * @} 105 | */ 106 | 107 | /** 108 | * @} 109 | */ 110 | 111 | /** 112 | * @} 113 | */ 114 | 115 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ 116 | -------------------------------------------------------------------------------- /stm32_application/uart.c: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | void USART1_Init() { 5 | /* USART configuration structure for USART1 */ 6 | USART_InitTypeDef usart1_init_struct; 7 | /* Bit configuration structure for GPIOA PIN9 and PIN10 */ 8 | GPIO_InitTypeDef gpioa_init_struct; 9 | 10 | /* Enable clock for USART1, AFIO and GPIOA */ 11 | RCC_APB2PeriphClockCmd(RCC_APB2Periph_USART1 | RCC_APB2Periph_GPIOA, ENABLE); 12 | 13 | /* GPIOA PIN9 alternative function Tx */ 14 | gpioa_init_struct.GPIO_Pin = GPIO_Pin_9; 15 | gpioa_init_struct.GPIO_Speed = GPIO_Speed_50MHz; 16 | gpioa_init_struct.GPIO_Mode = GPIO_Mode_AF_PP; 17 | GPIO_Init(GPIOA, &gpioa_init_struct); 18 | /* GPIOA PIN9 alternative function Rx */ 19 | gpioa_init_struct.GPIO_Pin = GPIO_Pin_10; 20 | gpioa_init_struct.GPIO_Speed = GPIO_Speed_50MHz; 21 | gpioa_init_struct.GPIO_Mode = GPIO_Mode_IN_FLOATING; 22 | GPIO_Init(GPIOA, &gpioa_init_struct); 23 | 24 | /* Enable USART1 25 | * No parity, Do both Rx and Tx, No HW flow control 26 | **/ 27 | usart1_init_struct.USART_BaudRate = 460800; 28 | usart1_init_struct.USART_WordLength = USART_WordLength_8b; 29 | usart1_init_struct.USART_StopBits = USART_StopBits_1; 30 | usart1_init_struct.USART_Parity = USART_Parity_No ; 31 | usart1_init_struct.USART_Mode = USART_Mode_Rx | USART_Mode_Tx; 32 | usart1_init_struct.USART_HardwareFlowControl = USART_HardwareFlowControl_None; 33 | /* Configure USART1 */ 34 | USART_Init(USART1, &usart1_init_struct); 35 | 36 | USART_Cmd(USART1, ENABLE); 37 | } 38 | 39 | void USART3_Init() { 40 | /* USART configuration structure for USART2 */ 41 | USART_InitTypeDef usart3_init_struct; 42 | /* Bit configuration structure for GPIOA PIN9 and PIN10 */ 43 | GPIO_InitTypeDef gpioc_init_struct; 44 | USART_ClockInitTypeDef USART_ClockInitStructure; 45 | 46 | /* Enable clock for USART1, AFIO and GPIOA */ 47 | RCC_APB2PeriphClockCmd(RCC_APB2Periph_USART1 | RCC_APB2Periph_GPIOC, ENABLE); 48 | 49 | /* GPIOC PIN10 alternative function Tx */ 50 | gpioc_init_struct.GPIO_Pin = GPIO_Pin_10; 51 | gpioc_init_struct.GPIO_Speed = GPIO_Speed_50MHz; 52 | gpioc_init_struct.GPIO_Mode = GPIO_Mode_AF_PP; 53 | GPIO_Init(GPIOC, &gpioc_init_struct); 54 | /* GPIOC PIN11 alternative function Rx */ 55 | gpioc_init_struct.GPIO_Pin = GPIO_Pin_11; 56 | gpioc_init_struct.GPIO_Speed = GPIO_Speed_50MHz; 57 | gpioc_init_struct.GPIO_Mode = GPIO_Mode_IN_FLOATING; 58 | GPIO_Init(GPIOC, &gpioc_init_struct); 59 | /* GPIOC PIN12 alternative function CK */ 60 | gpioc_init_struct.GPIO_Pin = GPIO_Pin_12; 61 | gpioc_init_struct.GPIO_Speed = GPIO_Speed_50MHz; 62 | gpioc_init_struct.GPIO_Mode = GPIO_Mode_IN_FLOATING; 63 | GPIO_Init(GPIOC, &gpioc_init_struct); 64 | 65 | /* Enable USART2 66 | * No parity, Do both Rx and Tx, No HW flow control 67 | **/ 68 | USART_ClockInitStructure.USART_Clock = USART_Clock_Enable; 69 | USART_ClockInitStructure.USART_CPOL = USART_CPOL_High; 70 | USART_ClockInitStructure.USART_CPHA = USART_CPHA_2Edge; 71 | USART_ClockInitStructure.USART_LastBit = USART_LastBit_Enable; 72 | USART_ClockInit(USART3, &USART_ClockInitStructure); 73 | 74 | usart3_init_struct.USART_BaudRate = 460800; 75 | usart3_init_struct.USART_WordLength = USART_WordLength_8b; 76 | usart3_init_struct.USART_StopBits = USART_StopBits_1; 77 | usart3_init_struct.USART_Parity = USART_Parity_No; 78 | usart3_init_struct.USART_Mode = USART_Mode_Rx | USART_Mode_Tx; 79 | usart3_init_struct.USART_HardwareFlowControl = USART_HardwareFlowControl_None; 80 | /* Configure USART1 */ 81 | USART_Init(USART3, &usart3_init_struct); 82 | 83 | USART_Cmd(USART3, ENABLE); 84 | } 85 | 86 | void USART1_DeInit() { 87 | USART_Cmd(USART1, DISABLE); 88 | RCC_APB2PeriphClockCmd(RCC_APB2Periph_USART1, DISABLE); 89 | } 90 | 91 | 92 | -------------------------------------------------------------------------------- /server/resources/sun_cloud.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | -------------------------------------------------------------------------------- /server/resources/light_rain.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | -------------------------------------------------------------------------------- /server/resources/clouds.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /stm32f10x/stm32f10x_crc.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f10x_crc.c 4 | * @author MCD Application Team 5 | * @version V3.5.0 6 | * @date 11-March-2011 7 | * @brief This file provides all the CRC firmware functions. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 12 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 13 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 14 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 15 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 16 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 17 | * 18 | *

© COPYRIGHT 2011 STMicroelectronics

19 | ****************************************************************************** 20 | */ 21 | 22 | /* Includes ------------------------------------------------------------------*/ 23 | #include "stm32f10x/stm32f10x_crc.h" 24 | 25 | /** @addtogroup STM32F10x_StdPeriph_Driver 26 | * @{ 27 | */ 28 | 29 | /** @defgroup CRC 30 | * @brief CRC driver modules 31 | * @{ 32 | */ 33 | 34 | /** @defgroup CRC_Private_TypesDefinitions 35 | * @{ 36 | */ 37 | 38 | /** 39 | * @} 40 | */ 41 | 42 | /** @defgroup CRC_Private_Defines 43 | * @{ 44 | */ 45 | 46 | /** 47 | * @} 48 | */ 49 | 50 | /** @defgroup CRC_Private_Macros 51 | * @{ 52 | */ 53 | 54 | /** 55 | * @} 56 | */ 57 | 58 | /** @defgroup CRC_Private_Variables 59 | * @{ 60 | */ 61 | 62 | /** 63 | * @} 64 | */ 65 | 66 | /** @defgroup CRC_Private_FunctionPrototypes 67 | * @{ 68 | */ 69 | 70 | /** 71 | * @} 72 | */ 73 | 74 | /** @defgroup CRC_Private_Functions 75 | * @{ 76 | */ 77 | 78 | /** 79 | * @brief Resets the CRC Data register (DR). 80 | * @param None 81 | * @retval None 82 | */ 83 | void CRC_ResetDR(void) 84 | { 85 | /* Reset CRC generator */ 86 | CRC->CR = CRC_CR_RESET; 87 | } 88 | 89 | /** 90 | * @brief Computes the 32-bit CRC of a given data word(32-bit). 91 | * @param Data: data word(32-bit) to compute its CRC 92 | * @retval 32-bit CRC 93 | */ 94 | uint32_t CRC_CalcCRC(uint32_t Data) 95 | { 96 | CRC->DR = Data; 97 | 98 | return (CRC->DR); 99 | } 100 | 101 | /** 102 | * @brief Computes the 32-bit CRC of a given buffer of data word(32-bit). 103 | * @param pBuffer: pointer to the buffer containing the data to be computed 104 | * @param BufferLength: length of the buffer to be computed 105 | * @retval 32-bit CRC 106 | */ 107 | uint32_t CRC_CalcBlockCRC(uint32_t pBuffer[], uint32_t BufferLength) 108 | { 109 | uint32_t index = 0; 110 | 111 | for(index = 0; index < BufferLength; index++) 112 | { 113 | CRC->DR = pBuffer[index]; 114 | } 115 | return (CRC->DR); 116 | } 117 | 118 | /** 119 | * @brief Returns the current CRC value. 120 | * @param None 121 | * @retval 32-bit CRC 122 | */ 123 | uint32_t CRC_GetCRC(void) 124 | { 125 | return (CRC->DR); 126 | } 127 | 128 | /** 129 | * @brief Stores a 8-bit data in the Independent Data(ID) register. 130 | * @param IDValue: 8-bit value to be stored in the ID register 131 | * @retval None 132 | */ 133 | void CRC_SetIDRegister(uint8_t IDValue) 134 | { 135 | CRC->IDR = IDValue; 136 | } 137 | 138 | /** 139 | * @brief Returns the 8-bit data stored in the Independent Data(ID) register 140 | * @param None 141 | * @retval 8-bit value of the ID register 142 | */ 143 | uint8_t CRC_GetIDRegister(void) 144 | { 145 | return (CRC->IDR); 146 | } 147 | 148 | /** 149 | * @} 150 | */ 151 | 152 | /** 153 | * @} 154 | */ 155 | 156 | /** 157 | * @} 158 | */ 159 | 160 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ 161 | -------------------------------------------------------------------------------- /server/forecast.php: -------------------------------------------------------------------------------- 1 | location = "Barcelona,ES"; 17 | $this->width = 1000; 18 | $this->height = 200; 19 | $this->font_size = 0.15; 20 | $this->font_family = "Arial"; 21 | $this->ndays = 5; 22 | } 23 | 24 | public function getTunables() { 25 | return array( 26 | "location" => array("type" => "text", "display" => "Location", "value" => $this->location), 27 | "font_family" => array("type" => "text", "display" => "Font Family", "value" => $this->font_family), 28 | "font_size" => array("type" => "fnum", "display" => "Font Size", "value" => $this->font_size), 29 | "ndays" => array("type" => "num", "display" => "Number of days", "value" => $this->ndays) 30 | ); 31 | } 32 | public function setTunables($v) { 33 | $this->location = $v["location"]["value"]; 34 | $this->font_family = $v["font_family"]["value"]; 35 | $this->font_size = $v["font_size"]["value"]; 36 | $this->ndays = $v["ndays"]["value"]; 37 | } 38 | 39 | public function shape() { 40 | // Return default width/height 41 | return array( 42 | "width" => $this->width, 43 | "height" => $this->height, 44 | "resizable" => true, 45 | "keep_aspect" => true, 46 | ); 47 | } 48 | 49 | public function render() { 50 | // Gather information from OpenWeatherMap 51 | $raw = file_get_contents( 52 | "http://api.openweathermap.org/data/2.5/forecast/daily?cnt=".($this->ndays+1)."&q=".$this->location."&APPID=".GlobalConfig::$weather_api_key 53 | ); 54 | $weather = json_decode($raw, true); 55 | 56 | $forecast = $weather["list"]; 57 | 58 | $daily = array(); 59 | $nd = count($forecast)-1; 60 | for ($i = 0; $i < $nd; $i++) { 61 | $icon = $forecast[$i+1]["weather"][0]["icon"]; 62 | $dayn = date('D', $forecast[$i+1]["dt"]); 63 | $mint = $forecast[$i+1]["temp"]["min"] - 273.15; 64 | $maxt = $forecast[$i+1]["temp"]["max"] - 273.15; 65 | 66 | $daily[] = sprintf( 67 | ' 68 | 69 | %s 70 | 71 | 72 | %d° %d° 73 | 74 | ', 75 | $this->width / $nd * ($i + 0.05), $this->height * 0.15, 76 | $this->width / $nd * 0.9, $this->height * 0.6, 77 | ProviderAux::embedSVG("resources/".$this->imgmap[$icon].".svg"), 78 | $this->width / $nd * ($i + 0.5), 0.12 * $this->height, 79 | $this->font_size * $this->height, $this->font_family, 80 | $dayn, 81 | $this->width / $nd * ($i + 0.5), 0.92 * $this->height, 82 | $this->font_size * $this->height, $this->font_family, 83 | $mint, $maxt 84 | ); 85 | } 86 | 87 | // Generate an SVG image out of this 88 | return sprintf( 89 | ' 91 | %s 92 | ', 93 | $this->width, $this->height, 94 | implode("\n", $daily) 95 | ); 96 | } 97 | 98 | // Weather code -> image mapping! 99 | public $imgmap = array( 100 | "01d" => "sun", 101 | "01n" => "moon", 102 | "02d" => "sun_cloud", 103 | "02n" => "moon_cloud", 104 | "03d" => "sun_scat_cloud", 105 | "03n" => "moon_scat_cloud", 106 | "04d" => "clouds", 107 | "04n" => "clouds", 108 | "09d" => "shower_rain", 109 | "09n" => "shower_rain", 110 | "10d" => "light_rain", 111 | "10n" => "light_rain", 112 | "11d" => "thunder", 113 | "11n" => "thunder", 114 | "13d" => "snow", 115 | "13n" => "snow", 116 | "50d" => "day_mist", 117 | "50n" => "night_mist", 118 | ); 119 | }; 120 | 121 | ?> 122 | -------------------------------------------------------------------------------- /stm32f10x/include/stm32f10x/stm32f10x_dbgmcu.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f10x_dbgmcu.h 4 | * @author MCD Application Team 5 | * @version V3.5.0 6 | * @date 11-March-2011 7 | * @brief This file contains all the functions prototypes for the DBGMCU 8 | * firmware library. 9 | ****************************************************************************** 10 | * @attention 11 | * 12 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 13 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 14 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 15 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 16 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 17 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 18 | * 19 | *

© COPYRIGHT 2011 STMicroelectronics

20 | ****************************************************************************** 21 | */ 22 | 23 | /* Define to prevent recursive inclusion -------------------------------------*/ 24 | #ifndef __STM32F10x_DBGMCU_H 25 | #define __STM32F10x_DBGMCU_H 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif 30 | 31 | /* Includes ------------------------------------------------------------------*/ 32 | #include "stm32f10x/stm32f10x.h" 33 | 34 | /** @addtogroup STM32F10x_StdPeriph_Driver 35 | * @{ 36 | */ 37 | 38 | /** @addtogroup DBGMCU 39 | * @{ 40 | */ 41 | 42 | /** @defgroup DBGMCU_Exported_Types 43 | * @{ 44 | */ 45 | 46 | /** 47 | * @} 48 | */ 49 | 50 | /** @defgroup DBGMCU_Exported_Constants 51 | * @{ 52 | */ 53 | 54 | #define DBGMCU_SLEEP ((uint32_t)0x00000001) 55 | #define DBGMCU_STOP ((uint32_t)0x00000002) 56 | #define DBGMCU_STANDBY ((uint32_t)0x00000004) 57 | #define DBGMCU_IWDG_STOP ((uint32_t)0x00000100) 58 | #define DBGMCU_WWDG_STOP ((uint32_t)0x00000200) 59 | #define DBGMCU_TIM1_STOP ((uint32_t)0x00000400) 60 | #define DBGMCU_TIM2_STOP ((uint32_t)0x00000800) 61 | #define DBGMCU_TIM3_STOP ((uint32_t)0x00001000) 62 | #define DBGMCU_TIM4_STOP ((uint32_t)0x00002000) 63 | #define DBGMCU_CAN1_STOP ((uint32_t)0x00004000) 64 | #define DBGMCU_I2C1_SMBUS_TIMEOUT ((uint32_t)0x00008000) 65 | #define DBGMCU_I2C2_SMBUS_TIMEOUT ((uint32_t)0x00010000) 66 | #define DBGMCU_TIM8_STOP ((uint32_t)0x00020000) 67 | #define DBGMCU_TIM5_STOP ((uint32_t)0x00040000) 68 | #define DBGMCU_TIM6_STOP ((uint32_t)0x00080000) 69 | #define DBGMCU_TIM7_STOP ((uint32_t)0x00100000) 70 | #define DBGMCU_CAN2_STOP ((uint32_t)0x00200000) 71 | #define DBGMCU_TIM15_STOP ((uint32_t)0x00400000) 72 | #define DBGMCU_TIM16_STOP ((uint32_t)0x00800000) 73 | #define DBGMCU_TIM17_STOP ((uint32_t)0x01000000) 74 | #define DBGMCU_TIM12_STOP ((uint32_t)0x02000000) 75 | #define DBGMCU_TIM13_STOP ((uint32_t)0x04000000) 76 | #define DBGMCU_TIM14_STOP ((uint32_t)0x08000000) 77 | #define DBGMCU_TIM9_STOP ((uint32_t)0x10000000) 78 | #define DBGMCU_TIM10_STOP ((uint32_t)0x20000000) 79 | #define DBGMCU_TIM11_STOP ((uint32_t)0x40000000) 80 | 81 | #define IS_DBGMCU_PERIPH(PERIPH) ((((PERIPH) & 0x800000F8) == 0x00) && ((PERIPH) != 0x00)) 82 | /** 83 | * @} 84 | */ 85 | 86 | /** @defgroup DBGMCU_Exported_Macros 87 | * @{ 88 | */ 89 | 90 | /** 91 | * @} 92 | */ 93 | 94 | /** @defgroup DBGMCU_Exported_Functions 95 | * @{ 96 | */ 97 | 98 | uint32_t DBGMCU_GetREVID(void); 99 | uint32_t DBGMCU_GetDEVID(void); 100 | void DBGMCU_Config(uint32_t DBGMCU_Periph, FunctionalState NewState); 101 | 102 | #ifdef __cplusplus 103 | } 104 | #endif 105 | 106 | #endif /* __STM32F10x_DBGMCU_H */ 107 | /** 108 | * @} 109 | */ 110 | 111 | /** 112 | * @} 113 | */ 114 | 115 | /** 116 | * @} 117 | */ 118 | 119 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ 120 | -------------------------------------------------------------------------------- /server/resources/moon_scat_cloud.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | -------------------------------------------------------------------------------- /stm32f10x/include/stm32f10x/stm32f10x_rtc.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f10x_rtc.h 4 | * @author MCD Application Team 5 | * @version V3.5.0 6 | * @date 11-March-2011 7 | * @brief This file contains all the functions prototypes for the RTC firmware 8 | * library. 9 | ****************************************************************************** 10 | * @attention 11 | * 12 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 13 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 14 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 15 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 16 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 17 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 18 | * 19 | *

© COPYRIGHT 2011 STMicroelectronics

20 | ****************************************************************************** 21 | */ 22 | 23 | /* Define to prevent recursive inclusion -------------------------------------*/ 24 | #ifndef __STM32F10x_RTC_H 25 | #define __STM32F10x_RTC_H 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif 30 | 31 | /* Includes ------------------------------------------------------------------*/ 32 | #include "stm32f10x/stm32f10x.h" 33 | 34 | /** @addtogroup STM32F10x_StdPeriph_Driver 35 | * @{ 36 | */ 37 | 38 | /** @addtogroup RTC 39 | * @{ 40 | */ 41 | 42 | /** @defgroup RTC_Exported_Types 43 | * @{ 44 | */ 45 | 46 | /** 47 | * @} 48 | */ 49 | 50 | /** @defgroup RTC_Exported_Constants 51 | * @{ 52 | */ 53 | 54 | /** @defgroup RTC_interrupts_define 55 | * @{ 56 | */ 57 | 58 | #define RTC_IT_OW ((uint16_t)0x0004) /*!< Overflow interrupt */ 59 | #define RTC_IT_ALR ((uint16_t)0x0002) /*!< Alarm interrupt */ 60 | #define RTC_IT_SEC ((uint16_t)0x0001) /*!< Second interrupt */ 61 | #define IS_RTC_IT(IT) ((((IT) & (uint16_t)0xFFF8) == 0x00) && ((IT) != 0x00)) 62 | #define IS_RTC_GET_IT(IT) (((IT) == RTC_IT_OW) || ((IT) == RTC_IT_ALR) || \ 63 | ((IT) == RTC_IT_SEC)) 64 | /** 65 | * @} 66 | */ 67 | 68 | /** @defgroup RTC_interrupts_flags 69 | * @{ 70 | */ 71 | 72 | #define RTC_FLAG_RTOFF ((uint16_t)0x0020) /*!< RTC Operation OFF flag */ 73 | #define RTC_FLAG_RSF ((uint16_t)0x0008) /*!< Registers Synchronized flag */ 74 | #define RTC_FLAG_OW ((uint16_t)0x0004) /*!< Overflow flag */ 75 | #define RTC_FLAG_ALR ((uint16_t)0x0002) /*!< Alarm flag */ 76 | #define RTC_FLAG_SEC ((uint16_t)0x0001) /*!< Second flag */ 77 | #define IS_RTC_CLEAR_FLAG(FLAG) ((((FLAG) & (uint16_t)0xFFF0) == 0x00) && ((FLAG) != 0x00)) 78 | #define IS_RTC_GET_FLAG(FLAG) (((FLAG) == RTC_FLAG_RTOFF) || ((FLAG) == RTC_FLAG_RSF) || \ 79 | ((FLAG) == RTC_FLAG_OW) || ((FLAG) == RTC_FLAG_ALR) || \ 80 | ((FLAG) == RTC_FLAG_SEC)) 81 | #define IS_RTC_PRESCALER(PRESCALER) ((PRESCALER) <= 0xFFFFF) 82 | 83 | /** 84 | * @} 85 | */ 86 | 87 | /** 88 | * @} 89 | */ 90 | 91 | /** @defgroup RTC_Exported_Macros 92 | * @{ 93 | */ 94 | 95 | /** 96 | * @} 97 | */ 98 | 99 | /** @defgroup RTC_Exported_Functions 100 | * @{ 101 | */ 102 | 103 | void RTC_ITConfig(uint16_t RTC_IT, FunctionalState NewState); 104 | void RTC_EnterConfigMode(void); 105 | void RTC_ExitConfigMode(void); 106 | uint32_t RTC_GetCounter(void); 107 | void RTC_SetCounter(uint32_t CounterValue); 108 | void RTC_SetPrescaler(uint32_t PrescalerValue); 109 | void RTC_SetAlarm(uint32_t AlarmValue); 110 | uint32_t RTC_GetDivider(void); 111 | void RTC_WaitForLastTask(void); 112 | void RTC_WaitForSynchro(void); 113 | FlagStatus RTC_GetFlagStatus(uint16_t RTC_FLAG); 114 | void RTC_ClearFlag(uint16_t RTC_FLAG); 115 | ITStatus RTC_GetITStatus(uint16_t RTC_IT); 116 | void RTC_ClearITPendingBit(uint16_t RTC_IT); 117 | 118 | #ifdef __cplusplus 119 | } 120 | #endif 121 | 122 | #endif /* __STM32F10x_RTC_H */ 123 | /** 124 | * @} 125 | */ 126 | 127 | /** 128 | * @} 129 | */ 130 | 131 | /** 132 | * @} 133 | */ 134 | 135 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ 136 | -------------------------------------------------------------------------------- /stm32f10x/include/stm32f10x/stm32f10x_iwdg.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f10x_iwdg.h 4 | * @author MCD Application Team 5 | * @version V3.5.0 6 | * @date 11-March-2011 7 | * @brief This file contains all the functions prototypes for the IWDG 8 | * firmware library. 9 | ****************************************************************************** 10 | * @attention 11 | * 12 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 13 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 14 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 15 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 16 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 17 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 18 | * 19 | *

© COPYRIGHT 2011 STMicroelectronics

20 | ****************************************************************************** 21 | */ 22 | 23 | /* Define to prevent recursive inclusion -------------------------------------*/ 24 | #ifndef __STM32F10x_IWDG_H 25 | #define __STM32F10x_IWDG_H 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif 30 | 31 | /* Includes ------------------------------------------------------------------*/ 32 | #include "stm32f10x/stm32f10x.h" 33 | 34 | /** @addtogroup STM32F10x_StdPeriph_Driver 35 | * @{ 36 | */ 37 | 38 | /** @addtogroup IWDG 39 | * @{ 40 | */ 41 | 42 | /** @defgroup IWDG_Exported_Types 43 | * @{ 44 | */ 45 | 46 | /** 47 | * @} 48 | */ 49 | 50 | /** @defgroup IWDG_Exported_Constants 51 | * @{ 52 | */ 53 | 54 | /** @defgroup IWDG_WriteAccess 55 | * @{ 56 | */ 57 | 58 | #define IWDG_WriteAccess_Enable ((uint16_t)0x5555) 59 | #define IWDG_WriteAccess_Disable ((uint16_t)0x0000) 60 | #define IS_IWDG_WRITE_ACCESS(ACCESS) (((ACCESS) == IWDG_WriteAccess_Enable) || \ 61 | ((ACCESS) == IWDG_WriteAccess_Disable)) 62 | /** 63 | * @} 64 | */ 65 | 66 | /** @defgroup IWDG_prescaler 67 | * @{ 68 | */ 69 | 70 | #define IWDG_Prescaler_4 ((uint8_t)0x00) 71 | #define IWDG_Prescaler_8 ((uint8_t)0x01) 72 | #define IWDG_Prescaler_16 ((uint8_t)0x02) 73 | #define IWDG_Prescaler_32 ((uint8_t)0x03) 74 | #define IWDG_Prescaler_64 ((uint8_t)0x04) 75 | #define IWDG_Prescaler_128 ((uint8_t)0x05) 76 | #define IWDG_Prescaler_256 ((uint8_t)0x06) 77 | #define IS_IWDG_PRESCALER(PRESCALER) (((PRESCALER) == IWDG_Prescaler_4) || \ 78 | ((PRESCALER) == IWDG_Prescaler_8) || \ 79 | ((PRESCALER) == IWDG_Prescaler_16) || \ 80 | ((PRESCALER) == IWDG_Prescaler_32) || \ 81 | ((PRESCALER) == IWDG_Prescaler_64) || \ 82 | ((PRESCALER) == IWDG_Prescaler_128)|| \ 83 | ((PRESCALER) == IWDG_Prescaler_256)) 84 | /** 85 | * @} 86 | */ 87 | 88 | /** @defgroup IWDG_Flag 89 | * @{ 90 | */ 91 | 92 | #define IWDG_FLAG_PVU ((uint16_t)0x0001) 93 | #define IWDG_FLAG_RVU ((uint16_t)0x0002) 94 | #define IS_IWDG_FLAG(FLAG) (((FLAG) == IWDG_FLAG_PVU) || ((FLAG) == IWDG_FLAG_RVU)) 95 | #define IS_IWDG_RELOAD(RELOAD) ((RELOAD) <= 0xFFF) 96 | /** 97 | * @} 98 | */ 99 | 100 | /** 101 | * @} 102 | */ 103 | 104 | /** @defgroup IWDG_Exported_Macros 105 | * @{ 106 | */ 107 | 108 | /** 109 | * @} 110 | */ 111 | 112 | /** @defgroup IWDG_Exported_Functions 113 | * @{ 114 | */ 115 | 116 | void IWDG_WriteAccessCmd(uint16_t IWDG_WriteAccess); 117 | void IWDG_SetPrescaler(uint8_t IWDG_Prescaler); 118 | void IWDG_SetReload(uint16_t Reload); 119 | void IWDG_ReloadCounter(void); 120 | void IWDG_Enable(void); 121 | FlagStatus IWDG_GetFlagStatus(uint16_t IWDG_FLAG); 122 | 123 | #ifdef __cplusplus 124 | } 125 | #endif 126 | 127 | #endif /* __STM32F10x_IWDG_H */ 128 | /** 129 | * @} 130 | */ 131 | 132 | /** 133 | * @} 134 | */ 135 | 136 | /** 137 | * @} 138 | */ 139 | 140 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ 141 | -------------------------------------------------------------------------------- /esp8266_firmware/uart.c: -------------------------------------------------------------------------------- 1 | 2 | #include "ets_sys.h" 3 | #include "osapi.h" 4 | #include "gpio.h" 5 | #include "os_type.h" 6 | #include "ip_addr.h" 7 | #include "espconn.h" 8 | #include "user_interface.h" 9 | #include "user_config.h" 10 | #include "uart_register.h" 11 | 12 | extern UartDevice UartDev; 13 | 14 | #define UART0 0 15 | #define UART1 1 16 | 17 | LOCAL void 18 | uart0_rx_intr_handler(void *para) 19 | { 20 | // Nothing? 21 | } 22 | 23 | /****************************************************************************** 24 | * FunctionName : uart_config 25 | * Description : Internal used function 26 | * UART0 used for data TX/RX, RX buffer size is 0x100, interrupt enabled 27 | * UART1 just used for debug output 28 | * Parameters : uart_no, use UART0 or UART1 defined ahead 29 | * Returns : NONE 30 | *******************************************************************************/ 31 | LOCAL void ICACHE_FLASH_ATTR 32 | uart_config(uint8 uart_no) 33 | { 34 | if (uart_no == UART1){ 35 | PIN_FUNC_SELECT(PERIPHS_IO_MUX_GPIO2_U, FUNC_U1TXD_BK); 36 | }else{ 37 | /* rcv_buff size if 0x100 */ 38 | ETS_UART_INTR_ATTACH(uart0_rx_intr_handler, &(UartDev.rcv_buff)); 39 | PIN_PULLUP_DIS(PERIPHS_IO_MUX_U0TXD_U); 40 | PIN_FUNC_SELECT(PERIPHS_IO_MUX_U0TXD_U, FUNC_U0TXD); 41 | #if UART_HW_RTS 42 | PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTDO_U, FUNC_U0RTS); //HW FLOW CONTROL RTS PIN 43 | #endif 44 | #if UART_HW_CTS 45 | PIN_FUNC_SELECT(PERIPHS_IO_MUX_MTCK_U, FUNC_U0CTS); //HW FLOW CONTROL CTS PIN 46 | #endif 47 | } 48 | uart_div_modify(uart_no, UART_CLK_FREQ / (UartDev.baut_rate));//SET BAUDRATE 49 | 50 | WRITE_PERI_REG(UART_CONF0(uart_no), ((UartDev.exist_parity & UART_PARITY_EN_M) << UART_PARITY_EN_S) //SET BIT AND PARITY MODE 51 | | ((UartDev.parity & UART_PARITY_M) <
© COPYRIGHT 2011 STMicroelectronics
20 | ****************************************************************************** 21 | */ 22 | 23 | /* Define to prevent recursive inclusion -------------------------------------*/ 24 | #ifndef __STM32F10x_PWR_H 25 | #define __STM32F10x_PWR_H 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif 30 | 31 | /* Includes ------------------------------------------------------------------*/ 32 | #include "stm32f10x/stm32f10x.h" 33 | 34 | /** @addtogroup STM32F10x_StdPeriph_Driver 35 | * @{ 36 | */ 37 | 38 | /** @addtogroup PWR 39 | * @{ 40 | */ 41 | 42 | /** @defgroup PWR_Exported_Types 43 | * @{ 44 | */ 45 | 46 | /** 47 | * @} 48 | */ 49 | 50 | /** @defgroup PWR_Exported_Constants 51 | * @{ 52 | */ 53 | 54 | /** @defgroup PVD_detection_level 55 | * @{ 56 | */ 57 | 58 | #define PWR_PVDLevel_2V2 ((uint32_t)0x00000000) 59 | #define PWR_PVDLevel_2V3 ((uint32_t)0x00000020) 60 | #define PWR_PVDLevel_2V4 ((uint32_t)0x00000040) 61 | #define PWR_PVDLevel_2V5 ((uint32_t)0x00000060) 62 | #define PWR_PVDLevel_2V6 ((uint32_t)0x00000080) 63 | #define PWR_PVDLevel_2V7 ((uint32_t)0x000000A0) 64 | #define PWR_PVDLevel_2V8 ((uint32_t)0x000000C0) 65 | #define PWR_PVDLevel_2V9 ((uint32_t)0x000000E0) 66 | #define IS_PWR_PVD_LEVEL(LEVEL) (((LEVEL) == PWR_PVDLevel_2V2) || ((LEVEL) == PWR_PVDLevel_2V3)|| \ 67 | ((LEVEL) == PWR_PVDLevel_2V4) || ((LEVEL) == PWR_PVDLevel_2V5)|| \ 68 | ((LEVEL) == PWR_PVDLevel_2V6) || ((LEVEL) == PWR_PVDLevel_2V7)|| \ 69 | ((LEVEL) == PWR_PVDLevel_2V8) || ((LEVEL) == PWR_PVDLevel_2V9)) 70 | /** 71 | * @} 72 | */ 73 | 74 | /** @defgroup Regulator_state_is_STOP_mode 75 | * @{ 76 | */ 77 | 78 | #define PWR_Regulator_ON ((uint32_t)0x00000000) 79 | #define PWR_Regulator_LowPower ((uint32_t)0x00000001) 80 | #define IS_PWR_REGULATOR(REGULATOR) (((REGULATOR) == PWR_Regulator_ON) || \ 81 | ((REGULATOR) == PWR_Regulator_LowPower)) 82 | /** 83 | * @} 84 | */ 85 | 86 | /** @defgroup STOP_mode_entry 87 | * @{ 88 | */ 89 | 90 | #define PWR_STOPEntry_WFI ((uint8_t)0x01) 91 | #define PWR_STOPEntry_WFE ((uint8_t)0x02) 92 | #define IS_PWR_STOP_ENTRY(ENTRY) (((ENTRY) == PWR_STOPEntry_WFI) || ((ENTRY) == PWR_STOPEntry_WFE)) 93 | 94 | /** 95 | * @} 96 | */ 97 | 98 | /** @defgroup PWR_Flag 99 | * @{ 100 | */ 101 | 102 | #define PWR_FLAG_WU ((uint32_t)0x00000001) 103 | #define PWR_FLAG_SB ((uint32_t)0x00000002) 104 | #define PWR_FLAG_PVDO ((uint32_t)0x00000004) 105 | #define IS_PWR_GET_FLAG(FLAG) (((FLAG) == PWR_FLAG_WU) || ((FLAG) == PWR_FLAG_SB) || \ 106 | ((FLAG) == PWR_FLAG_PVDO)) 107 | 108 | #define IS_PWR_CLEAR_FLAG(FLAG) (((FLAG) == PWR_FLAG_WU) || ((FLAG) == PWR_FLAG_SB)) 109 | /** 110 | * @} 111 | */ 112 | 113 | /** 114 | * @} 115 | */ 116 | 117 | /** @defgroup PWR_Exported_Macros 118 | * @{ 119 | */ 120 | 121 | /** 122 | * @} 123 | */ 124 | 125 | /** @defgroup PWR_Exported_Functions 126 | * @{ 127 | */ 128 | 129 | void PWR_DeInit(void); 130 | void PWR_BackupAccessCmd(FunctionalState NewState); 131 | void PWR_PVDCmd(FunctionalState NewState); 132 | void PWR_PVDLevelConfig(uint32_t PWR_PVDLevel); 133 | void PWR_WakeUpPinCmd(FunctionalState NewState); 134 | void PWR_EnterSTOPMode(uint32_t PWR_Regulator, uint8_t PWR_STOPEntry); 135 | void PWR_EnterSTANDBYMode(void); 136 | FlagStatus PWR_GetFlagStatus(uint32_t PWR_FLAG); 137 | void PWR_ClearFlag(uint32_t PWR_FLAG); 138 | 139 | #ifdef __cplusplus 140 | } 141 | #endif 142 | 143 | #endif /* __STM32F10x_PWR_H */ 144 | /** 145 | * @} 146 | */ 147 | 148 | /** 149 | * @} 150 | */ 151 | 152 | /** 153 | * @} 154 | */ 155 | 156 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ 157 | -------------------------------------------------------------------------------- /stm32_application/main.c: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include 4 | #include 5 | 6 | #include 7 | #include 8 | #include "gde043a2.h" 9 | #include "sram.h" 10 | #include "uart.h" 11 | #include "imgdec.h" 12 | 13 | // Add images 14 | #include "ap_setup.h" 15 | #include "lost_connection.h" 16 | #include "low_battery.h" 17 | #include "sleep.h" 18 | #include "dhcp_error.h" 19 | #include "dns_error.h" 20 | #include "connection_error.h" 21 | #include "invalid_image.h" 22 | 23 | void initHW() { 24 | // Init basic stuff 25 | SystemInit(); 26 | 27 | /* Debug support for low power modes: */ 28 | DBGMCU_Config(DBGMCU_SLEEP, ENABLE); 29 | DBGMCU_Config(DBGMCU_STOP, ENABLE); 30 | DBGMCU_Config(DBGMCU_STANDBY, ENABLE); 31 | 32 | // Enable clocks 33 | RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB | RCC_APB2Periph_AFIO, ENABLE); 34 | 35 | // Disable the fucking JTAG! 36 | GPIO_PinRemapConfig(GPIO_Remap_SWJ_JTAGDisable, ENABLE); 37 | GPIO_PinRemapConfig(GPIO_Remap_SPI1, ENABLE); 38 | 39 | //GPIO_PinRemapConfig(GPIO_FullRemap_USART3, DISABLE); 40 | //GPIO_PinRemapConfig(GPIO_PartialRemap_USART3, ENABLE); 41 | } 42 | 43 | void sync_blink() { 44 | // Some blink 45 | int i; 46 | GPIO_SetBits(GPIOB, GPIO_Pin_3); 47 | for (i = 0; i < 3000000; i++) { asm volatile(""); } 48 | GPIO_ResetBits(GPIOB, GPIO_Pin_3); 49 | for (i = 0; i < 3000000; i++) { asm volatile(""); } 50 | GPIO_SetBits(GPIOB, GPIO_Pin_3); 51 | for (i = 0; i < 3000000; i++) { asm volatile(""); } 52 | GPIO_ResetBits(GPIOB, GPIO_Pin_3); 53 | for (i = 0; i < 3000000; i++) { asm volatile(""); } 54 | } 55 | 56 | const void * image_table[8] = 57 | { 58 | ap_setup, 59 | lost_connection, 60 | low_battery, 61 | sleep_mode, 62 | dhcp_error, 63 | dns_error, 64 | connection_error, 65 | invalid_image 66 | }; 67 | 68 | unsigned char scratch[60*1024]; // __attribute__((section(".extdata"), used)); 69 | 70 | void SPI_Initialize() { 71 | // Configure PB3 & PB5 for SPI slave 72 | GPIO_InitTypeDef GPIO_InitStructure; 73 | GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; 74 | GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING; 75 | GPIO_InitStructure.GPIO_Pin = GPIO_Pin_3 | GPIO_Pin_5; 76 | GPIO_Init(GPIOB, &GPIO_InitStructure); 77 | 78 | RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB | RCC_APB2Periph_AFIO | RCC_APB2Periph_SPI1, ENABLE); 79 | 80 | SPI_InitTypeDef SPI_InitStructure; 81 | SPI_StructInit(&SPI_InitStructure); 82 | SPI_I2S_DeInit(SPI1); 83 | 84 | /* SPI1 Config */ 85 | SPI_InitStructure.SPI_Direction = SPI_Direction_2Lines_FullDuplex; 86 | SPI_InitStructure.SPI_Mode = SPI_Mode_Slave; 87 | SPI_InitStructure.SPI_DataSize = SPI_DataSize_8b; 88 | SPI_InitStructure.SPI_CPOL = SPI_CPOL_High; 89 | SPI_InitStructure.SPI_CPHA = SPI_CPHA_2Edge; 90 | SPI_InitStructure.SPI_NSS = SPI_NSS_Soft; 91 | SPI_InitStructure.SPI_FirstBit = SPI_FirstBit_MSB; 92 | 93 | SPI_RxFIFOThresholdConfig(SPI1, SPI_RxFIFOThreshold_QF); 94 | 95 | /* Configure SPI1 && enable */ 96 | SPI_Init(SPI1, &SPI_InitStructure); 97 | SPI_Cmd(SPI1, ENABLE); 98 | } 99 | 100 | int main() { 101 | // Init HW for the micro 102 | initHW(); 103 | 104 | // Fuckin SRAM memory has stopped working 105 | // That means only 60KB RAM, either B/W images (1bit) or compressed images! 106 | //FSMC_SRAM_Init(); 107 | 108 | SPI_Initialize(); 109 | 110 | // Wait for the first byte, that tells us what to do: 111 | while(SPI_I2S_GetFlagStatus(SPI1, SPI_I2S_FLAG_RXNE) == RESET); 112 | unsigned char cmd = SPI_I2S_ReceiveData(SPI1); 113 | 114 | // Bit 7 defines direction hint (which can be ignored by the device) 115 | // Bit 6 tells whether to show a predefined picture (0) or to load a picture (1) 116 | // If the bit is 1, it will be followed by 120000 bytes with the picture content 117 | // Bit 5 indicates whether the battery icon should be overlayed to the image 118 | // Bit 2,0 defines which preloaded picture to show (from the 4 in-ROM available) 119 | 120 | int direction = (cmd & 0x80) ? 1 : 0; 121 | int int_image = ((cmd & 0x40) == 0); 122 | int show_bat = ((cmd & 0x20) == 0); 123 | int imageidx = cmd & 0x7; 124 | 125 | if (!int_image) { 126 | // Keep reading for external image! 127 | unsigned int spointer = 0; 128 | while (spointer < sizeof(scratch)) { 129 | // Read buffer to scratch! 130 | while(SPI_I2S_GetFlagStatus(SPI1, SPI_I2S_FLAG_RXNE) == RESET) { /*__WFE(); */ } 131 | scratch[spointer++] = SPI_I2S_ReceiveData(SPI1); 132 | } 133 | } 134 | else { 135 | // Copy the internal compressed image 136 | memcpy(scratch, image_table[imageidx], sizeof(scratch)); 137 | } 138 | 139 | // Initialize tables (according to direction) 140 | einkd_init(direction); 141 | 142 | // Power ON, draw and OFF again! 143 | einkd_PowerOn(); 144 | einkd_refresh_compressed(scratch); 145 | einkd_PowerOff(); 146 | 147 | RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO | RCC_APB2Periph_SPI1, DISABLE); 148 | einkd_deinit(); 149 | 150 | // Turn ourselves OFF, hopefully save some power before final power gate off 151 | PWR_EnterSTOPMode(PWR_Regulator_LowPower, PWR_STOPEntry_WFI); 152 | 153 | while (1); 154 | 155 | return 0; 156 | } 157 | 158 | 159 | -------------------------------------------------------------------------------- /server/css/bootstrap-theme.min.css.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":["less/theme.less","less/mixins/vendor-prefixes.less","less/mixins/gradients.less","less/mixins/reset-filter.less"],"names":[],"mappings":";;;;AAmBA,YAAA,aAAA,UAAA,aAAA,aAAA,aAME,YAAA,EAAA,KAAA,EAAA,eC2CA,mBAAA,MAAA,EAAA,IAAA,EAAA,sBAAA,EAAA,IAAA,IAAA,iBACQ,WAAA,MAAA,EAAA,IAAA,EAAA,sBAAA,EAAA,IAAA,IAAA,iBDvCR,mBAAA,mBAAA,oBAAA,oBAAA,iBAAA,iBAAA,oBAAA,oBAAA,oBAAA,oBAAA,oBAAA,oBCsCA,mBAAA,MAAA,EAAA,IAAA,IAAA,iBACQ,WAAA,MAAA,EAAA,IAAA,IAAA,iBDlCR,qBAAA,sBAAA,sBAAA,uBAAA,mBAAA,oBAAA,sBAAA,uBAAA,sBAAA,uBAAA,sBAAA,uBAAA,+BAAA,gCAAA,6BAAA,gCAAA,gCAAA,gCCiCA,mBAAA,KACQ,WAAA,KDlDV,mBAAA,oBAAA,iBAAA,oBAAA,oBAAA,oBAuBI,YAAA,KAyCF,YAAA,YAEE,iBAAA,KAKJ,aErEI,YAAA,EAAA,IAAA,EAAA,KACA,iBAAA,iDACA,iBAAA,4CAAA,iBAAA,qEAEA,iBAAA,+CCnBF,OAAA,+GH4CA,OAAA,0DACA,kBAAA,SAuC2C,aAAA,QAA2B,aAAA,KArCtE,mBAAA,mBAEE,iBAAA,QACA,oBAAA,EAAA,MAGF,oBAAA,oBAEE,iBAAA,QACA,aAAA,QAMA,sBAAA,6BAAA,4BAAA,6BAAA,4BAAA,4BAAA,uBAAA,8BAAA,6BAAA,8BAAA,6BAAA,6BAAA,gCAAA,uCAAA,sCAAA,uCAAA,sCAAA,sCAME,iBAAA,QACA,iBAAA,KAgBN,aEtEI,iBAAA,oDACA,iBAAA,+CACA,iBAAA,wEAAA,iBAAA,kDAEA,OAAA,+GCnBF,OAAA,0DH4CA,kBAAA,SACA,aAAA,QAEA,mBAAA,mBAEE,iBAAA,QACA,oBAAA,EAAA,MAGF,oBAAA,oBAEE,iBAAA,QACA,aAAA,QAMA,sBAAA,6BAAA,4BAAA,6BAAA,4BAAA,4BAAA,uBAAA,8BAAA,6BAAA,8BAAA,6BAAA,6BAAA,gCAAA,uCAAA,sCAAA,uCAAA,sCAAA,sCAME,iBAAA,QACA,iBAAA,KAiBN,aEvEI,iBAAA,oDACA,iBAAA,+CACA,iBAAA,wEAAA,iBAAA,kDAEA,OAAA,+GCnBF,OAAA,0DH4CA,kBAAA,SACA,aAAA,QAEA,mBAAA,mBAEE,iBAAA,QACA,oBAAA,EAAA,MAGF,oBAAA,oBAEE,iBAAA,QACA,aAAA,QAMA,sBAAA,6BAAA,4BAAA,6BAAA,4BAAA,4BAAA,uBAAA,8BAAA,6BAAA,8BAAA,6BAAA,6BAAA,gCAAA,uCAAA,sCAAA,uCAAA,sCAAA,sCAME,iBAAA,QACA,iBAAA,KAkBN,UExEI,iBAAA,oDACA,iBAAA,+CACA,iBAAA,wEAAA,iBAAA,kDAEA,OAAA,+GCnBF,OAAA,0DH4CA,kBAAA,SACA,aAAA,QAEA,gBAAA,gBAEE,iBAAA,QACA,oBAAA,EAAA,MAGF,iBAAA,iBAEE,iBAAA,QACA,aAAA,QAMA,mBAAA,0BAAA,yBAAA,0BAAA,yBAAA,yBAAA,oBAAA,2BAAA,0BAAA,2BAAA,0BAAA,0BAAA,6BAAA,oCAAA,mCAAA,oCAAA,mCAAA,mCAME,iBAAA,QACA,iBAAA,KAmBN,aEzEI,iBAAA,oDACA,iBAAA,+CACA,iBAAA,wEAAA,iBAAA,kDAEA,OAAA,+GCnBF,OAAA,0DH4CA,kBAAA,SACA,aAAA,QAEA,mBAAA,mBAEE,iBAAA,QACA,oBAAA,EAAA,MAGF,oBAAA,oBAEE,iBAAA,QACA,aAAA,QAMA,sBAAA,6BAAA,4BAAA,6BAAA,4BAAA,4BAAA,uBAAA,8BAAA,6BAAA,8BAAA,6BAAA,6BAAA,gCAAA,uCAAA,sCAAA,uCAAA,sCAAA,sCAME,iBAAA,QACA,iBAAA,KAoBN,YE1EI,iBAAA,oDACA,iBAAA,+CACA,iBAAA,wEAAA,iBAAA,kDAEA,OAAA,+GCnBF,OAAA,0DH4CA,kBAAA,SACA,aAAA,QAEA,kBAAA,kBAEE,iBAAA,QACA,oBAAA,EAAA,MAGF,mBAAA,mBAEE,iBAAA,QACA,aAAA,QAMA,qBAAA,4BAAA,2BAAA,4BAAA,2BAAA,2BAAA,sBAAA,6BAAA,4BAAA,6BAAA,4BAAA,4BAAA,+BAAA,sCAAA,qCAAA,sCAAA,qCAAA,qCAME,iBAAA,QACA,iBAAA,KA2BN,eAAA,WClCE,mBAAA,EAAA,IAAA,IAAA,iBACQ,WAAA,EAAA,IAAA,IAAA,iBD2CV,0BAAA,0BE3FI,iBAAA,QACA,iBAAA,oDACA,iBAAA,+CAAA,iBAAA,wEACA,iBAAA,kDACA,OAAA,+GF0FF,kBAAA,SAEF,yBAAA,+BAAA,+BEhGI,iBAAA,QACA,iBAAA,oDACA,iBAAA,+CAAA,iBAAA,wEACA,iBAAA,kDACA,OAAA,+GFgGF,kBAAA,SASF,gBE7GI,iBAAA,iDACA,iBAAA,4CACA,iBAAA,qEAAA,iBAAA,+CACA,OAAA,+GACA,OAAA,0DCnBF,kBAAA,SH+HA,cAAA,ICjEA,mBAAA,MAAA,EAAA,IAAA,EAAA,sBAAA,EAAA,IAAA,IAAA,iBACQ,WAAA,MAAA,EAAA,IAAA,EAAA,sBAAA,EAAA,IAAA,IAAA,iBD6DV,sCAAA,oCE7GI,iBAAA,oDACA,iBAAA,+CACA,iBAAA,wEAAA,iBAAA,kDACA,OAAA,+GACA,kBAAA,SD2CF,mBAAA,MAAA,EAAA,IAAA,IAAA,iBACQ,WAAA,MAAA,EAAA,IAAA,IAAA,iBD0EV,cAAA,iBAEE,YAAA,EAAA,IAAA,EAAA,sBAIF,gBEhII,iBAAA,iDACA,iBAAA,4CACA,iBAAA,qEAAA,iBAAA,+CACA,OAAA,+GACA,OAAA,0DCnBF,kBAAA,SHkJA,cAAA,IAHF,sCAAA,oCEhII,iBAAA,oDACA,iBAAA,+CACA,iBAAA,wEAAA,iBAAA,kDACA,OAAA,+GACA,kBAAA,SD2CF,mBAAA,MAAA,EAAA,IAAA,IAAA,gBACQ,WAAA,MAAA,EAAA,IAAA,IAAA,gBDgFV,8BAAA,iCAYI,YAAA,EAAA,KAAA,EAAA,gBAKJ,qBAAA,kBAAA,mBAGE,cAAA,EAqBF,yBAfI,mDAAA,yDAAA,yDAGE,MAAA,KE7JF,iBAAA,oDACA,iBAAA,+CACA,iBAAA,wEAAA,iBAAA,kDACA,OAAA,+GACA,kBAAA,UFqKJ,OACE,YAAA,EAAA,IAAA,EAAA,qBC3HA,mBAAA,MAAA,EAAA,IAAA,EAAA,sBAAA,EAAA,IAAA,IAAA,gBACQ,WAAA,MAAA,EAAA,IAAA,EAAA,sBAAA,EAAA,IAAA,IAAA,gBDsIV,eEtLI,iBAAA,oDACA,iBAAA,+CACA,iBAAA,wEAAA,iBAAA,kDACA,OAAA,+GACA,kBAAA,SF8KF,aAAA,QAKF,YEvLI,iBAAA,oDACA,iBAAA,+CACA,iBAAA,wEAAA,iBAAA,kDACA,OAAA,+GACA,kBAAA,SF8KF,aAAA,QAMF,eExLI,iBAAA,oDACA,iBAAA,+CACA,iBAAA,wEAAA,iBAAA,kDACA,OAAA,+GACA,kBAAA,SF8KF,aAAA,QAOF,cEzLI,iBAAA,oDACA,iBAAA,+CACA,iBAAA,wEAAA,iBAAA,kDACA,OAAA,+GACA,kBAAA,SF8KF,aAAA,QAeF,UEjMI,iBAAA,oDACA,iBAAA,+CACA,iBAAA,wEAAA,iBAAA,kDACA,OAAA,+GACA,kBAAA,SFuMJ,cE3MI,iBAAA,oDACA,iBAAA,+CACA,iBAAA,wEAAA,iBAAA,kDACA,OAAA,+GACA,kBAAA,SFwMJ,sBE5MI,iBAAA,oDACA,iBAAA,+CACA,iBAAA,wEAAA,iBAAA,kDACA,OAAA,+GACA,kBAAA,SFyMJ,mBE7MI,iBAAA,oDACA,iBAAA,+CACA,iBAAA,wEAAA,iBAAA,kDACA,OAAA,+GACA,kBAAA,SF0MJ,sBE9MI,iBAAA,oDACA,iBAAA,+CACA,iBAAA,wEAAA,iBAAA,kDACA,OAAA,+GACA,kBAAA,SF2MJ,qBE/MI,iBAAA,oDACA,iBAAA,+CACA,iBAAA,wEAAA,iBAAA,kDACA,OAAA,+GACA,kBAAA,SF+MJ,sBElLI,iBAAA,yKACA,iBAAA,oKACA,iBAAA,iKFyLJ,YACE,cAAA,IC9KA,mBAAA,EAAA,IAAA,IAAA,iBACQ,WAAA,EAAA,IAAA,IAAA,iBDgLV,wBAAA,8BAAA,8BAGE,YAAA,EAAA,KAAA,EAAA,QEnOE,iBAAA,oDACA,iBAAA,+CACA,iBAAA,wEAAA,iBAAA,kDACA,OAAA,+GACA,kBAAA,SFiOF,aAAA,QALF,+BAAA,qCAAA,qCAQI,YAAA,KAUJ,OCnME,mBAAA,EAAA,IAAA,IAAA,gBACQ,WAAA,EAAA,IAAA,IAAA,gBD4MV,8BE5PI,iBAAA,oDACA,iBAAA,+CACA,iBAAA,wEAAA,iBAAA,kDACA,OAAA,+GACA,kBAAA,SFyPJ,8BE7PI,iBAAA,oDACA,iBAAA,+CACA,iBAAA,wEAAA,iBAAA,kDACA,OAAA,+GACA,kBAAA,SF0PJ,8BE9PI,iBAAA,oDACA,iBAAA,+CACA,iBAAA,wEAAA,iBAAA,kDACA,OAAA,+GACA,kBAAA,SF2PJ,2BE/PI,iBAAA,oDACA,iBAAA,+CACA,iBAAA,wEAAA,iBAAA,kDACA,OAAA,+GACA,kBAAA,SF4PJ,8BEhQI,iBAAA,oDACA,iBAAA,+CACA,iBAAA,wEAAA,iBAAA,kDACA,OAAA,+GACA,kBAAA,SF6PJ,6BEjQI,iBAAA,oDACA,iBAAA,+CACA,iBAAA,wEAAA,iBAAA,kDACA,OAAA,+GACA,kBAAA,SFoQJ,MExQI,iBAAA,oDACA,iBAAA,+CACA,iBAAA,wEAAA,iBAAA,kDACA,OAAA,+GACA,kBAAA,SFsQF,aAAA,QC3NA,mBAAA,MAAA,EAAA,IAAA,IAAA,gBAAA,EAAA,IAAA,EAAA,qBACQ,WAAA,MAAA,EAAA,IAAA,IAAA,gBAAA,EAAA,IAAA,EAAA"} -------------------------------------------------------------------------------- /server/functions.php: -------------------------------------------------------------------------------- 1 | $value) 18 | $ret .= array2js($key).": ".array2js($value).", "; 19 | return "{".$ret."}"; 20 | } 21 | else if (is_string($a)) 22 | return "'$a'"; 23 | 24 | return $a; 25 | } 26 | 27 | class Providers { 28 | // Returns list of providers 29 | static function getProvidersList() { 30 | $providers = array(); 31 | foreach(get_declared_classes() as $klass) { 32 | $reflect = new ReflectionClass($klass); 33 | if ($reflect->implementsInterface('ServiceProvider')) { 34 | $prop = $reflect->getStaticProperties(); 35 | $wname = $prop["widgetName"]; 36 | $providers[$wname] = array("class" => $klass, "icon" => $prop["widgetIcon"]); 37 | } 38 | } 39 | return $providers; 40 | } 41 | 42 | static function getRender($widget_name, $settings, $ws, $hs) { 43 | $plist = Providers::getProvidersList(); 44 | $w = new $plist[$widget_name]["class"]; 45 | $w->setTunables($settings); 46 | if ($ws > 0 && $hs > 0) { 47 | $w->width = $ws; 48 | $w->height = $hs; 49 | } 50 | 51 | return $w->render(); 52 | } 53 | }; 54 | 55 | // Image rendering stuff 56 | 57 | function renderSVG($id) { 58 | header('Content-type: image/svg+xml'); 59 | 60 | // Read the screen and parse it as JSON 61 | $scr = file_get_contents("screens/".$id); 62 | $scr = json_decode($scr, true); 63 | 64 | $body = array(); 65 | for ($i = 0; $i < count($scr["widgets"]); $i++) { 66 | $widget = $scr["widgets"][$i]; 67 | $params = array(); 68 | foreach ($widget["params"] as $p => $v) 69 | $params[$p] = array("value" => $v); 70 | 71 | $wi = Providers::getRender($widget["type"], $params, $widget["geo"]["w"] * $scr["width"], $widget["geo"]["h"] * $scr["height"]); 72 | 73 | $body[] = sprintf('', 74 | $widget["geo"]["x"] * $scr["width"], 75 | $widget["geo"]["y"] * $scr["height"], 76 | $widget["geo"]["w"] * $scr["width"], 77 | $widget["geo"]["h"] * $scr["height"], 78 | "data:image/svg+xml;base64,".base64_encode($wi) 79 | ); 80 | } 81 | 82 | $body = implode("\n", $body); 83 | 84 | $svg = sprintf(' 86 | %s 87 | ', $scr["width"], $scr["height"], $body); 88 | 89 | return array( 90 | "width" => $scr["width"], 91 | "height" => $scr["height"], 92 | "svg" => ''.$svg 93 | ); 94 | } 95 | 96 | function renderBMP($id, $numc, $maxwidth, $maxheight) { 97 | // Render image 98 | $data = renderSVG($id); 99 | $svg = $data["svg"]; 100 | $svgf = tempnam("/tmp", "svgconv"); 101 | file_put_contents($svgf, $svg); 102 | // Call convert 103 | exec("rsvg-convert -o " . $svgf . ".png " . $svgf); 104 | 105 | $im = new Imagick(); 106 | $im->readImageFile(fopen($svgf.".png", "rb")); 107 | $im->setImageFormat("png24"); 108 | $im->transformImageColorspace(imagick::COLORSPACE_GRAY); 109 | $im->posterizeImage($numc, imagick::DITHERMETHOD_NO); 110 | $im->setImageBackgroundColor('white'); 111 | $im = $im->flattenImages(); 112 | unlink($svgf); 113 | unlink($svgf.".png"); 114 | return $im; 115 | } 116 | 117 | 118 | // RLE compression: 119 | // Chunk header is one byte, decoded means: 120 | // 0XXX XXXX: The following byte is repeated XXXXXXX times + 1 (from 1 to 128) 121 | // 1XXX XXXX: Just copy the following XXXXXXX+1 bytes (means the pattern is not compressible) 122 | 123 | // Function that performs RLE compression! 124 | 125 | function img_compress($buf) { 126 | // Array to hold the number of repeated elements starting from that position 127 | $reps = array_fill(0, count($buf), 0); 128 | $prev = -1; 129 | for ($i = count($buf)-1; $i >= 0; $i--) { 130 | if ($buf[$i] != $prev) 131 | $ctr = 0; 132 | $ctr += 1; 133 | 134 | $reps[$i] = $ctr; 135 | $prev = $buf[$i]; 136 | } 137 | 138 | $outb = array_fill(0, 60*1024, 0); 139 | $outp = 0; 140 | $i = 0; 141 | $accum = 0; 142 | while ($i < count($buf)) { 143 | $bytec = min($reps[$i], 128); 144 | $encoderle = ($bytec > 3); 145 | 146 | if ($encoderle || $accum == 128) { 147 | // Flush noncompressable pattern 148 | if ($accum > 0) { 149 | $b = $accum - 1; 150 | $b |= 0x80; 151 | $outb[$outp - $accum - 1] = $b; 152 | $accum = 0; 153 | } 154 | } 155 | 156 | if ($encoderle) { 157 | # Emit a runlegth 158 | $outb[$outp++] = $bytec-1; 159 | $outb[$outp++] = $buf[$i]; 160 | $i += $bytec; 161 | } else { 162 | if ($accum == 0) 163 | $outp++; 164 | $outb[$outp++] = $buf[$i++]; 165 | $accum++; 166 | } 167 | } 168 | 169 | # Make sure to flush it all 170 | if ($accum > 0) { 171 | $b = $accum - 1; 172 | $b |= 0x80; 173 | $outb[$outp - $accum - 1] = $b; 174 | } 175 | 176 | return $outb; 177 | } 178 | 179 | ?> 180 | -------------------------------------------------------------------------------- /media/lost_connection.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 22 | 24 | 43 | 45 | 46 | 48 | image/svg+xml 49 | 51 | 52 | 53 | 54 | 55 | 60 | Lost connectionto the access point! 77 | 80 | 82 | 87 | 88 | 90 | 92 | 94 | 96 | 98 | 100 | 102 | 104 | 106 | 108 | 110 | 112 | 114 | 116 | 118 | 119 | 130 | 131 | -------------------------------------------------------------------------------- /stm32f10x/stm32f10x_iwdg.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f10x_iwdg.c 4 | * @author MCD Application Team 5 | * @version V3.5.0 6 | * @date 11-March-2011 7 | * @brief This file provides all the IWDG firmware functions. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 12 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 13 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 14 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 15 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 16 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 17 | * 18 | *

© COPYRIGHT 2011 STMicroelectronics

19 | ****************************************************************************** 20 | */ 21 | 22 | /* Includes ------------------------------------------------------------------*/ 23 | #include "stm32f10x/stm32f10x_iwdg.h" 24 | 25 | /** @addtogroup STM32F10x_StdPeriph_Driver 26 | * @{ 27 | */ 28 | 29 | /** @defgroup IWDG 30 | * @brief IWDG driver modules 31 | * @{ 32 | */ 33 | 34 | /** @defgroup IWDG_Private_TypesDefinitions 35 | * @{ 36 | */ 37 | 38 | /** 39 | * @} 40 | */ 41 | 42 | /** @defgroup IWDG_Private_Defines 43 | * @{ 44 | */ 45 | 46 | /* ---------------------- IWDG registers bit mask ----------------------------*/ 47 | 48 | /* KR register bit mask */ 49 | #define KR_KEY_Reload ((uint16_t)0xAAAA) 50 | #define KR_KEY_Enable ((uint16_t)0xCCCC) 51 | 52 | /** 53 | * @} 54 | */ 55 | 56 | /** @defgroup IWDG_Private_Macros 57 | * @{ 58 | */ 59 | 60 | /** 61 | * @} 62 | */ 63 | 64 | /** @defgroup IWDG_Private_Variables 65 | * @{ 66 | */ 67 | 68 | /** 69 | * @} 70 | */ 71 | 72 | /** @defgroup IWDG_Private_FunctionPrototypes 73 | * @{ 74 | */ 75 | 76 | /** 77 | * @} 78 | */ 79 | 80 | /** @defgroup IWDG_Private_Functions 81 | * @{ 82 | */ 83 | 84 | /** 85 | * @brief Enables or disables write access to IWDG_PR and IWDG_RLR registers. 86 | * @param IWDG_WriteAccess: new state of write access to IWDG_PR and IWDG_RLR registers. 87 | * This parameter can be one of the following values: 88 | * @arg IWDG_WriteAccess_Enable: Enable write access to IWDG_PR and IWDG_RLR registers 89 | * @arg IWDG_WriteAccess_Disable: Disable write access to IWDG_PR and IWDG_RLR registers 90 | * @retval None 91 | */ 92 | void IWDG_WriteAccessCmd(uint16_t IWDG_WriteAccess) 93 | { 94 | /* Check the parameters */ 95 | assert_param(IS_IWDG_WRITE_ACCESS(IWDG_WriteAccess)); 96 | IWDG->KR = IWDG_WriteAccess; 97 | } 98 | 99 | /** 100 | * @brief Sets IWDG Prescaler value. 101 | * @param IWDG_Prescaler: specifies the IWDG Prescaler value. 102 | * This parameter can be one of the following values: 103 | * @arg IWDG_Prescaler_4: IWDG prescaler set to 4 104 | * @arg IWDG_Prescaler_8: IWDG prescaler set to 8 105 | * @arg IWDG_Prescaler_16: IWDG prescaler set to 16 106 | * @arg IWDG_Prescaler_32: IWDG prescaler set to 32 107 | * @arg IWDG_Prescaler_64: IWDG prescaler set to 64 108 | * @arg IWDG_Prescaler_128: IWDG prescaler set to 128 109 | * @arg IWDG_Prescaler_256: IWDG prescaler set to 256 110 | * @retval None 111 | */ 112 | void IWDG_SetPrescaler(uint8_t IWDG_Prescaler) 113 | { 114 | /* Check the parameters */ 115 | assert_param(IS_IWDG_PRESCALER(IWDG_Prescaler)); 116 | IWDG->PR = IWDG_Prescaler; 117 | } 118 | 119 | /** 120 | * @brief Sets IWDG Reload value. 121 | * @param Reload: specifies the IWDG Reload value. 122 | * This parameter must be a number between 0 and 0x0FFF. 123 | * @retval None 124 | */ 125 | void IWDG_SetReload(uint16_t Reload) 126 | { 127 | /* Check the parameters */ 128 | assert_param(IS_IWDG_RELOAD(Reload)); 129 | IWDG->RLR = Reload; 130 | } 131 | 132 | /** 133 | * @brief Reloads IWDG counter with value defined in the reload register 134 | * (write access to IWDG_PR and IWDG_RLR registers disabled). 135 | * @param None 136 | * @retval None 137 | */ 138 | void IWDG_ReloadCounter(void) 139 | { 140 | IWDG->KR = KR_KEY_Reload; 141 | } 142 | 143 | /** 144 | * @brief Enables IWDG (write access to IWDG_PR and IWDG_RLR registers disabled). 145 | * @param None 146 | * @retval None 147 | */ 148 | void IWDG_Enable(void) 149 | { 150 | IWDG->KR = KR_KEY_Enable; 151 | } 152 | 153 | /** 154 | * @brief Checks whether the specified IWDG flag is set or not. 155 | * @param IWDG_FLAG: specifies the flag to check. 156 | * This parameter can be one of the following values: 157 | * @arg IWDG_FLAG_PVU: Prescaler Value Update on going 158 | * @arg IWDG_FLAG_RVU: Reload Value Update on going 159 | * @retval The new state of IWDG_FLAG (SET or RESET). 160 | */ 161 | FlagStatus IWDG_GetFlagStatus(uint16_t IWDG_FLAG) 162 | { 163 | FlagStatus bitstatus = RESET; 164 | /* Check the parameters */ 165 | assert_param(IS_IWDG_FLAG(IWDG_FLAG)); 166 | if ((IWDG->SR & IWDG_FLAG) != (uint32_t)RESET) 167 | { 168 | bitstatus = SET; 169 | } 170 | else 171 | { 172 | bitstatus = RESET; 173 | } 174 | /* Return the flag status */ 175 | return bitstatus; 176 | } 177 | 178 | /** 179 | * @} 180 | */ 181 | 182 | /** 183 | * @} 184 | */ 185 | 186 | /** 187 | * @} 188 | */ 189 | 190 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ 191 | -------------------------------------------------------------------------------- /stm32f10x/stm32f10x_dbgmcu.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f10x_dbgmcu.c 4 | * @author MCD Application Team 5 | * @version V3.5.0 6 | * @date 11-March-2011 7 | * @brief This file provides all the DBGMCU firmware functions. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 12 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 13 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 14 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 15 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 16 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 17 | * 18 | *

© COPYRIGHT 2011 STMicroelectronics

19 | ****************************************************************************** 20 | */ 21 | 22 | /* Includes ------------------------------------------------------------------*/ 23 | #include "stm32f10x/stm32f10x_dbgmcu.h" 24 | 25 | /** @addtogroup STM32F10x_StdPeriph_Driver 26 | * @{ 27 | */ 28 | 29 | /** @defgroup DBGMCU 30 | * @brief DBGMCU driver modules 31 | * @{ 32 | */ 33 | 34 | /** @defgroup DBGMCU_Private_TypesDefinitions 35 | * @{ 36 | */ 37 | 38 | /** 39 | * @} 40 | */ 41 | 42 | /** @defgroup DBGMCU_Private_Defines 43 | * @{ 44 | */ 45 | 46 | #define IDCODE_DEVID_MASK ((uint32_t)0x00000FFF) 47 | /** 48 | * @} 49 | */ 50 | 51 | /** @defgroup DBGMCU_Private_Macros 52 | * @{ 53 | */ 54 | 55 | /** 56 | * @} 57 | */ 58 | 59 | /** @defgroup DBGMCU_Private_Variables 60 | * @{ 61 | */ 62 | 63 | /** 64 | * @} 65 | */ 66 | 67 | /** @defgroup DBGMCU_Private_FunctionPrototypes 68 | * @{ 69 | */ 70 | 71 | /** 72 | * @} 73 | */ 74 | 75 | /** @defgroup DBGMCU_Private_Functions 76 | * @{ 77 | */ 78 | 79 | /** 80 | * @brief Returns the device revision identifier. 81 | * @param None 82 | * @retval Device revision identifier 83 | */ 84 | uint32_t DBGMCU_GetREVID(void) 85 | { 86 | return(DBGMCU->IDCODE >> 16); 87 | } 88 | 89 | /** 90 | * @brief Returns the device identifier. 91 | * @param None 92 | * @retval Device identifier 93 | */ 94 | uint32_t DBGMCU_GetDEVID(void) 95 | { 96 | return(DBGMCU->IDCODE & IDCODE_DEVID_MASK); 97 | } 98 | 99 | /** 100 | * @brief Configures the specified peripheral and low power mode behavior 101 | * when the MCU under Debug mode. 102 | * @param DBGMCU_Periph: specifies the peripheral and low power mode. 103 | * This parameter can be any combination of the following values: 104 | * @arg DBGMCU_SLEEP: Keep debugger connection during SLEEP mode 105 | * @arg DBGMCU_STOP: Keep debugger connection during STOP mode 106 | * @arg DBGMCU_STANDBY: Keep debugger connection during STANDBY mode 107 | * @arg DBGMCU_IWDG_STOP: Debug IWDG stopped when Core is halted 108 | * @arg DBGMCU_WWDG_STOP: Debug WWDG stopped when Core is halted 109 | * @arg DBGMCU_TIM1_STOP: TIM1 counter stopped when Core is halted 110 | * @arg DBGMCU_TIM2_STOP: TIM2 counter stopped when Core is halted 111 | * @arg DBGMCU_TIM3_STOP: TIM3 counter stopped when Core is halted 112 | * @arg DBGMCU_TIM4_STOP: TIM4 counter stopped when Core is halted 113 | * @arg DBGMCU_CAN1_STOP: Debug CAN2 stopped when Core is halted 114 | * @arg DBGMCU_I2C1_SMBUS_TIMEOUT: I2C1 SMBUS timeout mode stopped when Core is halted 115 | * @arg DBGMCU_I2C2_SMBUS_TIMEOUT: I2C2 SMBUS timeout mode stopped when Core is halted 116 | * @arg DBGMCU_TIM5_STOP: TIM5 counter stopped when Core is halted 117 | * @arg DBGMCU_TIM6_STOP: TIM6 counter stopped when Core is halted 118 | * @arg DBGMCU_TIM7_STOP: TIM7 counter stopped when Core is halted 119 | * @arg DBGMCU_TIM8_STOP: TIM8 counter stopped when Core is halted 120 | * @arg DBGMCU_CAN2_STOP: Debug CAN2 stopped when Core is halted 121 | * @arg DBGMCU_TIM15_STOP: TIM15 counter stopped when Core is halted 122 | * @arg DBGMCU_TIM16_STOP: TIM16 counter stopped when Core is halted 123 | * @arg DBGMCU_TIM17_STOP: TIM17 counter stopped when Core is halted 124 | * @arg DBGMCU_TIM9_STOP: TIM9 counter stopped when Core is halted 125 | * @arg DBGMCU_TIM10_STOP: TIM10 counter stopped when Core is halted 126 | * @arg DBGMCU_TIM11_STOP: TIM11 counter stopped when Core is halted 127 | * @arg DBGMCU_TIM12_STOP: TIM12 counter stopped when Core is halted 128 | * @arg DBGMCU_TIM13_STOP: TIM13 counter stopped when Core is halted 129 | * @arg DBGMCU_TIM14_STOP: TIM14 counter stopped when Core is halted 130 | * @param NewState: new state of the specified peripheral in Debug mode. 131 | * This parameter can be: ENABLE or DISABLE. 132 | * @retval None 133 | */ 134 | void DBGMCU_Config(uint32_t DBGMCU_Periph, FunctionalState NewState) 135 | { 136 | /* Check the parameters */ 137 | assert_param(IS_DBGMCU_PERIPH(DBGMCU_Periph)); 138 | assert_param(IS_FUNCTIONAL_STATE(NewState)); 139 | 140 | if (NewState != DISABLE) 141 | { 142 | DBGMCU->CR |= DBGMCU_Periph; 143 | } 144 | else 145 | { 146 | DBGMCU->CR &= ~DBGMCU_Periph; 147 | } 148 | } 149 | 150 | /** 151 | * @} 152 | */ 153 | 154 | /** 155 | * @} 156 | */ 157 | 158 | /** 159 | * @} 160 | */ 161 | 162 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ 163 | -------------------------------------------------------------------------------- /server/resources/sun_scat_cloud.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | -------------------------------------------------------------------------------- /media/low_battery.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 22 | 24 | 43 | 45 | 46 | 48 | image/svg+xml 49 | 51 | 52 | 53 | 54 | 55 | 60 | Charge me! 82 | 85 | 87 | 92 | 97 | 102 | 103 | 105 | 107 | 109 | 111 | 113 | 115 | 117 | 119 | 121 | 123 | 125 | 127 | 129 | 131 | 133 | 134 | 135 | 136 | -------------------------------------------------------------------------------- /media/connection_error.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 22 | 24 | 43 | 45 | 46 | 48 | image/svg+xml 49 | 51 | 52 | 53 | 54 | 55 | 60 | Connection errorCould not connect to the server 77 | 80 | 82 | 84 | 88 | 92 | 93 | 94 | 96 | 98 | 100 | 102 | 104 | 106 | 108 | 110 | 112 | 114 | 116 | 118 | 120 | 122 | 124 | 125 | 136 | 137 | -------------------------------------------------------------------------------- /media/sleep.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 22 | 24 | 43 | 45 | 46 | 48 | image/svg+xml 49 | 51 | 52 | 53 | 54 | 55 | 60 | 63 | 65 | 67 | 72 | 77 | 82 | 87 | 91 | 95 | 99 | 100 | 101 | 103 | 105 | 107 | 109 | 111 | 113 | 115 | 117 | 119 | 121 | 123 | 125 | 127 | 129 | 131 | 132 | 133 | 134 | -------------------------------------------------------------------------------- /media/dhcp_error.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 22 | 24 | 43 | 45 | 46 | 48 | image/svg+xml 49 | 51 | 52 | 53 | 54 | 55 | 60 | DHCP errorCould not get an IP address 77 | 80 | 82 | 84 | 86 | 90 | 94 | 100 | 104 | 110 | 114 | 120 | 121 | 122 | 123 | 125 | 127 | 129 | 131 | 133 | 135 | 137 | 139 | 141 | 143 | 145 | 147 | 149 | 151 | 153 | 154 | 165 | 166 | -------------------------------------------------------------------------------- /stm32f10x/stm32f10x_wwdg.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f10x_wwdg.c 4 | * @author MCD Application Team 5 | * @version V3.5.0 6 | * @date 11-March-2011 7 | * @brief This file provides all the WWDG firmware functions. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 12 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 13 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 14 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 15 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 16 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 17 | * 18 | *

© COPYRIGHT 2011 STMicroelectronics

19 | ****************************************************************************** 20 | */ 21 | 22 | /* Includes ------------------------------------------------------------------*/ 23 | #include "stm32f10x/stm32f10x_wwdg.h" 24 | #include "stm32f10x/stm32f10x_rcc.h" 25 | 26 | /** @addtogroup STM32F10x_StdPeriph_Driver 27 | * @{ 28 | */ 29 | 30 | /** @defgroup WWDG 31 | * @brief WWDG driver modules 32 | * @{ 33 | */ 34 | 35 | /** @defgroup WWDG_Private_TypesDefinitions 36 | * @{ 37 | */ 38 | 39 | /** 40 | * @} 41 | */ 42 | 43 | /** @defgroup WWDG_Private_Defines 44 | * @{ 45 | */ 46 | 47 | /* ----------- WWDG registers bit address in the alias region ----------- */ 48 | #define WWDG_OFFSET (WWDG_BASE - PERIPH_BASE) 49 | 50 | /* Alias word address of EWI bit */ 51 | #define CFR_OFFSET (WWDG_OFFSET + 0x04) 52 | #define EWI_BitNumber 0x09 53 | #define CFR_EWI_BB (PERIPH_BB_BASE + (CFR_OFFSET * 32) + (EWI_BitNumber * 4)) 54 | 55 | /* --------------------- WWDG registers bit mask ------------------------ */ 56 | 57 | /* CR register bit mask */ 58 | #define CR_WDGA_Set ((uint32_t)0x00000080) 59 | 60 | /* CFR register bit mask */ 61 | #define CFR_WDGTB_Mask ((uint32_t)0xFFFFFE7F) 62 | #define CFR_W_Mask ((uint32_t)0xFFFFFF80) 63 | #define BIT_Mask ((uint8_t)0x7F) 64 | 65 | /** 66 | * @} 67 | */ 68 | 69 | /** @defgroup WWDG_Private_Macros 70 | * @{ 71 | */ 72 | 73 | /** 74 | * @} 75 | */ 76 | 77 | /** @defgroup WWDG_Private_Variables 78 | * @{ 79 | */ 80 | 81 | /** 82 | * @} 83 | */ 84 | 85 | /** @defgroup WWDG_Private_FunctionPrototypes 86 | * @{ 87 | */ 88 | 89 | /** 90 | * @} 91 | */ 92 | 93 | /** @defgroup WWDG_Private_Functions 94 | * @{ 95 | */ 96 | 97 | /** 98 | * @brief Deinitializes the WWDG peripheral registers to their default reset values. 99 | * @param None 100 | * @retval None 101 | */ 102 | void WWDG_DeInit(void) 103 | { 104 | RCC_APB1PeriphResetCmd(RCC_APB1Periph_WWDG, ENABLE); 105 | RCC_APB1PeriphResetCmd(RCC_APB1Periph_WWDG, DISABLE); 106 | } 107 | 108 | /** 109 | * @brief Sets the WWDG Prescaler. 110 | * @param WWDG_Prescaler: specifies the WWDG Prescaler. 111 | * This parameter can be one of the following values: 112 | * @arg WWDG_Prescaler_1: WWDG counter clock = (PCLK1/4096)/1 113 | * @arg WWDG_Prescaler_2: WWDG counter clock = (PCLK1/4096)/2 114 | * @arg WWDG_Prescaler_4: WWDG counter clock = (PCLK1/4096)/4 115 | * @arg WWDG_Prescaler_8: WWDG counter clock = (PCLK1/4096)/8 116 | * @retval None 117 | */ 118 | void WWDG_SetPrescaler(uint32_t WWDG_Prescaler) 119 | { 120 | uint32_t tmpreg = 0; 121 | /* Check the parameters */ 122 | assert_param(IS_WWDG_PRESCALER(WWDG_Prescaler)); 123 | /* Clear WDGTB[1:0] bits */ 124 | tmpreg = WWDG->CFR & CFR_WDGTB_Mask; 125 | /* Set WDGTB[1:0] bits according to WWDG_Prescaler value */ 126 | tmpreg |= WWDG_Prescaler; 127 | /* Store the new value */ 128 | WWDG->CFR = tmpreg; 129 | } 130 | 131 | /** 132 | * @brief Sets the WWDG window value. 133 | * @param WindowValue: specifies the window value to be compared to the downcounter. 134 | * This parameter value must be lower than 0x80. 135 | * @retval None 136 | */ 137 | void WWDG_SetWindowValue(uint8_t WindowValue) 138 | { 139 | __IO uint32_t tmpreg = 0; 140 | 141 | /* Check the parameters */ 142 | assert_param(IS_WWDG_WINDOW_VALUE(WindowValue)); 143 | /* Clear W[6:0] bits */ 144 | 145 | tmpreg = WWDG->CFR & CFR_W_Mask; 146 | 147 | /* Set W[6:0] bits according to WindowValue value */ 148 | tmpreg |= WindowValue & (uint32_t) BIT_Mask; 149 | 150 | /* Store the new value */ 151 | WWDG->CFR = tmpreg; 152 | } 153 | 154 | /** 155 | * @brief Enables the WWDG Early Wakeup interrupt(EWI). 156 | * @param None 157 | * @retval None 158 | */ 159 | void WWDG_EnableIT(void) 160 | { 161 | *(__IO uint32_t *) CFR_EWI_BB = (uint32_t)ENABLE; 162 | } 163 | 164 | /** 165 | * @brief Sets the WWDG counter value. 166 | * @param Counter: specifies the watchdog counter value. 167 | * This parameter must be a number between 0x40 and 0x7F. 168 | * @retval None 169 | */ 170 | void WWDG_SetCounter(uint8_t Counter) 171 | { 172 | /* Check the parameters */ 173 | assert_param(IS_WWDG_COUNTER(Counter)); 174 | /* Write to T[6:0] bits to configure the counter value, no need to do 175 | a read-modify-write; writing a 0 to WDGA bit does nothing */ 176 | WWDG->CR = Counter & BIT_Mask; 177 | } 178 | 179 | /** 180 | * @brief Enables WWDG and load the counter value. 181 | * @param Counter: specifies the watchdog counter value. 182 | * This parameter must be a number between 0x40 and 0x7F. 183 | * @retval None 184 | */ 185 | void WWDG_Enable(uint8_t Counter) 186 | { 187 | /* Check the parameters */ 188 | assert_param(IS_WWDG_COUNTER(Counter)); 189 | WWDG->CR = CR_WDGA_Set | Counter; 190 | } 191 | 192 | /** 193 | * @brief Checks whether the Early Wakeup interrupt flag is set or not. 194 | * @param None 195 | * @retval The new state of the Early Wakeup interrupt flag (SET or RESET) 196 | */ 197 | FlagStatus WWDG_GetFlagStatus(void) 198 | { 199 | return (FlagStatus)(WWDG->SR); 200 | } 201 | 202 | /** 203 | * @brief Clears Early Wakeup interrupt flag. 204 | * @param None 205 | * @retval None 206 | */ 207 | void WWDG_ClearFlag(void) 208 | { 209 | WWDG->SR = (uint32_t)RESET; 210 | } 211 | 212 | /** 213 | * @} 214 | */ 215 | 216 | /** 217 | * @} 218 | */ 219 | 220 | /** 221 | * @} 222 | */ 223 | 224 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ 225 | -------------------------------------------------------------------------------- /media/dns_error.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 22 | 24 | 43 | 45 | 46 | 48 | image/svg+xml 49 | 51 | 52 | 53 | 54 | 55 | 60 | DNS errorCould not resolve domain name 77 | 80 | 82 | 84 | 86 | 90 | 94 | 98 | 103 | 108 | 109 | 110 | 112 | 114 | 116 | 118 | 120 | 122 | 124 | 126 | 128 | 130 | 132 | 134 | 136 | 138 | 140 | 141 | 143 | 145 | 147 | 149 | 151 | 153 | 155 | 157 | 159 | 161 | 163 | 165 | 167 | 169 | 171 | 172 | 183 | 184 | -------------------------------------------------------------------------------- /stm32f10x/include/stm32f10x/stm32f10x_cec.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f10x_cec.h 4 | * @author MCD Application Team 5 | * @version V3.5.0 6 | * @date 11-March-2011 7 | * @brief This file contains all the functions prototypes for the CEC firmware 8 | * library. 9 | ****************************************************************************** 10 | * @attention 11 | * 12 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 13 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 14 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 15 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 16 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 17 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 18 | * 19 | *

© COPYRIGHT 2011 STMicroelectronics

20 | ****************************************************************************** 21 | */ 22 | 23 | /* Define to prevent recursive inclusion -------------------------------------*/ 24 | #ifndef __STM32F10x_CEC_H 25 | #define __STM32F10x_CEC_H 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif 30 | 31 | /* Includes ------------------------------------------------------------------*/ 32 | #include "stm32f10x.h" 33 | 34 | /** @addtogroup STM32F10x_StdPeriph_Driver 35 | * @{ 36 | */ 37 | 38 | /** @addtogroup CEC 39 | * @{ 40 | */ 41 | 42 | 43 | /** @defgroup CEC_Exported_Types 44 | * @{ 45 | */ 46 | 47 | /** 48 | * @brief CEC Init structure definition 49 | */ 50 | typedef struct 51 | { 52 | uint16_t CEC_BitTimingMode; /*!< Configures the CEC Bit Timing Error Mode. 53 | This parameter can be a value of @ref CEC_BitTiming_Mode */ 54 | uint16_t CEC_BitPeriodMode; /*!< Configures the CEC Bit Period Error Mode. 55 | This parameter can be a value of @ref CEC_BitPeriod_Mode */ 56 | }CEC_InitTypeDef; 57 | 58 | /** 59 | * @} 60 | */ 61 | 62 | /** @defgroup CEC_Exported_Constants 63 | * @{ 64 | */ 65 | 66 | /** @defgroup CEC_BitTiming_Mode 67 | * @{ 68 | */ 69 | #define CEC_BitTimingStdMode ((uint16_t)0x00) /*!< Bit timing error Standard Mode */ 70 | #define CEC_BitTimingErrFreeMode CEC_CFGR_BTEM /*!< Bit timing error Free Mode */ 71 | 72 | #define IS_CEC_BIT_TIMING_ERROR_MODE(MODE) (((MODE) == CEC_BitTimingStdMode) || \ 73 | ((MODE) == CEC_BitTimingErrFreeMode)) 74 | /** 75 | * @} 76 | */ 77 | 78 | /** @defgroup CEC_BitPeriod_Mode 79 | * @{ 80 | */ 81 | #define CEC_BitPeriodStdMode ((uint16_t)0x00) /*!< Bit period error Standard Mode */ 82 | #define CEC_BitPeriodFlexibleMode CEC_CFGR_BPEM /*!< Bit period error Flexible Mode */ 83 | 84 | #define IS_CEC_BIT_PERIOD_ERROR_MODE(MODE) (((MODE) == CEC_BitPeriodStdMode) || \ 85 | ((MODE) == CEC_BitPeriodFlexibleMode)) 86 | /** 87 | * @} 88 | */ 89 | 90 | 91 | /** @defgroup CEC_interrupts_definition 92 | * @{ 93 | */ 94 | #define CEC_IT_TERR CEC_CSR_TERR 95 | #define CEC_IT_TBTRF CEC_CSR_TBTRF 96 | #define CEC_IT_RERR CEC_CSR_RERR 97 | #define CEC_IT_RBTF CEC_CSR_RBTF 98 | #define IS_CEC_GET_IT(IT) (((IT) == CEC_IT_TERR) || ((IT) == CEC_IT_TBTRF) || \ 99 | ((IT) == CEC_IT_RERR) || ((IT) == CEC_IT_RBTF)) 100 | /** 101 | * @} 102 | */ 103 | 104 | 105 | /** @defgroup CEC_Own_Address 106 | * @{ 107 | */ 108 | #define IS_CEC_ADDRESS(ADDRESS) ((ADDRESS) < 0x10) 109 | /** 110 | * @} 111 | */ 112 | 113 | /** @defgroup CEC_Prescaler 114 | * @{ 115 | */ 116 | #define IS_CEC_PRESCALER(PRESCALER) ((PRESCALER) <= 0x3FFF) 117 | 118 | /** 119 | * @} 120 | */ 121 | 122 | /** @defgroup CEC_flags_definition 123 | * @{ 124 | */ 125 | 126 | /** 127 | * @brief ESR register flags 128 | */ 129 | #define CEC_FLAG_BTE ((uint32_t)0x10010000) 130 | #define CEC_FLAG_BPE ((uint32_t)0x10020000) 131 | #define CEC_FLAG_RBTFE ((uint32_t)0x10040000) 132 | #define CEC_FLAG_SBE ((uint32_t)0x10080000) 133 | #define CEC_FLAG_ACKE ((uint32_t)0x10100000) 134 | #define CEC_FLAG_LINE ((uint32_t)0x10200000) 135 | #define CEC_FLAG_TBTFE ((uint32_t)0x10400000) 136 | 137 | /** 138 | * @brief CSR register flags 139 | */ 140 | #define CEC_FLAG_TEOM ((uint32_t)0x00000002) 141 | #define CEC_FLAG_TERR ((uint32_t)0x00000004) 142 | #define CEC_FLAG_TBTRF ((uint32_t)0x00000008) 143 | #define CEC_FLAG_RSOM ((uint32_t)0x00000010) 144 | #define CEC_FLAG_REOM ((uint32_t)0x00000020) 145 | #define CEC_FLAG_RERR ((uint32_t)0x00000040) 146 | #define CEC_FLAG_RBTF ((uint32_t)0x00000080) 147 | 148 | #define IS_CEC_CLEAR_FLAG(FLAG) ((((FLAG) & (uint32_t)0xFFFFFF03) == 0x00) && ((FLAG) != 0x00)) 149 | 150 | #define IS_CEC_GET_FLAG(FLAG) (((FLAG) == CEC_FLAG_BTE) || ((FLAG) == CEC_FLAG_BPE) || \ 151 | ((FLAG) == CEC_FLAG_RBTFE) || ((FLAG)== CEC_FLAG_SBE) || \ 152 | ((FLAG) == CEC_FLAG_ACKE) || ((FLAG) == CEC_FLAG_LINE) || \ 153 | ((FLAG) == CEC_FLAG_TBTFE) || ((FLAG) == CEC_FLAG_TEOM) || \ 154 | ((FLAG) == CEC_FLAG_TERR) || ((FLAG) == CEC_FLAG_TBTRF) || \ 155 | ((FLAG) == CEC_FLAG_RSOM) || ((FLAG) == CEC_FLAG_REOM) || \ 156 | ((FLAG) == CEC_FLAG_RERR) || ((FLAG) == CEC_FLAG_RBTF)) 157 | 158 | /** 159 | * @} 160 | */ 161 | 162 | /** 163 | * @} 164 | */ 165 | 166 | /** @defgroup CEC_Exported_Macros 167 | * @{ 168 | */ 169 | 170 | /** 171 | * @} 172 | */ 173 | 174 | /** @defgroup CEC_Exported_Functions 175 | * @{ 176 | */ 177 | void CEC_DeInit(void); 178 | void CEC_Init(CEC_InitTypeDef* CEC_InitStruct); 179 | void CEC_Cmd(FunctionalState NewState); 180 | void CEC_ITConfig(FunctionalState NewState); 181 | void CEC_OwnAddressConfig(uint8_t CEC_OwnAddress); 182 | void CEC_SetPrescaler(uint16_t CEC_Prescaler); 183 | void CEC_SendDataByte(uint8_t Data); 184 | uint8_t CEC_ReceiveDataByte(void); 185 | void CEC_StartOfMessage(void); 186 | void CEC_EndOfMessageCmd(FunctionalState NewState); 187 | FlagStatus CEC_GetFlagStatus(uint32_t CEC_FLAG); 188 | void CEC_ClearFlag(uint32_t CEC_FLAG); 189 | ITStatus CEC_GetITStatus(uint8_t CEC_IT); 190 | void CEC_ClearITPendingBit(uint16_t CEC_IT); 191 | 192 | #ifdef __cplusplus 193 | } 194 | #endif 195 | 196 | #endif /* __STM32F10x_CEC_H */ 197 | 198 | /** 199 | * @} 200 | */ 201 | 202 | /** 203 | * @} 204 | */ 205 | 206 | /** 207 | * @} 208 | */ 209 | 210 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ 211 | -------------------------------------------------------------------------------- /stm32f10x/include/stm32f10x/stm32f10x_exti.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f10x_exti.h 4 | * @author MCD Application Team 5 | * @version V3.5.0 6 | * @date 11-March-2011 7 | * @brief This file contains all the functions prototypes for the EXTI firmware 8 | * library. 9 | ****************************************************************************** 10 | * @attention 11 | * 12 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 13 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 14 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 15 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 16 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 17 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 18 | * 19 | *

© COPYRIGHT 2011 STMicroelectronics

20 | ****************************************************************************** 21 | */ 22 | 23 | /* Define to prevent recursive inclusion -------------------------------------*/ 24 | #ifndef __STM32F10x_EXTI_H 25 | #define __STM32F10x_EXTI_H 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif 30 | 31 | /* Includes ------------------------------------------------------------------*/ 32 | #include "stm32f10x/stm32f10x.h" 33 | 34 | /** @addtogroup STM32F10x_StdPeriph_Driver 35 | * @{ 36 | */ 37 | 38 | /** @addtogroup EXTI 39 | * @{ 40 | */ 41 | 42 | /** @defgroup EXTI_Exported_Types 43 | * @{ 44 | */ 45 | 46 | /** 47 | * @brief EXTI mode enumeration 48 | */ 49 | 50 | typedef enum 51 | { 52 | EXTI_Mode_Interrupt = 0x00, 53 | EXTI_Mode_Event = 0x04 54 | }EXTIMode_TypeDef; 55 | 56 | #define IS_EXTI_MODE(MODE) (((MODE) == EXTI_Mode_Interrupt) || ((MODE) == EXTI_Mode_Event)) 57 | 58 | /** 59 | * @brief EXTI Trigger enumeration 60 | */ 61 | 62 | typedef enum 63 | { 64 | EXTI_Trigger_Rising = 0x08, 65 | EXTI_Trigger_Falling = 0x0C, 66 | EXTI_Trigger_Rising_Falling = 0x10 67 | }EXTITrigger_TypeDef; 68 | 69 | #define IS_EXTI_TRIGGER(TRIGGER) (((TRIGGER) == EXTI_Trigger_Rising) || \ 70 | ((TRIGGER) == EXTI_Trigger_Falling) || \ 71 | ((TRIGGER) == EXTI_Trigger_Rising_Falling)) 72 | /** 73 | * @brief EXTI Init Structure definition 74 | */ 75 | 76 | typedef struct 77 | { 78 | uint32_t EXTI_Line; /*!< Specifies the EXTI lines to be enabled or disabled. 79 | This parameter can be any combination of @ref EXTI_Lines */ 80 | 81 | EXTIMode_TypeDef EXTI_Mode; /*!< Specifies the mode for the EXTI lines. 82 | This parameter can be a value of @ref EXTIMode_TypeDef */ 83 | 84 | EXTITrigger_TypeDef EXTI_Trigger; /*!< Specifies the trigger signal active edge for the EXTI lines. 85 | This parameter can be a value of @ref EXTIMode_TypeDef */ 86 | 87 | FunctionalState EXTI_LineCmd; /*!< Specifies the new state of the selected EXTI lines. 88 | This parameter can be set either to ENABLE or DISABLE */ 89 | }EXTI_InitTypeDef; 90 | 91 | /** 92 | * @} 93 | */ 94 | 95 | /** @defgroup EXTI_Exported_Constants 96 | * @{ 97 | */ 98 | 99 | /** @defgroup EXTI_Lines 100 | * @{ 101 | */ 102 | 103 | #define EXTI_Line0 ((uint32_t)0x00001) /*!< External interrupt line 0 */ 104 | #define EXTI_Line1 ((uint32_t)0x00002) /*!< External interrupt line 1 */ 105 | #define EXTI_Line2 ((uint32_t)0x00004) /*!< External interrupt line 2 */ 106 | #define EXTI_Line3 ((uint32_t)0x00008) /*!< External interrupt line 3 */ 107 | #define EXTI_Line4 ((uint32_t)0x00010) /*!< External interrupt line 4 */ 108 | #define EXTI_Line5 ((uint32_t)0x00020) /*!< External interrupt line 5 */ 109 | #define EXTI_Line6 ((uint32_t)0x00040) /*!< External interrupt line 6 */ 110 | #define EXTI_Line7 ((uint32_t)0x00080) /*!< External interrupt line 7 */ 111 | #define EXTI_Line8 ((uint32_t)0x00100) /*!< External interrupt line 8 */ 112 | #define EXTI_Line9 ((uint32_t)0x00200) /*!< External interrupt line 9 */ 113 | #define EXTI_Line10 ((uint32_t)0x00400) /*!< External interrupt line 10 */ 114 | #define EXTI_Line11 ((uint32_t)0x00800) /*!< External interrupt line 11 */ 115 | #define EXTI_Line12 ((uint32_t)0x01000) /*!< External interrupt line 12 */ 116 | #define EXTI_Line13 ((uint32_t)0x02000) /*!< External interrupt line 13 */ 117 | #define EXTI_Line14 ((uint32_t)0x04000) /*!< External interrupt line 14 */ 118 | #define EXTI_Line15 ((uint32_t)0x08000) /*!< External interrupt line 15 */ 119 | #define EXTI_Line16 ((uint32_t)0x10000) /*!< External interrupt line 16 Connected to the PVD Output */ 120 | #define EXTI_Line17 ((uint32_t)0x20000) /*!< External interrupt line 17 Connected to the RTC Alarm event */ 121 | #define EXTI_Line18 ((uint32_t)0x40000) /*!< External interrupt line 18 Connected to the USB Device/USB OTG FS 122 | Wakeup from suspend event */ 123 | #define EXTI_Line19 ((uint32_t)0x80000) /*!< External interrupt line 19 Connected to the Ethernet Wakeup event */ 124 | 125 | #define IS_EXTI_LINE(LINE) ((((LINE) & (uint32_t)0xFFF00000) == 0x00) && ((LINE) != (uint16_t)0x00)) 126 | #define IS_GET_EXTI_LINE(LINE) (((LINE) == EXTI_Line0) || ((LINE) == EXTI_Line1) || \ 127 | ((LINE) == EXTI_Line2) || ((LINE) == EXTI_Line3) || \ 128 | ((LINE) == EXTI_Line4) || ((LINE) == EXTI_Line5) || \ 129 | ((LINE) == EXTI_Line6) || ((LINE) == EXTI_Line7) || \ 130 | ((LINE) == EXTI_Line8) || ((LINE) == EXTI_Line9) || \ 131 | ((LINE) == EXTI_Line10) || ((LINE) == EXTI_Line11) || \ 132 | ((LINE) == EXTI_Line12) || ((LINE) == EXTI_Line13) || \ 133 | ((LINE) == EXTI_Line14) || ((LINE) == EXTI_Line15) || \ 134 | ((LINE) == EXTI_Line16) || ((LINE) == EXTI_Line17) || \ 135 | ((LINE) == EXTI_Line18) || ((LINE) == EXTI_Line19)) 136 | 137 | 138 | /** 139 | * @} 140 | */ 141 | 142 | /** 143 | * @} 144 | */ 145 | 146 | /** @defgroup EXTI_Exported_Macros 147 | * @{ 148 | */ 149 | 150 | /** 151 | * @} 152 | */ 153 | 154 | /** @defgroup EXTI_Exported_Functions 155 | * @{ 156 | */ 157 | 158 | void EXTI_DeInit(void); 159 | void EXTI_Init(EXTI_InitTypeDef* EXTI_InitStruct); 160 | void EXTI_StructInit(EXTI_InitTypeDef* EXTI_InitStruct); 161 | void EXTI_GenerateSWInterrupt(uint32_t EXTI_Line); 162 | FlagStatus EXTI_GetFlagStatus(uint32_t EXTI_Line); 163 | void EXTI_ClearFlag(uint32_t EXTI_Line); 164 | ITStatus EXTI_GetITStatus(uint32_t EXTI_Line); 165 | void EXTI_ClearITPendingBit(uint32_t EXTI_Line); 166 | void EXTI_DisableInterrupt(uint32_t EXTI_Line); 167 | void EXTI_EnableInterrupt(uint32_t EXTI_Line); 168 | 169 | #ifdef __cplusplus 170 | } 171 | #endif 172 | 173 | #endif /* __STM32F10x_EXTI_H */ 174 | /** 175 | * @} 176 | */ 177 | 178 | /** 179 | * @} 180 | */ 181 | 182 | /** 183 | * @} 184 | */ 185 | 186 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ 187 | --------------------------------------------------------------------------------