├── 表格.BMP ├── code ├── mylib │ ├── iot.c │ ├── delay.c │ ├── delay.h │ ├── esp8266.c │ ├── esp8266.h │ ├── dht11.h │ ├── fire.h │ ├── button.h │ ├── buzzer.h │ ├── mq5.h │ ├── fan.h │ ├── relay.h │ ├── iwdg.h │ ├── led.h │ ├── iwdg.c │ ├── iot.h │ ├── fire.c │ ├── usart2.h │ ├── eeprom.h │ ├── fan.c │ ├── buzzer.c │ ├── eint.h │ ├── relay.c │ ├── usart1.h │ ├── sht.h │ ├── ldt.h │ ├── gpio_iic.h │ ├── rtc.h │ ├── button.c │ ├── led.c │ ├── bitband.h │ ├── sht.c │ ├── oled.h │ ├── mq5.c │ ├── dht11.c │ ├── eeprom.c │ ├── usart2.c │ ├── ldt.c │ ├── eint.c │ ├── usart1.c │ ├── gpio_iic.c │ └── rtc.c ├── project │ └── Objects │ │ ├── fan.o │ │ ├── iot.o │ │ ├── ldt.o │ │ ├── led.o │ │ ├── mq5.o │ │ ├── rtc.o │ │ ├── sht.o │ │ ├── startup_stm32f10x_md.d │ │ ├── button.o │ │ ├── buzzer.o │ │ ├── delay.o │ │ ├── dht11.o │ │ ├── eeprom.o │ │ ├── eint.crf │ │ ├── eint.o │ │ ├── fan.crf │ │ ├── fire.crf │ │ ├── fire.o │ │ ├── iot.crf │ │ ├── iwdg.crf │ │ ├── iwdg.o │ │ ├── ldt.crf │ │ ├── led.crf │ │ ├── main.crf │ │ ├── main.o │ │ ├── misc.crf │ │ ├── misc.o │ │ ├── mq5.crf │ │ ├── oled.crf │ │ ├── oled.o │ │ ├── relay.o │ │ ├── rtc.crf │ │ ├── sht.crf │ │ ├── test.axf │ │ ├── usart1.o │ │ ├── usart2.o │ │ ├── button.crf │ │ ├── buzzer.crf │ │ ├── core_cm3.o │ │ ├── delay.crf │ │ ├── dht11.crf │ │ ├── eeprom.crf │ │ ├── esp8266.o │ │ ├── gpio_iic.o │ │ ├── relay.crf │ │ ├── usart1.crf │ │ ├── usart2.crf │ │ ├── core_cm3.crf │ │ ├── esp8266.crf │ │ ├── gpio_iic.crf │ │ ├── stm32f10x_adc.o │ │ ├── stm32f10x_bkp.o │ │ ├── stm32f10x_i2c.o │ │ ├── stm32f10x_it.o │ │ ├── stm32f10x_pwr.o │ │ ├── stm32f10x_rcc.o │ │ ├── stm32f10x_rtc.o │ │ ├── stm32f10x_adc.crf │ │ ├── stm32f10x_bkp.crf │ │ ├── stm32f10x_exti.crf │ │ ├── stm32f10x_exti.o │ │ ├── stm32f10x_gpio.crf │ │ ├── stm32f10x_gpio.o │ │ ├── stm32f10x_i2c.crf │ │ ├── stm32f10x_it.crf │ │ ├── stm32f10x_iwdg.crf │ │ ├── stm32f10x_iwdg.o │ │ ├── stm32f10x_pwr.crf │ │ ├── stm32f10x_rcc.crf │ │ ├── stm32f10x_rtc.crf │ │ ├── stm32f10x_usart.o │ │ ├── system_stm32f10x.o │ │ ├── test.build_log.htm │ │ ├── stm32f10x_usart.crf │ │ ├── system_stm32f10x.crf │ │ ├── core_cm3.d │ │ ├── startup_stm32f10x_md.o │ │ ├── test.lnp │ │ ├── mq5.d │ │ ├── iwdg.d │ │ ├── fan.d │ │ ├── led.d │ │ ├── delay.d │ │ ├── rtc.d │ │ ├── fire.d │ │ ├── ldt.d │ │ ├── sht.d │ │ ├── misc.d │ │ ├── relay.d │ │ ├── eint.d │ │ ├── button.d │ │ ├── buzzer.d │ │ ├── usart2.d │ │ ├── dht11.d │ │ ├── usart1.d │ │ ├── eeprom.d │ │ ├── oled.d │ │ ├── gpio_iic.d │ │ ├── iot.d │ │ ├── stm32f10x_it.d │ │ ├── stm32f10x_adc.d │ │ ├── stm32f10x_bkp.d │ │ ├── stm32f10x_i2c.d │ │ ├── stm32f10x_pwr.d │ │ ├── stm32f10x_rcc.d │ │ ├── stm32f10x_rtc.d │ │ ├── system_stm32f10x.d │ │ ├── stm32f10x_exti.d │ │ ├── stm32f10x_gpio.d │ │ ├── stm32f10x_iwdg.d │ │ ├── stm32f10x_usart.d │ │ ├── esp8266.d │ │ └── main.d ├── fwlib │ ├── src │ │ ├── stm32f10x_i2c.c │ │ ├── stm32f10x_flash.c │ │ ├── stm32f10x_usart.c │ │ ├── stm32f10x_crc.c │ │ ├── stm32f10x_iwdg.c │ │ └── stm32f10x_dbgmcu.c │ └── inc │ │ ├── stm32f10x_crc.h │ │ ├── stm32f10x_wwdg.h │ │ ├── stm32f10x_dbgmcu.h │ │ ├── stm32f10x_iwdg.h │ │ ├── stm32f10x_rtc.h │ │ └── stm32f10x_pwr.h └── user │ ├── stm32f10x_it.h │ ├── system_stm32f10x.h │ ├── stm32f10x_conf.h │ └── stm32f10x_it.c ├── web ├── favicon.ico └── iot │ ├── images │ ├── bg.jpg │ ├── iot.jpg │ ├── smart-home-3574545_1920.jpg │ ├── hands-typing-code-on-laptop.jpg │ ├── louis-reed-zDxlNcdUzxk-unsplash.jpg │ ├── close-up-of-laptop-keyboard-331684.jpg │ ├── computer-security-lock-and-payment.jpg │ ├── green-computer-circuit-board-159220.jpg │ ├── photo-of-woman-wearing-turtleneck-top-2777898.jpg │ ├── green-circuit-board-with-clear-glass-case-163073.jpg │ ├── sensor-img-switch-off.svg │ ├── sensor-img-switch-on.svg │ ├── device-img.svg │ ├── sensor-img-data.svg │ └── home-img-device.svg │ ├── .idea │ ├── misc.xml │ ├── .gitignore │ ├── jsLibraryMappings.xml │ ├── sqldialects.xml │ ├── modules.xml │ └── iot.iml │ ├── php │ ├── history.php │ ├── sensor.php │ ├── register.php │ ├── esp_download.php │ ├── login.php │ ├── functions.php │ └── esp_upload.php │ └── html │ ├── device.html │ └── index.html ├── 基于STM32单片机的家庭智能安全系统.png ├── 基于STM32单片机的家庭智能安全系统.xmind ├── README.md ├── LICENSE └── 毕业设计记录.md /表格.BMP: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weiyingjie/graduation-project/HEAD/表格.BMP -------------------------------------------------------------------------------- /code/mylib/iot.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weiyingjie/graduation-project/HEAD/code/mylib/iot.c -------------------------------------------------------------------------------- /web/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weiyingjie/graduation-project/HEAD/web/favicon.ico -------------------------------------------------------------------------------- /code/mylib/delay.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weiyingjie/graduation-project/HEAD/code/mylib/delay.c -------------------------------------------------------------------------------- /code/mylib/delay.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weiyingjie/graduation-project/HEAD/code/mylib/delay.h -------------------------------------------------------------------------------- /code/mylib/esp8266.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weiyingjie/graduation-project/HEAD/code/mylib/esp8266.c -------------------------------------------------------------------------------- /code/mylib/esp8266.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weiyingjie/graduation-project/HEAD/code/mylib/esp8266.h -------------------------------------------------------------------------------- /web/iot/images/bg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weiyingjie/graduation-project/HEAD/web/iot/images/bg.jpg -------------------------------------------------------------------------------- /web/iot/images/iot.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weiyingjie/graduation-project/HEAD/web/iot/images/iot.jpg -------------------------------------------------------------------------------- /基于STM32单片机的家庭智能安全系统.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weiyingjie/graduation-project/HEAD/基于STM32单片机的家庭智能安全系统.png -------------------------------------------------------------------------------- /code/project/Objects/fan.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weiyingjie/graduation-project/HEAD/code/project/Objects/fan.o -------------------------------------------------------------------------------- /code/project/Objects/iot.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weiyingjie/graduation-project/HEAD/code/project/Objects/iot.o -------------------------------------------------------------------------------- /code/project/Objects/ldt.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weiyingjie/graduation-project/HEAD/code/project/Objects/ldt.o -------------------------------------------------------------------------------- /code/project/Objects/led.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weiyingjie/graduation-project/HEAD/code/project/Objects/led.o -------------------------------------------------------------------------------- /code/project/Objects/mq5.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weiyingjie/graduation-project/HEAD/code/project/Objects/mq5.o -------------------------------------------------------------------------------- /code/project/Objects/rtc.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weiyingjie/graduation-project/HEAD/code/project/Objects/rtc.o -------------------------------------------------------------------------------- /code/project/Objects/sht.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weiyingjie/graduation-project/HEAD/code/project/Objects/sht.o -------------------------------------------------------------------------------- /code/project/Objects/startup_stm32f10x_md.d: -------------------------------------------------------------------------------- 1 | .\objects\startup_stm32f10x_md.o: ..\cmsis\startup_stm32f10x_md.s 2 | -------------------------------------------------------------------------------- /基于STM32单片机的家庭智能安全系统.xmind: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weiyingjie/graduation-project/HEAD/基于STM32单片机的家庭智能安全系统.xmind -------------------------------------------------------------------------------- /code/project/Objects/button.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weiyingjie/graduation-project/HEAD/code/project/Objects/button.o -------------------------------------------------------------------------------- /code/project/Objects/buzzer.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weiyingjie/graduation-project/HEAD/code/project/Objects/buzzer.o -------------------------------------------------------------------------------- /code/project/Objects/delay.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weiyingjie/graduation-project/HEAD/code/project/Objects/delay.o -------------------------------------------------------------------------------- /code/project/Objects/dht11.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weiyingjie/graduation-project/HEAD/code/project/Objects/dht11.o -------------------------------------------------------------------------------- /code/project/Objects/eeprom.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weiyingjie/graduation-project/HEAD/code/project/Objects/eeprom.o -------------------------------------------------------------------------------- /code/project/Objects/eint.crf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weiyingjie/graduation-project/HEAD/code/project/Objects/eint.crf -------------------------------------------------------------------------------- /code/project/Objects/eint.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weiyingjie/graduation-project/HEAD/code/project/Objects/eint.o -------------------------------------------------------------------------------- /code/project/Objects/fan.crf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weiyingjie/graduation-project/HEAD/code/project/Objects/fan.crf -------------------------------------------------------------------------------- /code/project/Objects/fire.crf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weiyingjie/graduation-project/HEAD/code/project/Objects/fire.crf -------------------------------------------------------------------------------- /code/project/Objects/fire.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weiyingjie/graduation-project/HEAD/code/project/Objects/fire.o -------------------------------------------------------------------------------- /code/project/Objects/iot.crf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weiyingjie/graduation-project/HEAD/code/project/Objects/iot.crf -------------------------------------------------------------------------------- /code/project/Objects/iwdg.crf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weiyingjie/graduation-project/HEAD/code/project/Objects/iwdg.crf -------------------------------------------------------------------------------- /code/project/Objects/iwdg.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weiyingjie/graduation-project/HEAD/code/project/Objects/iwdg.o -------------------------------------------------------------------------------- /code/project/Objects/ldt.crf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weiyingjie/graduation-project/HEAD/code/project/Objects/ldt.crf -------------------------------------------------------------------------------- /code/project/Objects/led.crf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weiyingjie/graduation-project/HEAD/code/project/Objects/led.crf -------------------------------------------------------------------------------- /code/project/Objects/main.crf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weiyingjie/graduation-project/HEAD/code/project/Objects/main.crf -------------------------------------------------------------------------------- /code/project/Objects/main.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weiyingjie/graduation-project/HEAD/code/project/Objects/main.o -------------------------------------------------------------------------------- /code/project/Objects/misc.crf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weiyingjie/graduation-project/HEAD/code/project/Objects/misc.crf -------------------------------------------------------------------------------- /code/project/Objects/misc.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weiyingjie/graduation-project/HEAD/code/project/Objects/misc.o -------------------------------------------------------------------------------- /code/project/Objects/mq5.crf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weiyingjie/graduation-project/HEAD/code/project/Objects/mq5.crf -------------------------------------------------------------------------------- /code/project/Objects/oled.crf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weiyingjie/graduation-project/HEAD/code/project/Objects/oled.crf -------------------------------------------------------------------------------- /code/project/Objects/oled.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weiyingjie/graduation-project/HEAD/code/project/Objects/oled.o -------------------------------------------------------------------------------- /code/project/Objects/relay.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weiyingjie/graduation-project/HEAD/code/project/Objects/relay.o -------------------------------------------------------------------------------- /code/project/Objects/rtc.crf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weiyingjie/graduation-project/HEAD/code/project/Objects/rtc.crf -------------------------------------------------------------------------------- /code/project/Objects/sht.crf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weiyingjie/graduation-project/HEAD/code/project/Objects/sht.crf -------------------------------------------------------------------------------- /code/project/Objects/test.axf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weiyingjie/graduation-project/HEAD/code/project/Objects/test.axf -------------------------------------------------------------------------------- /code/project/Objects/usart1.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weiyingjie/graduation-project/HEAD/code/project/Objects/usart1.o -------------------------------------------------------------------------------- /code/project/Objects/usart2.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weiyingjie/graduation-project/HEAD/code/project/Objects/usart2.o -------------------------------------------------------------------------------- /code/fwlib/src/stm32f10x_i2c.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weiyingjie/graduation-project/HEAD/code/fwlib/src/stm32f10x_i2c.c -------------------------------------------------------------------------------- /code/project/Objects/button.crf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weiyingjie/graduation-project/HEAD/code/project/Objects/button.crf -------------------------------------------------------------------------------- /code/project/Objects/buzzer.crf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weiyingjie/graduation-project/HEAD/code/project/Objects/buzzer.crf -------------------------------------------------------------------------------- /code/project/Objects/core_cm3.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weiyingjie/graduation-project/HEAD/code/project/Objects/core_cm3.o -------------------------------------------------------------------------------- /code/project/Objects/delay.crf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weiyingjie/graduation-project/HEAD/code/project/Objects/delay.crf -------------------------------------------------------------------------------- /code/project/Objects/dht11.crf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weiyingjie/graduation-project/HEAD/code/project/Objects/dht11.crf -------------------------------------------------------------------------------- /code/project/Objects/eeprom.crf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weiyingjie/graduation-project/HEAD/code/project/Objects/eeprom.crf -------------------------------------------------------------------------------- /code/project/Objects/esp8266.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weiyingjie/graduation-project/HEAD/code/project/Objects/esp8266.o -------------------------------------------------------------------------------- /code/project/Objects/gpio_iic.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weiyingjie/graduation-project/HEAD/code/project/Objects/gpio_iic.o -------------------------------------------------------------------------------- /code/project/Objects/relay.crf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weiyingjie/graduation-project/HEAD/code/project/Objects/relay.crf -------------------------------------------------------------------------------- /code/project/Objects/usart1.crf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weiyingjie/graduation-project/HEAD/code/project/Objects/usart1.crf -------------------------------------------------------------------------------- /code/project/Objects/usart2.crf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weiyingjie/graduation-project/HEAD/code/project/Objects/usart2.crf -------------------------------------------------------------------------------- /code/fwlib/src/stm32f10x_flash.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weiyingjie/graduation-project/HEAD/code/fwlib/src/stm32f10x_flash.c -------------------------------------------------------------------------------- /code/fwlib/src/stm32f10x_usart.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weiyingjie/graduation-project/HEAD/code/fwlib/src/stm32f10x_usart.c -------------------------------------------------------------------------------- /code/project/Objects/core_cm3.crf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weiyingjie/graduation-project/HEAD/code/project/Objects/core_cm3.crf -------------------------------------------------------------------------------- /code/project/Objects/esp8266.crf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weiyingjie/graduation-project/HEAD/code/project/Objects/esp8266.crf -------------------------------------------------------------------------------- /code/project/Objects/gpio_iic.crf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weiyingjie/graduation-project/HEAD/code/project/Objects/gpio_iic.crf -------------------------------------------------------------------------------- /code/project/Objects/stm32f10x_adc.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weiyingjie/graduation-project/HEAD/code/project/Objects/stm32f10x_adc.o -------------------------------------------------------------------------------- /code/project/Objects/stm32f10x_bkp.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weiyingjie/graduation-project/HEAD/code/project/Objects/stm32f10x_bkp.o -------------------------------------------------------------------------------- /code/project/Objects/stm32f10x_i2c.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weiyingjie/graduation-project/HEAD/code/project/Objects/stm32f10x_i2c.o -------------------------------------------------------------------------------- /code/project/Objects/stm32f10x_it.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weiyingjie/graduation-project/HEAD/code/project/Objects/stm32f10x_it.o -------------------------------------------------------------------------------- /code/project/Objects/stm32f10x_pwr.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weiyingjie/graduation-project/HEAD/code/project/Objects/stm32f10x_pwr.o -------------------------------------------------------------------------------- /code/project/Objects/stm32f10x_rcc.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weiyingjie/graduation-project/HEAD/code/project/Objects/stm32f10x_rcc.o -------------------------------------------------------------------------------- /code/project/Objects/stm32f10x_rtc.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weiyingjie/graduation-project/HEAD/code/project/Objects/stm32f10x_rtc.o -------------------------------------------------------------------------------- /code/project/Objects/stm32f10x_adc.crf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weiyingjie/graduation-project/HEAD/code/project/Objects/stm32f10x_adc.crf -------------------------------------------------------------------------------- /code/project/Objects/stm32f10x_bkp.crf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weiyingjie/graduation-project/HEAD/code/project/Objects/stm32f10x_bkp.crf -------------------------------------------------------------------------------- /code/project/Objects/stm32f10x_exti.crf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weiyingjie/graduation-project/HEAD/code/project/Objects/stm32f10x_exti.crf -------------------------------------------------------------------------------- /code/project/Objects/stm32f10x_exti.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weiyingjie/graduation-project/HEAD/code/project/Objects/stm32f10x_exti.o -------------------------------------------------------------------------------- /code/project/Objects/stm32f10x_gpio.crf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weiyingjie/graduation-project/HEAD/code/project/Objects/stm32f10x_gpio.crf -------------------------------------------------------------------------------- /code/project/Objects/stm32f10x_gpio.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weiyingjie/graduation-project/HEAD/code/project/Objects/stm32f10x_gpio.o -------------------------------------------------------------------------------- /code/project/Objects/stm32f10x_i2c.crf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weiyingjie/graduation-project/HEAD/code/project/Objects/stm32f10x_i2c.crf -------------------------------------------------------------------------------- /code/project/Objects/stm32f10x_it.crf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weiyingjie/graduation-project/HEAD/code/project/Objects/stm32f10x_it.crf -------------------------------------------------------------------------------- /code/project/Objects/stm32f10x_iwdg.crf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weiyingjie/graduation-project/HEAD/code/project/Objects/stm32f10x_iwdg.crf -------------------------------------------------------------------------------- /code/project/Objects/stm32f10x_iwdg.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weiyingjie/graduation-project/HEAD/code/project/Objects/stm32f10x_iwdg.o -------------------------------------------------------------------------------- /code/project/Objects/stm32f10x_pwr.crf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weiyingjie/graduation-project/HEAD/code/project/Objects/stm32f10x_pwr.crf -------------------------------------------------------------------------------- /code/project/Objects/stm32f10x_rcc.crf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weiyingjie/graduation-project/HEAD/code/project/Objects/stm32f10x_rcc.crf -------------------------------------------------------------------------------- /code/project/Objects/stm32f10x_rtc.crf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weiyingjie/graduation-project/HEAD/code/project/Objects/stm32f10x_rtc.crf -------------------------------------------------------------------------------- /code/project/Objects/stm32f10x_usart.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weiyingjie/graduation-project/HEAD/code/project/Objects/stm32f10x_usart.o -------------------------------------------------------------------------------- /code/project/Objects/system_stm32f10x.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weiyingjie/graduation-project/HEAD/code/project/Objects/system_stm32f10x.o -------------------------------------------------------------------------------- /code/project/Objects/test.build_log.htm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weiyingjie/graduation-project/HEAD/code/project/Objects/test.build_log.htm -------------------------------------------------------------------------------- /code/project/Objects/stm32f10x_usart.crf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weiyingjie/graduation-project/HEAD/code/project/Objects/stm32f10x_usart.crf -------------------------------------------------------------------------------- /code/project/Objects/system_stm32f10x.crf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weiyingjie/graduation-project/HEAD/code/project/Objects/system_stm32f10x.crf -------------------------------------------------------------------------------- /code/project/Objects/core_cm3.d: -------------------------------------------------------------------------------- 1 | .\objects\core_cm3.o: ..\cmsis\core_cm3.c 2 | .\objects\core_cm3.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdint.h 3 | -------------------------------------------------------------------------------- /code/project/Objects/startup_stm32f10x_md.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weiyingjie/graduation-project/HEAD/code/project/Objects/startup_stm32f10x_md.o -------------------------------------------------------------------------------- /web/iot/images/smart-home-3574545_1920.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weiyingjie/graduation-project/HEAD/web/iot/images/smart-home-3574545_1920.jpg -------------------------------------------------------------------------------- /web/iot/images/hands-typing-code-on-laptop.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weiyingjie/graduation-project/HEAD/web/iot/images/hands-typing-code-on-laptop.jpg -------------------------------------------------------------------------------- /web/iot/images/louis-reed-zDxlNcdUzxk-unsplash.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weiyingjie/graduation-project/HEAD/web/iot/images/louis-reed-zDxlNcdUzxk-unsplash.jpg -------------------------------------------------------------------------------- /web/iot/images/close-up-of-laptop-keyboard-331684.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weiyingjie/graduation-project/HEAD/web/iot/images/close-up-of-laptop-keyboard-331684.jpg -------------------------------------------------------------------------------- /web/iot/images/computer-security-lock-and-payment.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weiyingjie/graduation-project/HEAD/web/iot/images/computer-security-lock-and-payment.jpg -------------------------------------------------------------------------------- /web/iot/images/green-computer-circuit-board-159220.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weiyingjie/graduation-project/HEAD/web/iot/images/green-computer-circuit-board-159220.jpg -------------------------------------------------------------------------------- /web/iot/images/photo-of-woman-wearing-turtleneck-top-2777898.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weiyingjie/graduation-project/HEAD/web/iot/images/photo-of-woman-wearing-turtleneck-top-2777898.jpg -------------------------------------------------------------------------------- /web/iot/images/green-circuit-board-with-clear-glass-case-163073.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weiyingjie/graduation-project/HEAD/web/iot/images/green-circuit-board-with-clear-glass-case-163073.jpg -------------------------------------------------------------------------------- /code/mylib/dht11.h: -------------------------------------------------------------------------------- 1 | #ifndef __DHT11_H 2 | #define __DHT11_H 3 | 4 | extern void dht11_init(void); // 初始化dht11 5 | 6 | extern void dht11_get_value(char *buf); // 获取值 7 | 8 | #endif 9 | 10 | -------------------------------------------------------------------------------- /web/iot/.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /web/iot/.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # Default ignored files 2 | /shelf/ 3 | /workspace.xml 4 | # Datasource local storage ignored files 5 | /dataSources/ 6 | /dataSources.local.xml 7 | # Editor-based HTTP Client requests 8 | /httpRequests/ 9 | -------------------------------------------------------------------------------- /code/mylib/fire.h: -------------------------------------------------------------------------------- 1 | #ifndef __FIRE_H 2 | #define __FIRE_H 3 | /* 4 | 火焰传感器 5 | PA7 浮空输入 6 | */ 7 | #include "stm32f10x_conf.h" 8 | 9 | extern void fire_init(void); // 初始化 10 | 11 | extern u8 fire_get_state(void); // 获取有无火焰 12 | 13 | #endif 14 | 15 | 16 | -------------------------------------------------------------------------------- /web/iot/.idea/jsLibraryMappings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /code/mylib/button.h: -------------------------------------------------------------------------------- 1 | #ifndef __BUTTON_H 2 | #define __BUTTON_H 3 | 4 | /* 5 | KEY0 PC9 6 | KEY1 PC8 7 | WK_UP PA0 8 | */ 9 | 10 | #include "stm32f10x_conf.h" 11 | 12 | extern void button_init(void); 13 | 14 | extern int button_status(int nu); 15 | 16 | #endif 17 | 18 | 19 | -------------------------------------------------------------------------------- /code/mylib/buzzer.h: -------------------------------------------------------------------------------- 1 | #ifndef __BUZZER_H 2 | #define __BUZZER_H 3 | 4 | /* 5 | PC7高电平触发 6 | */ 7 | 8 | #include "stm32f10x_conf.h" 9 | 10 | extern void buzzer_init(void); 11 | 12 | extern void buzzer_on(void); 13 | 14 | extern void buzzer_off(void); 15 | 16 | #endif 17 | 18 | -------------------------------------------------------------------------------- /code/mylib/mq5.h: -------------------------------------------------------------------------------- 1 | #ifndef __MQ5_H 2 | #define __MQ5_H 3 | /* 4 | 液化气传感器 5 | AO PC4 模拟输入 6 | DO PA4 数字输入 7 | */ 8 | 9 | #include "stm32f10x_conf.h" 10 | 11 | extern void mq5_init(void); // 初始化 12 | 13 | extern int mq5_get_value(void); // 获取检测的模拟量 14 | 15 | #endif 16 | 17 | -------------------------------------------------------------------------------- /web/iot/.idea/sqldialects.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /code/mylib/fan.h: -------------------------------------------------------------------------------- 1 | #ifndef __FAN_H 2 | #define __FAN_H 3 | /* 4 | 排风扇 5 | PC5管脚控制 6 | */ 7 | #include "stm32f10x_conf.h" // 包含ST公司提供的头文件 8 | 9 | extern void fan_init(void); 10 | 11 | extern void fan_on(void); 12 | 13 | extern void fan_off(void); 14 | 15 | 16 | #endif 17 | 18 | 19 | -------------------------------------------------------------------------------- /web/iot/.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /web/iot/php/history.php: -------------------------------------------------------------------------------- 1 | 'updateSensorError'); 11 | $sql = 'update sensors set s_cmd = "' . $_POST['s_cmd'] . '" where s_id = "' . $_POST['s_id'] . '";'; 12 | if ($res = query($link, $sql)) { 13 | $ret['status'] = 'updateSensorOk'; 14 | } 15 | } 16 | 17 | $ret = json_encode($ret, JSON_UNESCAPED_UNICODE); 18 | echo $ret; 19 | } 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /code/mylib/rtc.h: -------------------------------------------------------------------------------- 1 | #ifndef __RTC_H 2 | #define __RTC_H 3 | /* 4 | 该文件用于驱动STM32F103RBT6芯片中RTC的外设 5 | 时钟频率使用的是LSE加预分频 = 1Hz 6 | 计数值是用来存储秒数的 7 | 我们表示的时间范围为 8 | 1970/1/1 00:00:00 ----- 2099/12/31 23:59:59 9 | */ 10 | #include "stm32f10x_conf.h"//包含了该头文件所有的外设头文件均已包含 11 | 12 | struct time_st//用于存储日期和时间的结构体 13 | { 14 | int Y;//年份 15 | int M;//月份 16 | int D;//日期 17 | int W;//星期 18 | int h;//小时 19 | int m;//分钟 20 | int s;//秒数 21 | }; 22 | 23 | extern void rtc_init(struct time_st *t);//初始化RTC 24 | 25 | extern void set_time(struct time_st *t);//设置时间 26 | 27 | extern void conv_time(struct time_st *t);//转换时间 28 | 29 | extern void get_time(struct time_st *t);//获取时间 30 | 31 | #endif 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /web/iot/.idea/iot.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # graduation-project 2 | 毕设题目**基于STM32单片机的家庭智能安全系统** 3 | 4 | ## 各部分代码分布 5 | - **code** 目录中为STM32的keil工程文件,C语言开发。 6 | - **web** 目录中为云平台的源代码,前端Vue ([传送门](https://cn.vuejs.org/))+HTML为主,加上部分CSS,UI库使用Element-UI ([传送门](https://element.eleme.cn/2.0/#/zh-CN)),使用方式均为**CDN导入**的方式,后端使用PHP连接数据库,数据库为MySQL。 7 | - **web** 目录中 **iot.sql** 为数据库文件,数据库名称为 iot 8 | 9 | ## 本设计实现的功能 10 | 11 | ### 云平台 12 | 本设计实现了一个基本的云平台,可以实现设备显示及远程控制,设备绑定通过传感器id(s_id)作为唯一标识。 13 | 14 | 远程控制:前端点击开/关,后端更新数据库中sensors表的s_cmd字段,单片机请求esp_download.php页面,页面在数据库中进行查询,如果查到则返回 `{"s_id":"16","cmd":true}`类似的字符串,再由单片机解析字符串后进行相应操作 15 | 16 | ### 单片机 17 | 单片机部分实现数据采集,数据处理,数据显示,自动报警、数据上传及远程控制 18 | 19 | 数据采集:使用C语言驱动各传感器进行采集。 20 | 21 | 数据处理:需要处理的部分为esp8266接收的字符串、传感器采集到的数据与设定的阈值之间的关系等。 22 | 23 | 数据显示:实现数码管驱动及OLED屏幕驱动。 24 | 25 | 自动报警:通过比较传感器采集值及设定的阈值来判断是否报警。 26 | 27 | 数据上传:单片机通过esp8266发送GET请求,参数中包含s_id和s_data,请求esp_upload.php页面,通过页面接收请求后查询有此传感器后进行存储。 28 | 29 | 远程控制:见云平台部分。 30 | 31 | -------------------------------------------------------------------------------- /code/mylib/button.c: -------------------------------------------------------------------------------- 1 | #include "button.h" 2 | #include "bitband.h" 3 | 4 | void button_init(void) 5 | { 6 | GPIO_InitTypeDef Button_Value1; 7 | GPIO_InitTypeDef Button_Value2; 8 | 9 | // 使能A组和C组时钟 10 | RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA | RCC_APB2Periph_GPIOC, ENABLE); 11 | 12 | // KEY0,1 上拉输入1111// WK_UP 下拉 13 | Button_Value1.GPIO_Mode = GPIO_Mode_IPU; 14 | Button_Value1.GPIO_Pin = GPIO_Pin_9 | GPIO_Pin_8; 15 | Button_Value2.GPIO_Mode = GPIO_Mode_IPD; 16 | Button_Value2.GPIO_Pin = GPIO_Pin_0; 17 | 18 | GPIO_Init(GPIOC, &Button_Value1); 19 | GPIO_Init(GPIOA, &Button_Value2); 20 | 21 | //GPIO_SetBits(GPIOC, GPIO_Pin_8 | GPIO_Pin_9); 22 | //GPIO_SetBits(GPIOA, GPIO_Pin_0); 23 | } 24 | 25 | int button_status(int nu) 26 | { 27 | int ret = 0; 28 | switch(nu) { 29 | case 0 : ret = PCIn(9); break; 30 | case 1 : ret = PCIn(8); break; 31 | case 2 : ret = PAIn(0); ret = !ret; break; 32 | } 33 | return !ret; 34 | } 35 | 36 | -------------------------------------------------------------------------------- /web/iot/php/register.php: -------------------------------------------------------------------------------- 1 | 0, 'email'=>0, 'name'=>0); 8 | 9 | // 判断是否存在并存入 10 | $sql = 'select * from user where email = "' . $_POST['email'] . '";'; 11 | if (fetchRow($link, $sql)) { 12 | $ret['code'] = 1; 13 | $ret['email'] = 1; 14 | } 15 | 16 | $sql = 'select * from user where name = "' . $_POST['name'] . '";'; 17 | if (fetchRow($link, $sql)) { 18 | $ret['code'] = 1; 19 | $ret['name'] = 1; 20 | } 21 | 22 | if ($ret['code'] == 0) { 23 | $sql = 'insert into user(u_pwd, email, name) values("' . $_POST['passwd'] . '", "' . $_POST['email'] . '", "' . $_POST['name'] . '");'; 24 | query($link, $sql); 25 | } 26 | 27 | $ret = json_encode($ret, JSON_UNESCAPED_UNICODE); 28 | die($ret); 29 | } 30 | 31 | 32 | -------------------------------------------------------------------------------- /web/iot/images/sensor-img-switch-off.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /web/iot/images/sensor-img-switch-on.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /code/mylib/led.c: -------------------------------------------------------------------------------- 1 | #include "led.h" 2 | #include "bitband.h" 3 | 4 | void led_init(void) // 初始化 5 | { 6 | GPIO_InitTypeDef Led_Value; 7 | 8 | // 使能时钟 9 | RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOC, ENABLE); 10 | // PC1~3设置推挽输出 11 | 12 | Led_Value.GPIO_Mode = GPIO_Mode_Out_PP; // 推挽输出 13 | Led_Value.GPIO_Speed = GPIO_Speed_50MHz;// 速度50Mhz 14 | Led_Value.GPIO_Pin = GPIO_Pin_1 | GPIO_Pin_2 | GPIO_Pin_3; 15 | 16 | GPIO_Init(GPIOC, &Led_Value); 17 | 18 | PCOut(1) = 0; 19 | PCOut(2) = 0; 20 | PCOut(3) = 0; 21 | } 22 | 23 | void led_on(int nu) // 根据nu参数亮灯 24 | { 25 | switch (nu) 26 | { 27 | case 0 : PCOut(1) = 1; break; 28 | case 1 : PCOut(2) = 1; break; 29 | case 2 : PCOut(3) = 1; break; 30 | default: 31 | break; 32 | } 33 | } 34 | 35 | void led_off(int nu)// 根据nu参数灭灯 36 | { 37 | switch (nu) 38 | { 39 | case 0 : PCOut(1) = 0; break; 40 | case 1 : PCOut(2) = 0; break; 41 | case 2 : PCOut(3) = 0; break; 42 | default: 43 | break; 44 | } 45 | } 46 | 47 | 48 | -------------------------------------------------------------------------------- /web/iot/php/esp_download.php: -------------------------------------------------------------------------------- 1 | POST /iot/php/esp_download.php 11 | //// [1] => s_id 12 | //// [2] => 1 13 | //$arr = preg_split('[\r\n|\?|&|=]', $content); // 分割字符串 14 | 15 | if (!empty($_GET)) { 16 | if (isset($_GET['s_id'])) { 17 | $s_id = $_GET['s_id']; 18 | $sql = 'select s_cmd from sensors where s_id = "' . $s_id . '";'; 19 | if($res = fetchRow($link, $sql)) { 20 | $s_cmd = $res['s_cmd']; 21 | $ret = array('s_id' => $s_id, 'cmd' => $s_cmd == 1); 22 | $ret = json_encode($ret, JSON_UNESCAPED_UNICODE); 23 | echo $ret; // {"s_id":"16 ","cmd":true} 24 | } // array 25 | } 26 | } 27 | 28 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 WYJ 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /web/iot/php/login.php: -------------------------------------------------------------------------------- 1 | 0, 'email' => 0, 'passwd' => 0); 8 | 9 | // 判断是否存在 10 | $sql = 'select * from user where email = "' . $_POST['email'] . '";'; 11 | if (fetchRow($link, $sql)) { 12 | // 账号存在 判断密码 13 | $sql = 'select * from user where email = "' . $_POST['email'] . '" and u_pwd = "' . $_POST['passwd'] . '";'; 14 | if (!($res = fetchRow($link, $sql))) { 15 | // 密码错误 1 0 1 16 | $ret['code'] = 1; 17 | $ret['passwd'] = 1; 18 | } else { 19 | session_start(); 20 | $_SESSION['userinfo']=array( 21 | 'u_id'=>$res['u_id'], 22 | 'email'=>$res['email'], 23 | 'name'=>$res['name'] 24 | ); 25 | } 26 | } else { 27 | // 账号不存在 1 1 0 28 | $ret['code'] = 1; 29 | $ret['email'] = 1; 30 | } 31 | 32 | $ret = json_encode($ret, JSON_UNESCAPED_UNICODE); 33 | echo($ret); 34 | } 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /web/iot/images/device-img.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /毕业设计记录.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: 毕业设计记录 3 | tags: 毕设 4 | renderNumberedHeading: true 5 | grammar_cjkRuby: true 6 | --- 7 | 8 | --- 9 | 10 | # 单片机 11 | ## 芯片 12 | STM32F103RBT6 13 | 14 | ## 火焰传感器 15 | - 输出:DO数字量输出 16 | - 功能:判断有无火焰 17 | - 接线:DO - PC4 18 | 19 | ## 继电器 20 | ![继电器](./images/继电器.png) 21 | 高电平有效继电器 22 | - 管脚: 23 | - NO:(Normal Open)常开端 24 | - COM:公共端 25 | - NC:(Normal Close)常闭端 26 | 27 | ==通常情况下常闭端和公共端已经连通,IN端高电平时NO端和COM端连通,实现弱电控制强电的效果== 28 | 29 | 继电器的操作使用到了**位带** 30 | 31 | ## 四位八段数码管 32 | 33 | ### 数码管 34 | 35 | ### 3-8译码器 36 | 37 | ## MQ-5液化气传感器 38 | - 输出管脚 39 | - AO:模拟输出 40 | - DO:数字输出 41 | 42 | ADC模数转换器 43 | 44 | ## OLED屏幕 45 | 46 | I²C总线 47 | 48 | 字模 49 | 50 | ## SHT30 51 | 温湿度传感器 52 | I²C总线 53 | 54 | ## ESP8266 55 | 56 | USART接口 57 | 58 | AT指令 59 | 60 | ## RTC实时时钟 61 | 62 | --- 63 | 64 | # 服务器 65 | ## HTTP协议 66 | 67 | ![HTTP请求报文](./images/1588432287893.png) 68 | 69 | ## 单片机与服务器的数据交换 70 | 71 | ==ESP8266使用透传模式 #F44336== 72 | 73 | **upload** 74 | 75 | ``` http 76 | GET /iot/php/esp_upload.php?s_id=1&s_data=2 HTTP/1.1\r\nHost: www.wyjiot.cn\r\n\r\n 77 | ``` 78 | 79 | **download** 80 | 81 | ``` http 82 | GET /iot/php/esp_download.php?s_id=1 HTTP/1.1\r\nHost: www.wyjiot.cn\r\n\r\n 83 | ``` 84 | 85 | -------------------------------------------------------------------------------- /code/mylib/bitband.h: -------------------------------------------------------------------------------- 1 | #ifndef __BITBAND_H 2 | #define __BITBAND_H 3 | 4 | #define BIT_BAND(ADDR, BITNUM) ((ADDR & 0xF0000000) + 0x2000000) + ((ADDR & 0xFFFFF) << 5) + (BITNUM << 2) 5 | // 将位带地址转换成位带区地址 6 | #define MEM_ADDR(ADDR) *(volatile unsigned int *)(ADDR) 7 | // 将十六进制数字转换成真正的地址 8 | #define BITBAND(ADDR, BITNUM) MEM_ADDR(BIT_BAND(ADDR, BITNUM)) 9 | // 将上面两个宏定义结合 10 | #define GPIOA_IDR_ADDR (GPIOA_BASE + 0x08) 11 | #define GPIOA_ODR_ADDR (GPIOA_BASE + 0x0C) 12 | 13 | #define GPIOB_IDR_ADDR (GPIOB_BASE + 0x08) 14 | #define GPIOB_ODR_ADDR (GPIOB_BASE + 0x0C) 15 | 16 | #define GPIOC_IDR_ADDR (GPIOC_BASE + 0x08) 17 | #define GPIOC_ODR_ADDR (GPIOC_BASE + 0x0C) 18 | 19 | #define GPIOD_IDR_ADDR (GPIOD_BASE + 0x08) 20 | #define GPIOD_ODR_ADDR (GPIOD_BASE + 0x0C) 21 | // 将每组输入输出寄存器地址进行宏定义 22 | #define PAOut(n) BITBAND(GPIOA_ODR_ADDR, n) 23 | #define PAIn(n) BITBAND(GPIOA_IDR_ADDR, n) 24 | 25 | #define PBOut(n) BITBAND(GPIOB_ODR_ADDR, n) 26 | #define PBIn(n) BITBAND(GPIOB_IDR_ADDR, n) 27 | 28 | #define PCOut(n) BITBAND(GPIOC_ODR_ADDR, n) 29 | #define PCIn(n) BITBAND(GPIOC_IDR_ADDR, n) 30 | 31 | #define PDOut(n) BITBAND(GPIOD_ODR_ADDR, n) 32 | #define PDIn(n) BITBAND(GPIOD_IDR_ADDR, n) 33 | // 将每组的输入输出进行宏定义 34 | 35 | #endif 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /code/project/Objects/test.lnp: -------------------------------------------------------------------------------- 1 | --cpu Cortex-M3 2 | ".\objects\core_cm3.o" 3 | ".\objects\startup_stm32f10x_md.o" 4 | ".\objects\stm32f10x_rcc.o" 5 | ".\objects\stm32f10x_gpio.o" 6 | ".\objects\misc.o" 7 | ".\objects\stm32f10x_exti.o" 8 | ".\objects\stm32f10x_iwdg.o" 9 | ".\objects\stm32f10x_usart.o" 10 | ".\objects\stm32f10x_i2c.o" 11 | ".\objects\stm32f10x_adc.o" 12 | ".\objects\stm32f10x_bkp.o" 13 | ".\objects\stm32f10x_pwr.o" 14 | ".\objects\stm32f10x_rtc.o" 15 | ".\objects\led.o" 16 | ".\objects\buzzer.o" 17 | ".\objects\button.o" 18 | ".\objects\delay.o" 19 | ".\objects\iwdg.o" 20 | ".\objects\usart1.o" 21 | ".\objects\gpio_iic.o" 22 | ".\objects\sht.o" 23 | ".\objects\oled.o" 24 | ".\objects\fire.o" 25 | ".\objects\fan.o" 26 | ".\objects\ldt.o" 27 | ".\objects\mq5.o" 28 | ".\objects\esp8266.o" 29 | ".\objects\iot.o" 30 | ".\objects\rtc.o" 31 | ".\objects\usart2.o" 32 | ".\objects\relay.o" 33 | ".\objects\main.o" 34 | ".\objects\stm32f10x_it.o" 35 | ".\objects\system_stm32f10x.o" 36 | --ro-base 0x08000000 --entry 0x08000000 --rw-base 0x20000000 --entry Reset_Handler --first __Vectors --strict --summary_stderr --info summarysizes --map --xref --callgraph --symbols 37 | --info sizes --info totals --info unused --info veneers 38 | --list ".\Listings\test.map" -o .\Objects\test.axf -------------------------------------------------------------------------------- /web/iot/images/sensor-img-data.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /code/mylib/sht.c: -------------------------------------------------------------------------------- 1 | #include "sht.h" 2 | #include "gpio_iic.h" 3 | #include "delay.h" 4 | 5 | void sht_init(void)//初始化的函数 6 | { 7 | IIC_Init(); 8 | } 9 | 10 | void sht_write_mode(void)//配置SHT30传感器内部采样速率 11 | { 12 | IIC_Start(); 13 | IIC_Send_Byte(SLAVE_ADDR); // 发送设备地址 + 写标志 14 | while(IIC_Wait_Ack()); 15 | IIC_Send_Byte(PERIODIC_MODE_HIGH >> 8); // 发送指令的高8位 16 | while(IIC_Wait_Ack()); 17 | IIC_Send_Byte(PERIODIC_MODE_HIGH & 0xFF); // 发送指令的低8位 18 | while(IIC_Wait_Ack()); 19 | IIC_Stop(); 20 | delay_ms(5); 21 | } 22 | 23 | void sht_write_read_cmd(void)//发送读取SHT30采集数据的命令 24 | { 25 | IIC_Start(); 26 | IIC_Send_Byte(SLAVE_ADDR); // 发送设备地址 + 写标志 27 | while(IIC_Wait_Ack()); 28 | IIC_Send_Byte(READOUT_PERIODIC_MODE >> 8); // 发送指令的高8位 29 | while(IIC_Wait_Ack()); 30 | IIC_Send_Byte(READOUT_PERIODIC_MODE & 0xFF); // 发送指令的低8位 31 | while(IIC_Wait_Ack()); 32 | } 33 | 34 | void sht_read_data(double sht_data[2])//读取SHT30采集到的数据 35 | { 36 | u8 buf[6] = {0};//存储SHT30读出的数据 37 | u8 i = 0;//i变量为循环变量 38 | u16 temp = 0, hum = 0; 39 | 40 | IIC_Start(); 41 | IIC_Send_Byte(SLAVE_ADDR | 1); 42 | delay_us(5); 43 | while(IIC_Wait_Ack()); 44 | for(i = 0; i < 6; i++) 45 | { 46 | if(i == 5) 47 | buf[i] = IIC_Recv_Byte(0);//读数据,不需要产生ACK 48 | else 49 | buf[i] = IIC_Recv_Byte(1);//读数据,产生ACK 50 | } 51 | IIC_Stop(); 52 | 53 | // 转换数据 54 | temp = (buf[0] << 8) | buf[1]; 55 | sht_data[0] = (double)(-45 + 175 * (double)temp / 65535); 56 | hum = (buf[3] << 8) | buf[4]; 57 | sht_data[1] = (double)(100 * (double)hum / 65535); 58 | } 59 | 60 | -------------------------------------------------------------------------------- /code/project/Objects/mq5.d: -------------------------------------------------------------------------------- 1 | .\objects\mq5.o: ..\mylib\mq5.c 2 | .\objects\mq5.o: ..\mylib\mq5.h 3 | .\objects\mq5.o: ..\user\stm32f10x_conf.h 4 | .\objects\mq5.o: ..\fwlib\inc\stm32f10x_adc.h 5 | .\objects\mq5.o: C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.1.0\Device\Include\stm32f10x.h 6 | .\objects\mq5.o: ..\cmsis\core_cm3.h 7 | .\objects\mq5.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdint.h 8 | .\objects\mq5.o: C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.1.0\Device\Include\system_stm32f10x.h 9 | .\objects\mq5.o: ..\user\stm32f10x_conf.h 10 | .\objects\mq5.o: ..\fwlib\inc\stm32f10x_bkp.h 11 | .\objects\mq5.o: ..\fwlib\inc\stm32f10x_can.h 12 | .\objects\mq5.o: ..\fwlib\inc\stm32f10x_cec.h 13 | .\objects\mq5.o: ..\fwlib\inc\stm32f10x_crc.h 14 | .\objects\mq5.o: ..\fwlib\inc\stm32f10x_dac.h 15 | .\objects\mq5.o: ..\fwlib\inc\stm32f10x_dbgmcu.h 16 | .\objects\mq5.o: ..\fwlib\inc\stm32f10x_dma.h 17 | .\objects\mq5.o: ..\fwlib\inc\stm32f10x_exti.h 18 | .\objects\mq5.o: ..\fwlib\inc\stm32f10x_flash.h 19 | .\objects\mq5.o: ..\fwlib\inc\stm32f10x_fsmc.h 20 | .\objects\mq5.o: ..\fwlib\inc\stm32f10x_gpio.h 21 | .\objects\mq5.o: ..\fwlib\inc\stm32f10x_i2c.h 22 | .\objects\mq5.o: ..\fwlib\inc\stm32f10x_iwdg.h 23 | .\objects\mq5.o: ..\fwlib\inc\stm32f10x_pwr.h 24 | .\objects\mq5.o: ..\fwlib\inc\stm32f10x_rcc.h 25 | .\objects\mq5.o: ..\fwlib\inc\stm32f10x_rtc.h 26 | .\objects\mq5.o: ..\fwlib\inc\stm32f10x_sdio.h 27 | .\objects\mq5.o: ..\fwlib\inc\stm32f10x_spi.h 28 | .\objects\mq5.o: ..\fwlib\inc\stm32f10x_tim.h 29 | .\objects\mq5.o: ..\fwlib\inc\stm32f10x_usart.h 30 | .\objects\mq5.o: ..\fwlib\inc\stm32f10x_wwdg.h 31 | .\objects\mq5.o: ..\fwlib\inc\misc.h 32 | -------------------------------------------------------------------------------- /web/iot/php/functions.php: -------------------------------------------------------------------------------- 1 | '; 23 | echo '错误的SQL:' . $sql . '
'; 24 | echo '错误代码:' . mysqli_errno($link) . '
'; 25 | echo '错误信息:' . mysqli_error($link) . '
'; 26 | die; // 错误结束程序 27 | } 28 | } 29 | 30 | function fetchAll($link, $sql) 31 | { 32 | 33 | //执行query()函数 34 | if ($result = query($link, $sql)) { 35 | //执行成功 36 | //遍历结果集 37 | $rows = array(); 38 | while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) { 39 | $rows[] = $row; 40 | } 41 | //释放结果集资源 42 | mysqli_free_result($result); 43 | return $rows; 44 | 45 | } else { 46 | //执行失败 47 | return false; 48 | } 49 | } 50 | 51 | function fetchRow($link, $sql) 52 | { 53 | //执行query()函数 54 | if ($result = query($link, $sql)) { 55 | //从结果集取得一次数据即可 56 | $row = mysqli_fetch_array($result, MYSQLI_ASSOC); 57 | return $row; 58 | } else { 59 | return false; 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /code/project/Objects/iwdg.d: -------------------------------------------------------------------------------- 1 | .\objects\iwdg.o: ..\mylib\iwdg.c 2 | .\objects\iwdg.o: ..\mylib\iwdg.h 3 | .\objects\iwdg.o: ..\user\stm32f10x_conf.h 4 | .\objects\iwdg.o: ..\fwlib\inc\stm32f10x_adc.h 5 | .\objects\iwdg.o: C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.1.0\Device\Include\stm32f10x.h 6 | .\objects\iwdg.o: ..\cmsis\core_cm3.h 7 | .\objects\iwdg.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdint.h 8 | .\objects\iwdg.o: C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.1.0\Device\Include\system_stm32f10x.h 9 | .\objects\iwdg.o: ..\user\stm32f10x_conf.h 10 | .\objects\iwdg.o: ..\fwlib\inc\stm32f10x_bkp.h 11 | .\objects\iwdg.o: ..\fwlib\inc\stm32f10x_can.h 12 | .\objects\iwdg.o: ..\fwlib\inc\stm32f10x_cec.h 13 | .\objects\iwdg.o: ..\fwlib\inc\stm32f10x_crc.h 14 | .\objects\iwdg.o: ..\fwlib\inc\stm32f10x_dac.h 15 | .\objects\iwdg.o: ..\fwlib\inc\stm32f10x_dbgmcu.h 16 | .\objects\iwdg.o: ..\fwlib\inc\stm32f10x_dma.h 17 | .\objects\iwdg.o: ..\fwlib\inc\stm32f10x_exti.h 18 | .\objects\iwdg.o: ..\fwlib\inc\stm32f10x_flash.h 19 | .\objects\iwdg.o: ..\fwlib\inc\stm32f10x_fsmc.h 20 | .\objects\iwdg.o: ..\fwlib\inc\stm32f10x_gpio.h 21 | .\objects\iwdg.o: ..\fwlib\inc\stm32f10x_i2c.h 22 | .\objects\iwdg.o: ..\fwlib\inc\stm32f10x_iwdg.h 23 | .\objects\iwdg.o: ..\fwlib\inc\stm32f10x_pwr.h 24 | .\objects\iwdg.o: ..\fwlib\inc\stm32f10x_rcc.h 25 | .\objects\iwdg.o: ..\fwlib\inc\stm32f10x_rtc.h 26 | .\objects\iwdg.o: ..\fwlib\inc\stm32f10x_sdio.h 27 | .\objects\iwdg.o: ..\fwlib\inc\stm32f10x_spi.h 28 | .\objects\iwdg.o: ..\fwlib\inc\stm32f10x_tim.h 29 | .\objects\iwdg.o: ..\fwlib\inc\stm32f10x_usart.h 30 | .\objects\iwdg.o: ..\fwlib\inc\stm32f10x_wwdg.h 31 | .\objects\iwdg.o: ..\fwlib\inc\misc.h 32 | -------------------------------------------------------------------------------- /code/project/Objects/fan.d: -------------------------------------------------------------------------------- 1 | .\objects\fan.o: ..\mylib\fan.c 2 | .\objects\fan.o: ..\mylib\fan.h 3 | .\objects\fan.o: ..\user\stm32f10x_conf.h 4 | .\objects\fan.o: ..\fwlib\inc\stm32f10x_adc.h 5 | .\objects\fan.o: C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.1.0\Device\Include\stm32f10x.h 6 | .\objects\fan.o: ..\cmsis\core_cm3.h 7 | .\objects\fan.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdint.h 8 | .\objects\fan.o: C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.1.0\Device\Include\system_stm32f10x.h 9 | .\objects\fan.o: ..\user\stm32f10x_conf.h 10 | .\objects\fan.o: ..\fwlib\inc\stm32f10x_bkp.h 11 | .\objects\fan.o: ..\fwlib\inc\stm32f10x_can.h 12 | .\objects\fan.o: ..\fwlib\inc\stm32f10x_cec.h 13 | .\objects\fan.o: ..\fwlib\inc\stm32f10x_crc.h 14 | .\objects\fan.o: ..\fwlib\inc\stm32f10x_dac.h 15 | .\objects\fan.o: ..\fwlib\inc\stm32f10x_dbgmcu.h 16 | .\objects\fan.o: ..\fwlib\inc\stm32f10x_dma.h 17 | .\objects\fan.o: ..\fwlib\inc\stm32f10x_exti.h 18 | .\objects\fan.o: ..\fwlib\inc\stm32f10x_flash.h 19 | .\objects\fan.o: ..\fwlib\inc\stm32f10x_fsmc.h 20 | .\objects\fan.o: ..\fwlib\inc\stm32f10x_gpio.h 21 | .\objects\fan.o: ..\fwlib\inc\stm32f10x_i2c.h 22 | .\objects\fan.o: ..\fwlib\inc\stm32f10x_iwdg.h 23 | .\objects\fan.o: ..\fwlib\inc\stm32f10x_pwr.h 24 | .\objects\fan.o: ..\fwlib\inc\stm32f10x_rcc.h 25 | .\objects\fan.o: ..\fwlib\inc\stm32f10x_rtc.h 26 | .\objects\fan.o: ..\fwlib\inc\stm32f10x_sdio.h 27 | .\objects\fan.o: ..\fwlib\inc\stm32f10x_spi.h 28 | .\objects\fan.o: ..\fwlib\inc\stm32f10x_tim.h 29 | .\objects\fan.o: ..\fwlib\inc\stm32f10x_usart.h 30 | .\objects\fan.o: ..\fwlib\inc\stm32f10x_wwdg.h 31 | .\objects\fan.o: ..\fwlib\inc\misc.h 32 | .\objects\fan.o: ..\mylib\bitband.h 33 | -------------------------------------------------------------------------------- /code/project/Objects/led.d: -------------------------------------------------------------------------------- 1 | .\objects\led.o: ..\mylib\led.c 2 | .\objects\led.o: ..\mylib\led.h 3 | .\objects\led.o: ..\user\stm32f10x_conf.h 4 | .\objects\led.o: ..\fwlib\inc\stm32f10x_adc.h 5 | .\objects\led.o: C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.1.0\Device\Include\stm32f10x.h 6 | .\objects\led.o: ..\cmsis\core_cm3.h 7 | .\objects\led.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdint.h 8 | .\objects\led.o: C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.1.0\Device\Include\system_stm32f10x.h 9 | .\objects\led.o: ..\user\stm32f10x_conf.h 10 | .\objects\led.o: ..\fwlib\inc\stm32f10x_bkp.h 11 | .\objects\led.o: ..\fwlib\inc\stm32f10x_can.h 12 | .\objects\led.o: ..\fwlib\inc\stm32f10x_cec.h 13 | .\objects\led.o: ..\fwlib\inc\stm32f10x_crc.h 14 | .\objects\led.o: ..\fwlib\inc\stm32f10x_dac.h 15 | .\objects\led.o: ..\fwlib\inc\stm32f10x_dbgmcu.h 16 | .\objects\led.o: ..\fwlib\inc\stm32f10x_dma.h 17 | .\objects\led.o: ..\fwlib\inc\stm32f10x_exti.h 18 | .\objects\led.o: ..\fwlib\inc\stm32f10x_flash.h 19 | .\objects\led.o: ..\fwlib\inc\stm32f10x_fsmc.h 20 | .\objects\led.o: ..\fwlib\inc\stm32f10x_gpio.h 21 | .\objects\led.o: ..\fwlib\inc\stm32f10x_i2c.h 22 | .\objects\led.o: ..\fwlib\inc\stm32f10x_iwdg.h 23 | .\objects\led.o: ..\fwlib\inc\stm32f10x_pwr.h 24 | .\objects\led.o: ..\fwlib\inc\stm32f10x_rcc.h 25 | .\objects\led.o: ..\fwlib\inc\stm32f10x_rtc.h 26 | .\objects\led.o: ..\fwlib\inc\stm32f10x_sdio.h 27 | .\objects\led.o: ..\fwlib\inc\stm32f10x_spi.h 28 | .\objects\led.o: ..\fwlib\inc\stm32f10x_tim.h 29 | .\objects\led.o: ..\fwlib\inc\stm32f10x_usart.h 30 | .\objects\led.o: ..\fwlib\inc\stm32f10x_wwdg.h 31 | .\objects\led.o: ..\fwlib\inc\misc.h 32 | .\objects\led.o: ..\mylib\bitband.h 33 | -------------------------------------------------------------------------------- /web/iot/images/home-img-device.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /code/project/Objects/delay.d: -------------------------------------------------------------------------------- 1 | .\objects\delay.o: ..\mylib\delay.c 2 | .\objects\delay.o: ..\mylib\delay.h 3 | .\objects\delay.o: ..\user\stm32f10x_conf.h 4 | .\objects\delay.o: ..\fwlib\inc\stm32f10x_adc.h 5 | .\objects\delay.o: C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.1.0\Device\Include\stm32f10x.h 6 | .\objects\delay.o: ..\cmsis\core_cm3.h 7 | .\objects\delay.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdint.h 8 | .\objects\delay.o: C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.1.0\Device\Include\system_stm32f10x.h 9 | .\objects\delay.o: ..\user\stm32f10x_conf.h 10 | .\objects\delay.o: ..\fwlib\inc\stm32f10x_bkp.h 11 | .\objects\delay.o: ..\fwlib\inc\stm32f10x_can.h 12 | .\objects\delay.o: ..\fwlib\inc\stm32f10x_cec.h 13 | .\objects\delay.o: ..\fwlib\inc\stm32f10x_crc.h 14 | .\objects\delay.o: ..\fwlib\inc\stm32f10x_dac.h 15 | .\objects\delay.o: ..\fwlib\inc\stm32f10x_dbgmcu.h 16 | .\objects\delay.o: ..\fwlib\inc\stm32f10x_dma.h 17 | .\objects\delay.o: ..\fwlib\inc\stm32f10x_exti.h 18 | .\objects\delay.o: ..\fwlib\inc\stm32f10x_flash.h 19 | .\objects\delay.o: ..\fwlib\inc\stm32f10x_fsmc.h 20 | .\objects\delay.o: ..\fwlib\inc\stm32f10x_gpio.h 21 | .\objects\delay.o: ..\fwlib\inc\stm32f10x_i2c.h 22 | .\objects\delay.o: ..\fwlib\inc\stm32f10x_iwdg.h 23 | .\objects\delay.o: ..\fwlib\inc\stm32f10x_pwr.h 24 | .\objects\delay.o: ..\fwlib\inc\stm32f10x_rcc.h 25 | .\objects\delay.o: ..\fwlib\inc\stm32f10x_rtc.h 26 | .\objects\delay.o: ..\fwlib\inc\stm32f10x_sdio.h 27 | .\objects\delay.o: ..\fwlib\inc\stm32f10x_spi.h 28 | .\objects\delay.o: ..\fwlib\inc\stm32f10x_tim.h 29 | .\objects\delay.o: ..\fwlib\inc\stm32f10x_usart.h 30 | .\objects\delay.o: ..\fwlib\inc\stm32f10x_wwdg.h 31 | .\objects\delay.o: ..\fwlib\inc\misc.h 32 | -------------------------------------------------------------------------------- /code/project/Objects/rtc.d: -------------------------------------------------------------------------------- 1 | .\objects\rtc.o: ..\mylib\rtc.c 2 | .\objects\rtc.o: ..\mylib\rtc.h 3 | .\objects\rtc.o: ..\user\stm32f10x_conf.h 4 | .\objects\rtc.o: ..\fwlib\inc\stm32f10x_adc.h 5 | .\objects\rtc.o: C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.1.0\Device\Include\stm32f10x.h 6 | .\objects\rtc.o: ..\cmsis\core_cm3.h 7 | .\objects\rtc.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdint.h 8 | .\objects\rtc.o: C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.1.0\Device\Include\system_stm32f10x.h 9 | .\objects\rtc.o: ..\user\stm32f10x_conf.h 10 | .\objects\rtc.o: ..\fwlib\inc\stm32f10x_bkp.h 11 | .\objects\rtc.o: ..\fwlib\inc\stm32f10x_can.h 12 | .\objects\rtc.o: ..\fwlib\inc\stm32f10x_cec.h 13 | .\objects\rtc.o: ..\fwlib\inc\stm32f10x_crc.h 14 | .\objects\rtc.o: ..\fwlib\inc\stm32f10x_dac.h 15 | .\objects\rtc.o: ..\fwlib\inc\stm32f10x_dbgmcu.h 16 | .\objects\rtc.o: ..\fwlib\inc\stm32f10x_dma.h 17 | .\objects\rtc.o: ..\fwlib\inc\stm32f10x_exti.h 18 | .\objects\rtc.o: ..\fwlib\inc\stm32f10x_flash.h 19 | .\objects\rtc.o: ..\fwlib\inc\stm32f10x_fsmc.h 20 | .\objects\rtc.o: ..\fwlib\inc\stm32f10x_gpio.h 21 | .\objects\rtc.o: ..\fwlib\inc\stm32f10x_i2c.h 22 | .\objects\rtc.o: ..\fwlib\inc\stm32f10x_iwdg.h 23 | .\objects\rtc.o: ..\fwlib\inc\stm32f10x_pwr.h 24 | .\objects\rtc.o: ..\fwlib\inc\stm32f10x_rcc.h 25 | .\objects\rtc.o: ..\fwlib\inc\stm32f10x_rtc.h 26 | .\objects\rtc.o: ..\fwlib\inc\stm32f10x_sdio.h 27 | .\objects\rtc.o: ..\fwlib\inc\stm32f10x_spi.h 28 | .\objects\rtc.o: ..\fwlib\inc\stm32f10x_tim.h 29 | .\objects\rtc.o: ..\fwlib\inc\stm32f10x_usart.h 30 | .\objects\rtc.o: ..\fwlib\inc\stm32f10x_wwdg.h 31 | .\objects\rtc.o: ..\fwlib\inc\misc.h 32 | .\objects\rtc.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\string.h 33 | -------------------------------------------------------------------------------- /code/project/Objects/fire.d: -------------------------------------------------------------------------------- 1 | .\objects\fire.o: ..\mylib\fire.c 2 | .\objects\fire.o: ..\mylib\fire.h 3 | .\objects\fire.o: ..\user\stm32f10x_conf.h 4 | .\objects\fire.o: ..\fwlib\inc\stm32f10x_adc.h 5 | .\objects\fire.o: C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.1.0\Device\Include\stm32f10x.h 6 | .\objects\fire.o: ..\cmsis\core_cm3.h 7 | .\objects\fire.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdint.h 8 | .\objects\fire.o: C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.1.0\Device\Include\system_stm32f10x.h 9 | .\objects\fire.o: ..\user\stm32f10x_conf.h 10 | .\objects\fire.o: ..\fwlib\inc\stm32f10x_bkp.h 11 | .\objects\fire.o: ..\fwlib\inc\stm32f10x_can.h 12 | .\objects\fire.o: ..\fwlib\inc\stm32f10x_cec.h 13 | .\objects\fire.o: ..\fwlib\inc\stm32f10x_crc.h 14 | .\objects\fire.o: ..\fwlib\inc\stm32f10x_dac.h 15 | .\objects\fire.o: ..\fwlib\inc\stm32f10x_dbgmcu.h 16 | .\objects\fire.o: ..\fwlib\inc\stm32f10x_dma.h 17 | .\objects\fire.o: ..\fwlib\inc\stm32f10x_exti.h 18 | .\objects\fire.o: ..\fwlib\inc\stm32f10x_flash.h 19 | .\objects\fire.o: ..\fwlib\inc\stm32f10x_fsmc.h 20 | .\objects\fire.o: ..\fwlib\inc\stm32f10x_gpio.h 21 | .\objects\fire.o: ..\fwlib\inc\stm32f10x_i2c.h 22 | .\objects\fire.o: ..\fwlib\inc\stm32f10x_iwdg.h 23 | .\objects\fire.o: ..\fwlib\inc\stm32f10x_pwr.h 24 | .\objects\fire.o: ..\fwlib\inc\stm32f10x_rcc.h 25 | .\objects\fire.o: ..\fwlib\inc\stm32f10x_rtc.h 26 | .\objects\fire.o: ..\fwlib\inc\stm32f10x_sdio.h 27 | .\objects\fire.o: ..\fwlib\inc\stm32f10x_spi.h 28 | .\objects\fire.o: ..\fwlib\inc\stm32f10x_tim.h 29 | .\objects\fire.o: ..\fwlib\inc\stm32f10x_usart.h 30 | .\objects\fire.o: ..\fwlib\inc\stm32f10x_wwdg.h 31 | .\objects\fire.o: ..\fwlib\inc\misc.h 32 | .\objects\fire.o: ..\mylib\bitband.h 33 | -------------------------------------------------------------------------------- /code/mylib/oled.h: -------------------------------------------------------------------------------- 1 | #ifndef __OLED_H 2 | #define __OLED_H 3 | /* 4 | 用GPIO的方式来模拟IIC协议 5 | 这样做的优点是移植性是最好的 6 | 通过硬件原理图可知 7 | 时钟线 IIC_SCL PB6 8 | 数据线 IIC_SDA PB7 9 | oled.c 和 oled.h 是用来操作开发板上有关OLED的实验 10 | */ 11 | #include "stdlib.h"//包含了标准库的头文件 12 | 13 | typedef unsigned char u8;//通过typedef定义u8类型 14 | typedef unsigned int u32;//通过typedef定义u32类型 15 | 16 | #define OLED_CMD 0 //写命令 17 | #define OLED_DATA 1 //写数据 18 | 19 | 20 | //OLED控制用函数 21 | extern void OLED_WR_Byte(u8 data, u8 cmd);//IIC为CMD写入一个字节的数据 22 | 23 | extern void OLED_Display_On(void);//OLED开启显示 24 | 25 | extern void OLED_Display_Off(void);//OLED关闭显示 26 | 27 | extern void OLED_Init(void);//初始化OLED 28 | 29 | extern void OLED_Clear(void);//OLED清屏 30 | 31 | extern void OLED_DrawPoint(u8 x, u8 y, u8 t);//画一个点 32 | 33 | extern void OLED_Fill(u8 x1, u8 y1, u8 x2, u8 y2, u8 dot);//画一个矩形 34 | 35 | extern void OLED_ShowChar(u8 x, u8 y, u8 chr, u8 Char_Size);//显示一个字符 36 | 37 | extern void OLED_ShowNum(u8 x, u8 y, u32 num, u8 len, u8 size);//显示一个整数 38 | 39 | extern void OLED_ShowString(u8 x, u8 y, u8 *p, u8 Char_Size);//显示一个字符串 40 | 41 | extern void OLED_Set_Pos(u8 x, u8 y);//设置像素点的坐标 42 | 43 | extern void OLED_ShowTEmp(u8 x, u8 y);//显示汉字温度 44 | 45 | extern void OLED_ShowHUm(u8 x, u8 y);//显示汉字湿度 46 | 47 | extern void OLED_ShowFIre(u8 x, u8 y);//显示汉字火焰 48 | 49 | extern void OLED_ShowGAs(u8 x, u8 y);//显示汉字气体 50 | 51 | extern void OLED_ShowTIttle(u8 x, u8 y);//显示摄氏度的符号 52 | 53 | extern void OLED_ShowCHinese(u8 x, u8 y);//显示汉字 54 | 55 | extern void OLED_DrawBMP(u8 x0, u8 y0, u8 x1, u8 y1, u8 BMP[]);//显示图片 56 | 57 | extern void fill_picture(u8 fill_Data);//填充图片 58 | 59 | #endif 60 | 61 | 62 | 63 | 64 | -------------------------------------------------------------------------------- /code/project/Objects/ldt.d: -------------------------------------------------------------------------------- 1 | .\objects\ldt.o: ..\mylib\ldt.c 2 | .\objects\ldt.o: ..\mylib\ldt.h 3 | .\objects\ldt.o: ..\user\stm32f10x_conf.h 4 | .\objects\ldt.o: ..\fwlib\inc\stm32f10x_adc.h 5 | .\objects\ldt.o: C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.1.0\Device\Include\stm32f10x.h 6 | .\objects\ldt.o: ..\cmsis\core_cm3.h 7 | .\objects\ldt.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdint.h 8 | .\objects\ldt.o: C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.1.0\Device\Include\system_stm32f10x.h 9 | .\objects\ldt.o: ..\user\stm32f10x_conf.h 10 | .\objects\ldt.o: ..\fwlib\inc\stm32f10x_bkp.h 11 | .\objects\ldt.o: ..\fwlib\inc\stm32f10x_can.h 12 | .\objects\ldt.o: ..\fwlib\inc\stm32f10x_cec.h 13 | .\objects\ldt.o: ..\fwlib\inc\stm32f10x_crc.h 14 | .\objects\ldt.o: ..\fwlib\inc\stm32f10x_dac.h 15 | .\objects\ldt.o: ..\fwlib\inc\stm32f10x_dbgmcu.h 16 | .\objects\ldt.o: ..\fwlib\inc\stm32f10x_dma.h 17 | .\objects\ldt.o: ..\fwlib\inc\stm32f10x_exti.h 18 | .\objects\ldt.o: ..\fwlib\inc\stm32f10x_flash.h 19 | .\objects\ldt.o: ..\fwlib\inc\stm32f10x_fsmc.h 20 | .\objects\ldt.o: ..\fwlib\inc\stm32f10x_gpio.h 21 | .\objects\ldt.o: ..\fwlib\inc\stm32f10x_i2c.h 22 | .\objects\ldt.o: ..\fwlib\inc\stm32f10x_iwdg.h 23 | .\objects\ldt.o: ..\fwlib\inc\stm32f10x_pwr.h 24 | .\objects\ldt.o: ..\fwlib\inc\stm32f10x_rcc.h 25 | .\objects\ldt.o: ..\fwlib\inc\stm32f10x_rtc.h 26 | .\objects\ldt.o: ..\fwlib\inc\stm32f10x_sdio.h 27 | .\objects\ldt.o: ..\fwlib\inc\stm32f10x_spi.h 28 | .\objects\ldt.o: ..\fwlib\inc\stm32f10x_tim.h 29 | .\objects\ldt.o: ..\fwlib\inc\stm32f10x_usart.h 30 | .\objects\ldt.o: ..\fwlib\inc\stm32f10x_wwdg.h 31 | .\objects\ldt.o: ..\fwlib\inc\misc.h 32 | .\objects\ldt.o: ..\mylib\bitband.h 33 | .\objects\ldt.o: ..\mylib\delay.h 34 | -------------------------------------------------------------------------------- /code/project/Objects/sht.d: -------------------------------------------------------------------------------- 1 | .\objects\sht.o: ..\mylib\sht.c 2 | .\objects\sht.o: ..\mylib\sht.h 3 | .\objects\sht.o: ..\user\stm32f10x_conf.h 4 | .\objects\sht.o: ..\fwlib\inc\stm32f10x_adc.h 5 | .\objects\sht.o: C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.1.0\Device\Include\stm32f10x.h 6 | .\objects\sht.o: ..\cmsis\core_cm3.h 7 | .\objects\sht.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdint.h 8 | .\objects\sht.o: C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.1.0\Device\Include\system_stm32f10x.h 9 | .\objects\sht.o: ..\user\stm32f10x_conf.h 10 | .\objects\sht.o: ..\fwlib\inc\stm32f10x_bkp.h 11 | .\objects\sht.o: ..\fwlib\inc\stm32f10x_can.h 12 | .\objects\sht.o: ..\fwlib\inc\stm32f10x_cec.h 13 | .\objects\sht.o: ..\fwlib\inc\stm32f10x_crc.h 14 | .\objects\sht.o: ..\fwlib\inc\stm32f10x_dac.h 15 | .\objects\sht.o: ..\fwlib\inc\stm32f10x_dbgmcu.h 16 | .\objects\sht.o: ..\fwlib\inc\stm32f10x_dma.h 17 | .\objects\sht.o: ..\fwlib\inc\stm32f10x_exti.h 18 | .\objects\sht.o: ..\fwlib\inc\stm32f10x_flash.h 19 | .\objects\sht.o: ..\fwlib\inc\stm32f10x_fsmc.h 20 | .\objects\sht.o: ..\fwlib\inc\stm32f10x_gpio.h 21 | .\objects\sht.o: ..\fwlib\inc\stm32f10x_i2c.h 22 | .\objects\sht.o: ..\fwlib\inc\stm32f10x_iwdg.h 23 | .\objects\sht.o: ..\fwlib\inc\stm32f10x_pwr.h 24 | .\objects\sht.o: ..\fwlib\inc\stm32f10x_rcc.h 25 | .\objects\sht.o: ..\fwlib\inc\stm32f10x_rtc.h 26 | .\objects\sht.o: ..\fwlib\inc\stm32f10x_sdio.h 27 | .\objects\sht.o: ..\fwlib\inc\stm32f10x_spi.h 28 | .\objects\sht.o: ..\fwlib\inc\stm32f10x_tim.h 29 | .\objects\sht.o: ..\fwlib\inc\stm32f10x_usart.h 30 | .\objects\sht.o: ..\fwlib\inc\stm32f10x_wwdg.h 31 | .\objects\sht.o: ..\fwlib\inc\misc.h 32 | .\objects\sht.o: ..\mylib\gpio_iic.h 33 | .\objects\sht.o: ..\mylib\delay.h 34 | -------------------------------------------------------------------------------- /code/project/Objects/misc.d: -------------------------------------------------------------------------------- 1 | .\objects\misc.o: ..\fwlib\src\misc.c 2 | .\objects\misc.o: ..\fwlib\inc\misc.h 3 | .\objects\misc.o: C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.1.0\Device\Include\stm32f10x.h 4 | .\objects\misc.o: ..\cmsis\core_cm3.h 5 | .\objects\misc.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdint.h 6 | .\objects\misc.o: C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.1.0\Device\Include\system_stm32f10x.h 7 | .\objects\misc.o: ..\user\stm32f10x_conf.h 8 | .\objects\misc.o: ..\fwlib\inc\stm32f10x_adc.h 9 | .\objects\misc.o: C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.1.0\Device\Include\stm32f10x.h 10 | .\objects\misc.o: ..\fwlib\inc\stm32f10x_bkp.h 11 | .\objects\misc.o: ..\fwlib\inc\stm32f10x_can.h 12 | .\objects\misc.o: ..\fwlib\inc\stm32f10x_cec.h 13 | .\objects\misc.o: ..\fwlib\inc\stm32f10x_crc.h 14 | .\objects\misc.o: ..\fwlib\inc\stm32f10x_dac.h 15 | .\objects\misc.o: ..\fwlib\inc\stm32f10x_dbgmcu.h 16 | .\objects\misc.o: ..\fwlib\inc\stm32f10x_dma.h 17 | .\objects\misc.o: ..\fwlib\inc\stm32f10x_exti.h 18 | .\objects\misc.o: ..\fwlib\inc\stm32f10x_flash.h 19 | .\objects\misc.o: ..\fwlib\inc\stm32f10x_fsmc.h 20 | .\objects\misc.o: ..\fwlib\inc\stm32f10x_gpio.h 21 | .\objects\misc.o: ..\fwlib\inc\stm32f10x_i2c.h 22 | .\objects\misc.o: ..\fwlib\inc\stm32f10x_iwdg.h 23 | .\objects\misc.o: ..\fwlib\inc\stm32f10x_pwr.h 24 | .\objects\misc.o: ..\fwlib\inc\stm32f10x_rcc.h 25 | .\objects\misc.o: ..\fwlib\inc\stm32f10x_rtc.h 26 | .\objects\misc.o: ..\fwlib\inc\stm32f10x_sdio.h 27 | .\objects\misc.o: ..\fwlib\inc\stm32f10x_spi.h 28 | .\objects\misc.o: ..\fwlib\inc\stm32f10x_tim.h 29 | .\objects\misc.o: ..\fwlib\inc\stm32f10x_usart.h 30 | .\objects\misc.o: ..\fwlib\inc\stm32f10x_wwdg.h 31 | .\objects\misc.o: ..\fwlib\inc\misc.h 32 | -------------------------------------------------------------------------------- /code/project/Objects/relay.d: -------------------------------------------------------------------------------- 1 | .\objects\relay.o: ..\mylib\relay.c 2 | .\objects\relay.o: ..\mylib\relay.h 3 | .\objects\relay.o: ..\user\stm32f10x_conf.h 4 | .\objects\relay.o: ..\fwlib\inc\stm32f10x_adc.h 5 | .\objects\relay.o: C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.1.0\Device\Include\stm32f10x.h 6 | .\objects\relay.o: ..\cmsis\core_cm3.h 7 | .\objects\relay.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdint.h 8 | .\objects\relay.o: C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.1.0\Device\Include\system_stm32f10x.h 9 | .\objects\relay.o: ..\user\stm32f10x_conf.h 10 | .\objects\relay.o: ..\fwlib\inc\stm32f10x_bkp.h 11 | .\objects\relay.o: ..\fwlib\inc\stm32f10x_can.h 12 | .\objects\relay.o: ..\fwlib\inc\stm32f10x_cec.h 13 | .\objects\relay.o: ..\fwlib\inc\stm32f10x_crc.h 14 | .\objects\relay.o: ..\fwlib\inc\stm32f10x_dac.h 15 | .\objects\relay.o: ..\fwlib\inc\stm32f10x_dbgmcu.h 16 | .\objects\relay.o: ..\fwlib\inc\stm32f10x_dma.h 17 | .\objects\relay.o: ..\fwlib\inc\stm32f10x_exti.h 18 | .\objects\relay.o: ..\fwlib\inc\stm32f10x_flash.h 19 | .\objects\relay.o: ..\fwlib\inc\stm32f10x_fsmc.h 20 | .\objects\relay.o: ..\fwlib\inc\stm32f10x_gpio.h 21 | .\objects\relay.o: ..\fwlib\inc\stm32f10x_i2c.h 22 | .\objects\relay.o: ..\fwlib\inc\stm32f10x_iwdg.h 23 | .\objects\relay.o: ..\fwlib\inc\stm32f10x_pwr.h 24 | .\objects\relay.o: ..\fwlib\inc\stm32f10x_rcc.h 25 | .\objects\relay.o: ..\fwlib\inc\stm32f10x_rtc.h 26 | .\objects\relay.o: ..\fwlib\inc\stm32f10x_sdio.h 27 | .\objects\relay.o: ..\fwlib\inc\stm32f10x_spi.h 28 | .\objects\relay.o: ..\fwlib\inc\stm32f10x_tim.h 29 | .\objects\relay.o: ..\fwlib\inc\stm32f10x_usart.h 30 | .\objects\relay.o: ..\fwlib\inc\stm32f10x_wwdg.h 31 | .\objects\relay.o: ..\fwlib\inc\misc.h 32 | .\objects\relay.o: ..\mylib\bitband.h 33 | -------------------------------------------------------------------------------- /code/project/Objects/eint.d: -------------------------------------------------------------------------------- 1 | .\objects\eint.o: ..\mylib\eint.c 2 | .\objects\eint.o: ..\mylib\eint.h 3 | .\objects\eint.o: ..\user\stm32f10x_conf.h 4 | .\objects\eint.o: ..\fwlib\inc\stm32f10x_adc.h 5 | .\objects\eint.o: C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.1.0\Device\Include\stm32f10x.h 6 | .\objects\eint.o: ..\cmsis\core_cm3.h 7 | .\objects\eint.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdint.h 8 | .\objects\eint.o: C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.1.0\Device\Include\system_stm32f10x.h 9 | .\objects\eint.o: ..\user\stm32f10x_conf.h 10 | .\objects\eint.o: ..\fwlib\inc\stm32f10x_bkp.h 11 | .\objects\eint.o: ..\fwlib\inc\stm32f10x_can.h 12 | .\objects\eint.o: ..\fwlib\inc\stm32f10x_cec.h 13 | .\objects\eint.o: ..\fwlib\inc\stm32f10x_crc.h 14 | .\objects\eint.o: ..\fwlib\inc\stm32f10x_dac.h 15 | .\objects\eint.o: ..\fwlib\inc\stm32f10x_dbgmcu.h 16 | .\objects\eint.o: ..\fwlib\inc\stm32f10x_dma.h 17 | .\objects\eint.o: ..\fwlib\inc\stm32f10x_exti.h 18 | .\objects\eint.o: ..\fwlib\inc\stm32f10x_flash.h 19 | .\objects\eint.o: ..\fwlib\inc\stm32f10x_fsmc.h 20 | .\objects\eint.o: ..\fwlib\inc\stm32f10x_gpio.h 21 | .\objects\eint.o: ..\fwlib\inc\stm32f10x_i2c.h 22 | .\objects\eint.o: ..\fwlib\inc\stm32f10x_iwdg.h 23 | .\objects\eint.o: ..\fwlib\inc\stm32f10x_pwr.h 24 | .\objects\eint.o: ..\fwlib\inc\stm32f10x_rcc.h 25 | .\objects\eint.o: ..\fwlib\inc\stm32f10x_rtc.h 26 | .\objects\eint.o: ..\fwlib\inc\stm32f10x_sdio.h 27 | .\objects\eint.o: ..\fwlib\inc\stm32f10x_spi.h 28 | .\objects\eint.o: ..\fwlib\inc\stm32f10x_tim.h 29 | .\objects\eint.o: ..\fwlib\inc\stm32f10x_usart.h 30 | .\objects\eint.o: ..\fwlib\inc\stm32f10x_wwdg.h 31 | .\objects\eint.o: ..\fwlib\inc\misc.h 32 | .\objects\eint.o: ..\mylib\delay.h 33 | .\objects\eint.o: ..\mylib\button.h 34 | -------------------------------------------------------------------------------- /code/mylib/mq5.c: -------------------------------------------------------------------------------- 1 | #include "mq5.h" 2 | 3 | /* 4 | 液化气传感器 5 | AO PC4 模拟输入 由原理图可知AD转换通道为14 6 | DO PA4 数字输入 7 | */ 8 | 9 | void adc_init(void) // 初始化ADC 10 | { 11 | GPIO_InitTypeDef Gpio_Value; 12 | ADC_InitTypeDef Adc_Value; 13 | 14 | // 使能时钟 15 | RCC_APB2PeriphClockCmd(RCC_APB2Periph_ADC1 | RCC_APB2Periph_GPIOA | RCC_APB2Periph_GPIOC, ENABLE); 16 | 17 | // 初始化GPIO 18 | Gpio_Value.GPIO_Mode = GPIO_Mode_AIN; // 模拟输入 19 | Gpio_Value.GPIO_Pin = GPIO_Pin_4; 20 | GPIO_Init(GPIOA, &Gpio_Value); 21 | 22 | Gpio_Value.GPIO_Mode = GPIO_Mode_IN_FLOATING; // 浮空输入 23 | GPIO_Init(GPIOC, &Gpio_Value); 24 | 25 | // 初始化ADC 26 | Adc_Value.ADC_ContinuousConvMode = DISABLE; // 连续转换模式关闭 27 | Adc_Value.ADC_DataAlign = ADC_DataAlign_Right; // 数据右对齐 28 | Adc_Value.ADC_ExternalTrigConv = ADC_ExternalTrigConv_None; // 关闭外部触发 29 | Adc_Value.ADC_Mode = ADC_Mode_Independent; // 单次转换模式 30 | Adc_Value.ADC_NbrOfChannel = 14; // 转换通道为14 31 | Adc_Value.ADC_ScanConvMode = DISABLE; // 扫描模式关闭 32 | ADC_Init(ADC1, &Adc_Value); 33 | 34 | // 配置转换通道 35 | ADC_RegularChannelConfig(ADC1, ADC_Channel_14, 1, ADC_SampleTime_239Cycles5); 36 | 37 | // 使能ADC 38 | ADC_Cmd(ADC1, ENABLE); 39 | } 40 | 41 | void adc_start(void) // 开始转换 42 | { 43 | ADC_SoftwareStartConvCmd(ADC1, ENABLE); 44 | } 45 | 46 | void adc_wait(void) 47 | { 48 | while(ADC_GetFlagStatus(ADC1, ADC_FLAG_EOC) == RESET); 49 | ADC_ClearFlag(ADC1, ADC_FLAG_EOC); // 清除标志位 50 | } 51 | 52 | int adc_get_value(void) 53 | { 54 | return ADC_GetConversionValue(ADC1); 55 | } 56 | 57 | void mq5_init(void) // 初始化 58 | { 59 | adc_init(); 60 | } 61 | 62 | int mq5_get_value(void) // 获取检测的模拟量 63 | { 64 | adc_start(); 65 | adc_wait(); 66 | return adc_get_value(); 67 | } 68 | 69 | -------------------------------------------------------------------------------- /web/iot/php/esp_upload.php: -------------------------------------------------------------------------------- 1 | {"data":15.24} 16 | // [1] => POST /iot/php/esp_upload.php 17 | // [2] => s_id 18 | // [3] => 1 19 | //print_r($content); 20 | //$arr = preg_split('[\r\n|\?|&|=]', $content); // 分割字符串 21 | // GET /iot/php/esp_upload.php?s_id=19&s_data=36.708629 22 | if (!empty($_GET)) { 23 | if (isset($_GET['s_id']) && isset($_GET['s_data'])) { 24 | $s_id = $_GET['s_id']; 25 | $s_data = $_GET['s_data']; 26 | $sql = 'update sensors set s_data = "' . $s_data . '" where s_id = "' . $s_id . '";'; 27 | if (query($link, $sql)) { 28 | $ret = array('status' => 200); 29 | $ret = json_encode($ret, JSON_UNESCAPED_UNICODE); 30 | echo $ret; 31 | } 32 | 33 | // 存入history 34 | $sql = 'select * from sensors where s_id = "' . $s_id . '";'; 35 | if ($res = fetchRow($link, $sql)) { 36 | if ($res['s_type'] == 'data') { 37 | $d_id = $res['d_id']; 38 | $s_name = $res['s_name']; 39 | $sql = 'insert into history(d_id, s_id, s_name, s_data, time) values("' . $d_id . '", "' . $s_id . '", "' . $s_name . '", "' . $s_data . '", "' . $time . '");'; 40 | query($link, $sql); 41 | } 42 | } 43 | } 44 | } 45 | 46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /code/project/Objects/button.d: -------------------------------------------------------------------------------- 1 | .\objects\button.o: ..\mylib\button.c 2 | .\objects\button.o: ..\mylib\button.h 3 | .\objects\button.o: ..\user\stm32f10x_conf.h 4 | .\objects\button.o: ..\fwlib\inc\stm32f10x_adc.h 5 | .\objects\button.o: C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.1.0\Device\Include\stm32f10x.h 6 | .\objects\button.o: ..\cmsis\core_cm3.h 7 | .\objects\button.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdint.h 8 | .\objects\button.o: C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.1.0\Device\Include\system_stm32f10x.h 9 | .\objects\button.o: ..\user\stm32f10x_conf.h 10 | .\objects\button.o: ..\fwlib\inc\stm32f10x_bkp.h 11 | .\objects\button.o: ..\fwlib\inc\stm32f10x_can.h 12 | .\objects\button.o: ..\fwlib\inc\stm32f10x_cec.h 13 | .\objects\button.o: ..\fwlib\inc\stm32f10x_crc.h 14 | .\objects\button.o: ..\fwlib\inc\stm32f10x_dac.h 15 | .\objects\button.o: ..\fwlib\inc\stm32f10x_dbgmcu.h 16 | .\objects\button.o: ..\fwlib\inc\stm32f10x_dma.h 17 | .\objects\button.o: ..\fwlib\inc\stm32f10x_exti.h 18 | .\objects\button.o: ..\fwlib\inc\stm32f10x_flash.h 19 | .\objects\button.o: ..\fwlib\inc\stm32f10x_fsmc.h 20 | .\objects\button.o: ..\fwlib\inc\stm32f10x_gpio.h 21 | .\objects\button.o: ..\fwlib\inc\stm32f10x_i2c.h 22 | .\objects\button.o: ..\fwlib\inc\stm32f10x_iwdg.h 23 | .\objects\button.o: ..\fwlib\inc\stm32f10x_pwr.h 24 | .\objects\button.o: ..\fwlib\inc\stm32f10x_rcc.h 25 | .\objects\button.o: ..\fwlib\inc\stm32f10x_rtc.h 26 | .\objects\button.o: ..\fwlib\inc\stm32f10x_sdio.h 27 | .\objects\button.o: ..\fwlib\inc\stm32f10x_spi.h 28 | .\objects\button.o: ..\fwlib\inc\stm32f10x_tim.h 29 | .\objects\button.o: ..\fwlib\inc\stm32f10x_usart.h 30 | .\objects\button.o: ..\fwlib\inc\stm32f10x_wwdg.h 31 | .\objects\button.o: ..\fwlib\inc\misc.h 32 | .\objects\button.o: ..\mylib\bitband.h 33 | -------------------------------------------------------------------------------- /code/project/Objects/buzzer.d: -------------------------------------------------------------------------------- 1 | .\objects\buzzer.o: ..\mylib\buzzer.c 2 | .\objects\buzzer.o: ..\mylib\buzzer.h 3 | .\objects\buzzer.o: ..\user\stm32f10x_conf.h 4 | .\objects\buzzer.o: ..\fwlib\inc\stm32f10x_adc.h 5 | .\objects\buzzer.o: C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.1.0\Device\Include\stm32f10x.h 6 | .\objects\buzzer.o: ..\cmsis\core_cm3.h 7 | .\objects\buzzer.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdint.h 8 | .\objects\buzzer.o: C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.1.0\Device\Include\system_stm32f10x.h 9 | .\objects\buzzer.o: ..\user\stm32f10x_conf.h 10 | .\objects\buzzer.o: ..\fwlib\inc\stm32f10x_bkp.h 11 | .\objects\buzzer.o: ..\fwlib\inc\stm32f10x_can.h 12 | .\objects\buzzer.o: ..\fwlib\inc\stm32f10x_cec.h 13 | .\objects\buzzer.o: ..\fwlib\inc\stm32f10x_crc.h 14 | .\objects\buzzer.o: ..\fwlib\inc\stm32f10x_dac.h 15 | .\objects\buzzer.o: ..\fwlib\inc\stm32f10x_dbgmcu.h 16 | .\objects\buzzer.o: ..\fwlib\inc\stm32f10x_dma.h 17 | .\objects\buzzer.o: ..\fwlib\inc\stm32f10x_exti.h 18 | .\objects\buzzer.o: ..\fwlib\inc\stm32f10x_flash.h 19 | .\objects\buzzer.o: ..\fwlib\inc\stm32f10x_fsmc.h 20 | .\objects\buzzer.o: ..\fwlib\inc\stm32f10x_gpio.h 21 | .\objects\buzzer.o: ..\fwlib\inc\stm32f10x_i2c.h 22 | .\objects\buzzer.o: ..\fwlib\inc\stm32f10x_iwdg.h 23 | .\objects\buzzer.o: ..\fwlib\inc\stm32f10x_pwr.h 24 | .\objects\buzzer.o: ..\fwlib\inc\stm32f10x_rcc.h 25 | .\objects\buzzer.o: ..\fwlib\inc\stm32f10x_rtc.h 26 | .\objects\buzzer.o: ..\fwlib\inc\stm32f10x_sdio.h 27 | .\objects\buzzer.o: ..\fwlib\inc\stm32f10x_spi.h 28 | .\objects\buzzer.o: ..\fwlib\inc\stm32f10x_tim.h 29 | .\objects\buzzer.o: ..\fwlib\inc\stm32f10x_usart.h 30 | .\objects\buzzer.o: ..\fwlib\inc\stm32f10x_wwdg.h 31 | .\objects\buzzer.o: ..\fwlib\inc\misc.h 32 | .\objects\buzzer.o: ..\mylib\bitband.h 33 | -------------------------------------------------------------------------------- /code/project/Objects/usart2.d: -------------------------------------------------------------------------------- 1 | .\objects\usart2.o: ..\mylib\usart2.c 2 | .\objects\usart2.o: ..\mylib\usart2.h 3 | .\objects\usart2.o: ..\user\stm32f10x_conf.h 4 | .\objects\usart2.o: ..\fwlib\inc\stm32f10x_adc.h 5 | .\objects\usart2.o: C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.1.0\Device\Include\stm32f10x.h 6 | .\objects\usart2.o: ..\cmsis\core_cm3.h 7 | .\objects\usart2.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdint.h 8 | .\objects\usart2.o: C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.1.0\Device\Include\system_stm32f10x.h 9 | .\objects\usart2.o: ..\user\stm32f10x_conf.h 10 | .\objects\usart2.o: ..\fwlib\inc\stm32f10x_bkp.h 11 | .\objects\usart2.o: ..\fwlib\inc\stm32f10x_can.h 12 | .\objects\usart2.o: ..\fwlib\inc\stm32f10x_cec.h 13 | .\objects\usart2.o: ..\fwlib\inc\stm32f10x_crc.h 14 | .\objects\usart2.o: ..\fwlib\inc\stm32f10x_dac.h 15 | .\objects\usart2.o: ..\fwlib\inc\stm32f10x_dbgmcu.h 16 | .\objects\usart2.o: ..\fwlib\inc\stm32f10x_dma.h 17 | .\objects\usart2.o: ..\fwlib\inc\stm32f10x_exti.h 18 | .\objects\usart2.o: ..\fwlib\inc\stm32f10x_flash.h 19 | .\objects\usart2.o: ..\fwlib\inc\stm32f10x_fsmc.h 20 | .\objects\usart2.o: ..\fwlib\inc\stm32f10x_gpio.h 21 | .\objects\usart2.o: ..\fwlib\inc\stm32f10x_i2c.h 22 | .\objects\usart2.o: ..\fwlib\inc\stm32f10x_iwdg.h 23 | .\objects\usart2.o: ..\fwlib\inc\stm32f10x_pwr.h 24 | .\objects\usart2.o: ..\fwlib\inc\stm32f10x_rcc.h 25 | .\objects\usart2.o: ..\fwlib\inc\stm32f10x_rtc.h 26 | .\objects\usart2.o: ..\fwlib\inc\stm32f10x_sdio.h 27 | .\objects\usart2.o: ..\fwlib\inc\stm32f10x_spi.h 28 | .\objects\usart2.o: ..\fwlib\inc\stm32f10x_tim.h 29 | .\objects\usart2.o: ..\fwlib\inc\stm32f10x_usart.h 30 | .\objects\usart2.o: ..\fwlib\inc\stm32f10x_wwdg.h 31 | .\objects\usart2.o: ..\fwlib\inc\misc.h 32 | .\objects\usart2.o: ..\mylib\esp8266.h 33 | -------------------------------------------------------------------------------- /code/project/Objects/dht11.d: -------------------------------------------------------------------------------- 1 | .\objects\dht11.o: ..\mylib\dht11.c 2 | .\objects\dht11.o: ..\mylib\dht11.h 3 | .\objects\dht11.o: ..\mylib\delay.h 4 | .\objects\dht11.o: ..\user\stm32f10x_conf.h 5 | .\objects\dht11.o: ..\fwlib\inc\stm32f10x_adc.h 6 | .\objects\dht11.o: C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.1.0\Device\Include\stm32f10x.h 7 | .\objects\dht11.o: ..\cmsis\core_cm3.h 8 | .\objects\dht11.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdint.h 9 | .\objects\dht11.o: C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.1.0\Device\Include\system_stm32f10x.h 10 | .\objects\dht11.o: ..\user\stm32f10x_conf.h 11 | .\objects\dht11.o: ..\fwlib\inc\stm32f10x_bkp.h 12 | .\objects\dht11.o: ..\fwlib\inc\stm32f10x_can.h 13 | .\objects\dht11.o: ..\fwlib\inc\stm32f10x_cec.h 14 | .\objects\dht11.o: ..\fwlib\inc\stm32f10x_crc.h 15 | .\objects\dht11.o: ..\fwlib\inc\stm32f10x_dac.h 16 | .\objects\dht11.o: ..\fwlib\inc\stm32f10x_dbgmcu.h 17 | .\objects\dht11.o: ..\fwlib\inc\stm32f10x_dma.h 18 | .\objects\dht11.o: ..\fwlib\inc\stm32f10x_exti.h 19 | .\objects\dht11.o: ..\fwlib\inc\stm32f10x_flash.h 20 | .\objects\dht11.o: ..\fwlib\inc\stm32f10x_fsmc.h 21 | .\objects\dht11.o: ..\fwlib\inc\stm32f10x_gpio.h 22 | .\objects\dht11.o: ..\fwlib\inc\stm32f10x_i2c.h 23 | .\objects\dht11.o: ..\fwlib\inc\stm32f10x_iwdg.h 24 | .\objects\dht11.o: ..\fwlib\inc\stm32f10x_pwr.h 25 | .\objects\dht11.o: ..\fwlib\inc\stm32f10x_rcc.h 26 | .\objects\dht11.o: ..\fwlib\inc\stm32f10x_rtc.h 27 | .\objects\dht11.o: ..\fwlib\inc\stm32f10x_sdio.h 28 | .\objects\dht11.o: ..\fwlib\inc\stm32f10x_spi.h 29 | .\objects\dht11.o: ..\fwlib\inc\stm32f10x_tim.h 30 | .\objects\dht11.o: ..\fwlib\inc\stm32f10x_usart.h 31 | .\objects\dht11.o: ..\fwlib\inc\stm32f10x_wwdg.h 32 | .\objects\dht11.o: ..\fwlib\inc\misc.h 33 | .\objects\dht11.o: ..\mylib\bitband.h 34 | -------------------------------------------------------------------------------- /code/project/Objects/usart1.d: -------------------------------------------------------------------------------- 1 | .\objects\usart1.o: ..\mylib\usart1.c 2 | .\objects\usart1.o: ..\mylib\usart1.h 3 | .\objects\usart1.o: ..\user\stm32f10x_conf.h 4 | .\objects\usart1.o: ..\fwlib\inc\stm32f10x_adc.h 5 | .\objects\usart1.o: C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.1.0\Device\Include\stm32f10x.h 6 | .\objects\usart1.o: ..\cmsis\core_cm3.h 7 | .\objects\usart1.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdint.h 8 | .\objects\usart1.o: C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.1.0\Device\Include\system_stm32f10x.h 9 | .\objects\usart1.o: ..\user\stm32f10x_conf.h 10 | .\objects\usart1.o: ..\fwlib\inc\stm32f10x_bkp.h 11 | .\objects\usart1.o: ..\fwlib\inc\stm32f10x_can.h 12 | .\objects\usart1.o: ..\fwlib\inc\stm32f10x_cec.h 13 | .\objects\usart1.o: ..\fwlib\inc\stm32f10x_crc.h 14 | .\objects\usart1.o: ..\fwlib\inc\stm32f10x_dac.h 15 | .\objects\usart1.o: ..\fwlib\inc\stm32f10x_dbgmcu.h 16 | .\objects\usart1.o: ..\fwlib\inc\stm32f10x_dma.h 17 | .\objects\usart1.o: ..\fwlib\inc\stm32f10x_exti.h 18 | .\objects\usart1.o: ..\fwlib\inc\stm32f10x_flash.h 19 | .\objects\usart1.o: ..\fwlib\inc\stm32f10x_fsmc.h 20 | .\objects\usart1.o: ..\fwlib\inc\stm32f10x_gpio.h 21 | .\objects\usart1.o: ..\fwlib\inc\stm32f10x_i2c.h 22 | .\objects\usart1.o: ..\fwlib\inc\stm32f10x_iwdg.h 23 | .\objects\usart1.o: ..\fwlib\inc\stm32f10x_pwr.h 24 | .\objects\usart1.o: ..\fwlib\inc\stm32f10x_rcc.h 25 | .\objects\usart1.o: ..\fwlib\inc\stm32f10x_rtc.h 26 | .\objects\usart1.o: ..\fwlib\inc\stm32f10x_sdio.h 27 | .\objects\usart1.o: ..\fwlib\inc\stm32f10x_spi.h 28 | .\objects\usart1.o: ..\fwlib\inc\stm32f10x_tim.h 29 | .\objects\usart1.o: ..\fwlib\inc\stm32f10x_usart.h 30 | .\objects\usart1.o: ..\fwlib\inc\stm32f10x_wwdg.h 31 | .\objects\usart1.o: ..\fwlib\inc\misc.h 32 | .\objects\usart1.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\string.h 33 | -------------------------------------------------------------------------------- /code/project/Objects/eeprom.d: -------------------------------------------------------------------------------- 1 | .\objects\eeprom.o: ..\mylib\eeprom.c 2 | .\objects\eeprom.o: ..\mylib\eeprom.h 3 | .\objects\eeprom.o: ..\user\stm32f10x_conf.h 4 | .\objects\eeprom.o: ..\fwlib\inc\stm32f10x_adc.h 5 | .\objects\eeprom.o: C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.1.0\Device\Include\stm32f10x.h 6 | .\objects\eeprom.o: ..\cmsis\core_cm3.h 7 | .\objects\eeprom.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdint.h 8 | .\objects\eeprom.o: C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.1.0\Device\Include\system_stm32f10x.h 9 | .\objects\eeprom.o: ..\user\stm32f10x_conf.h 10 | .\objects\eeprom.o: ..\fwlib\inc\stm32f10x_bkp.h 11 | .\objects\eeprom.o: ..\fwlib\inc\stm32f10x_can.h 12 | .\objects\eeprom.o: ..\fwlib\inc\stm32f10x_cec.h 13 | .\objects\eeprom.o: ..\fwlib\inc\stm32f10x_crc.h 14 | .\objects\eeprom.o: ..\fwlib\inc\stm32f10x_dac.h 15 | .\objects\eeprom.o: ..\fwlib\inc\stm32f10x_dbgmcu.h 16 | .\objects\eeprom.o: ..\fwlib\inc\stm32f10x_dma.h 17 | .\objects\eeprom.o: ..\fwlib\inc\stm32f10x_exti.h 18 | .\objects\eeprom.o: ..\fwlib\inc\stm32f10x_flash.h 19 | .\objects\eeprom.o: ..\fwlib\inc\stm32f10x_fsmc.h 20 | .\objects\eeprom.o: ..\fwlib\inc\stm32f10x_gpio.h 21 | .\objects\eeprom.o: ..\fwlib\inc\stm32f10x_i2c.h 22 | .\objects\eeprom.o: ..\fwlib\inc\stm32f10x_iwdg.h 23 | .\objects\eeprom.o: ..\fwlib\inc\stm32f10x_pwr.h 24 | .\objects\eeprom.o: ..\fwlib\inc\stm32f10x_rcc.h 25 | .\objects\eeprom.o: ..\fwlib\inc\stm32f10x_rtc.h 26 | .\objects\eeprom.o: ..\fwlib\inc\stm32f10x_sdio.h 27 | .\objects\eeprom.o: ..\fwlib\inc\stm32f10x_spi.h 28 | .\objects\eeprom.o: ..\fwlib\inc\stm32f10x_tim.h 29 | .\objects\eeprom.o: ..\fwlib\inc\stm32f10x_usart.h 30 | .\objects\eeprom.o: ..\fwlib\inc\stm32f10x_wwdg.h 31 | .\objects\eeprom.o: ..\fwlib\inc\misc.h 32 | .\objects\eeprom.o: ..\mylib\gpio_iic.h 33 | .\objects\eeprom.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdlib.h 34 | -------------------------------------------------------------------------------- /code/project/Objects/oled.d: -------------------------------------------------------------------------------- 1 | .\objects\oled.o: ..\mylib\oled.c 2 | .\objects\oled.o: ..\mylib\oled.h 3 | .\objects\oled.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdlib.h 4 | .\objects\oled.o: ..\mylib\oledfont.h 5 | .\objects\oled.o: ..\mylib\delay.h 6 | .\objects\oled.o: ..\user\stm32f10x_conf.h 7 | .\objects\oled.o: ..\fwlib\inc\stm32f10x_adc.h 8 | .\objects\oled.o: C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.1.0\Device\Include\stm32f10x.h 9 | .\objects\oled.o: ..\cmsis\core_cm3.h 10 | .\objects\oled.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdint.h 11 | .\objects\oled.o: C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.1.0\Device\Include\system_stm32f10x.h 12 | .\objects\oled.o: ..\user\stm32f10x_conf.h 13 | .\objects\oled.o: ..\fwlib\inc\stm32f10x_bkp.h 14 | .\objects\oled.o: ..\fwlib\inc\stm32f10x_can.h 15 | .\objects\oled.o: ..\fwlib\inc\stm32f10x_cec.h 16 | .\objects\oled.o: ..\fwlib\inc\stm32f10x_crc.h 17 | .\objects\oled.o: ..\fwlib\inc\stm32f10x_dac.h 18 | .\objects\oled.o: ..\fwlib\inc\stm32f10x_dbgmcu.h 19 | .\objects\oled.o: ..\fwlib\inc\stm32f10x_dma.h 20 | .\objects\oled.o: ..\fwlib\inc\stm32f10x_exti.h 21 | .\objects\oled.o: ..\fwlib\inc\stm32f10x_flash.h 22 | .\objects\oled.o: ..\fwlib\inc\stm32f10x_fsmc.h 23 | .\objects\oled.o: ..\fwlib\inc\stm32f10x_gpio.h 24 | .\objects\oled.o: ..\fwlib\inc\stm32f10x_i2c.h 25 | .\objects\oled.o: ..\fwlib\inc\stm32f10x_iwdg.h 26 | .\objects\oled.o: ..\fwlib\inc\stm32f10x_pwr.h 27 | .\objects\oled.o: ..\fwlib\inc\stm32f10x_rcc.h 28 | .\objects\oled.o: ..\fwlib\inc\stm32f10x_rtc.h 29 | .\objects\oled.o: ..\fwlib\inc\stm32f10x_sdio.h 30 | .\objects\oled.o: ..\fwlib\inc\stm32f10x_spi.h 31 | .\objects\oled.o: ..\fwlib\inc\stm32f10x_tim.h 32 | .\objects\oled.o: ..\fwlib\inc\stm32f10x_usart.h 33 | .\objects\oled.o: ..\fwlib\inc\stm32f10x_wwdg.h 34 | .\objects\oled.o: ..\fwlib\inc\misc.h 35 | .\objects\oled.o: ..\mylib\gpio_iic.h 36 | -------------------------------------------------------------------------------- /code/mylib/dht11.c: -------------------------------------------------------------------------------- 1 | #include "dht11.h" 2 | #include "delay.h" 3 | #include "bitband.h" 4 | 5 | void dht11_init(void) // 初始化dht11 6 | { 7 | // 使能时钟 8 | RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOC, ENABLE); 9 | 10 | delay_init(); 11 | } 12 | 13 | void set_dht_gpio_output(void) 14 | { 15 | GPIO_InitTypeDef Gpio_Value; 16 | 17 | Gpio_Value.GPIO_Mode = GPIO_Mode_Out_PP; 18 | Gpio_Value.GPIO_Pin = GPIO_Pin_10; 19 | Gpio_Value.GPIO_Speed = GPIO_Speed_50MHz; 20 | GPIO_Init(GPIOC, &Gpio_Value); 21 | } 22 | 23 | void set_dht_gpio_input(void) 24 | { 25 | GPIO_InitTypeDef Gpio_Value; 26 | 27 | Gpio_Value.GPIO_Mode = GPIO_Mode_IN_FLOATING; 28 | Gpio_Value.GPIO_Pin = GPIO_Pin_10; 29 | GPIO_Init(GPIOC, &Gpio_Value); 30 | } 31 | 32 | void dht_output_status(int state) 33 | { 34 | set_dht_gpio_output(); 35 | if(state == 1) 36 | PCOut(10) = 1; 37 | else 38 | PCOut(10) = 0; 39 | } 40 | 41 | int dht_input_status(void) 42 | { 43 | set_dht_gpio_input(); 44 | return PCIn(10); 45 | } 46 | 47 | void dht11_get_value(char *buf) // 获取值 48 | { 49 | int i = 0; 50 | char flag = 0; 51 | char time = 0; 52 | char tmp = 0; 53 | 54 | // 发送开始信号 55 | dht_output_status(1); 56 | dht_output_status(0); 57 | delay_ms(18); 58 | dht_output_status(1); 59 | // 超时处理(40us) 60 | do 61 | { 62 | flag = dht_input_status(); 63 | time++; 64 | delay_us(2); 65 | }while(flag == 1 && time <= 20); 66 | if(time > 20) // dht11没有响应 67 | return; 68 | // 响应了 69 | while(!dht_input_status()); 70 | for(i = 0; i < 40; i++) { 71 | while(dht_input_status()); 72 | while(!dht_input_status()); 73 | delay_us(30); 74 | // 开始传输数据 75 | tmp <<= 1; 76 | if(dht_input_status()) // 数据为1 77 | tmp |= 1; 78 | if(i % 8 == 7) { 79 | buf[i / 8] = tmp; 80 | tmp = 0; 81 | } 82 | } 83 | dht_output_status(1); 84 | } 85 | 86 | -------------------------------------------------------------------------------- /web/iot/html/device.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 设备 6 | 7 | 8 | 9 | 10 | 11 |
12 | 成功按钮 13 | {$_SESSION['device']} 14 | {{ s_data }} 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 58 | 59 | -------------------------------------------------------------------------------- /code/project/Objects/gpio_iic.d: -------------------------------------------------------------------------------- 1 | .\objects\gpio_iic.o: ..\mylib\gpio_iic.c 2 | .\objects\gpio_iic.o: ..\mylib\gpio_iic.h 3 | .\objects\gpio_iic.o: ..\user\stm32f10x_conf.h 4 | .\objects\gpio_iic.o: ..\fwlib\inc\stm32f10x_adc.h 5 | .\objects\gpio_iic.o: C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.1.0\Device\Include\stm32f10x.h 6 | .\objects\gpio_iic.o: ..\cmsis\core_cm3.h 7 | .\objects\gpio_iic.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdint.h 8 | .\objects\gpio_iic.o: C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.1.0\Device\Include\system_stm32f10x.h 9 | .\objects\gpio_iic.o: ..\user\stm32f10x_conf.h 10 | .\objects\gpio_iic.o: ..\fwlib\inc\stm32f10x_bkp.h 11 | .\objects\gpio_iic.o: ..\fwlib\inc\stm32f10x_can.h 12 | .\objects\gpio_iic.o: ..\fwlib\inc\stm32f10x_cec.h 13 | .\objects\gpio_iic.o: ..\fwlib\inc\stm32f10x_crc.h 14 | .\objects\gpio_iic.o: ..\fwlib\inc\stm32f10x_dac.h 15 | .\objects\gpio_iic.o: ..\fwlib\inc\stm32f10x_dbgmcu.h 16 | .\objects\gpio_iic.o: ..\fwlib\inc\stm32f10x_dma.h 17 | .\objects\gpio_iic.o: ..\fwlib\inc\stm32f10x_exti.h 18 | .\objects\gpio_iic.o: ..\fwlib\inc\stm32f10x_flash.h 19 | .\objects\gpio_iic.o: ..\fwlib\inc\stm32f10x_fsmc.h 20 | .\objects\gpio_iic.o: ..\fwlib\inc\stm32f10x_gpio.h 21 | .\objects\gpio_iic.o: ..\fwlib\inc\stm32f10x_i2c.h 22 | .\objects\gpio_iic.o: ..\fwlib\inc\stm32f10x_iwdg.h 23 | .\objects\gpio_iic.o: ..\fwlib\inc\stm32f10x_pwr.h 24 | .\objects\gpio_iic.o: ..\fwlib\inc\stm32f10x_rcc.h 25 | .\objects\gpio_iic.o: ..\fwlib\inc\stm32f10x_rtc.h 26 | .\objects\gpio_iic.o: ..\fwlib\inc\stm32f10x_sdio.h 27 | .\objects\gpio_iic.o: ..\fwlib\inc\stm32f10x_spi.h 28 | .\objects\gpio_iic.o: ..\fwlib\inc\stm32f10x_tim.h 29 | .\objects\gpio_iic.o: ..\fwlib\inc\stm32f10x_usart.h 30 | .\objects\gpio_iic.o: ..\fwlib\inc\stm32f10x_wwdg.h 31 | .\objects\gpio_iic.o: ..\fwlib\inc\misc.h 32 | .\objects\gpio_iic.o: ..\mylib\delay.h 33 | .\objects\gpio_iic.o: ..\mylib\bitband.h 34 | -------------------------------------------------------------------------------- /code/project/Objects/iot.d: -------------------------------------------------------------------------------- 1 | .\objects\iot.o: ..\mylib\iot.c 2 | .\objects\iot.o: ..\mylib\esp8266.h 3 | .\objects\iot.o: C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.1.0\Device\Include\stm32f10x.h 4 | .\objects\iot.o: ..\cmsis\core_cm3.h 5 | .\objects\iot.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdint.h 6 | .\objects\iot.o: C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.1.0\Device\Include\system_stm32f10x.h 7 | .\objects\iot.o: ..\user\stm32f10x_conf.h 8 | .\objects\iot.o: ..\fwlib\inc\stm32f10x_adc.h 9 | .\objects\iot.o: C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.1.0\Device\Include\stm32f10x.h 10 | .\objects\iot.o: ..\fwlib\inc\stm32f10x_bkp.h 11 | .\objects\iot.o: ..\fwlib\inc\stm32f10x_can.h 12 | .\objects\iot.o: ..\fwlib\inc\stm32f10x_cec.h 13 | .\objects\iot.o: ..\fwlib\inc\stm32f10x_crc.h 14 | .\objects\iot.o: ..\fwlib\inc\stm32f10x_dac.h 15 | .\objects\iot.o: ..\fwlib\inc\stm32f10x_dbgmcu.h 16 | .\objects\iot.o: ..\fwlib\inc\stm32f10x_dma.h 17 | .\objects\iot.o: ..\fwlib\inc\stm32f10x_exti.h 18 | .\objects\iot.o: ..\fwlib\inc\stm32f10x_flash.h 19 | .\objects\iot.o: ..\fwlib\inc\stm32f10x_fsmc.h 20 | .\objects\iot.o: ..\fwlib\inc\stm32f10x_gpio.h 21 | .\objects\iot.o: ..\fwlib\inc\stm32f10x_i2c.h 22 | .\objects\iot.o: ..\fwlib\inc\stm32f10x_iwdg.h 23 | .\objects\iot.o: ..\fwlib\inc\stm32f10x_pwr.h 24 | .\objects\iot.o: ..\fwlib\inc\stm32f10x_rcc.h 25 | .\objects\iot.o: ..\fwlib\inc\stm32f10x_rtc.h 26 | .\objects\iot.o: ..\fwlib\inc\stm32f10x_sdio.h 27 | .\objects\iot.o: ..\fwlib\inc\stm32f10x_spi.h 28 | .\objects\iot.o: ..\fwlib\inc\stm32f10x_tim.h 29 | .\objects\iot.o: ..\fwlib\inc\stm32f10x_usart.h 30 | .\objects\iot.o: ..\fwlib\inc\stm32f10x_wwdg.h 31 | .\objects\iot.o: ..\fwlib\inc\misc.h 32 | .\objects\iot.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdio.h 33 | .\objects\iot.o: ..\mylib\delay.h 34 | .\objects\iot.o: ..\mylib\iot.h 35 | .\objects\iot.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdlib.h 36 | -------------------------------------------------------------------------------- /code/project/Objects/stm32f10x_it.d: -------------------------------------------------------------------------------- 1 | .\objects\stm32f10x_it.o: ..\user\stm32f10x_it.c 2 | .\objects\stm32f10x_it.o: ..\user\stm32f10x_it.h 3 | .\objects\stm32f10x_it.o: C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.1.0\Device\Include\stm32f10x.h 4 | .\objects\stm32f10x_it.o: ..\cmsis\core_cm3.h 5 | .\objects\stm32f10x_it.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdint.h 6 | .\objects\stm32f10x_it.o: C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.1.0\Device\Include\system_stm32f10x.h 7 | .\objects\stm32f10x_it.o: ..\user\stm32f10x_conf.h 8 | .\objects\stm32f10x_it.o: ..\fwlib\inc\stm32f10x_adc.h 9 | .\objects\stm32f10x_it.o: C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.1.0\Device\Include\stm32f10x.h 10 | .\objects\stm32f10x_it.o: ..\fwlib\inc\stm32f10x_bkp.h 11 | .\objects\stm32f10x_it.o: ..\fwlib\inc\stm32f10x_can.h 12 | .\objects\stm32f10x_it.o: ..\fwlib\inc\stm32f10x_cec.h 13 | .\objects\stm32f10x_it.o: ..\fwlib\inc\stm32f10x_crc.h 14 | .\objects\stm32f10x_it.o: ..\fwlib\inc\stm32f10x_dac.h 15 | .\objects\stm32f10x_it.o: ..\fwlib\inc\stm32f10x_dbgmcu.h 16 | .\objects\stm32f10x_it.o: ..\fwlib\inc\stm32f10x_dma.h 17 | .\objects\stm32f10x_it.o: ..\fwlib\inc\stm32f10x_exti.h 18 | .\objects\stm32f10x_it.o: ..\fwlib\inc\stm32f10x_flash.h 19 | .\objects\stm32f10x_it.o: ..\fwlib\inc\stm32f10x_fsmc.h 20 | .\objects\stm32f10x_it.o: ..\fwlib\inc\stm32f10x_gpio.h 21 | .\objects\stm32f10x_it.o: ..\fwlib\inc\stm32f10x_i2c.h 22 | .\objects\stm32f10x_it.o: ..\fwlib\inc\stm32f10x_iwdg.h 23 | .\objects\stm32f10x_it.o: ..\fwlib\inc\stm32f10x_pwr.h 24 | .\objects\stm32f10x_it.o: ..\fwlib\inc\stm32f10x_rcc.h 25 | .\objects\stm32f10x_it.o: ..\fwlib\inc\stm32f10x_rtc.h 26 | .\objects\stm32f10x_it.o: ..\fwlib\inc\stm32f10x_sdio.h 27 | .\objects\stm32f10x_it.o: ..\fwlib\inc\stm32f10x_spi.h 28 | .\objects\stm32f10x_it.o: ..\fwlib\inc\stm32f10x_tim.h 29 | .\objects\stm32f10x_it.o: ..\fwlib\inc\stm32f10x_usart.h 30 | .\objects\stm32f10x_it.o: ..\fwlib\inc\stm32f10x_wwdg.h 31 | .\objects\stm32f10x_it.o: ..\fwlib\inc\misc.h 32 | -------------------------------------------------------------------------------- /code/project/Objects/stm32f10x_adc.d: -------------------------------------------------------------------------------- 1 | .\objects\stm32f10x_adc.o: ..\fwlib\src\stm32f10x_adc.c 2 | .\objects\stm32f10x_adc.o: ..\fwlib\inc\stm32f10x_adc.h 3 | .\objects\stm32f10x_adc.o: C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.1.0\Device\Include\stm32f10x.h 4 | .\objects\stm32f10x_adc.o: ..\cmsis\core_cm3.h 5 | .\objects\stm32f10x_adc.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdint.h 6 | .\objects\stm32f10x_adc.o: C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.1.0\Device\Include\system_stm32f10x.h 7 | .\objects\stm32f10x_adc.o: ..\user\stm32f10x_conf.h 8 | .\objects\stm32f10x_adc.o: ..\fwlib\inc\stm32f10x_adc.h 9 | .\objects\stm32f10x_adc.o: ..\fwlib\inc\stm32f10x_bkp.h 10 | .\objects\stm32f10x_adc.o: C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.1.0\Device\Include\stm32f10x.h 11 | .\objects\stm32f10x_adc.o: ..\fwlib\inc\stm32f10x_can.h 12 | .\objects\stm32f10x_adc.o: ..\fwlib\inc\stm32f10x_cec.h 13 | .\objects\stm32f10x_adc.o: ..\fwlib\inc\stm32f10x_crc.h 14 | .\objects\stm32f10x_adc.o: ..\fwlib\inc\stm32f10x_dac.h 15 | .\objects\stm32f10x_adc.o: ..\fwlib\inc\stm32f10x_dbgmcu.h 16 | .\objects\stm32f10x_adc.o: ..\fwlib\inc\stm32f10x_dma.h 17 | .\objects\stm32f10x_adc.o: ..\fwlib\inc\stm32f10x_exti.h 18 | .\objects\stm32f10x_adc.o: ..\fwlib\inc\stm32f10x_flash.h 19 | .\objects\stm32f10x_adc.o: ..\fwlib\inc\stm32f10x_fsmc.h 20 | .\objects\stm32f10x_adc.o: ..\fwlib\inc\stm32f10x_gpio.h 21 | .\objects\stm32f10x_adc.o: ..\fwlib\inc\stm32f10x_i2c.h 22 | .\objects\stm32f10x_adc.o: ..\fwlib\inc\stm32f10x_iwdg.h 23 | .\objects\stm32f10x_adc.o: ..\fwlib\inc\stm32f10x_pwr.h 24 | .\objects\stm32f10x_adc.o: ..\fwlib\inc\stm32f10x_rcc.h 25 | .\objects\stm32f10x_adc.o: ..\fwlib\inc\stm32f10x_rtc.h 26 | .\objects\stm32f10x_adc.o: ..\fwlib\inc\stm32f10x_sdio.h 27 | .\objects\stm32f10x_adc.o: ..\fwlib\inc\stm32f10x_spi.h 28 | .\objects\stm32f10x_adc.o: ..\fwlib\inc\stm32f10x_tim.h 29 | .\objects\stm32f10x_adc.o: ..\fwlib\inc\stm32f10x_usart.h 30 | .\objects\stm32f10x_adc.o: ..\fwlib\inc\stm32f10x_wwdg.h 31 | .\objects\stm32f10x_adc.o: ..\fwlib\inc\misc.h 32 | -------------------------------------------------------------------------------- /code/project/Objects/stm32f10x_bkp.d: -------------------------------------------------------------------------------- 1 | .\objects\stm32f10x_bkp.o: ..\fwlib\src\stm32f10x_bkp.c 2 | .\objects\stm32f10x_bkp.o: ..\fwlib\inc\stm32f10x_bkp.h 3 | .\objects\stm32f10x_bkp.o: C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.1.0\Device\Include\stm32f10x.h 4 | .\objects\stm32f10x_bkp.o: ..\cmsis\core_cm3.h 5 | .\objects\stm32f10x_bkp.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdint.h 6 | .\objects\stm32f10x_bkp.o: C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.1.0\Device\Include\system_stm32f10x.h 7 | .\objects\stm32f10x_bkp.o: ..\user\stm32f10x_conf.h 8 | .\objects\stm32f10x_bkp.o: ..\fwlib\inc\stm32f10x_adc.h 9 | .\objects\stm32f10x_bkp.o: C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.1.0\Device\Include\stm32f10x.h 10 | .\objects\stm32f10x_bkp.o: ..\fwlib\inc\stm32f10x_bkp.h 11 | .\objects\stm32f10x_bkp.o: ..\fwlib\inc\stm32f10x_can.h 12 | .\objects\stm32f10x_bkp.o: ..\fwlib\inc\stm32f10x_cec.h 13 | .\objects\stm32f10x_bkp.o: ..\fwlib\inc\stm32f10x_crc.h 14 | .\objects\stm32f10x_bkp.o: ..\fwlib\inc\stm32f10x_dac.h 15 | .\objects\stm32f10x_bkp.o: ..\fwlib\inc\stm32f10x_dbgmcu.h 16 | .\objects\stm32f10x_bkp.o: ..\fwlib\inc\stm32f10x_dma.h 17 | .\objects\stm32f10x_bkp.o: ..\fwlib\inc\stm32f10x_exti.h 18 | .\objects\stm32f10x_bkp.o: ..\fwlib\inc\stm32f10x_flash.h 19 | .\objects\stm32f10x_bkp.o: ..\fwlib\inc\stm32f10x_fsmc.h 20 | .\objects\stm32f10x_bkp.o: ..\fwlib\inc\stm32f10x_gpio.h 21 | .\objects\stm32f10x_bkp.o: ..\fwlib\inc\stm32f10x_i2c.h 22 | .\objects\stm32f10x_bkp.o: ..\fwlib\inc\stm32f10x_iwdg.h 23 | .\objects\stm32f10x_bkp.o: ..\fwlib\inc\stm32f10x_pwr.h 24 | .\objects\stm32f10x_bkp.o: ..\fwlib\inc\stm32f10x_rcc.h 25 | .\objects\stm32f10x_bkp.o: ..\fwlib\inc\stm32f10x_rtc.h 26 | .\objects\stm32f10x_bkp.o: ..\fwlib\inc\stm32f10x_sdio.h 27 | .\objects\stm32f10x_bkp.o: ..\fwlib\inc\stm32f10x_spi.h 28 | .\objects\stm32f10x_bkp.o: ..\fwlib\inc\stm32f10x_tim.h 29 | .\objects\stm32f10x_bkp.o: ..\fwlib\inc\stm32f10x_usart.h 30 | .\objects\stm32f10x_bkp.o: ..\fwlib\inc\stm32f10x_wwdg.h 31 | .\objects\stm32f10x_bkp.o: ..\fwlib\inc\misc.h 32 | -------------------------------------------------------------------------------- /code/project/Objects/stm32f10x_i2c.d: -------------------------------------------------------------------------------- 1 | .\objects\stm32f10x_i2c.o: ..\fwlib\src\stm32f10x_i2c.c 2 | .\objects\stm32f10x_i2c.o: ..\fwlib\inc\stm32f10x_i2c.h 3 | .\objects\stm32f10x_i2c.o: C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.1.0\Device\Include\stm32f10x.h 4 | .\objects\stm32f10x_i2c.o: ..\cmsis\core_cm3.h 5 | .\objects\stm32f10x_i2c.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdint.h 6 | .\objects\stm32f10x_i2c.o: C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.1.0\Device\Include\system_stm32f10x.h 7 | .\objects\stm32f10x_i2c.o: ..\user\stm32f10x_conf.h 8 | .\objects\stm32f10x_i2c.o: ..\fwlib\inc\stm32f10x_adc.h 9 | .\objects\stm32f10x_i2c.o: C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.1.0\Device\Include\stm32f10x.h 10 | .\objects\stm32f10x_i2c.o: ..\fwlib\inc\stm32f10x_bkp.h 11 | .\objects\stm32f10x_i2c.o: ..\fwlib\inc\stm32f10x_can.h 12 | .\objects\stm32f10x_i2c.o: ..\fwlib\inc\stm32f10x_cec.h 13 | .\objects\stm32f10x_i2c.o: ..\fwlib\inc\stm32f10x_crc.h 14 | .\objects\stm32f10x_i2c.o: ..\fwlib\inc\stm32f10x_dac.h 15 | .\objects\stm32f10x_i2c.o: ..\fwlib\inc\stm32f10x_dbgmcu.h 16 | .\objects\stm32f10x_i2c.o: ..\fwlib\inc\stm32f10x_dma.h 17 | .\objects\stm32f10x_i2c.o: ..\fwlib\inc\stm32f10x_exti.h 18 | .\objects\stm32f10x_i2c.o: ..\fwlib\inc\stm32f10x_flash.h 19 | .\objects\stm32f10x_i2c.o: ..\fwlib\inc\stm32f10x_fsmc.h 20 | .\objects\stm32f10x_i2c.o: ..\fwlib\inc\stm32f10x_gpio.h 21 | .\objects\stm32f10x_i2c.o: ..\fwlib\inc\stm32f10x_i2c.h 22 | .\objects\stm32f10x_i2c.o: ..\fwlib\inc\stm32f10x_iwdg.h 23 | .\objects\stm32f10x_i2c.o: ..\fwlib\inc\stm32f10x_pwr.h 24 | .\objects\stm32f10x_i2c.o: ..\fwlib\inc\stm32f10x_rcc.h 25 | .\objects\stm32f10x_i2c.o: ..\fwlib\inc\stm32f10x_rtc.h 26 | .\objects\stm32f10x_i2c.o: ..\fwlib\inc\stm32f10x_sdio.h 27 | .\objects\stm32f10x_i2c.o: ..\fwlib\inc\stm32f10x_spi.h 28 | .\objects\stm32f10x_i2c.o: ..\fwlib\inc\stm32f10x_tim.h 29 | .\objects\stm32f10x_i2c.o: ..\fwlib\inc\stm32f10x_usart.h 30 | .\objects\stm32f10x_i2c.o: ..\fwlib\inc\stm32f10x_wwdg.h 31 | .\objects\stm32f10x_i2c.o: ..\fwlib\inc\misc.h 32 | -------------------------------------------------------------------------------- /code/project/Objects/stm32f10x_pwr.d: -------------------------------------------------------------------------------- 1 | .\objects\stm32f10x_pwr.o: ..\fwlib\src\stm32f10x_pwr.c 2 | .\objects\stm32f10x_pwr.o: ..\fwlib\inc\stm32f10x_pwr.h 3 | .\objects\stm32f10x_pwr.o: C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.1.0\Device\Include\stm32f10x.h 4 | .\objects\stm32f10x_pwr.o: ..\cmsis\core_cm3.h 5 | .\objects\stm32f10x_pwr.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdint.h 6 | .\objects\stm32f10x_pwr.o: C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.1.0\Device\Include\system_stm32f10x.h 7 | .\objects\stm32f10x_pwr.o: ..\user\stm32f10x_conf.h 8 | .\objects\stm32f10x_pwr.o: ..\fwlib\inc\stm32f10x_adc.h 9 | .\objects\stm32f10x_pwr.o: C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.1.0\Device\Include\stm32f10x.h 10 | .\objects\stm32f10x_pwr.o: ..\fwlib\inc\stm32f10x_bkp.h 11 | .\objects\stm32f10x_pwr.o: ..\fwlib\inc\stm32f10x_can.h 12 | .\objects\stm32f10x_pwr.o: ..\fwlib\inc\stm32f10x_cec.h 13 | .\objects\stm32f10x_pwr.o: ..\fwlib\inc\stm32f10x_crc.h 14 | .\objects\stm32f10x_pwr.o: ..\fwlib\inc\stm32f10x_dac.h 15 | .\objects\stm32f10x_pwr.o: ..\fwlib\inc\stm32f10x_dbgmcu.h 16 | .\objects\stm32f10x_pwr.o: ..\fwlib\inc\stm32f10x_dma.h 17 | .\objects\stm32f10x_pwr.o: ..\fwlib\inc\stm32f10x_exti.h 18 | .\objects\stm32f10x_pwr.o: ..\fwlib\inc\stm32f10x_flash.h 19 | .\objects\stm32f10x_pwr.o: ..\fwlib\inc\stm32f10x_fsmc.h 20 | .\objects\stm32f10x_pwr.o: ..\fwlib\inc\stm32f10x_gpio.h 21 | .\objects\stm32f10x_pwr.o: ..\fwlib\inc\stm32f10x_i2c.h 22 | .\objects\stm32f10x_pwr.o: ..\fwlib\inc\stm32f10x_iwdg.h 23 | .\objects\stm32f10x_pwr.o: ..\fwlib\inc\stm32f10x_pwr.h 24 | .\objects\stm32f10x_pwr.o: ..\fwlib\inc\stm32f10x_rcc.h 25 | .\objects\stm32f10x_pwr.o: ..\fwlib\inc\stm32f10x_rtc.h 26 | .\objects\stm32f10x_pwr.o: ..\fwlib\inc\stm32f10x_sdio.h 27 | .\objects\stm32f10x_pwr.o: ..\fwlib\inc\stm32f10x_spi.h 28 | .\objects\stm32f10x_pwr.o: ..\fwlib\inc\stm32f10x_tim.h 29 | .\objects\stm32f10x_pwr.o: ..\fwlib\inc\stm32f10x_usart.h 30 | .\objects\stm32f10x_pwr.o: ..\fwlib\inc\stm32f10x_wwdg.h 31 | .\objects\stm32f10x_pwr.o: ..\fwlib\inc\misc.h 32 | -------------------------------------------------------------------------------- /code/project/Objects/stm32f10x_rcc.d: -------------------------------------------------------------------------------- 1 | .\objects\stm32f10x_rcc.o: ..\fwlib\src\stm32f10x_rcc.c 2 | .\objects\stm32f10x_rcc.o: ..\fwlib\inc\stm32f10x_rcc.h 3 | .\objects\stm32f10x_rcc.o: C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.1.0\Device\Include\stm32f10x.h 4 | .\objects\stm32f10x_rcc.o: ..\cmsis\core_cm3.h 5 | .\objects\stm32f10x_rcc.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdint.h 6 | .\objects\stm32f10x_rcc.o: C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.1.0\Device\Include\system_stm32f10x.h 7 | .\objects\stm32f10x_rcc.o: ..\user\stm32f10x_conf.h 8 | .\objects\stm32f10x_rcc.o: ..\fwlib\inc\stm32f10x_adc.h 9 | .\objects\stm32f10x_rcc.o: C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.1.0\Device\Include\stm32f10x.h 10 | .\objects\stm32f10x_rcc.o: ..\fwlib\inc\stm32f10x_bkp.h 11 | .\objects\stm32f10x_rcc.o: ..\fwlib\inc\stm32f10x_can.h 12 | .\objects\stm32f10x_rcc.o: ..\fwlib\inc\stm32f10x_cec.h 13 | .\objects\stm32f10x_rcc.o: ..\fwlib\inc\stm32f10x_crc.h 14 | .\objects\stm32f10x_rcc.o: ..\fwlib\inc\stm32f10x_dac.h 15 | .\objects\stm32f10x_rcc.o: ..\fwlib\inc\stm32f10x_dbgmcu.h 16 | .\objects\stm32f10x_rcc.o: ..\fwlib\inc\stm32f10x_dma.h 17 | .\objects\stm32f10x_rcc.o: ..\fwlib\inc\stm32f10x_exti.h 18 | .\objects\stm32f10x_rcc.o: ..\fwlib\inc\stm32f10x_flash.h 19 | .\objects\stm32f10x_rcc.o: ..\fwlib\inc\stm32f10x_fsmc.h 20 | .\objects\stm32f10x_rcc.o: ..\fwlib\inc\stm32f10x_gpio.h 21 | .\objects\stm32f10x_rcc.o: ..\fwlib\inc\stm32f10x_i2c.h 22 | .\objects\stm32f10x_rcc.o: ..\fwlib\inc\stm32f10x_iwdg.h 23 | .\objects\stm32f10x_rcc.o: ..\fwlib\inc\stm32f10x_pwr.h 24 | .\objects\stm32f10x_rcc.o: ..\fwlib\inc\stm32f10x_rcc.h 25 | .\objects\stm32f10x_rcc.o: ..\fwlib\inc\stm32f10x_rtc.h 26 | .\objects\stm32f10x_rcc.o: ..\fwlib\inc\stm32f10x_sdio.h 27 | .\objects\stm32f10x_rcc.o: ..\fwlib\inc\stm32f10x_spi.h 28 | .\objects\stm32f10x_rcc.o: ..\fwlib\inc\stm32f10x_tim.h 29 | .\objects\stm32f10x_rcc.o: ..\fwlib\inc\stm32f10x_usart.h 30 | .\objects\stm32f10x_rcc.o: ..\fwlib\inc\stm32f10x_wwdg.h 31 | .\objects\stm32f10x_rcc.o: ..\fwlib\inc\misc.h 32 | -------------------------------------------------------------------------------- /code/project/Objects/stm32f10x_rtc.d: -------------------------------------------------------------------------------- 1 | .\objects\stm32f10x_rtc.o: ..\fwlib\src\stm32f10x_rtc.c 2 | .\objects\stm32f10x_rtc.o: ..\fwlib\inc\stm32f10x_rtc.h 3 | .\objects\stm32f10x_rtc.o: C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.1.0\Device\Include\stm32f10x.h 4 | .\objects\stm32f10x_rtc.o: ..\cmsis\core_cm3.h 5 | .\objects\stm32f10x_rtc.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdint.h 6 | .\objects\stm32f10x_rtc.o: C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.1.0\Device\Include\system_stm32f10x.h 7 | .\objects\stm32f10x_rtc.o: ..\user\stm32f10x_conf.h 8 | .\objects\stm32f10x_rtc.o: ..\fwlib\inc\stm32f10x_adc.h 9 | .\objects\stm32f10x_rtc.o: C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.1.0\Device\Include\stm32f10x.h 10 | .\objects\stm32f10x_rtc.o: ..\fwlib\inc\stm32f10x_bkp.h 11 | .\objects\stm32f10x_rtc.o: ..\fwlib\inc\stm32f10x_can.h 12 | .\objects\stm32f10x_rtc.o: ..\fwlib\inc\stm32f10x_cec.h 13 | .\objects\stm32f10x_rtc.o: ..\fwlib\inc\stm32f10x_crc.h 14 | .\objects\stm32f10x_rtc.o: ..\fwlib\inc\stm32f10x_dac.h 15 | .\objects\stm32f10x_rtc.o: ..\fwlib\inc\stm32f10x_dbgmcu.h 16 | .\objects\stm32f10x_rtc.o: ..\fwlib\inc\stm32f10x_dma.h 17 | .\objects\stm32f10x_rtc.o: ..\fwlib\inc\stm32f10x_exti.h 18 | .\objects\stm32f10x_rtc.o: ..\fwlib\inc\stm32f10x_flash.h 19 | .\objects\stm32f10x_rtc.o: ..\fwlib\inc\stm32f10x_fsmc.h 20 | .\objects\stm32f10x_rtc.o: ..\fwlib\inc\stm32f10x_gpio.h 21 | .\objects\stm32f10x_rtc.o: ..\fwlib\inc\stm32f10x_i2c.h 22 | .\objects\stm32f10x_rtc.o: ..\fwlib\inc\stm32f10x_iwdg.h 23 | .\objects\stm32f10x_rtc.o: ..\fwlib\inc\stm32f10x_pwr.h 24 | .\objects\stm32f10x_rtc.o: ..\fwlib\inc\stm32f10x_rcc.h 25 | .\objects\stm32f10x_rtc.o: ..\fwlib\inc\stm32f10x_rtc.h 26 | .\objects\stm32f10x_rtc.o: ..\fwlib\inc\stm32f10x_sdio.h 27 | .\objects\stm32f10x_rtc.o: ..\fwlib\inc\stm32f10x_spi.h 28 | .\objects\stm32f10x_rtc.o: ..\fwlib\inc\stm32f10x_tim.h 29 | .\objects\stm32f10x_rtc.o: ..\fwlib\inc\stm32f10x_usart.h 30 | .\objects\stm32f10x_rtc.o: ..\fwlib\inc\stm32f10x_wwdg.h 31 | .\objects\stm32f10x_rtc.o: ..\fwlib\inc\misc.h 32 | -------------------------------------------------------------------------------- /code/mylib/eeprom.c: -------------------------------------------------------------------------------- 1 | #include "eeprom.h" 2 | #include "gpio_iic.h" 3 | #include "stdlib.h" 4 | 5 | 6 | 7 | void eeprom_init(void) // 初始化EEPROM 8 | { 9 | IIC_Init(); 10 | } 11 | 12 | void eeprom_byte_write(u8 daddr, u8 waddr, u8 data) // 按字节写 13 | { 14 | IIC_Start(); 15 | IIC_Send_Byte(daddr); // 发送设备地址 + 写标志 16 | IIC_Wait_Ack(); 17 | IIC_Send_Byte(waddr); // 发送word address 18 | IIC_Wait_Ack(); 19 | IIC_Send_Byte(data); 20 | IIC_Wait_Ack(); 21 | IIC_Stop(); 22 | } 23 | 24 | void eeprom_page_write(u8 daddr, u8 waddr, u8 *buf, u8 size) // 按页写 25 | { 26 | u8 i = 0; // 循环变量 27 | 28 | IIC_Start(); 29 | IIC_Send_Byte(daddr); // 发送设备地址 + 写标志 30 | IIC_Wait_Ack(); 31 | IIC_Send_Byte(waddr); 32 | IIC_Wait_Ack(); 33 | for(i = 0; i < size; i++) { 34 | IIC_Send_Byte(buf[i]); 35 | IIC_Wait_Ack(); 36 | } 37 | IIC_Stop(); 38 | } 39 | 40 | u8 eeprom_cur_read(u8 daddr) // 当前地址读 41 | { 42 | u8 data = 0; // 存储接收的数据 43 | 44 | IIC_Start(); 45 | IIC_Send_Byte(daddr | 1); 46 | IIC_Wait_Ack(); 47 | data = IIC_Recv_Byte(0); // 读数据,不要ACK 48 | IIC_Stop(); 49 | 50 | return data; 51 | } 52 | 53 | u8 eeprom_rand_read(u8 daddr, u8 waddr) // 随机地址读 54 | { 55 | u8 data = 0; // 存储接收的数据 56 | 57 | IIC_Start(); 58 | IIC_Send_Byte(daddr); // 发送设备地址 + 写标志 59 | IIC_Wait_Ack(); 60 | IIC_Send_Byte(waddr); // 发送word address 61 | IIC_Wait_Ack(); 62 | IIC_Start(); 63 | IIC_Send_Byte(daddr | 1); // 发送设备地址 + 读标志 64 | IIC_Wait_Ack(); 65 | data = IIC_Recv_Byte(0); // 读一字节数据,不要ACK 66 | IIC_Stop(); 67 | 68 | return data; 69 | } 70 | 71 | void eeprom_sequ_read(u8 daddr, u8 waddr, u8 *buf, u8 size) // 顺序读 72 | { 73 | u8 i = 0; // 循环变量 74 | 75 | IIC_Start(); 76 | IIC_Send_Byte(daddr); 77 | IIC_Wait_Ack(); 78 | IIC_Send_Byte(waddr); 79 | IIC_Wait_Ack(); 80 | IIC_Start(); 81 | IIC_Send_Byte(daddr | 1); 82 | IIC_Wait_Ack(); 83 | for(i = 0; i < size-1; i++) { 84 | buf[i] = IIC_Recv_Byte(1); // 读数据,有ACK 85 | } 86 | buf[i] = IIC_Recv_Byte(0); 87 | IIC_Stop(); 88 | } 89 | 90 | -------------------------------------------------------------------------------- /code/project/Objects/system_stm32f10x.d: -------------------------------------------------------------------------------- 1 | .\objects\system_stm32f10x.o: ..\user\system_stm32f10x.c 2 | .\objects\system_stm32f10x.o: C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.1.0\Device\Include\stm32f10x.h 3 | .\objects\system_stm32f10x.o: ..\cmsis\core_cm3.h 4 | .\objects\system_stm32f10x.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdint.h 5 | .\objects\system_stm32f10x.o: C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.1.0\Device\Include\system_stm32f10x.h 6 | .\objects\system_stm32f10x.o: ..\user\stm32f10x_conf.h 7 | .\objects\system_stm32f10x.o: ..\fwlib\inc\stm32f10x_adc.h 8 | .\objects\system_stm32f10x.o: C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.1.0\Device\Include\stm32f10x.h 9 | .\objects\system_stm32f10x.o: ..\fwlib\inc\stm32f10x_bkp.h 10 | .\objects\system_stm32f10x.o: ..\fwlib\inc\stm32f10x_can.h 11 | .\objects\system_stm32f10x.o: ..\fwlib\inc\stm32f10x_cec.h 12 | .\objects\system_stm32f10x.o: ..\fwlib\inc\stm32f10x_crc.h 13 | .\objects\system_stm32f10x.o: ..\fwlib\inc\stm32f10x_dac.h 14 | .\objects\system_stm32f10x.o: ..\fwlib\inc\stm32f10x_dbgmcu.h 15 | .\objects\system_stm32f10x.o: ..\fwlib\inc\stm32f10x_dma.h 16 | .\objects\system_stm32f10x.o: ..\fwlib\inc\stm32f10x_exti.h 17 | .\objects\system_stm32f10x.o: ..\fwlib\inc\stm32f10x_flash.h 18 | .\objects\system_stm32f10x.o: ..\fwlib\inc\stm32f10x_fsmc.h 19 | .\objects\system_stm32f10x.o: ..\fwlib\inc\stm32f10x_gpio.h 20 | .\objects\system_stm32f10x.o: ..\fwlib\inc\stm32f10x_i2c.h 21 | .\objects\system_stm32f10x.o: ..\fwlib\inc\stm32f10x_iwdg.h 22 | .\objects\system_stm32f10x.o: ..\fwlib\inc\stm32f10x_pwr.h 23 | .\objects\system_stm32f10x.o: ..\fwlib\inc\stm32f10x_rcc.h 24 | .\objects\system_stm32f10x.o: ..\fwlib\inc\stm32f10x_rtc.h 25 | .\objects\system_stm32f10x.o: ..\fwlib\inc\stm32f10x_sdio.h 26 | .\objects\system_stm32f10x.o: ..\fwlib\inc\stm32f10x_spi.h 27 | .\objects\system_stm32f10x.o: ..\fwlib\inc\stm32f10x_tim.h 28 | .\objects\system_stm32f10x.o: ..\fwlib\inc\stm32f10x_usart.h 29 | .\objects\system_stm32f10x.o: ..\fwlib\inc\stm32f10x_wwdg.h 30 | .\objects\system_stm32f10x.o: ..\fwlib\inc\misc.h 31 | -------------------------------------------------------------------------------- /code/project/Objects/stm32f10x_exti.d: -------------------------------------------------------------------------------- 1 | .\objects\stm32f10x_exti.o: ..\fwlib\src\stm32f10x_exti.c 2 | .\objects\stm32f10x_exti.o: ..\fwlib\inc\stm32f10x_exti.h 3 | .\objects\stm32f10x_exti.o: C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.1.0\Device\Include\stm32f10x.h 4 | .\objects\stm32f10x_exti.o: ..\cmsis\core_cm3.h 5 | .\objects\stm32f10x_exti.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdint.h 6 | .\objects\stm32f10x_exti.o: C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.1.0\Device\Include\system_stm32f10x.h 7 | .\objects\stm32f10x_exti.o: ..\user\stm32f10x_conf.h 8 | .\objects\stm32f10x_exti.o: ..\fwlib\inc\stm32f10x_adc.h 9 | .\objects\stm32f10x_exti.o: C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.1.0\Device\Include\stm32f10x.h 10 | .\objects\stm32f10x_exti.o: ..\fwlib\inc\stm32f10x_bkp.h 11 | .\objects\stm32f10x_exti.o: ..\fwlib\inc\stm32f10x_can.h 12 | .\objects\stm32f10x_exti.o: ..\fwlib\inc\stm32f10x_cec.h 13 | .\objects\stm32f10x_exti.o: ..\fwlib\inc\stm32f10x_crc.h 14 | .\objects\stm32f10x_exti.o: ..\fwlib\inc\stm32f10x_dac.h 15 | .\objects\stm32f10x_exti.o: ..\fwlib\inc\stm32f10x_dbgmcu.h 16 | .\objects\stm32f10x_exti.o: ..\fwlib\inc\stm32f10x_dma.h 17 | .\objects\stm32f10x_exti.o: ..\fwlib\inc\stm32f10x_exti.h 18 | .\objects\stm32f10x_exti.o: ..\fwlib\inc\stm32f10x_flash.h 19 | .\objects\stm32f10x_exti.o: ..\fwlib\inc\stm32f10x_fsmc.h 20 | .\objects\stm32f10x_exti.o: ..\fwlib\inc\stm32f10x_gpio.h 21 | .\objects\stm32f10x_exti.o: ..\fwlib\inc\stm32f10x_i2c.h 22 | .\objects\stm32f10x_exti.o: ..\fwlib\inc\stm32f10x_iwdg.h 23 | .\objects\stm32f10x_exti.o: ..\fwlib\inc\stm32f10x_pwr.h 24 | .\objects\stm32f10x_exti.o: ..\fwlib\inc\stm32f10x_rcc.h 25 | .\objects\stm32f10x_exti.o: ..\fwlib\inc\stm32f10x_rtc.h 26 | .\objects\stm32f10x_exti.o: ..\fwlib\inc\stm32f10x_sdio.h 27 | .\objects\stm32f10x_exti.o: ..\fwlib\inc\stm32f10x_spi.h 28 | .\objects\stm32f10x_exti.o: ..\fwlib\inc\stm32f10x_tim.h 29 | .\objects\stm32f10x_exti.o: ..\fwlib\inc\stm32f10x_usart.h 30 | .\objects\stm32f10x_exti.o: ..\fwlib\inc\stm32f10x_wwdg.h 31 | .\objects\stm32f10x_exti.o: ..\fwlib\inc\misc.h 32 | -------------------------------------------------------------------------------- /code/project/Objects/stm32f10x_gpio.d: -------------------------------------------------------------------------------- 1 | .\objects\stm32f10x_gpio.o: ..\fwlib\src\stm32f10x_gpio.c 2 | .\objects\stm32f10x_gpio.o: ..\fwlib\inc\stm32f10x_gpio.h 3 | .\objects\stm32f10x_gpio.o: C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.1.0\Device\Include\stm32f10x.h 4 | .\objects\stm32f10x_gpio.o: ..\cmsis\core_cm3.h 5 | .\objects\stm32f10x_gpio.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdint.h 6 | .\objects\stm32f10x_gpio.o: C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.1.0\Device\Include\system_stm32f10x.h 7 | .\objects\stm32f10x_gpio.o: ..\user\stm32f10x_conf.h 8 | .\objects\stm32f10x_gpio.o: ..\fwlib\inc\stm32f10x_adc.h 9 | .\objects\stm32f10x_gpio.o: C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.1.0\Device\Include\stm32f10x.h 10 | .\objects\stm32f10x_gpio.o: ..\fwlib\inc\stm32f10x_bkp.h 11 | .\objects\stm32f10x_gpio.o: ..\fwlib\inc\stm32f10x_can.h 12 | .\objects\stm32f10x_gpio.o: ..\fwlib\inc\stm32f10x_cec.h 13 | .\objects\stm32f10x_gpio.o: ..\fwlib\inc\stm32f10x_crc.h 14 | .\objects\stm32f10x_gpio.o: ..\fwlib\inc\stm32f10x_dac.h 15 | .\objects\stm32f10x_gpio.o: ..\fwlib\inc\stm32f10x_dbgmcu.h 16 | .\objects\stm32f10x_gpio.o: ..\fwlib\inc\stm32f10x_dma.h 17 | .\objects\stm32f10x_gpio.o: ..\fwlib\inc\stm32f10x_exti.h 18 | .\objects\stm32f10x_gpio.o: ..\fwlib\inc\stm32f10x_flash.h 19 | .\objects\stm32f10x_gpio.o: ..\fwlib\inc\stm32f10x_fsmc.h 20 | .\objects\stm32f10x_gpio.o: ..\fwlib\inc\stm32f10x_gpio.h 21 | .\objects\stm32f10x_gpio.o: ..\fwlib\inc\stm32f10x_i2c.h 22 | .\objects\stm32f10x_gpio.o: ..\fwlib\inc\stm32f10x_iwdg.h 23 | .\objects\stm32f10x_gpio.o: ..\fwlib\inc\stm32f10x_pwr.h 24 | .\objects\stm32f10x_gpio.o: ..\fwlib\inc\stm32f10x_rcc.h 25 | .\objects\stm32f10x_gpio.o: ..\fwlib\inc\stm32f10x_rtc.h 26 | .\objects\stm32f10x_gpio.o: ..\fwlib\inc\stm32f10x_sdio.h 27 | .\objects\stm32f10x_gpio.o: ..\fwlib\inc\stm32f10x_spi.h 28 | .\objects\stm32f10x_gpio.o: ..\fwlib\inc\stm32f10x_tim.h 29 | .\objects\stm32f10x_gpio.o: ..\fwlib\inc\stm32f10x_usart.h 30 | .\objects\stm32f10x_gpio.o: ..\fwlib\inc\stm32f10x_wwdg.h 31 | .\objects\stm32f10x_gpio.o: ..\fwlib\inc\misc.h 32 | -------------------------------------------------------------------------------- /code/project/Objects/stm32f10x_iwdg.d: -------------------------------------------------------------------------------- 1 | .\objects\stm32f10x_iwdg.o: ..\fwlib\src\stm32f10x_iwdg.c 2 | .\objects\stm32f10x_iwdg.o: ..\fwlib\inc\stm32f10x_iwdg.h 3 | .\objects\stm32f10x_iwdg.o: C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.1.0\Device\Include\stm32f10x.h 4 | .\objects\stm32f10x_iwdg.o: ..\cmsis\core_cm3.h 5 | .\objects\stm32f10x_iwdg.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdint.h 6 | .\objects\stm32f10x_iwdg.o: C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.1.0\Device\Include\system_stm32f10x.h 7 | .\objects\stm32f10x_iwdg.o: ..\user\stm32f10x_conf.h 8 | .\objects\stm32f10x_iwdg.o: ..\fwlib\inc\stm32f10x_adc.h 9 | .\objects\stm32f10x_iwdg.o: C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.1.0\Device\Include\stm32f10x.h 10 | .\objects\stm32f10x_iwdg.o: ..\fwlib\inc\stm32f10x_bkp.h 11 | .\objects\stm32f10x_iwdg.o: ..\fwlib\inc\stm32f10x_can.h 12 | .\objects\stm32f10x_iwdg.o: ..\fwlib\inc\stm32f10x_cec.h 13 | .\objects\stm32f10x_iwdg.o: ..\fwlib\inc\stm32f10x_crc.h 14 | .\objects\stm32f10x_iwdg.o: ..\fwlib\inc\stm32f10x_dac.h 15 | .\objects\stm32f10x_iwdg.o: ..\fwlib\inc\stm32f10x_dbgmcu.h 16 | .\objects\stm32f10x_iwdg.o: ..\fwlib\inc\stm32f10x_dma.h 17 | .\objects\stm32f10x_iwdg.o: ..\fwlib\inc\stm32f10x_exti.h 18 | .\objects\stm32f10x_iwdg.o: ..\fwlib\inc\stm32f10x_flash.h 19 | .\objects\stm32f10x_iwdg.o: ..\fwlib\inc\stm32f10x_fsmc.h 20 | .\objects\stm32f10x_iwdg.o: ..\fwlib\inc\stm32f10x_gpio.h 21 | .\objects\stm32f10x_iwdg.o: ..\fwlib\inc\stm32f10x_i2c.h 22 | .\objects\stm32f10x_iwdg.o: ..\fwlib\inc\stm32f10x_iwdg.h 23 | .\objects\stm32f10x_iwdg.o: ..\fwlib\inc\stm32f10x_pwr.h 24 | .\objects\stm32f10x_iwdg.o: ..\fwlib\inc\stm32f10x_rcc.h 25 | .\objects\stm32f10x_iwdg.o: ..\fwlib\inc\stm32f10x_rtc.h 26 | .\objects\stm32f10x_iwdg.o: ..\fwlib\inc\stm32f10x_sdio.h 27 | .\objects\stm32f10x_iwdg.o: ..\fwlib\inc\stm32f10x_spi.h 28 | .\objects\stm32f10x_iwdg.o: ..\fwlib\inc\stm32f10x_tim.h 29 | .\objects\stm32f10x_iwdg.o: ..\fwlib\inc\stm32f10x_usart.h 30 | .\objects\stm32f10x_iwdg.o: ..\fwlib\inc\stm32f10x_wwdg.h 31 | .\objects\stm32f10x_iwdg.o: ..\fwlib\inc\misc.h 32 | -------------------------------------------------------------------------------- /code/project/Objects/stm32f10x_usart.d: -------------------------------------------------------------------------------- 1 | .\objects\stm32f10x_usart.o: ..\fwlib\src\stm32f10x_usart.c 2 | .\objects\stm32f10x_usart.o: ..\fwlib\inc\stm32f10x_usart.h 3 | .\objects\stm32f10x_usart.o: C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.1.0\Device\Include\stm32f10x.h 4 | .\objects\stm32f10x_usart.o: ..\cmsis\core_cm3.h 5 | .\objects\stm32f10x_usart.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdint.h 6 | .\objects\stm32f10x_usart.o: C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.1.0\Device\Include\system_stm32f10x.h 7 | .\objects\stm32f10x_usart.o: ..\user\stm32f10x_conf.h 8 | .\objects\stm32f10x_usart.o: ..\fwlib\inc\stm32f10x_adc.h 9 | .\objects\stm32f10x_usart.o: C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.1.0\Device\Include\stm32f10x.h 10 | .\objects\stm32f10x_usart.o: ..\fwlib\inc\stm32f10x_bkp.h 11 | .\objects\stm32f10x_usart.o: ..\fwlib\inc\stm32f10x_can.h 12 | .\objects\stm32f10x_usart.o: ..\fwlib\inc\stm32f10x_cec.h 13 | .\objects\stm32f10x_usart.o: ..\fwlib\inc\stm32f10x_crc.h 14 | .\objects\stm32f10x_usart.o: ..\fwlib\inc\stm32f10x_dac.h 15 | .\objects\stm32f10x_usart.o: ..\fwlib\inc\stm32f10x_dbgmcu.h 16 | .\objects\stm32f10x_usart.o: ..\fwlib\inc\stm32f10x_dma.h 17 | .\objects\stm32f10x_usart.o: ..\fwlib\inc\stm32f10x_exti.h 18 | .\objects\stm32f10x_usart.o: ..\fwlib\inc\stm32f10x_flash.h 19 | .\objects\stm32f10x_usart.o: ..\fwlib\inc\stm32f10x_fsmc.h 20 | .\objects\stm32f10x_usart.o: ..\fwlib\inc\stm32f10x_gpio.h 21 | .\objects\stm32f10x_usart.o: ..\fwlib\inc\stm32f10x_i2c.h 22 | .\objects\stm32f10x_usart.o: ..\fwlib\inc\stm32f10x_iwdg.h 23 | .\objects\stm32f10x_usart.o: ..\fwlib\inc\stm32f10x_pwr.h 24 | .\objects\stm32f10x_usart.o: ..\fwlib\inc\stm32f10x_rcc.h 25 | .\objects\stm32f10x_usart.o: ..\fwlib\inc\stm32f10x_rtc.h 26 | .\objects\stm32f10x_usart.o: ..\fwlib\inc\stm32f10x_sdio.h 27 | .\objects\stm32f10x_usart.o: ..\fwlib\inc\stm32f10x_spi.h 28 | .\objects\stm32f10x_usart.o: ..\fwlib\inc\stm32f10x_tim.h 29 | .\objects\stm32f10x_usart.o: ..\fwlib\inc\stm32f10x_usart.h 30 | .\objects\stm32f10x_usart.o: ..\fwlib\inc\stm32f10x_wwdg.h 31 | .\objects\stm32f10x_usart.o: ..\fwlib\inc\misc.h 32 | -------------------------------------------------------------------------------- /code/project/Objects/esp8266.d: -------------------------------------------------------------------------------- 1 | .\objects\esp8266.o: ..\mylib\esp8266.c 2 | .\objects\esp8266.o: ..\mylib\esp8266.h 3 | .\objects\esp8266.o: C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.1.0\Device\Include\stm32f10x.h 4 | .\objects\esp8266.o: ..\cmsis\core_cm3.h 5 | .\objects\esp8266.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdint.h 6 | .\objects\esp8266.o: C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.1.0\Device\Include\system_stm32f10x.h 7 | .\objects\esp8266.o: ..\user\stm32f10x_conf.h 8 | .\objects\esp8266.o: ..\fwlib\inc\stm32f10x_adc.h 9 | .\objects\esp8266.o: C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.1.0\Device\Include\stm32f10x.h 10 | .\objects\esp8266.o: ..\fwlib\inc\stm32f10x_bkp.h 11 | .\objects\esp8266.o: ..\fwlib\inc\stm32f10x_can.h 12 | .\objects\esp8266.o: ..\fwlib\inc\stm32f10x_cec.h 13 | .\objects\esp8266.o: ..\fwlib\inc\stm32f10x_crc.h 14 | .\objects\esp8266.o: ..\fwlib\inc\stm32f10x_dac.h 15 | .\objects\esp8266.o: ..\fwlib\inc\stm32f10x_dbgmcu.h 16 | .\objects\esp8266.o: ..\fwlib\inc\stm32f10x_dma.h 17 | .\objects\esp8266.o: ..\fwlib\inc\stm32f10x_exti.h 18 | .\objects\esp8266.o: ..\fwlib\inc\stm32f10x_flash.h 19 | .\objects\esp8266.o: ..\fwlib\inc\stm32f10x_fsmc.h 20 | .\objects\esp8266.o: ..\fwlib\inc\stm32f10x_gpio.h 21 | .\objects\esp8266.o: ..\fwlib\inc\stm32f10x_i2c.h 22 | .\objects\esp8266.o: ..\fwlib\inc\stm32f10x_iwdg.h 23 | .\objects\esp8266.o: ..\fwlib\inc\stm32f10x_pwr.h 24 | .\objects\esp8266.o: ..\fwlib\inc\stm32f10x_rcc.h 25 | .\objects\esp8266.o: ..\fwlib\inc\stm32f10x_rtc.h 26 | .\objects\esp8266.o: ..\fwlib\inc\stm32f10x_sdio.h 27 | .\objects\esp8266.o: ..\fwlib\inc\stm32f10x_spi.h 28 | .\objects\esp8266.o: ..\fwlib\inc\stm32f10x_tim.h 29 | .\objects\esp8266.o: ..\fwlib\inc\stm32f10x_usart.h 30 | .\objects\esp8266.o: ..\fwlib\inc\stm32f10x_wwdg.h 31 | .\objects\esp8266.o: ..\fwlib\inc\misc.h 32 | .\objects\esp8266.o: ..\mylib\usart2.h 33 | .\objects\esp8266.o: ..\mylib\delay.h 34 | .\objects\esp8266.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdio.h 35 | .\objects\esp8266.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdlib.h 36 | .\objects\esp8266.o: ..\mylib\led.h 37 | .\objects\esp8266.o: ..\mylib\usart1.h 38 | -------------------------------------------------------------------------------- /code/user/stm32f10x_it.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file Project/STM32F10x_StdPeriph_Template/stm32f10x_it.h 4 | * @author MCD Application Team 5 | * @version V3.5.0 6 | * @date 08-April-2011 7 | * @brief This file contains the headers of the interrupt handlers. 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 | /* Define to prevent recursive inclusion -------------------------------------*/ 23 | #ifndef __STM32F10x_IT_H 24 | #define __STM32F10x_IT_H 25 | 26 | #ifdef __cplusplus 27 | extern "C" { 28 | #endif 29 | 30 | /* Includes ------------------------------------------------------------------*/ 31 | #include "stm32f10x.h" 32 | 33 | /* Exported types ------------------------------------------------------------*/ 34 | /* Exported constants --------------------------------------------------------*/ 35 | /* Exported macro ------------------------------------------------------------*/ 36 | /* Exported functions ------------------------------------------------------- */ 37 | 38 | void NMI_Handler(void); 39 | void HardFault_Handler(void); 40 | void MemManage_Handler(void); 41 | void BusFault_Handler(void); 42 | void UsageFault_Handler(void); 43 | void SVC_Handler(void); 44 | void DebugMon_Handler(void); 45 | void PendSV_Handler(void); 46 | void SysTick_Handler(void); 47 | 48 | #ifdef __cplusplus 49 | } 50 | #endif 51 | 52 | #endif /* __STM32F10x_IT_H */ 53 | 54 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ 55 | -------------------------------------------------------------------------------- /code/project/Objects/main.d: -------------------------------------------------------------------------------- 1 | .\objects\main.o: ..\user\main.c 2 | .\objects\main.o: ..\mylib\led.h 3 | .\objects\main.o: ..\user\stm32f10x_conf.h 4 | .\objects\main.o: ..\fwlib\inc\stm32f10x_adc.h 5 | .\objects\main.o: C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.1.0\Device\Include\stm32f10x.h 6 | .\objects\main.o: ..\cmsis\core_cm3.h 7 | .\objects\main.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdint.h 8 | .\objects\main.o: C:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\1.1.0\Device\Include\system_stm32f10x.h 9 | .\objects\main.o: ..\user\stm32f10x_conf.h 10 | .\objects\main.o: ..\fwlib\inc\stm32f10x_bkp.h 11 | .\objects\main.o: ..\fwlib\inc\stm32f10x_can.h 12 | .\objects\main.o: ..\fwlib\inc\stm32f10x_cec.h 13 | .\objects\main.o: ..\fwlib\inc\stm32f10x_crc.h 14 | .\objects\main.o: ..\fwlib\inc\stm32f10x_dac.h 15 | .\objects\main.o: ..\fwlib\inc\stm32f10x_dbgmcu.h 16 | .\objects\main.o: ..\fwlib\inc\stm32f10x_dma.h 17 | .\objects\main.o: ..\fwlib\inc\stm32f10x_exti.h 18 | .\objects\main.o: ..\fwlib\inc\stm32f10x_flash.h 19 | .\objects\main.o: ..\fwlib\inc\stm32f10x_fsmc.h 20 | .\objects\main.o: ..\fwlib\inc\stm32f10x_gpio.h 21 | .\objects\main.o: ..\fwlib\inc\stm32f10x_i2c.h 22 | .\objects\main.o: ..\fwlib\inc\stm32f10x_iwdg.h 23 | .\objects\main.o: ..\fwlib\inc\stm32f10x_pwr.h 24 | .\objects\main.o: ..\fwlib\inc\stm32f10x_rcc.h 25 | .\objects\main.o: ..\fwlib\inc\stm32f10x_rtc.h 26 | .\objects\main.o: ..\fwlib\inc\stm32f10x_sdio.h 27 | .\objects\main.o: ..\fwlib\inc\stm32f10x_spi.h 28 | .\objects\main.o: ..\fwlib\inc\stm32f10x_tim.h 29 | .\objects\main.o: ..\fwlib\inc\stm32f10x_usart.h 30 | .\objects\main.o: ..\fwlib\inc\stm32f10x_wwdg.h 31 | .\objects\main.o: ..\fwlib\inc\misc.h 32 | .\objects\main.o: ..\mylib\buzzer.h 33 | .\objects\main.o: ..\mylib\fan.h 34 | .\objects\main.o: ..\mylib\button.h 35 | .\objects\main.o: ..\mylib\iwdg.h 36 | .\objects\main.o: ..\mylib\delay.h 37 | .\objects\main.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdio.h 38 | .\objects\main.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\string.h 39 | .\objects\main.o: ..\mylib\sht.h 40 | .\objects\main.o: ..\mylib\oled.h 41 | .\objects\main.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdlib.h 42 | .\objects\main.o: ..\mylib\oledfont.h 43 | .\objects\main.o: ..\mylib\fire.h 44 | .\objects\main.o: ..\mylib\ldt.h 45 | .\objects\main.o: ..\mylib\mq5.h 46 | .\objects\main.o: ..\mylib\esp8266.h 47 | .\objects\main.o: ..\mylib\iot.h 48 | .\objects\main.o: ..\mylib\rtc.h 49 | .\objects\main.o: ..\mylib\bitband.h 50 | -------------------------------------------------------------------------------- /code/user/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 | -------------------------------------------------------------------------------- /code/fwlib/inc/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 | -------------------------------------------------------------------------------- /code/mylib/usart2.c: -------------------------------------------------------------------------------- 1 | #include "usart2.h" 2 | #include "esp8266.h" 3 | 4 | usart_2_handler usart2_handler; 5 | 6 | void usart_2_init(void) 7 | { 8 | GPIO_InitTypeDef Gpio_Value; 9 | USART_InitTypeDef Usart_Value; 10 | NVIC_InitTypeDef Nvic_Value; 11 | 12 | RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE); 13 | RCC_APB1PeriphClockCmd(RCC_APB1Periph_USART2, ENABLE); 14 | 15 | Gpio_Value.GPIO_Mode = GPIO_Mode_AF_PP; 16 | Gpio_Value.GPIO_Pin = GPIO_Pin_2; 17 | Gpio_Value.GPIO_Speed = GPIO_Speed_50MHz; 18 | GPIO_Init(GPIOA, &Gpio_Value); 19 | 20 | Gpio_Value.GPIO_Mode = GPIO_Mode_IN_FLOATING; 21 | Gpio_Value.GPIO_Pin = GPIO_Pin_3; 22 | GPIO_Init(GPIOA, &Gpio_Value); 23 | 24 | GPIO_PinRemapConfig(GPIO_Remap_USART2, ENABLE); 25 | 26 | Usart_Value.USART_BaudRate = 115200; 27 | Usart_Value.USART_HardwareFlowControl = USART_HardwareFlowControl_None; 28 | Usart_Value.USART_Mode = USART_Mode_Rx | USART_Mode_Tx; 29 | Usart_Value.USART_Parity = USART_Parity_No; 30 | Usart_Value.USART_StopBits = USART_StopBits_1; 31 | Usart_Value.USART_WordLength = USART_WordLength_8b; 32 | USART_Init(USART2, &Usart_Value); 33 | 34 | NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2); 35 | Nvic_Value.NVIC_IRQChannel = USART2_IRQn; 36 | Nvic_Value.NVIC_IRQChannelCmd = ENABLE; 37 | Nvic_Value.NVIC_IRQChannelPreemptionPriority = 2; 38 | Nvic_Value.NVIC_IRQChannelSubPriority = 2; 39 | NVIC_Init(&Nvic_Value); 40 | 41 | USART_ITConfig(USART2, USART_IT_RXNE, ENABLE); 42 | 43 | USART_Cmd(USART2, ENABLE); 44 | } 45 | 46 | void usart_2_send_byte(char c) 47 | { 48 | USART_SendData(USART2, (uint16_t)c); 49 | while(USART_GetFlagStatus(USART2, USART_FLAG_TC) == RESET); 50 | USART_ClearFlag(USART2, USART_FLAG_TC); 51 | } 52 | 53 | void usart_2_send_data(char *buf) 54 | { 55 | while(*buf) 56 | { 57 | usart_2_send_byte(*buf); 58 | buf++; 59 | } 60 | } 61 | 62 | void USART2_IRQHandler(void) 63 | { 64 | uint16_t data; 65 | 66 | if(USART_GetITStatus(USART2, USART_IT_RXNE) == SET) 67 | { 68 | data = USART_ReceiveData(USART2); 69 | dataHandler(data); 70 | USART_ClearITPendingBit(USART2, USART_IT_RXNE); 71 | } 72 | } 73 | 74 | void set_usart_2_handler(usart_2_handler h) 75 | { 76 | usart2_handler = h; 77 | } 78 | 79 | unsigned char usart_2_recv_byte(void) 80 | { 81 | unsigned char data; 82 | 83 | if(USART_GetFlagStatus(USART2, USART_FLAG_RXNE) != RESET) 84 | { 85 | data = USART_ReceiveData(USART2); 86 | USART_ClearFlag(USART2, USART_FLAG_RXNE); 87 | } 88 | return data; 89 | } 90 | 91 | 92 | 93 | 94 | 95 | 96 | -------------------------------------------------------------------------------- /code/mylib/ldt.c: -------------------------------------------------------------------------------- 1 | #include "ldt.h" 2 | #include "bitband.h" 3 | #include "delay.h" 4 | 5 | #define HC138_A0 PCOut(11) 6 | #define HC138_A1 PCOut(12) 7 | #define HC138_A2 PDOut(2) 8 | #define HC595_SLCK PBOut(5) 9 | #define HC595_LCLK PBOut(4) 10 | #define HC595_DATA PBOut(3) 11 | 12 | void ldt_init(void)//初始化的函数(初始化模块使用到的管脚) 13 | { 14 | GPIO_InitTypeDef Gpio_Value;//定义了GPIO固件的结构体变量 15 | 16 | RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB | RCC_APB2Periph_GPIOC | 17 | RCC_APB2Periph_GPIOD | RCC_APB2Periph_AFIO, ENABLE); 18 | //通过APB2总线使能GPIOC组 GPIOB组 GPIOD组 和AFIO的时钟 19 | 20 | GPIO_PinRemapConfig(GPIO_Remap_SWJ_JTAGDisable, ENABLE);//改变指定管脚的映射 21 | //JTAG-DP 关闭功能 + SW-DP 使能 22 | 23 | Gpio_Value.GPIO_Mode = GPIO_Mode_Out_PP;//选择推挽的输出模式 24 | Gpio_Value.GPIO_Pin = GPIO_Pin_11 | GPIO_Pin_12;//选择 11 12 号管脚 25 | Gpio_Value.GPIO_Speed = GPIO_Speed_50MHz;//选择50MHz的输出速度 26 | GPIO_Init(GPIOC, &Gpio_Value);//按照上述配置初始化GPIOC组的管脚 27 | 28 | Gpio_Value.GPIO_Pin = GPIO_Pin_2;//选择 2 号管脚 29 | GPIO_Init(GPIOD, &Gpio_Value);//按照上述配置初始化GPIOD组的管脚 30 | 31 | Gpio_Value.GPIO_Pin = GPIO_Pin_3 | GPIO_Pin_4 | GPIO_Pin_5;//选择3 4 5号管脚 32 | GPIO_Init(GPIOB, &Gpio_Value);//按照上述配置初始化GPIOB组的管脚 33 | 34 | HC138_A0 = 0; 35 | HC138_A1 = 0; 36 | HC138_A2 = 0; 37 | HC595_SLCK = 0; 38 | HC595_LCLK = 0; 39 | HC595_DATA = 0; 40 | } 41 | 42 | void hc138_out_data(uint8_t data)//通过hc138选择数码管的公共端 43 | {//按照74HC138的官方手册上的真值表配置函数 44 | switch(data) { 45 | case 0 : HC138_A0 = 0; HC138_A1 = 0; HC138_A2 = 0; break; 46 | case 1 : HC138_A0 = 1; HC138_A1 = 0; HC138_A2 = 0; break; 47 | case 2 : HC138_A0 = 0; HC138_A1 = 1; HC138_A2 = 0; break; 48 | case 3 : HC138_A0 = 1; HC138_A1 = 1; HC138_A2 = 0; break; 49 | } 50 | } 51 | 52 | void hc595_send_data(uint8_t data)//通过hc595把串行数据转换成并行数据 53 | {//按照74HC595的官方手册上的流程配置函数 54 | uint8_t i = 0; // 循环变量 55 | 56 | for(i = 0; i < 8; i++) { 57 | HC595_DATA = ((data >> 7) & 0x01); // 将最低位数据交给DS管脚 58 | HC595_SLCK = 1; // SH_CP管脚产生上升沿 59 | data <<= 1; 60 | HC595_SLCK = 0; 61 | } 62 | HC595_LCLK = 1; // ST_CP管脚产生上升沿 63 | //delay_ms(1); 64 | HC595_LCLK = 0; 65 | } 66 | 67 | void digit_show_data(int data)//在数码管中显示数据 68 | {//使用的是4位共阴极的数码管,自己去找编码 0x3F 0x06 ... (0 ~ 9 A ~ F) 69 | uint8_t i = 0; 70 | int data_[4] = {0}; 71 | uint8_t table[] = { 72 | 0x3f,0x06,0x5b,0x4f, // 0-3 73 | 0x66,0x6d,0x7d,0x07, // 4-7 74 | 0x7f,0x6f,0x77,0x7c, // 6-b 75 | 0x39,0x5e,0x79,0x71 // c-f 76 | };//存放数码管的编码 77 | 78 | data_[0] = data / 1000; 79 | data_[1] = (data / 100) % 10; 80 | data_[2] = (data / 10) % 10; 81 | data_[3] = data % 10; 82 | 83 | for(i = 0; i < 4; i++) { 84 | hc138_out_data(i);//选择公共端(选择让哪个数码管显示数据) 85 | hc595_send_data(table[data_[i]]);//把编码通过函数转换成并行数据 86 | delay_ms(1); 87 | hc595_send_data(0);//手动清空74HC595模块中8位位移寄存器中的数据 88 | } 89 | 90 | } 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | -------------------------------------------------------------------------------- /code/mylib/eint.c: -------------------------------------------------------------------------------- 1 | #include "eint.h" 2 | #include "delay.h" 3 | #include "button.h" 4 | 5 | static eint_handler eint_h0, eint_h1, eint_h2; 6 | 7 | void eint_init(void) // 初始化GPIO/NVIC/EXTI 8 | { 9 | GPIO_InitTypeDef Gpio_Value; 10 | NVIC_InitTypeDef Nvic_Value; 11 | EXTI_InitTypeDef Exti_Value; 12 | 13 | // 使能时钟 14 | RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOC | RCC_APB2Periph_GPIOA | RCC_APB2Periph_AFIO, ENABLE); 15 | 16 | // 初始化GPIO(PC9 PC8 IPU PA0 IPD) 17 | Gpio_Value.GPIO_Mode = GPIO_Mode_IPU; 18 | Gpio_Value.GPIO_Pin = GPIO_Pin_9 | GPIO_Pin_8; 19 | GPIO_Init(GPIOC, &Gpio_Value); 20 | 21 | Gpio_Value.GPIO_Mode = GPIO_Mode_IPD; 22 | Gpio_Value.GPIO_Pin = GPIO_Pin_0; 23 | GPIO_Init(GPIOA, &Gpio_Value); 24 | 25 | GPIO_EXTILineConfig(GPIO_PortSourceGPIOC, GPIO_PinSource9); 26 | GPIO_EXTILineConfig(GPIO_PortSourceGPIOC, GPIO_PinSource8); 27 | GPIO_EXTILineConfig(GPIO_PortSourceGPIOA, GPIO_PinSource0); 28 | 29 | // 初始化NVIC 30 | NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2); // 设置NVIC优先级 31 | 32 | Nvic_Value.NVIC_IRQChannel = EXTI9_5_IRQn; // 设置中断号 33 | Nvic_Value.NVIC_IRQChannelCmd = ENABLE; 34 | Nvic_Value.NVIC_IRQChannelPreemptionPriority = 2; 35 | Nvic_Value.NVIC_IRQChannelSubPriority = 2; 36 | NVIC_Init(&Nvic_Value); 37 | 38 | Nvic_Value.NVIC_IRQChannel = EXTI0_IRQn; 39 | Nvic_Value.NVIC_IRQChannelCmd = ENABLE; 40 | Nvic_Value.NVIC_IRQChannelPreemptionPriority = 2; 41 | Nvic_Value.NVIC_IRQChannelSubPriority = 2; 42 | NVIC_Init(&Nvic_Value); 43 | 44 | // 初始化EXTI 45 | Exti_Value.EXTI_Line = EXTI_Line9 | EXTI_Line8; 46 | Exti_Value.EXTI_LineCmd = ENABLE; 47 | Exti_Value.EXTI_Mode = EXTI_Mode_Interrupt; // 设置为中断模式 48 | Exti_Value.EXTI_Trigger = EXTI_Trigger_Falling; // 下降沿触发 49 | EXTI_Init(&Exti_Value); 50 | Exti_Value.EXTI_Line = EXTI_Line0; 51 | Exti_Value.EXTI_LineCmd = ENABLE; 52 | Exti_Value.EXTI_Mode = EXTI_Mode_Interrupt; 53 | Exti_Value.EXTI_Trigger = EXTI_Trigger_Rising; // 上升沿触发 54 | EXTI_Init(&Exti_Value); 55 | delay_init(); 56 | } 57 | 58 | 59 | void EXTI9_5_IRQHandler(void) // 实现中断处理的回调函数 60 | { 61 | // 判断是由哪个外部中断触发的 62 | if(EXTI_GetITStatus(EXTI_Line9) == SET) { 63 | delay_ms(30); 64 | if(button_status(0)) { 65 | while(button_status(0)) 66 | delay_ms(30); 67 | eint_h0(); 68 | // 清除标志位 69 | EXTI_ClearITPendingBit(EXTI_Line9); 70 | } 71 | } 72 | 73 | if(EXTI_GetITStatus(EXTI_Line8) == SET) { 74 | delay_ms(30); 75 | if(button_status(1)) { 76 | while(button_status(1)) 77 | delay_ms(30); 78 | eint_h1(); 79 | // 清除标志位 80 | EXTI_ClearITPendingBit(EXTI_Line8); 81 | } 82 | } 83 | } 84 | 85 | void EXTI0_IRQHandler(void) 86 | { 87 | delay_ms(30); 88 | if(button_status(2)) { 89 | while(button_status(2)) 90 | delay_ms(30); 91 | eint_h2(); 92 | EXTI_ClearITPendingBit(EXTI_Line0); 93 | } 94 | } 95 | 96 | void set_eint_handler(eint_handler h0, eint_handler h1, eint_handler h2) // 设置中断处理函数 97 | { 98 | eint_h0 = h0; 99 | eint_h1 = h1; 100 | eint_h2 = h2; 101 | } 102 | 103 | -------------------------------------------------------------------------------- /code/mylib/usart1.c: -------------------------------------------------------------------------------- 1 | #include "usart1.h" 2 | #include "string.h" 3 | 4 | /* 5 | 串口USART1 6 | RX PA10 接收 只需要配置成浮空输入 7 | TX PA9 发送 需要配置成复用推挽 8 | */ 9 | 10 | #define RECVSIZE 128 11 | 12 | usart1_handler u1_h; 13 | 14 | 15 | void usart_1_init(void) // 初始化USART1 16 | { 17 | GPIO_InitTypeDef Gpio_Value; 18 | USART_InitTypeDef Usart_Value; 19 | NVIC_InitTypeDef Nvic_Value; 20 | 21 | // 使能时钟 22 | RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA | RCC_APB2Periph_USART1, ENABLE); 23 | 24 | // 初始化GPIO 25 | Gpio_Value.GPIO_Mode = GPIO_Mode_AF_PP; 26 | Gpio_Value.GPIO_Pin = GPIO_Pin_9; 27 | Gpio_Value.GPIO_Speed = GPIO_Speed_50MHz; 28 | GPIO_Init(GPIOA, &Gpio_Value); 29 | 30 | Gpio_Value.GPIO_Mode = GPIO_Mode_IN_FLOATING; 31 | Gpio_Value.GPIO_Pin = GPIO_Pin_10; 32 | GPIO_Init(GPIOA, &Gpio_Value); 33 | 34 | // 初始化USART1 35 | Usart_Value.USART_BaudRate = 115200; // 设置波特率115200 36 | Usart_Value.USART_HardwareFlowControl = USART_HardwareFlowControl_None; // 关闭硬件流控 37 | Usart_Value.USART_Mode = USART_Mode_Rx | USART_Mode_Tx; // 设置串口模式为发送接收 38 | Usart_Value.USART_Parity = USART_Parity_No; // 没有奇偶校验位 39 | Usart_Value.USART_StopBits = USART_StopBits_1; // 1个停止位 40 | Usart_Value.USART_WordLength = USART_WordLength_8b; // 8个数据位 41 | USART_Init(USART1, &Usart_Value); // 初始化USART1 42 | 43 | // 初始化NVIC 44 | NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2); 45 | Nvic_Value.NVIC_IRQChannel = USART1_IRQn; 46 | Nvic_Value.NVIC_IRQChannelCmd = ENABLE; 47 | Nvic_Value.NVIC_IRQChannelPreemptionPriority = 2; 48 | Nvic_Value.NVIC_IRQChannelSubPriority = 2; 49 | NVIC_Init(&Nvic_Value); 50 | 51 | USART_ITConfig(USART1, USART_IT_RXNE, ENABLE); // 使能USART1的中断为接收触发 52 | 53 | USART_Cmd(USART1, ENABLE); // 使能USART1 54 | } 55 | 56 | void USART1_IRQHandler(void) 57 | { 58 | static int i = 0; 59 | unsigned char c = 0; 60 | static char recv_str[RECVSIZE] = {0}; 61 | static int recv_flag = 0; 62 | if(USART_GetITStatus(USART1, USART_IT_RXNE) == SET) { 63 | //u1_h(USART_ReceiveData(USART1)); 64 | recv_flag = 1; // 开始接收 65 | c = USART_ReceiveData(USART1); 66 | if(i <= RECVSIZE) { 67 | if(c == ';') { 68 | recv_flag = 0; // 完成接收 69 | c = '\0'; 70 | } 71 | recv_str[i++] = c; 72 | } else { 73 | recv_flag = 0; 74 | } 75 | if(!recv_flag) { 76 | // 接收完成调用函数 77 | u1_h(recv_str); 78 | //memset(recv_str, '\0', RECVSIZE); 79 | i = 0; 80 | } 81 | USART_ClearITPendingBit(USART1, USART_IT_RXNE); // 清除标志位 82 | } 83 | } 84 | 85 | void usart_1_send_byte(unsigned char c) // 发送数据 86 | { 87 | USART_SendData(USART1, c); 88 | while(USART_GetFlagStatus(USART1, USART_FLAG_TC) == RESET); 89 | USART_ClearFlag(USART1, USART_FLAG_TC); // 清除标志位 90 | } 91 | 92 | unsigned char usart_1_recv_byte(void) // 接收数据 93 | { 94 | unsigned char ret = 0; 95 | if(USART_GetFlagStatus(USART1, USART_FLAG_RXNE) == SET) { 96 | ret = USART_ReceiveData(USART1); 97 | USART_ClearFlag(USART1, USART_FLAG_RXNE); 98 | } 99 | return ret; 100 | } 101 | 102 | void usart_1_send_data(char *buf) // 发送字符串 103 | { 104 | int i = 0; 105 | int len = strlen(buf); 106 | 107 | for(i = 0; i < len; i++) { 108 | usart_1_send_byte(buf[i]); 109 | } 110 | } 111 | 112 | void set_usart_1_handler(usart1_handler h) 113 | { 114 | u1_h = h; 115 | } 116 | 117 | -------------------------------------------------------------------------------- /code/user/stm32f10x_conf.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file Project/STM32F10x_StdPeriph_Template/stm32f10x_conf.h 4 | * @author MCD Application Team 5 | * @version V3.5.0 6 | * @date 08-April-2011 7 | * @brief Library configuration 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 | /* Define to prevent recursive inclusion -------------------------------------*/ 23 | #ifndef __STM32F10x_CONF_H 24 | #define __STM32F10x_CONF_H 25 | 26 | /* Includes ------------------------------------------------------------------*/ 27 | /* Uncomment/Comment the line below to enable/disable peripheral header file inclusion */ 28 | #include "stm32f10x_adc.h" 29 | #include "stm32f10x_bkp.h" 30 | #include "stm32f10x_can.h" 31 | #include "stm32f10x_cec.h" 32 | #include "stm32f10x_crc.h" 33 | #include "stm32f10x_dac.h" 34 | #include "stm32f10x_dbgmcu.h" 35 | #include "stm32f10x_dma.h" 36 | #include "stm32f10x_exti.h" 37 | #include "stm32f10x_flash.h" 38 | #include "stm32f10x_fsmc.h" 39 | #include "stm32f10x_gpio.h" 40 | #include "stm32f10x_i2c.h" 41 | #include "stm32f10x_iwdg.h" 42 | #include "stm32f10x_pwr.h" 43 | #include "stm32f10x_rcc.h" 44 | #include "stm32f10x_rtc.h" 45 | #include "stm32f10x_sdio.h" 46 | #include "stm32f10x_spi.h" 47 | #include "stm32f10x_tim.h" 48 | #include "stm32f10x_usart.h" 49 | #include "stm32f10x_wwdg.h" 50 | #include "misc.h" /* High level functions for NVIC and SysTick (add-on to CMSIS functions) */ 51 | 52 | /* Exported types ------------------------------------------------------------*/ 53 | /* Exported constants --------------------------------------------------------*/ 54 | /* Uncomment the line below to expanse the "assert_param" macro in the 55 | Standard Peripheral Library drivers code */ 56 | /* #define USE_FULL_ASSERT 1 */ 57 | 58 | /* Exported macro ------------------------------------------------------------*/ 59 | #ifdef USE_FULL_ASSERT 60 | 61 | /** 62 | * @brief The assert_param macro is used for function's parameters check. 63 | * @param expr: If expr is false, it calls assert_failed function which reports 64 | * the name of the source file and the source line number of the call 65 | * that failed. If expr is true, it returns no value. 66 | * @retval None 67 | */ 68 | #define assert_param(expr) ((expr) ? (void)0 : assert_failed((uint8_t *)__FILE__, __LINE__)) 69 | /* Exported functions ------------------------------------------------------- */ 70 | void assert_failed(uint8_t* file, uint32_t line); 71 | #else 72 | #define assert_param(expr) ((void)0) 73 | #endif /* USE_FULL_ASSERT */ 74 | 75 | #endif /* __STM32F10x_CONF_H */ 76 | 77 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ 78 | -------------------------------------------------------------------------------- /code/fwlib/inc/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.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 | -------------------------------------------------------------------------------- /code/mylib/gpio_iic.c: -------------------------------------------------------------------------------- 1 | #include "gpio_iic.h" 2 | #include "delay.h" 3 | #include "bitband.h" 4 | 5 | /* 6 | 用GPIO的方式模拟IIC总线这种方法,和硬件连接的GPIO有关 7 | 我的设备接到不同的GPIO上,将来就需要配置响应的GPIO 8 | 因为我们做的实验有OLED EEPROM SHT30,而这些设备都是连接在了相同的管脚上 9 | 所以,在使用时从设备地址一定不要写错 10 | */ 11 | 12 | //以下代码是硬件相关的,移植时候需要修改 13 | GPIO_InitTypeDef GPIO_InitForSCL; 14 | GPIO_InitTypeDef GPIO_InitForSDAOut; 15 | GPIO_InitTypeDef GPIO_InitForSDAIn; 16 | 17 | #define IIC_SCL PBOut(6) 18 | #define IIC_SDA PBOut(7) 19 | #define IIC_SDA_STATUS PBIn(7) 20 | 21 | void IIC_Init(void) 22 | { 23 | RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB, ENABLE); 24 | 25 | //PB6 SCL 26 | GPIO_InitForSCL.GPIO_Mode = GPIO_Mode_Out_PP; 27 | GPIO_InitForSCL.GPIO_Pin = GPIO_Pin_6; 28 | GPIO_InitForSCL.GPIO_Speed = GPIO_Speed_50MHz; 29 | 30 | //PB7 SDA OUT 31 | GPIO_InitForSDAOut.GPIO_Mode = GPIO_Mode_Out_PP; 32 | GPIO_InitForSDAOut.GPIO_Pin = GPIO_Pin_7; 33 | GPIO_InitForSDAOut.GPIO_Speed = GPIO_Speed_50MHz; 34 | 35 | //PB7 SDA IN 36 | GPIO_InitForSDAIn.GPIO_Mode = GPIO_Mode_IPU; 37 | GPIO_InitForSDAIn.GPIO_Pin = GPIO_Pin_7; 38 | GPIO_InitForSDAIn.GPIO_Speed = GPIO_Speed_50MHz; 39 | 40 | GPIO_Init(GPIOB, &GPIO_InitForSDAOut); 41 | GPIO_Init(GPIOB, &GPIO_InitForSCL); 42 | 43 | IIC_SCL = 1; 44 | IIC_SDA = 1; 45 | } 46 | 47 | void IIC_Sda_In(void) 48 | { 49 | GPIO_Init(GPIOB, &GPIO_InitForSDAIn); 50 | } 51 | 52 | void IIC_Sda_Out(void) 53 | { 54 | GPIO_Init(GPIOB, &GPIO_InitForSDAOut); 55 | } 56 | //以上代码是硬件相关的,移植时候需要修改 57 | 58 | //以下代码硬件无关,只跟iic协议有关 59 | void IIC_Start(void) 60 | { 61 | IIC_Sda_Out(); 62 | IIC_SDA=1; 63 | IIC_SCL=1; 64 | delay_us(2); 65 | IIC_SDA=0; 66 | delay_us(2); 67 | IIC_SCL=0; 68 | } 69 | 70 | void IIC_Stop(void) 71 | { 72 | IIC_Sda_Out(); 73 | IIC_SCL=0; 74 | IIC_SDA=0; 75 | delay_us(2); 76 | IIC_SCL=1; 77 | delay_us(1); 78 | IIC_SDA=1; 79 | delay_us(2); 80 | } 81 | 82 | u8 IIC_Wait_Ack(void) 83 | { 84 | u8 ucErrTime=0; 85 | IIC_Sda_In(); 86 | IIC_SCL = 0; 87 | delay_us(1); 88 | IIC_SCL=1; 89 | delay_us(1); 90 | while(IIC_SDA_STATUS) { 91 | ucErrTime++; 92 | if(ucErrTime>250) { 93 | IIC_Stop(); 94 | return 1; 95 | } 96 | } 97 | IIC_SCL=0; 98 | return 0; 99 | } 100 | 101 | void IIC_Ack(void) 102 | { 103 | IIC_SCL=0; 104 | IIC_Sda_Out(); 105 | IIC_SDA=0; 106 | delay_us(2); 107 | IIC_SCL=1; 108 | delay_us(2); 109 | IIC_SCL=0; 110 | } 111 | 112 | void IIC_NAck(void) 113 | { 114 | IIC_SCL=0; 115 | IIC_Sda_Out(); 116 | IIC_SDA=1; 117 | delay_us(2); 118 | IIC_SCL=1; 119 | delay_us(2); 120 | IIC_SCL=0; 121 | } 122 | 123 | void IIC_Send_Byte(u8 txd) 124 | { 125 | u8 t; 126 | 127 | IIC_Sda_Out(); 128 | 129 | for (t = 0;t < 8; t++) { 130 | IIC_SCL = 0; 131 | delay_us(1); 132 | IIC_SDA = (txd & 0x80) >> 7; 133 | txd <<= 1; 134 | delay_us(1); 135 | IIC_SCL=1; 136 | delay_us(2); 137 | } 138 | IIC_SCL = 0; 139 | } 140 | 141 | u8 IIC_Recv_Byte(unsigned char ack) 142 | { 143 | unsigned char i,receive=0; 144 | IIC_Sda_In(); 145 | for(i=0;i<8;i++ ) { 146 | IIC_SCL=0; 147 | delay_us(2); 148 | IIC_SCL=1; 149 | delay_us(2); 150 | receive<<=1; 151 | if(IIC_SDA_STATUS) 152 | receive |= 1; 153 | } 154 | IIC_SCL = 0; 155 | if (!ack) 156 | IIC_NAck(); 157 | else 158 | IIC_Ack(); 159 | return receive; 160 | } 161 | -------------------------------------------------------------------------------- /code/fwlib/src/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_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 | -------------------------------------------------------------------------------- /code/fwlib/inc/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.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 | -------------------------------------------------------------------------------- /code/fwlib/inc/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.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 | -------------------------------------------------------------------------------- /code/fwlib/inc/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.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 | -------------------------------------------------------------------------------- /code/mylib/rtc.c: -------------------------------------------------------------------------------- 1 | #include "rtc.h" 2 | #include "string.h" 3 | 4 | const uint8_t monthTable[12] = {31,28,31,30,31,30,31,31,30,31,30,31};//存储每个月的天数(闰年2月份需要多加1天) 5 | static struct time_st T;//定义了日期时间结构体的全局变量 6 | 7 | static uint8_t isLeapYear(uint16_t y)//判断是否是闰年 8 | { 9 | return (((!(y % 4)) && (y % 100)) || (!(y % 400))); 10 | } 11 | 12 | void RTC_IRQHandler(void) 13 | { 14 | if(RTC_GetITStatus(RTC_IT_SEC) == SET)//判断是否是由RTC的秒中断触发的中断 15 | { 16 | conv_time(&T);//转换RTC中的时间并保存到全局变量T中 17 | RTC_ClearITPendingBit(RTC_IT_SEC);//清除RTC秒中断的中断标志 18 | } 19 | } 20 | 21 | void NVIC_Configuration(void)//配置中断控制器 22 | { 23 | NVIC_InitTypeDef Nvic_Value; 24 | 25 | NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);//配置组优先级和子优先级的所占比例 26 | Nvic_Value.NVIC_IRQChannel = RTC_IRQn;//选择RTC的中断号 27 | Nvic_Value.NVIC_IRQChannelCmd = ENABLE;//选择使能该中断 28 | Nvic_Value.NVIC_IRQChannelPreemptionPriority = 2;//选择组优先级的级别是2 29 | Nvic_Value.NVIC_IRQChannelSubPriority = 2;//选择子优先级的级别是2 30 | NVIC_Init(&Nvic_Value);//按照上述配置初始化NVIC 31 | } 32 | 33 | void RTC_Configuration(void)//配置RTC 34 | { 35 | RCC_APB1PeriphClockCmd(RCC_APB1Periph_BKP | RCC_APB1Periph_PWR, ENABLE); 36 | //通过APB1总线使能BKP和PWR的时钟 37 | PWR_BackupAccessCmd(ENABLE);//通过PWR使能后备区域的写访问(关闭了写保护) 38 | BKP_DeInit();//复位BKP 39 | RCC_LSEConfig(RCC_LSE_ON);//通过RCC开启LSE时钟源 40 | while(RCC_GetFlagStatus(RCC_FLAG_LSERDY) == RESET);//死等的方式等待LSE稳定 41 | RCC_RTCCLKConfig(RCC_RTCCLKSource_LSE);//通过RCC为RTC选择由LSE提供时钟源 42 | RCC_RTCCLKCmd(ENABLE);//通过RCC使能RTC的时钟 43 | RTC_WaitForSynchro();//等待RTC时钟同步 44 | RTC_WaitForLastTask();//等待最后一次对RTC寄存器的写操作完成 45 | RTC_ITConfig(RTC_IT_SEC, ENABLE);//使能RTC的秒中断 46 | RTC_WaitForLastTask();//等待最后一次对RTC寄存器的写操作完成 47 | RTC_EnterConfigMode();//进入RTC的配置模式 48 | RTC_SetPrescaler(32767);//设置RTC的预分频 49 | RTC_WaitForLastTask();//等待最后一次对RTC寄存器的写操作完成 50 | RTC_ExitConfigMode();//退出RTC的配置模式 51 | } 52 | 53 | void rtc_init(struct time_st *t)//初始化RTC 54 | { 55 | NVIC_Configuration();//配置了RTC的中断 56 | if(BKP_ReadBackupRegister(BKP_DR10) != 0x9527)//通过读备份寄存器中的值是否是特定的值判断是否是第一次操作RTC 57 | { 58 | RTC_Configuration();//配置RTC 59 | RTC_WaitForLastTask();//等待最后一次对RTC寄存器的写操作完成 60 | RTC_EnterConfigMode();//进入RTC的配置模式 61 | set_time(t);//设置时间 62 | RTC_WaitForLastTask();//等待最后一次对RTC寄存器的写操作完成 63 | RTC_ExitConfigMode();//退出RTC的配置模式 64 | BKP_WriteBackupRegister(BKP_DR10, 0x9527);//为BKP的寄存器中写入特定的值 65 | } 66 | else//不是第一次操作RTC 67 | { 68 | RTC_WaitForSynchro();//等待RTC的时钟同步 69 | RTC_WaitForLastTask();//等待最后一次对RTC寄存器的写操作完成 70 | RTC_ITConfig(RTC_IT_SEC, ENABLE);//使能RTC的秒中断 71 | RTC_WaitForLastTask();//等待最后一次对RTC寄存器的写操作完成 72 | } 73 | } 74 | 75 | void set_time(struct time_st* t)//设置时间 76 | { 77 | uint32_t secCount = 0; 78 | uint16_t i; 79 | 80 | if(t->Y < 1970 || t->Y > 2099) 81 | return ; 82 | 83 | for(i = 1970; i < t->Y; i++) 84 | { 85 | if(isLeapYear(i)) 86 | secCount += 31622400; 87 | else 88 | secCount += 31536000; 89 | } 90 | 91 | for (i = 0; i < t->M - 1; i++) 92 | { 93 | secCount += ((uint32_t)monthTable[i] * 86400); 94 | if (isLeapYear(t->Y) && i == 1) 95 | secCount += 86400; 96 | } 97 | secCount += (uint32_t)(t->D - 1) * 86400; 98 | secCount += (uint32_t)(t->h) * 3600; 99 | secCount += (uint32_t)(t->m) * 60; 100 | secCount += (uint32_t)(t->s); 101 | 102 | RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR|RCC_APB1Periph_BKP, ENABLE); 103 | PWR_BackupAccessCmd(ENABLE); 104 | RTC_SetCounter(secCount); 105 | RTC_WaitForLastTask(); 106 | } 107 | 108 | void conv_time(struct time_st* t)//转换时间 109 | { 110 | uint32_t timeCount = 0; 111 | uint32_t Count = 0; 112 | uint16_t tmp = 0; 113 | 114 | timeCount = RTC_GetCounter(); 115 | Count = timeCount / 86400; 116 | t->W = (4 + Count) % 7; 117 | if(Count != 0) 118 | { 119 | tmp = 1970; 120 | while(Count >= 365) 121 | { 122 | if(isLeapYear(tmp)) 123 | { 124 | if(Count>= 366) 125 | { 126 | Count -= 366; 127 | } 128 | else 129 | { 130 | tmp++; 131 | break; 132 | } 133 | } 134 | else 135 | { 136 | Count -= 365; 137 | } 138 | tmp++; 139 | } 140 | t->Y = tmp; 141 | tmp = 0; 142 | while(Count >= 28) 143 | { 144 | if(isLeapYear(t->Y) && tmp == 1) 145 | { 146 | if(Count >= 29) 147 | Count -= 29; 148 | else 149 | break; 150 | } 151 | else 152 | { 153 | if(Count >= monthTable[tmp]) 154 | Count -= monthTable[tmp]; 155 | else 156 | break; 157 | } 158 | tmp++; 159 | } 160 | t->M = tmp + 1; 161 | t->D = Count + 1; 162 | } 163 | Count = timeCount % 86400; 164 | t->h = Count / 3600; 165 | t->m = (Count % 3600) / 60; 166 | t->s = (Count % 3600) % 60; 167 | } 168 | 169 | void get_time(struct time_st *t)//获取时间 170 | { 171 | memcpy(t, &T, sizeof(T));//把全局变量T中保存的数据另存到形参t中 172 | } 173 | 174 | 175 | 176 | 177 | 178 | -------------------------------------------------------------------------------- /code/fwlib/inc/stm32f10x_pwr.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f10x_pwr.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 PWR 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_PWR_H 25 | #define __STM32F10x_PWR_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 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 | -------------------------------------------------------------------------------- /code/user/stm32f10x_it.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file Project/STM32F10x_StdPeriph_Template/stm32f10x_it.c 4 | * @author MCD Application Team 5 | * @version V3.5.0 6 | * @date 08-April-2011 7 | * @brief Main Interrupt Service Routines. 8 | * This file provides template for all exceptions handler and 9 | * peripherals interrupt service routine. 10 | ****************************************************************************** 11 | * @attention 12 | * 13 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 14 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 15 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 16 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 17 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 18 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 19 | * 20 | *

© COPYRIGHT 2011 STMicroelectronics

21 | ****************************************************************************** 22 | */ 23 | 24 | /* Includes ------------------------------------------------------------------*/ 25 | #include "stm32f10x_it.h" 26 | 27 | /** @addtogroup STM32F10x_StdPeriph_Template 28 | * @{ 29 | */ 30 | 31 | /* Private typedef -----------------------------------------------------------*/ 32 | /* Private define ------------------------------------------------------------*/ 33 | /* Private macro -------------------------------------------------------------*/ 34 | /* Private variables ---------------------------------------------------------*/ 35 | /* Private function prototypes -----------------------------------------------*/ 36 | /* Private functions ---------------------------------------------------------*/ 37 | 38 | /******************************************************************************/ 39 | /* Cortex-M3 Processor Exceptions Handlers */ 40 | /******************************************************************************/ 41 | 42 | /** 43 | * @brief This function handles NMI exception. 44 | * @param None 45 | * @retval None 46 | */ 47 | void NMI_Handler(void) 48 | { 49 | } 50 | 51 | /** 52 | * @brief This function handles Hard Fault exception. 53 | * @param None 54 | * @retval None 55 | */ 56 | void HardFault_Handler(void) 57 | { 58 | /* Go to infinite loop when Hard Fault exception occurs */ 59 | while (1) 60 | { 61 | } 62 | } 63 | 64 | /** 65 | * @brief This function handles Memory Manage exception. 66 | * @param None 67 | * @retval None 68 | */ 69 | void MemManage_Handler(void) 70 | { 71 | /* Go to infinite loop when Memory Manage exception occurs */ 72 | while (1) 73 | { 74 | } 75 | } 76 | 77 | /** 78 | * @brief This function handles Bus Fault exception. 79 | * @param None 80 | * @retval None 81 | */ 82 | void BusFault_Handler(void) 83 | { 84 | /* Go to infinite loop when Bus Fault exception occurs */ 85 | while (1) 86 | { 87 | } 88 | } 89 | 90 | /** 91 | * @brief This function handles Usage Fault exception. 92 | * @param None 93 | * @retval None 94 | */ 95 | void UsageFault_Handler(void) 96 | { 97 | /* Go to infinite loop when Usage Fault exception occurs */ 98 | while (1) 99 | { 100 | } 101 | } 102 | 103 | /** 104 | * @brief This function handles SVCall exception. 105 | * @param None 106 | * @retval None 107 | */ 108 | void SVC_Handler(void) 109 | { 110 | } 111 | 112 | /** 113 | * @brief This function handles Debug Monitor exception. 114 | * @param None 115 | * @retval None 116 | */ 117 | void DebugMon_Handler(void) 118 | { 119 | } 120 | 121 | /** 122 | * @brief This function handles PendSVC exception. 123 | * @param None 124 | * @retval None 125 | */ 126 | void PendSV_Handler(void) 127 | { 128 | } 129 | 130 | /** 131 | * @brief This function handles SysTick Handler. 132 | * @param None 133 | * @retval None 134 | */ 135 | void SysTick_Handler(void) 136 | { 137 | } 138 | 139 | /******************************************************************************/ 140 | /* STM32F10x Peripherals Interrupt Handlers */ 141 | /* Add here the Interrupt Handler for the used peripheral(s) (PPP), for the */ 142 | /* available peripheral interrupt handler's name please refer to the startup */ 143 | /* file (startup_stm32f10x_xx.s). */ 144 | /******************************************************************************/ 145 | 146 | /** 147 | * @brief This function handles PPP interrupt request. 148 | * @param None 149 | * @retval None 150 | */ 151 | /*void PPP_IRQHandler(void) 152 | { 153 | }*/ 154 | 155 | /** 156 | * @} 157 | */ 158 | 159 | 160 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ 161 | -------------------------------------------------------------------------------- /code/fwlib/src/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_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 | -------------------------------------------------------------------------------- /code/fwlib/src/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_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 | -------------------------------------------------------------------------------- /web/iot/html/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 物联网云平台 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 21 | 22 | 23 | 首页 24 | 25 | 26 | 控制台 27 | 28 | 29 | 登录 30 | 31 | 32 | 注册 33 | 34 | 35 | 36 | 37 | 38 | 39 | 47 | 48 | 49 | 52 | 53 | 54 |
55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 102 | 103 | 175 | --------------------------------------------------------------------------------