├── .gitattributes ├── Component ├── FIFO_QUEUE │ ├── FIFO_Def.h │ ├── fifo_queue.c │ ├── fifo_queue.h │ └── t_queue.h ├── FatFs │ ├── inc │ │ ├── FatFs_Demo.h │ │ ├── diskio.h │ │ ├── ff.h │ │ ├── ffconf.h │ │ └── integer.h │ ├── option │ │ ├── cc932.c │ │ ├── cc936.c │ │ ├── cc949.c │ │ ├── cc950.c │ │ ├── ccsbcs.c │ │ ├── syscall.c │ │ └── unicode.c │ └── src │ │ ├── diskio.c │ │ ├── fatfs_demo.c │ │ └── ff.c ├── Gizwits │ ├── Utils │ │ ├── common.c │ │ ├── common.h │ │ ├── dataPointTools.c │ │ ├── dataPointTools.h │ │ ├── ringBuffer.h │ │ └── ringbuffer.c │ ├── port │ │ ├── gizwits_flash.c │ │ ├── gizwits_flash.h │ │ ├── gizwits_port.c │ │ ├── gizwits_port.h │ │ ├── gizwits_uart.c │ │ └── gizwits_uart.h │ └── src │ │ ├── gagent_md5.c │ │ ├── gagent_md5.h │ │ ├── gizwits_ota.c │ │ ├── gizwits_ota.h │ │ ├── gizwits_product.c │ │ ├── gizwits_product.h │ │ ├── gizwits_protocol.c │ │ └── gizwits_protocol.h ├── RegLib │ ├── inc │ │ ├── RegLib.h │ │ └── sys.h │ └── src │ │ ├── RegLib.c │ │ └── sys.c ├── SD_CARD │ ├── bak │ │ ├── sdio_sdcard.c │ │ └── sdio_sdcard.h │ ├── sd_demo.c │ ├── sd_main.c │ ├── sdcard.c │ ├── sdcard.h │ ├── sdcard_include.h │ ├── sdio_sdcard.c │ ├── sdio_sdcard.h │ ├── stm3210e_eval.c │ ├── stm3210e_eval.h │ ├── stm32_eval.h │ ├── stm32_eval_sdio_sd.c │ └── stm32_eval_sdio_sd.h ├── SFUD-master │ ├── others │ │ ├── bsp.c │ │ ├── bsp.h │ │ ├── sfud_demo.c │ │ ├── sfud_demo.h │ │ ├── stm32f103xB.icf │ │ ├── stm32f103xE.icf │ │ └── types.h │ └── sfud │ │ ├── inc │ │ ├── sfud.h │ │ ├── sfud_cfg.h │ │ ├── sfud_def.h │ │ └── sfud_flash_def.h │ │ ├── port │ │ └── sfud_port.c │ │ └── src │ │ ├── sfud.c │ │ └── sfud_sfdp.c ├── Sensor │ ├── inc │ │ ├── SHT20.h │ │ ├── Sensor.h │ │ ├── SnsText.h │ │ └── stm32f1_temp_sensor.h │ └── src │ │ ├── CO2_Sensor.c │ │ ├── CO_Sensor.c │ │ ├── PM25_Sensor.c │ │ ├── SHT20.c │ │ ├── SnsText.c │ │ ├── TVOCSensor.c │ │ ├── co2.c │ │ ├── co2.h │ │ ├── hcho_sensor.c │ │ ├── sensor.c │ │ └── stm32f1_temp_sensor.c ├── TFTLib │ ├── ILI9341 │ │ ├── inc │ │ │ ├── TFT_Demo.h │ │ │ ├── tft_commands.h │ │ │ ├── tft_config.h │ │ │ ├── tft_control.h │ │ │ ├── tft_core.h │ │ │ ├── tft_dma.h │ │ │ ├── tft_encoder.h │ │ │ ├── tft_glcdfont.h │ │ │ ├── tft_graph.h │ │ │ ├── tft_itoa.h │ │ │ └── tft_text.h │ │ └── src │ │ │ ├── tft_core.c │ │ │ ├── tft_demo.c │ │ │ ├── tft_dma.c │ │ │ ├── tft_encoder.c │ │ │ ├── tft_graph.c │ │ │ ├── tft_itoa.c │ │ │ └── tft_text.c │ └── ILI9341_4Line │ │ ├── inc │ │ ├── FONT_API.h │ │ ├── Font1.h │ │ ├── Font32_32.h │ │ ├── Picture.h │ │ ├── QDTFT_demo.h │ │ ├── SnsGUI.h │ │ ├── UserFont.h │ │ ├── UserGUI.h │ │ ├── font10_16.h │ │ ├── font20_12.h │ │ ├── font24_16.h │ │ ├── font26_16.h │ │ ├── font32_32_api.h │ │ └── icon_battery.h │ │ └── src │ │ ├── FONT_API.c │ │ ├── Font1.c │ │ ├── QDTFT_demo.c │ │ ├── SnsGUI.c │ │ ├── UserGUI.c │ │ ├── font32_32_api.c │ │ └── logo.pic ├── UGUI │ └── UGUI-master │ │ ├── LICENSE.md │ │ ├── README.md │ │ ├── UGUI_Demo.c │ │ ├── UGUI_Demo.h │ │ ├── ugui.c │ │ ├── ugui.h │ │ ├── ugui_config.h │ │ ├── ugui_font.c │ │ ├── ugui_font.h │ │ └── ugui_fontlib.h └── USB │ ├── LIB │ ├── inc │ │ ├── disk_image.h │ │ ├── hw_config.h │ │ ├── mass_mal.h │ │ ├── memory.h │ │ ├── usb_bot.h │ │ ├── usb_conf.h │ │ ├── usb_desc.h │ │ ├── usb_istr.h │ │ ├── usb_prop.h │ │ ├── usb_pwr.h │ │ └── usb_scsi.h │ └── src │ │ ├── disk_image.c │ │ ├── hw_config.c │ │ ├── mass_mal.c │ │ ├── memory.c │ │ ├── scsi_data.c │ │ ├── usb_bot.c │ │ ├── usb_desc.c │ │ ├── usb_endp.c │ │ ├── usb_istr.c │ │ ├── usb_prop.c │ │ ├── usb_pwr.c │ │ └── usb_scsi.c │ ├── UsbApp │ ├── UsbApp.c │ └── UsbApp.h │ └── Usb_LIB │ ├── inc │ ├── usb_core.h │ ├── usb_def.h │ ├── usb_init.h │ ├── usb_int.h │ ├── usb_lib.h │ ├── usb_mem.h │ ├── usb_regs.h │ ├── usb_sil.h │ └── usb_type.h │ └── src │ ├── usb_core.c │ ├── usb_init.c │ ├── usb_int.c │ ├── usb_mem.c │ ├── usb_regs.c │ └── usb_sil.c ├── Dev ├── BSP │ ├── board_AT_V1203.c │ ├── board_AT_V1203.h │ ├── board_AirDog_V10.c │ ├── board_AirDog_V10.h │ ├── board_AirDog_V11.c │ ├── board_AirDog_V11.h │ ├── board_AirDog_V12.c │ ├── board_AirDog_V12.h │ ├── board_V1_2_3.c │ └── board_V1_2_3.h └── Driver │ ├── inc │ ├── ADC_Drv.h │ ├── BatteryLevel.h │ ├── ExtiDrv.h │ ├── F10X_Flash_If.h │ ├── IIC_Drv.h │ ├── ILI9341_4Line_SPI.h │ ├── ILI9341_Drv.h │ ├── Key_Drv.h │ ├── PCF8563.h │ ├── PWM.h │ ├── PWM_TIM5.h │ ├── PowerCtrl.h │ ├── QueueDef.h │ ├── RTCDrv.h │ ├── SW_UART.h │ ├── SW_UART2.h │ ├── SW_UART3.h │ ├── TFT_API.h │ ├── TimerManager.h │ ├── Uart_Drv.h │ ├── beep_drv.h │ ├── debug_queue.h │ ├── debugfile.h │ ├── delay.h │ ├── flash_font.h │ ├── gizwits_queue.h │ ├── queue.h │ ├── queue2.h │ ├── rom_flash_interface.h │ ├── sd_card_interface.h │ ├── spi_flash_interface.h │ ├── timer_drv.h │ ├── uart_queue.h │ └── wifi_queue.h │ └── src │ ├── ADC_Drv.c │ ├── BatteryLevel.c │ ├── ExtiDrv.c │ ├── F10X_Flash_If.c │ ├── IIC_Drv.c │ ├── ILI9341_4Line_SPI.c │ ├── Key_Drv.c │ ├── PCF8563.c │ ├── PWM.c │ ├── PWM_TIM5.c │ ├── PowerCtrl.c │ ├── RTCDrv.c │ ├── SW_UART.c │ ├── SW_UART2.c │ ├── SW_UART3.c │ ├── TFT_API.c │ ├── TVOC_IIC.c │ ├── TimerManager.c │ ├── Uart_Drv.c │ ├── beep_drv.c │ ├── debug_queue.c │ ├── debugfile.c │ ├── delay.c │ ├── flash_font.c │ ├── gizwits_queue.c │ ├── queue.c │ ├── queue2.c │ ├── rom_flash_interface.c │ ├── sd_card_interface.c │ ├── spi_flash_interface.c │ ├── timer_drv.c │ ├── uart_queue.c │ └── wifi_queue.c ├── LICENSE ├── Library ├── inc │ ├── misc.h │ ├── stm32f10x_adc.h │ ├── stm32f10x_bkp.h │ ├── stm32f10x_can.h │ ├── stm32f10x_cec.h │ ├── stm32f10x_crc.h │ ├── stm32f10x_dac.h │ ├── stm32f10x_dbgmcu.h │ ├── stm32f10x_dma.h │ ├── stm32f10x_exti.h │ ├── stm32f10x_flash.h │ ├── stm32f10x_fsmc.h │ ├── stm32f10x_gpio.h │ ├── stm32f10x_i2c.h │ ├── stm32f10x_iwdg.h │ ├── stm32f10x_pwr.h │ ├── stm32f10x_rcc.h │ ├── stm32f10x_rtc.h │ ├── stm32f10x_sdio.h │ ├── stm32f10x_spi.h │ ├── stm32f10x_tim.h │ ├── stm32f10x_usart.h │ └── stm32f10x_wwdg.h └── src │ ├── misc.c │ ├── stm32f10x_adc.c │ ├── stm32f10x_bkp.c │ ├── stm32f10x_can.c │ ├── stm32f10x_cec.c │ ├── stm32f10x_crc.c │ ├── stm32f10x_dac.c │ ├── stm32f10x_dbgmcu.c │ ├── stm32f10x_dma.c │ ├── stm32f10x_exti.c │ ├── stm32f10x_flash.c │ ├── stm32f10x_fsmc.c │ ├── stm32f10x_gpio.c │ ├── stm32f10x_i2c.c │ ├── stm32f10x_iwdg.c │ ├── stm32f10x_pwr.c │ ├── stm32f10x_rcc.c │ ├── stm32f10x_rtc.c │ ├── stm32f10x_sdio.c │ ├── stm32f10x_spi.c │ ├── stm32f10x_tim.c │ ├── stm32f10x_usart.c │ └── stm32f10x_wwdg.c ├── OS ├── inc │ ├── os_global.h │ └── os_timer.h └── src │ ├── os_global.c │ └── os_timer.c ├── Project ├── AirDog.plg ├── AirDog.uvgui.chenh ├── AirDog.uvgui.wen ├── AirDog.uvguix.wen ├── AirDog.uvopt ├── AirDog.uvproj ├── AirDog.uvproj.saved_uv4 ├── AirDog_Target 1.dep ├── DebugConfig │ └── Target_1_STM32F103RC_1.0.0.dbgconf ├── JLinkLog.txt ├── JLinkSettings.ini └── Target 1.BAT ├── README.md ├── SI ├── 1_AirDog_180713.IAB ├── 1_AirDog_180713.IAD ├── 1_AirDog_180713.IMB ├── 1_AirDog_180713.IMD ├── 1_AirDog_180713.PFI ├── 1_AirDog_180713.PO ├── 1_AirDog_180713.PR ├── 1_AirDog_180713.PRI ├── 1_AirDog_180713.PS ├── 1_AirDog_180713.SearchResults ├── 1_AirDog_180713.WK3 └── 新建文本文档.txt ├── System ├── CMSIS │ ├── core_cm3.c │ ├── core_cm3.h │ ├── stm32f10x.h │ ├── system_stm32f10x.c │ └── system_stm32f10x.h └── startup │ ├── startup_stm32f10x_cl.s │ ├── startup_stm32f10x_hd.s │ ├── startup_stm32f10x_hd_vl.s │ ├── startup_stm32f10x_ld.s │ ├── startup_stm32f10x_ld_vl.s │ ├── startup_stm32f10x_md.s │ ├── startup_stm32f10x_md_vl.s │ └── startup_stm32f10x_xl.s ├── User ├── inc │ ├── Application.h │ ├── GlobalDef.h │ ├── SDRR.h │ ├── board_version.h │ ├── cfg_variable.h │ ├── stm32f10x_conf.h │ └── stm32f10x_it.h └── src │ ├── Application.c │ ├── SDRR.c │ ├── cfg_variable.c │ ├── main.c │ └── stm32f10x_it.c ├── bin ├── AirDog-App-HV1.32 SV1.86.bin ├── AirDog-App-HV1.32 SV1.87.bin ├── AirDog-App-HV1.32 SV2.02.bin ├── AirDog-App-HV1.32 SV2.05.bin ├── Booloader bin file │ └── BOOT-V0.25R3-32KF1XX.hex └── readme.txt ├── doc ├── AIRDOG_ Instruction manual-V0.3-PDF-Ver.pdf ├── AIRDOG_ Instruction manual-V0.3.docx ├── AIRDOG空气质量检测仪说明书-V0.3-PDF-Ver.pdf ├── AIRDOG空气质量检测仪说明书-V0.3.docx ├── APP文件 │ ├── AIRDOG_安卓APP.apk │ └── Android.zip ├── Data Sheet │ ├── 3A-Switch-Charger-ETA974X.zip │ ├── Handling manual Size Counts.pdf │ ├── Modbus documentation Size Counts.pdf │ ├── Operation-Manual-for-HCHO-Module-final.pdf │ ├── PMS7003-攀藤激光传感器数据手册.pdf │ ├── RM0090-CN.rar │ ├── RM0090-EN.pdf │ ├── S8 LP Product sheet.pdf │ ├── S8 LP Product specification.pdf │ ├── SADK S8 Installation manual.pdf │ ├── SHT20 中文技术手册 (1).rar │ ├── STM32F103xC-xD-xE-datasheet.pdf │ ├── Sensirion_Humidity_Sensors_SHT20_Datasheet.pdf │ ├── ZM01-VOCs-Winsensor-CN.pdf │ ├── plantower-pms5003-manual_v2-3.pdf │ └── 达特WZ-S型甲醛检测模组.pdf ├── disk config file │ ├── config.txt │ ├── default │ ├── font │ │ ├── 22.7z │ │ └── 22.bin │ ├── sensor │ │ ├── 40-06-08.txt │ │ └── sensor_data.txt │ └── system ├── dv ├── pcb │ ├── 16-AirDog_V1.311_180920.~(3).PcbDoc.Zip │ └── AirDog_V1.307_2018-03-29_1.~(2).PcbDoc.Zip └── schematic │ ├── 16-AirDog_V1.311-180114.pdf │ └── readme.txt └── uCOS-II ├── Ports ├── os_cpu.h ├── os_cpu_a.asm ├── os_cpu_c.c └── os_dbg.c └── Source ├── os_core.c ├── os_flag.c ├── os_mbox.c ├── os_mem.c ├── os_mutex.c ├── os_q.c ├── os_sem.c ├── os_task.c ├── os_time.c ├── os_tmr.c └── ucos_ii.h /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /Component/FIFO_QUEUE/FIFO_Def.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef __FIFO_DEF_H__ 3 | #define __FIFO_DEF_H__ 4 | 5 | #include "GlobalDef.h" 6 | 7 | 8 | 9 | #define EXTERN_CLASS typedef struct {\ 10 | uint8_t chMask[sizeof(struct { 11 | 12 | #define END_EXTERN_CLASS(__NAME) })];\ 13 | }__NAME; 14 | 15 | #define DEF_CLASS typedef struct { 16 | #define END_DEF_CLASS(__NAME) }__##__NAME;\ 17 | typedef struct {\ 18 | uint8_t chMask[sizeof(__##__NAME)];\ 19 | }__NAME; 20 | 21 | #define CLASS(__NAME) __##__NAME 22 | 23 | #define PRIVATE static 24 | 25 | //! вдIARЮЊР§зг 26 | #define NO_INIT __attribute__((section("NO_INIT"),zero_init)) //__no_init 27 | 28 | #define TYPE_CONVERT(__ADDR,__TYPE) (*((__TYPE *)(__ADDR))) 29 | 30 | 31 | 32 | #endif 33 | 34 | -------------------------------------------------------------------------------- /Component/FIFO_QUEUE/fifo_queue.c: -------------------------------------------------------------------------------- 1 | 2 | #include "fifo_queue.h" 3 | 4 | 5 | 6 | /* ! 定义了一个专门的byte队列类型, 7 | 这个队列用uint16_t作为计数器类型, 8 | 所以,可以处理0~65535个元素, 用bool作为临界区变量类型*/ 9 | DEF_QUEUE_U16(word_queue, uint16_t, bool) 10 | END_DEF_QUEUE_U16 11 | 12 | /*============================ GLOBAL VARIABLES ==============================*/ 13 | /*============================ LOCAL VARIABLES ===============================*/ 14 | 15 | /*! 用刚刚定义的新类型byte_queue来定义一个队列s_tBLQIn, 这里s表示static,说明变量是静态的,_t表示这是自定义数据类 16 | 型, BL是Bootloader的缩写, Q是Queue的缩写 In表示这是一个输入队列*/ 17 | 18 | NO_INIT PRIVATE QUEUE(word_queue) s_tBLQIn; 19 | //! 这是它的缓冲 20 | NO_INIT PRIVATE uint16_t s_InBuffer[16]; 21 | 22 | //! 用刚刚定义的新类型byte_queue来定义一个队列s_BLQOut; 23 | //NO_INIT PRIVATE QUEUE(byte_queue) s_tBLQOut; 24 | //! 这是它的缓冲 25 | //NO_INIT PRIVATE uint8_t s_chOutBuffer[64]; 26 | 27 | 28 | //! 用两个队列,In和Out封装成一个管道pipe, 后面的两个函数是管道的一端, 29 | bool pipe_write_word(uint16_t word) 30 | { 31 | return ENQUEUE(word_queue, &s_tBLQIn, word); 32 | } 33 | 34 | bool pipe_is_full(void) 35 | { 36 | return QUEUE_IS_FULL(word_queue, &s_tBLQIn); 37 | 38 | } 39 | 40 | bool pipe_is_empty(void) 41 | { 42 | return QUEUE_IS_EMPTY(word_queue, &s_tBLQIn); 43 | } 44 | 45 | bool pipe_read_word(uint16_t *pWord) 46 | { 47 | return DEQUEUE(word_queue, &s_tBLQIn, pWord); 48 | } 49 | 50 | bool pipe_peek_word(uint16_t * pWord) 51 | { 52 | return PEEK_QUEUE(word_queue, &s_tBLQIn, pWord); 53 | } 54 | 55 | 56 | /*! 这是一个不折不扣如何使用队列的例子,亮点是 ENAQUEUE, PEEK_QUEUE和DEQUEUE, SERIAL_IN 57 | ? ? 和SERIAL_OUT是串行输入输出设备的接口,你直接认为是串口就好了 58 | */ 59 | /* 60 | PRIVATE STATE(BootLoader_Task) BEGIN 61 | 62 | do { 63 | uint8_t chByte; 64 | if (SERIAL_IN(&chByte)) { 65 | ENQUEUE(byte_queue, &s_tBLQIn, chByte); 66 | } 67 | } while (false); 68 | 69 | do { 70 | uint8_t chByte; 71 | if (PEEK_QUEUE(byte_queue, &s_tBLQOut, &chByte)) { 72 | if (SERIAL_OUT(chByte)) { 73 | DEQUEUE(byte_queue, &s_tBLQOut, &chByte); 74 | } 75 | } 76 | } while (false); 77 | ... 78 | 79 | REFLEXIVE_STATE; 80 | END 81 | */ 82 | 83 | DEF_QUEUE_U8(byte_queue, uint8_t, bool) 84 | END_DEF_QUEUE_U8 85 | 86 | NO_INIT PRIVATE QUEUE(byte_queue)s_tBQ; 87 | 88 | //! 这是它的缓冲 89 | NO_INIT PRIVATE uint8_t s_BQBuff[64]; 90 | 91 | 92 | bool pipe_write_byte(uint8_t byte) 93 | { 94 | return ENQUEUE(byte_queue, &s_tBQ, byte); 95 | } 96 | 97 | bool pipe_byte_is_full(void) 98 | { 99 | return QUEUE_IS_FULL(byte_queue, &s_tBQ); 100 | 101 | } 102 | 103 | bool pipe_byte_is_empty(void) 104 | { 105 | return QUEUE_IS_EMPTY(byte_queue, &s_tBQ); 106 | } 107 | 108 | bool pipe_read_byte(uint8_t *p) 109 | { 110 | return DEQUEUE(byte_queue, &s_tBQ, p); 111 | } 112 | 113 | bool pipe_peek_byte(uint8_t * p) 114 | { 115 | return PEEK_QUEUE(byte_queue, &s_tBQ, p); 116 | } 117 | 118 | void byte_queue_init(void) 119 | { 120 | QUEUE_INIT(byte_queue, &s_tBQ, s_BQBuff, sizeof(s_BQBuff) / sizeof(s_BQBuff[0])); 121 | } 122 | 123 | void sht_queue_init(void) 124 | { 125 | QUEUE_INIT(word_queue, &s_tBLQIn, s_InBuffer, sizeof(s_InBuffer) / sizeof(s_InBuffer[0])); 126 | } 127 | 128 | -------------------------------------------------------------------------------- /Component/FIFO_QUEUE/fifo_queue.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef __FIFO_QUEUE_H__ 3 | #define __FIFO_QUEUE_H__ 4 | 5 | 6 | #include "T_queue.h" 7 | 8 | #if 0 9 | #ifndef bool 10 | typedef enum 11 | { 12 | e_false = 0, e_true = !e_false, 13 | }bool; 14 | #endif 15 | #endif 16 | 17 | bool pipe_read_word(uint16_t *pWord); 18 | bool pipe_write_word(uint16_t word); 19 | 20 | bool pipe_is_full(void); 21 | bool pipe_is_empty(void); 22 | bool pipe_peek_word(uint16_t * pWord); 23 | 24 | bool pipe_write_byte(uint8_t byte); 25 | bool pipe_byte_is_full(void); 26 | bool pipe_byte_is_empty(void); 27 | bool pipe_read_byte(uint8_t *p); 28 | bool pipe_peek_byte(uint8_t * p); 29 | 30 | void sht_queue_init(void); 31 | void byte_queue_init(void); 32 | 33 | 34 | #endif 35 | 36 | -------------------------------------------------------------------------------- /Component/FatFs/inc/FatFs_Demo.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef __FATFS_DEMO_H__ 3 | #define __FATFS_DEMO_H__ 4 | 5 | #include 6 | #include "ff.h" 7 | #include "GlobalDef.h" 8 | 9 | 10 | 11 | #define SENSOR_TXT_FILE_NAME "sensor_data.txt" 12 | 13 | // 磁盘信息 14 | typedef struct 15 | { 16 | uint8_t mount; // 挂载是否成功; 0: 成功; 非0: 失败 17 | uint32_t total; // 总容量, KB 18 | uint32_t free; // 剩余容量, KB 19 | }DiskInfo; 20 | 21 | extern DiskInfo diskInfo[]; 22 | 23 | extern FIL fileFIL; 24 | extern long strtol(const char *str, char **endptr, int base); 25 | 26 | void FatFs_Demo(void); 27 | FRESULT FILE_Open(FIL * fileFIL, char * file_name); 28 | E_RESULT FILE_Write(char * file_name, char write_buf[]); 29 | void FILE_FormatDisk(FATFS * disk, const char * diskPath, uint8_t format); 30 | uint32_t FILE_GetSensorTotalItems(void); 31 | void FILE_SearchUpdateBinFile(const char * diskPath); 32 | void FILE_ReadConfig(void); 33 | 34 | void FILE_TimeStampToFileName(uint32_t time_stamp, char * fileName, uint16_t buf_size); 35 | uint8_t FILE_GetLock(void); 36 | 37 | 38 | 39 | 40 | 41 | #endif //end of file 42 | 43 | -------------------------------------------------------------------------------- /Component/FatFs/inc/diskio.h: -------------------------------------------------------------------------------- 1 | /*-----------------------------------------------------------------------/ 2 | / Low level disk interface modlue include file (C)ChaN, 2014 / 3 | /-----------------------------------------------------------------------*/ 4 | 5 | #ifndef _DISKIO_DEFINED 6 | #define _DISKIO_DEFINED 7 | 8 | #ifdef __cplusplus 9 | extern "C" { 10 | #endif 11 | 12 | #define _USE_WRITE 1 /* 1: Enable disk_write function */ 13 | #define _USE_IOCTL 1 /* 1: Enable disk_ioctl fucntion */ 14 | 15 | #include "integer.h" 16 | 17 | 18 | /* Status of Disk Functions */ 19 | typedef BYTE DSTATUS; 20 | 21 | /* Results of Disk Functions */ 22 | typedef enum { 23 | RES_OK = 0, /* 0: Successful */ 24 | RES_ERROR, /* 1: R/W Error */ 25 | RES_WRPRT, /* 2: Write Protected */ 26 | RES_NOTRDY, /* 3: Not Ready */ 27 | RES_PARERR /* 4: Invalid Parameter */ 28 | } DRESULT; 29 | 30 | 31 | /*---------------------------------------*/ 32 | /* Prototypes for disk control functions */ 33 | 34 | 35 | DSTATUS disk_initialize (BYTE pdrv); 36 | DSTATUS disk_status (BYTE pdrv); 37 | DRESULT disk_read (BYTE pdrv, BYTE* buff, DWORD sector, UINT count); 38 | DRESULT disk_write (BYTE pdrv, const BYTE* buff, DWORD sector, UINT count); 39 | DRESULT disk_ioctl (BYTE pdrv, BYTE cmd, void* buff); 40 | DWORD get_fattime (void); 41 | 42 | /* Disk Status Bits (DSTATUS) */ 43 | 44 | #define STA_NOINIT 0x01 /* Drive not initialized */ 45 | #define STA_NODISK 0x02 /* No medium in the drive */ 46 | #define STA_PROTECT 0x04 /* Write protected */ 47 | 48 | 49 | /* Command code for disk_ioctrl fucntion */ 50 | 51 | /* Generic command (Used by FatFs) */ 52 | #define CTRL_SYNC 0 /* Complete pending write process (needed at _FS_READONLY == 0) */ 53 | #define GET_SECTOR_COUNT 1 /* Get media size (needed at _USE_MKFS == 1) */ 54 | #define GET_SECTOR_SIZE 2 /* Get sector size (needed at _MAX_SS != _MIN_SS) */ 55 | #define GET_BLOCK_SIZE 3 /* Get erase block size (needed at _USE_MKFS == 1) */ 56 | #define CTRL_TRIM 4 /* Inform device that the data on the block of sectors is no longer used (needed at _USE_TRIM == 1) */ 57 | 58 | /* Generic command (Not used by FatFs) */ 59 | #define CTRL_POWER 5 /* Get/Set power status */ 60 | #define CTRL_LOCK 6 /* Lock/Unlock media removal */ 61 | #define CTRL_EJECT 7 /* Eject media */ 62 | #define CTRL_FORMAT 8 /* Create physical format on the media */ 63 | 64 | /* MMC/SDC specific ioctl command */ 65 | #define MMC_GET_TYPE 10 /* Get card type */ 66 | #define MMC_GET_CSD 11 /* Get CSD */ 67 | #define MMC_GET_CID 12 /* Get CID */ 68 | #define MMC_GET_OCR 13 /* Get OCR */ 69 | #define MMC_GET_SDSTAT 14 /* Get SD status */ 70 | 71 | /* ATA/CF specific ioctl command */ 72 | #define ATA_GET_REV 20 /* Get F/W revision */ 73 | #define ATA_GET_MODEL 21 /* Get model name */ 74 | #define ATA_GET_SN 22 /* Get serial number */ 75 | 76 | #ifdef __cplusplus 77 | } 78 | #endif 79 | 80 | #endif 81 | -------------------------------------------------------------------------------- /Component/FatFs/inc/integer.h: -------------------------------------------------------------------------------- 1 | /*-------------------------------------------*/ 2 | /* Integer type definitions for FatFs module */ 3 | /*-------------------------------------------*/ 4 | 5 | #ifndef FF_INTEGER 6 | #define FF_INTEGER 7 | 8 | #ifdef _WIN32 /* FatFs development platform */ 9 | 10 | #include 11 | typedef unsigned __int64 QWORD; 12 | 13 | #else /* Embedded platform */ 14 | 15 | /* These types MUST be 16-bit or 32-bit */ 16 | typedef int INT; 17 | typedef unsigned int UINT; 18 | 19 | /* This type MUST be 8-bit */ 20 | typedef unsigned char BYTE; 21 | 22 | /* These types MUST be 16-bit */ 23 | typedef short SHORT; 24 | typedef unsigned short WORD; 25 | typedef unsigned short WCHAR; 26 | 27 | /* These types MUST be 32-bit */ 28 | typedef long LONG; 29 | typedef unsigned long DWORD; 30 | 31 | /* This type MUST be 64-bit (Remove this for ANSI C (C89) compatibility) */ 32 | typedef unsigned long long QWORD; 33 | 34 | #endif 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /Component/FatFs/option/unicode.c: -------------------------------------------------------------------------------- 1 | #include "../ff.h" 2 | 3 | #if _USE_LFN != 0 4 | 5 | #if _CODE_PAGE == 932 /* Japanese Shift_JIS */ 6 | #include "cc932.c" 7 | #elif _CODE_PAGE == 936 /* Simplified Chinese GBK */ 8 | #include "cc936.c" 9 | #elif _CODE_PAGE == 949 /* Korean */ 10 | #include "cc949.c" 11 | #elif _CODE_PAGE == 950 /* Traditional Chinese Big5 */ 12 | #include "cc950.c" 13 | #else /* Single Byte Character-Set */ 14 | #include "ccsbcs.c" 15 | #endif 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /Component/Gizwits/Utils/dataPointTools.h: -------------------------------------------------------------------------------- 1 | /** 2 | ************************************************************ 3 | * @file dataPointTools.h 4 | * @brief Data point processing tool set 5 | * @author Gizwits 6 | * @date 2017-07-19 7 | * @version V03030000 8 | * @copyright Gizwits 9 | * 10 | * @note Gizwits is only for smart hardware 11 | * Gizwits Smart Cloud for Smart Products 12 | * Links | Value Added | Open | Neutral | Safety | Own | Free | Ecology 13 | * www.gizwits.com 14 | * 15 | ***********************************************************/ 16 | #ifndef _DATAPOINT_TOOLS_H_ 17 | #define _DATAPOINT_TOOLS_H_ 18 | 19 | #ifdef __cplusplus 20 | extern "C" { 21 | #endif 22 | 23 | #include 24 | #include 25 | #include 26 | #include 27 | 28 | int8_t gizByteOrderExchange(uint8_t *buf,uint32_t dataLen); 29 | uint32_t gizY2X(uint32_t ratio, int32_t addition, int32_t preValue); 30 | int32_t gizX2Y(uint32_t ratio, int32_t addition, uint32_t preValue); 31 | uint32_t gizY2XFloat(float ratio, float addition, float preValue); 32 | float gizX2YFloat(float ratio, float addition, uint32_t preValue); 33 | uint8_t gizAcrossByteJudge(uint32_t bitOffset,uint32_t bitLen); 34 | int32_t gizVarlenCompressValue(uint32_t bitOffset,uint32_t bitLen,uint8_t *bufAddr,uint32_t srcData); 35 | int32_t gizVarlenDecompressionValue(uint32_t bitOffset,uint32_t bitLen,uint8_t *arrayAddr,uint32_t arrayLen); 36 | int32_t gizStandardDecompressionValue(uint32_t byteOffset,uint32_t bitOffset,uint32_t bitLen,uint8_t *arrayAddr,uint32_t arrayLen); 37 | int32_t gizStandardCompressValue(uint32_t byteOffset,uint32_t bitOffset,uint32_t bitLen,uint8_t *bufAddr,uint32_t srcData); 38 | 39 | #ifdef __cplusplus 40 | } 41 | #endif 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /Component/Gizwits/Utils/ringBuffer.h: -------------------------------------------------------------------------------- 1 | /** 2 | ************************************************************ 3 | * @file ringbuffer.h 4 | * @brief Loop buffer processing 5 | * @author Gizwits 6 | * @date 2017-07-19 7 | * @version V03030000 8 | * @copyright Gizwits 9 | * 10 | * @note Gizwits is only for smart hardware 11 | * Gizwits Smart Cloud for Smart Products 12 | * Links | Value Added | Open | Neutral | Safety | Own | Free | Ecology 13 | * www.gizwits.com 14 | * 15 | ***********************************************************/ 16 | #ifndef _GIZWITS_RING_BUFFER_H 17 | #define _GIZWITS_RING_BUFFER_H 18 | 19 | #ifdef __cplusplus 20 | extern "C" { 21 | #endif 22 | 23 | #include 24 | #include 25 | #include 26 | #include 27 | 28 | #define min(a, b) (a)<(b)?(a):(b) ///< Calculate the minimum value 29 | 30 | #pragma pack(1) 31 | typedef struct { 32 | size_t rbCapacity; 33 | uint8_t *rbHead; 34 | uint8_t *rbTail; 35 | uint8_t *rbBuff; 36 | }rb_t; 37 | #pragma pack() 38 | 39 | int8_t rbCreate(rb_t* rb); 40 | int8_t rbDelete(rb_t* rb); 41 | int32_t rbCapacity(rb_t *rb); 42 | int32_t rbCanRead(rb_t *rb); 43 | int32_t rbCanWrite(rb_t *rb); 44 | int32_t rbRead(rb_t *rb, void *data, size_t count); 45 | int32_t rbWrite(rb_t *rb, const void *data, size_t count); 46 | 47 | #ifdef __cplusplus 48 | } 49 | #endif 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /Component/Gizwits/port/gizwits_flash.h: -------------------------------------------------------------------------------- 1 | #ifndef __GIZWITS_FLASH_H__ 2 | #define __GIZWITS_FLASH_H__ 3 | 4 | 5 | #include "stm32f10x.h" 6 | 7 | //typedef uint32_t u32; 8 | //typedef uint16_t u16; 9 | //typedef uint8_t u8; 10 | 11 | //typedef __IO uint32_t vu32; 12 | //typedef __IO uint16_t vu16; 13 | //typedef __IO uint8_t vu8; 14 | 15 | //#include "stm32f10x.h" 16 | /* BootLoader Flash首地址 */ 17 | #define SYS_Bootloader_SAVE_ADDR_BASE 0x08000000//Bootloader首地址 18 | /* 升级参数存储 */ 19 | #define UPDATE_PARAM_SAVE_ADDR_BASE 0x08006C00 20 | #define UPDATE_PARAM_MAX_SIZE (1*1024)//支持参数大小1KB 21 | /* APP Flash首地址 */ 22 | #define SYS_APP_SAVE_ADDR_BASE 0x08007000 23 | #define APP_DATA_MAX_SIZE (110*1024L)//支持APP大小110KB 24 | /* APP BAK Flash首地址 */ 25 | #define SYS_APP_BAK_SAVE_ADDR_BASE 0x08022800 26 | #define APP_BAK_DATA_MAX_SIZE (110*1024L)//支持APP_BAK大小110KB 27 | 28 | 29 | /* FLASH页大小 */ 30 | //#define FLASH_PAGE_SIZE 0x400U //1KB 31 | 32 | #define NEED_UPDATA_PARAM 0xA5A5//////10100101 10100101 33 | #define DONT_UPDATA_PARAM 0x5A5A//////01011010 01011010 34 | 35 | //void save_param_to_flash(uint16_t * buf_to_save,uint16_t len ); 36 | //void read_param_from_flash(uint16_t * buf_to_get,uint16_t len); 37 | //void set_flash_flag_to_updata(uint16_t crc_code); 38 | void flash_erase(uint32_t size , uint32_t addr_base); 39 | //void EraseFlash(uint32_t size); 40 | void rFlashData(uint8_t * buf_to_get , uint16_t len , uint32_t rFlashAddr); 41 | void wFlashData(uint8_t * buf_to_save , uint16_t len , uint32_t wFlashAddr); 42 | void iap_load_app(u32 appxaddr); 43 | 44 | #endif 45 | 46 | -------------------------------------------------------------------------------- /Component/Gizwits/port/gizwits_port.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaberOnGo/AirDog/e741a01c44aee19c57c81071a268d98cc484962a/Component/Gizwits/port/gizwits_port.c -------------------------------------------------------------------------------- /Component/Gizwits/port/gizwits_port.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef __GIZWITS_PORT_H__ 3 | #define __GIZWITS_PORT_H__ 4 | 5 | #include "stm32f10x.h" 6 | 7 | 8 | 9 | void gizwits_user_init(void); 10 | void gizwits_user_task(void); 11 | 12 | void WIFI_SetConnectStatus(uint8_t conn_sta); 13 | uint8_t WIFI_GetConnectStatus(void); 14 | 15 | char *PRODUCT_SECRET_STRING(void); 16 | char * PRODUCT_KEY_STRING(void); 17 | 18 | 19 | #endif 20 | 21 | -------------------------------------------------------------------------------- /Component/Gizwits/port/gizwits_uart.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef __GIZWITS_UART_H__ 3 | #define __GIZWITS_UART_H__ 4 | 5 | #include "stm32f10x.h" 6 | #include "GlobalDef.h" 7 | #include "gizwits_product.h" 8 | 9 | typedef enum 10 | { 11 | CMD_W2M_CtrlDev = 0x02, 12 | 13 | 14 | CMD_W2M_Reserved = 0xFF, 15 | }CMD_WiFiToMCU; // CMD WIFI -> MCU 16 | 17 | typedef enum 18 | { 19 | CMD_M2W_SetWiFi = 0x01, 20 | CMD_M2W_InfoReport = 0x03, 21 | CMD_M2W_Reserved = 0xFF, 22 | }CMD_MCUToWiFi; // MCU -> WIFI 23 | 24 | typedef enum 25 | { 26 | E_INFO_CO2 = 0, 27 | E_INFO_temp, 28 | E_INFO_hcho_ppb, 29 | E_INFO_humi, 30 | E_INFO_tvoc_ppb, 31 | E_INFO_pm10_ug, 32 | E_INFO_pm2p5_ug, 33 | E_INFO_END, 34 | }E_INFO_TYPE; 35 | 36 | 37 | void gizwits_uart_init(void); 38 | void gizwits_set_wifi_mode(uint8_t mode); 39 | 40 | #endif 41 | 42 | 43 | -------------------------------------------------------------------------------- /Component/Gizwits/src/gagent_md5.h: -------------------------------------------------------------------------------- 1 | #ifndef _GAGENT_MD5_H 2 | #define _GAGENT_MD5_H 3 | 4 | #include 5 | 6 | 7 | #if 1 8 | #define GIZ_MD5_DBG(fmt, ...) printf(fmt, ##__VA_ARGS__) 9 | #else 10 | #define GIZ_MD5_DBG(...) 11 | #endif 12 | 13 | 14 | 15 | #pragma pack(1) 16 | typedef struct 17 | { 18 | unsigned int count[2]; 19 | unsigned int state[4]; 20 | unsigned char buffer[64]; 21 | } MD5_CTX; 22 | #pragma pack() 23 | 24 | #define F(x,y,z) ((x & y) | (~x & z)) 25 | #define G(x,y,z) ((x & z) | (y & ~z)) 26 | #define H(x,y,z) (x^y^z) 27 | #define I(x,y,z) (y ^ (x | ~z)) 28 | #define ROTATE_LEFT(x,n) ((x << n) | (x >> (32-n))) 29 | #define FF(a,b,c,d,x,s,ac) \ 30 | { \ 31 | a += F(b,c,d) + x + ac; \ 32 | a = ROTATE_LEFT(a,s); \ 33 | a += b; \ 34 | } 35 | #define GG(a,b,c,d,x,s,ac) \ 36 | { \ 37 | a += G(b,c,d) + x + ac; \ 38 | a = ROTATE_LEFT(a,s); \ 39 | a += b; \ 40 | } 41 | #define HH(a,b,c,d,x,s,ac) \ 42 | { \ 43 | a += H(b,c,d) + x + ac; \ 44 | a = ROTATE_LEFT(a,s); \ 45 | a += b; \ 46 | } 47 | #define II(a,b,c,d,x,s,ac) \ 48 | { \ 49 | a += I(b,c,d) + x + ac; \ 50 | a = ROTATE_LEFT(a,s); \ 51 | a += b; \ 52 | } 53 | 54 | void GAgent_MD5Init(MD5_CTX *context); 55 | void GAgent_MD5Update(MD5_CTX *context, unsigned char *input, unsigned int inputlen); 56 | 57 | //void GAgent_MD5Final(MD5_CTX *context, unsigned char digest[16]); 58 | void GAgent_MD5Final(MD5_CTX *context, unsigned char *digest); 59 | 60 | //void GAgent_MD5Transform(unsigned int state[4], unsigned char block[64]); 61 | void GAgent_MD5Transform(unsigned int * state, unsigned char * block); 62 | 63 | void GAgent_MD5Encode(unsigned char *output, unsigned int *input, unsigned int len); 64 | 65 | //void GAgent_MD5Decode(unsigned int *output, unsigned char *input, unsigned int len); 66 | void GAgent_MD5Decode(uint32_t * output, uint8_t * input, uint32_t len); 67 | 68 | #endif 69 | -------------------------------------------------------------------------------- /Component/Gizwits/src/gizwits_ota.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef __GITWITS_OTA_H__ 3 | #define __GITWITS_OTA_H__ 4 | 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | 10 | #include 11 | #include "stm32f10x.h" 12 | #include "gizwits_protocol.h" 13 | 14 | 15 | 16 | 17 | 18 | #ifdef __cplusplus 19 | } 20 | #endif 21 | 22 | 23 | 24 | 25 | #endif 26 | 27 | -------------------------------------------------------------------------------- /Component/Gizwits/src/gizwits_product.h: -------------------------------------------------------------------------------- 1 | /** 2 | ************************************************************ 3 | * @file gizwits_product.h 4 | * @brief Corresponding gizwits_product.c header file (including product hardware and software version definition) 5 | * @author Gizwits 6 | * @date 2017-07-19 7 | * @version V03030000 8 | * @copyright Gizwits 9 | * 10 | * @note 机智云.只为智能硬件而生 11 | * Gizwits Smart Cloud for Smart Products 12 | * 链接|增值?|开放|中立|安全|自有|自由|生态 13 | * www.gizwits.com 14 | * 15 | ***********************************************************/ 16 | #ifndef _GIZWITS_PRODUCT_H 17 | #define _GIZWITS_PRODUCT_H 18 | 19 | #ifdef __cplusplus 20 | extern "C" { 21 | #endif 22 | #include 23 | #include "gizwits_protocol.h" 24 | 25 | #include "GlobalDef.h" 26 | //#define PROTOCOL_DEBUG /// 6 | #include 7 | #include 8 | #include 9 | 10 | #define SFUD_DEMO_TEST_BUFFER_SIZE 1024 11 | 12 | #ifdef SFUD_DEBUG_MODE 13 | static void sfud_demo(uint32_t addr, size_t size, uint8_t *data); 14 | 15 | static uint8_t sfud_demo_test_buf[SFUD_DEMO_TEST_BUFFER_SIZE]; 16 | #endif 17 | 18 | void sfud_demo_task(void) 19 | { 20 | #ifdef SFUD_DEBUG_MODE 21 | bsp_init(); 22 | 23 | /* SFUD initialize */ 24 | if (sfud_init() == SFUD_SUCCESS) { 25 | sfud_demo(0, sizeof(sfud_demo_test_buf), sfud_demo_test_buf); 26 | } 27 | 28 | #if 0 29 | while (1) { 30 | LED_RUN_ON; 31 | delay(6000000); 32 | LED_RUN_OFF; 33 | delay(6000000); 34 | } 35 | #endif 36 | 37 | #endif 38 | } 39 | 40 | /** 41 | * SFUD demo for the first flash device test. 42 | * 43 | * @param addr flash start address 44 | * @param size test flash size 45 | * @param size test flash data buffer 46 | */ 47 | #ifdef SFUD_DEBUG_MODE 48 | void flash_reset(void) 49 | { 50 | const sfud_flash *flash = sfud_get_device_table() + 0; 51 | 52 | sfud_chip_erase(flash); 53 | } 54 | 55 | static void sfud_demo(uint32_t addr, size_t size, uint8_t *data) { 56 | 57 | sfud_err result = SFUD_SUCCESS; 58 | const sfud_flash *flash = sfud_get_device_table() + 0; 59 | size_t i; 60 | /* prepare write data */ 61 | for (i = 0; i < size; i++) { 62 | data[i] = i; 63 | } 64 | /* erase test */ 65 | result = sfud_erase(flash, addr, size); 66 | if (result == SFUD_SUCCESS) { 67 | os_printf("Erase the %s flash data finish. Start from 0x%08X, size is %ld.\r\n", flash->name, addr, 68 | size); 69 | } else { 70 | os_printf("Erase the %s flash data failed.\r\n", flash->name); 71 | return; 72 | } 73 | /* write test */ 74 | result = sfud_write(flash, addr, size, data); 75 | if (result == SFUD_SUCCESS) { 76 | os_printf("Write the %s flash data finish. Start from 0x%08X, size is %ld.\r\n", flash->name, addr, 77 | size); 78 | } else { 79 | os_printf("Write the %s flash data failed.\r\n", flash->name); 80 | return; 81 | } 82 | /* read test */ 83 | result = sfud_read(flash, addr, size, data); 84 | if (result == SFUD_SUCCESS) { 85 | os_printf("Read the %s flash data success. Start from 0x%08X, size is %ld. The data is:\r\n", flash->name, addr, 86 | size); 87 | os_printf("Offset (h) 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F\r\n"); 88 | for (i = 0; i < size; i++) { 89 | if (i % 16 == 0) { 90 | os_printf("[%08X] ", addr + i); 91 | } 92 | os_printf("%02X ", data[i]); 93 | if (((i + 1) % 16 == 0) || i == size - 1) { 94 | os_printf("\r\n"); 95 | } 96 | } 97 | os_printf("\r\n"); 98 | } else { 99 | os_printf("Read the %s flash data failed.\r\n", flash->name); 100 | } 101 | /* data check */ 102 | for (i = 0; i < size; i++) { 103 | if (data[i] != i % 256) { 104 | os_printf("Read and check write data has an error. Write the %s flash data failed.\r\n", flash->name); 105 | break; 106 | } 107 | } 108 | 109 | flash_reset(); 110 | 111 | if (i == size) { 112 | os_printf("The %s flash test is success.\r\n", flash->name); 113 | } 114 | } 115 | #endif 116 | 117 | -------------------------------------------------------------------------------- /Component/SFUD-master/others/sfud_demo.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef __SFUD_DEMO_H__ 3 | #define __SFUD_DEMO_H__ 4 | 5 | 6 | 7 | 8 | void sfud_demo_task(void); 9 | 10 | 11 | #endif 12 | 13 | -------------------------------------------------------------------------------- /Component/SFUD-master/others/stm32f103xB.icf: -------------------------------------------------------------------------------- 1 | /*###ICF### Section handled by ICF editor, don't touch! ****/ 2 | /*-Editor annotation file-*/ 3 | /* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_0.xml" */ 4 | /*-Specials-*/ 5 | define symbol __ICFEDIT_intvec_start__ = 0x08000000; 6 | /* software version and hardware version store start address */ 7 | define symbol __ICFEDIT_version_start__ = __ICFEDIT_intvec_start__ + 512; 8 | /*-Memory Regions-*/ 9 | define symbol __ICFEDIT_region_ROM_start__ = __ICFEDIT_intvec_start__; 10 | define symbol __ICFEDIT_region_ROM_end__ = 0x0801FFFF; 11 | define symbol __ICFEDIT_region_RAM_start__ = 0x20000000; 12 | define symbol __ICFEDIT_region_RAM_end__ = 0x20004FFF; 13 | /*-Sizes-*/ 14 | define symbol __ICFEDIT_size_cstack__ = 0x800; 15 | define symbol __ICFEDIT_size_heap__ = 0x800; 16 | 17 | /**** End of ICF editor section. ###ICF###*/ 18 | 19 | define memory mem with size = 4G; 20 | define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__]; 21 | define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__ to __ICFEDIT_region_RAM_end__]; 22 | 23 | define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { }; 24 | define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { }; 25 | 26 | initialize by copy { readwrite }; 27 | do not initialize { section .noinit }; 28 | 29 | place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec }; 30 | 31 | place in ROM_region { readonly }; 32 | place in RAM_region { readwrite, 33 | block CSTACK, block HEAP }; 34 | 35 | /* armink add for version storage */ 36 | keep { section .version }; 37 | place at address mem:__ICFEDIT_version_start__ { readonly section .version }; 38 | 39 | /* armink add for rtt finsh */ 40 | keep { section FSymTab }; 41 | keep { section VSymTab }; -------------------------------------------------------------------------------- /Component/SFUD-master/others/stm32f103xE.icf: -------------------------------------------------------------------------------- 1 | /*###ICF### Section handled by ICF editor, don't touch! ****/ 2 | /*-Editor annotation file-*/ 3 | /* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_0.xml" */ 4 | /*-Specials-*/ 5 | define symbol __ICFEDIT_intvec_start__ = 0x08000000; 6 | /* software version and hardware version store start address */ 7 | define symbol __ICFEDIT_version_start__ = __ICFEDIT_intvec_start__ + 512; 8 | /*-Memory Regions-*/ 9 | define symbol __ICFEDIT_region_ROM_start__ = __ICFEDIT_intvec_start__; 10 | define symbol __ICFEDIT_region_ROM_end__ = 0x0807FFFF; 11 | define symbol __ICFEDIT_region_RAM_start__ = 0x20000000; 12 | define symbol __ICFEDIT_region_RAM_end__ = 0x2000FFFF; 13 | /*-Sizes-*/ 14 | define symbol __ICFEDIT_size_cstack__ = 0x1000; 15 | define symbol __ICFEDIT_size_heap__ = 0x1000; 16 | 17 | /**** End of ICF editor section. ###ICF###*/ 18 | 19 | define memory mem with size = 4G; 20 | define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__]; 21 | define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__ to __ICFEDIT_region_RAM_end__]; 22 | 23 | define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { }; 24 | define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { }; 25 | 26 | initialize by copy { readwrite }; 27 | do not initialize { section .noinit }; 28 | 29 | place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec }; 30 | 31 | place in ROM_region { readonly }; 32 | place in RAM_region { readwrite, 33 | block CSTACK, block HEAP }; 34 | 35 | /* armink add for version storage */ 36 | keep { section .version }; 37 | place at address mem:__ICFEDIT_version_start__ { readonly section .version }; 38 | 39 | /* armink add for rtt finsh */ 40 | keep { section FSymTab }; 41 | keep { section VSymTab }; -------------------------------------------------------------------------------- /Component/SFUD-master/others/types.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef TYPES_H_ 3 | #define TYPES_H_ 4 | 5 | #include 6 | #include 7 | typedef int bool_t; /**< boolean type */ 8 | 9 | #ifndef TRUE 10 | #define TRUE 1 11 | #endif 12 | 13 | #ifndef FALSE 14 | #define FALSE 0 15 | #endif 16 | 17 | #ifndef NULL 18 | #define NULL 0 19 | #endif 20 | 21 | #define success 0 22 | #define fail 1 23 | 24 | 25 | #ifndef disable 26 | #define disable 0 27 | #endif 28 | 29 | #ifndef enable 30 | #define enable 1 31 | #endif 32 | 33 | #endif /* TYPES_H_ */ 34 | -------------------------------------------------------------------------------- /Component/SFUD-master/sfud/inc/sfud_cfg.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the Serial Flash Universal Driver Library. 3 | * 4 | * Copyright (c) 2016, Armink, 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining 7 | * a copy of this software and associated documentation files (the 8 | * 'Software'), to deal in the Software without restriction, including 9 | * without limitation the rights to use, copy, modify, merge, publish, 10 | * distribute, sublicense, and/or sell copies of the Software, and to 11 | * permit persons to whom the Software is furnished to do so, subject to 12 | * the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 20 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 21 | * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 22 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 23 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | * 25 | * Function: It is the configure head file for this library. 26 | * Created on: 2016-04-23 27 | */ 28 | 29 | #ifndef _SFUD_CFG_H_ 30 | #define _SFUD_CFG_H_ 31 | 32 | //#define SFUD_DEBUG_MODE 33 | 34 | #define SFUD_USING_SFDP 35 | 36 | #define SFUD_USING_FLASH_INFO_TABLE 37 | 38 | enum { 39 | SFUD_W25Q16JV_DEVICE_INDEX = 0, 40 | }; 41 | 42 | //#define C99 // 是否使用C99, added by pi 2017-5-18 43 | 44 | #ifdef C99 45 | #define SFUD_FLASH_DEVICE_TABLE \ 46 | {\ 47 | [SFUD_W25Q16JV_DEVICE_INDEX] = {.name = "W25Q16JV", .spi.name = "SPI2"}, \ 48 | } 49 | #else 50 | #define SFUD_DEVICE_INDEX_0_NAME "W25Q16JV" 51 | #define SFUD_DEVICE_INDEX_0_SPI "SPI2" 52 | #endif 53 | 54 | 55 | #define FLASH_CS_Pin GPIO_Pin_12 56 | #define FLASH_CS_PORT GPIOB 57 | 58 | #endif /* _SFUD_CFG_H_ */ 59 | -------------------------------------------------------------------------------- /Component/Sensor/inc/SHT20.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef __SHT20_H__ 3 | #define __SHT20_H__ 4 | 5 | #include "GlobalDef.h" 6 | 7 | 8 | 9 | // sensor command 10 | typedef enum{ 11 | TRIG_T_MEASUREMENT_HM = 0xE3, // command trig. temp meas. hold master 12 | TRIG_RH_MEASUREMENT_HM = 0xE5, // command trig. humidity meas. hold master 13 | TRIG_T_MEASUREMENT_POLL = 0xF3, // command trig. temp meas. no hold master 14 | TRIG_RH_MEASUREMENT_POLL = 0xF5, // command trig. humidity meas. no hold master 15 | USER_REG_W = 0xE6, // command writing user register 16 | USER_REG_R = 0xE7, // command reading user register 17 | SOFT_RESET = 0xFE // command soft reset 18 | }etSHT2xCommand; 19 | 20 | 21 | 22 | 23 | 24 | 25 | void SHT20_RegConfig(uint8_t precision_mask, uint8_t is_heated); 26 | 27 | 28 | 29 | #endif 30 | 31 | -------------------------------------------------------------------------------- /Component/Sensor/inc/SnsText.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef __SNS_TEXT_H__ 3 | #define __SNS_TEXT_H__ 4 | 5 | #include "UGUI_Demo.h" 6 | 7 | #endif 8 | 9 | -------------------------------------------------------------------------------- /Component/Sensor/inc/stm32f1_temp_sensor.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef __STM32F1_TEMP_SENSOR_H__ 3 | #define __STM32F1_TEMP_SENSOR_H__ 4 | 5 | #include "GlobalDef.h" 6 | void ITempSensor_Init(void); 7 | 8 | 9 | #endif 10 | 11 | -------------------------------------------------------------------------------- /Component/Sensor/src/CO2_Sensor.c: -------------------------------------------------------------------------------- 1 | 2 | #include "sensor.h" 3 | #include "uart_drv.h" 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /Component/Sensor/src/CO_Sensor.c: -------------------------------------------------------------------------------- 1 | 2 | #include "sensor.h" 3 | #include "uart_drv.h" 4 | #include "os_timer.h" 5 | 6 | 7 | 8 | #if CO_DBG_EN 9 | #define CO_DBG(fmt, ...) os_printf(fmt, ##__VA_ARGS__) 10 | #else 11 | #define CO_DBG(...) 12 | #endif 13 | 14 | 15 | 16 | 17 | 18 | static T_UART_Rx Rx; 19 | static os_timer_t tTimerCO; 20 | 21 | 22 | static SYS_RESULT COBufCheck(uint8_t * buf, uint16_t len) 23 | { 24 | uint8_t new_sum = 0; // 待计算的校验和 25 | 26 | if(buf[0] != 0xFF && buf[1] != 0x04 || len < 2) 27 | { 28 | CO_DBG("COBufCheck: header err\r\n"); 29 | return SYS_FAILED; 30 | } 31 | new_sum = sys_gen_sum_8(&buf[1], len - 2); 32 | new_sum = (~new_sum) + 1; 33 | if(new_sum == buf[len - 1])return SYS_SUCCESS; 34 | 35 | CO_DBG("COBufCheck sum err\r\n"); 36 | return SYS_FAILED; 37 | } 38 | 39 | static void TimerCO_CallBack(void * arg) 40 | { 41 | if(COBufCheck(Rx.buf, Rx.rx_cnt) != SYS_SUCCESS)return; 42 | 43 | 44 | } 45 | 46 | #if 0 47 | void CO_USART_IRQHandler(void) 48 | { 49 | if(READ_REG_32_BIT(CO_USART->SR, USART_SR_RXNE)) 50 | { 51 | uint8_t data = 0; 52 | data = (uint16_t)(CO_USART->DR & (uint16_t)0x01FF); 53 | 54 | if(Rx.last_val == 0xFF && data == 0x04) // header 55 | { 56 | Rx.rx_cnt = 0; 57 | Rx.buf[Rx.rx_cnt++] = 0xFF; 58 | } 59 | else if(Rx.rx_cnt >= Rx.size) 60 | { 61 | Rx.rx_cnt = 0; 62 | // try to disable interrupt here 63 | } 64 | Rx.buf[Rx.rx_cnt++] = data; 65 | Rx.last_val = data; 66 | if(Rx.rx_cnt == 9) 67 | { 68 | // start rx timer here 69 | os_timer_arm(&tTimerCO, 0, 0); 70 | Rx.rx_cnt = 0; 71 | } 72 | } 73 | } 74 | #endif 75 | 76 | static uint8_t co_rx_buf[16]; 77 | void CO_Sensor_Init(void) 78 | { 79 | CO_USART_Init(9600); 80 | Rx.buf = co_rx_buf; 81 | Rx.size = sizeof(co_rx_buf); 82 | os_timer_setfn(&tTimerCO, TimerCO_CallBack, NULL); 83 | } 84 | 85 | -------------------------------------------------------------------------------- /Component/Sensor/src/SnsText.c: -------------------------------------------------------------------------------- 1 | 2 | #include "SnsText.h" 3 | #include "os_global.h" 4 | #include "tft_graph.h" 5 | 6 | 7 | -------------------------------------------------------------------------------- /Component/Sensor/src/TVOCSensor.c: -------------------------------------------------------------------------------- 1 | 2 | #include "sensor.h" 3 | 4 | #include "IIC_Drv.h" 5 | #include "os_timer.h" 6 | #include "SnsGUI.h" 7 | 8 | #if TVOC_DBG_EN 9 | #define TVOC_DBG(fmt, ...) os_printf(fmt, ##__VA_ARGS__) 10 | #else 11 | #define TVOC_DBG(...) 12 | #endif 13 | 14 | 15 | 16 | 17 | IIC_BUS tvoc_bus = 18 | { 19 | { GPIO_Pin_4, GPIOA }, // SDA 20 | { GPIO_Pin_5, GPIOA }, // SCL 21 | }; 22 | 23 | SYS_RESULT ZM01_Read(uint8_t * data) 24 | { 25 | SYS_RESULT res; 26 | 27 | res = IIC_ReadNByteExt(&tvoc_bus, 0x55, 0xAA, data, 1, 1); 28 | TVOC_DBG("buf: 0x%02x\r\n", *data); 29 | return res; 30 | } 31 | 32 | // 5 ppm 量程, 值范围: 1 - 200 33 | // ppb = x * 5000 / 200 = x * 25 34 | #define tvoc_val_2_ppb(v) ( (uint16_t)v * 25) 35 | 36 | static void TVOC_GUI_Display(uint16_t ppb) 37 | { 38 | // if(tvoc_ppm == 0xFFFF)global_tvoc_ppb = 0xFFFF; 39 | //else global_tvoc_ppb = tvoc_ppm * 100; 40 | 41 | // 显示 42 | do 43 | { 44 | static u8 first_time = 1; 45 | static u32 last_sec = 0; 46 | u32 sec = os_get_tick() / 100; 47 | 48 | if(sec < 180) // 小于 180 s 49 | { 50 | sec = 180 - sec; 51 | } 52 | else sec = 0; 53 | 54 | if(ppb != 0xFFFF) 55 | { 56 | 57 | if(first_time) 58 | { 59 | first_time = 0; 60 | SnsGUI_ClearCircle(CIRCLE_TVOC); 61 | } 62 | SnsGUI_DisplayTVOC(ppb ); 63 | } 64 | else 65 | { 66 | if(last_sec != sec) 67 | { 68 | last_sec = sec; 69 | // 显示秒数 70 | SnsGUI_TVOCWait(sec); 71 | } 72 | TVOC_DBG("wait tvoc: left sec = %ld\n", sec); 73 | } 74 | } 75 | while(0); 76 | } 77 | 78 | static os_timer_t tTimerZM01; 79 | static void TimerZM01_CallBack(void * arg) 80 | { 81 | uint8_t val = 0; 82 | uint16_t ppb = 0; 83 | 84 | if(ZM01_Read(&val) == SYS_SUCCESS) 85 | { 86 | 87 | ppb = tvoc_val_2_ppb(val); 88 | TVOC_DBG("read ZM01 success: tvoc = %d ppb \r\n", ppb); 89 | TVOC_GUI_Display(ppb); 90 | SDRR_SaveSensorPoint(SENSOR_TVOC, &ppb); 91 | } 92 | else 93 | { 94 | TVOC_DBG("read ZM01 err\r\n"); 95 | } 96 | os_timer_arm(&tTimerZM01, SEC(1), 0); 97 | } 98 | 99 | void TVOC_Sensor_Init(void) 100 | { 101 | IIC_Init(&tvoc_bus); 102 | os_timer_setfn(&tTimerZM01, TimerZM01_CallBack, NULL); 103 | os_timer_arm(&tTimerZM01, SEC(1), 0); 104 | } 105 | 106 | 107 | 108 | 109 | 110 | -------------------------------------------------------------------------------- /Component/Sensor/src/co2.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef __CO2_H__ 3 | #define __CO2_H__ 4 | 5 | /******************************************************* 6 | 7 | SENSE AIR CO2 Sensor S8 0053 Driver, MODBUS protocol 8 | SenseAir CO2 传感器系列 S8 0053 驱动 9 | 使用 非标准MODBUS 协议 10 | 11 | *********************************************************/ 12 | // CO2 校正模式 13 | typedef enum 14 | { 15 | CO2_CalMode_Air = 0x06, // 干净空气中校正 16 | CO2_CalMode_Zero = 0x07, // 0 校正, 即氮气中校正 17 | }CO2_CalMode; 18 | 19 | extern uint16_t global_co2_ppm; 20 | 21 | void CO2_SendCmdReadPPM(void); 22 | void CO2_SendCmdReadMeterStatus(void); 23 | void CO2_SendCmdReadCO2AndMeterStatus(void); 24 | 25 | void CO2_SendCmdCalibration_Step1(void); 26 | void CO2_SendCmdCalibration_Step2(CO2_CalMode mode); 27 | void CO2_SendCmdCalibration_Step3(void); 28 | void CO2_SendCmdCalibration_Step4(void); 29 | 30 | void CO2_SendCmdReadABCPeriod(void); 31 | void CO2_SendCmdEnableABCPeriod(void); 32 | void CO2_SendCmdDisableABCPeriod(void); 33 | 34 | void CO2_StartBackgndCali(void); 35 | 36 | #endif 37 | 38 | 39 | -------------------------------------------------------------------------------- /Component/Sensor/src/sensor.c: -------------------------------------------------------------------------------- 1 | 2 | #include "sensor.h" 3 | #include "board_version.h" 4 | 5 | 6 | 7 | // 队列中剩余可用长度 8 | uint16_t q_free_size(T_ROUND_QUEUE * q) 9 | { 10 | uint16_t end = q->size - 1 - q->head; 11 | 12 | return (end + q->tail) % q->size; 13 | } 14 | 15 | // 队列已用长度 16 | uint16_t q_used_size(T_ROUND_QUEUE * q) 17 | { 18 | uint16_t end = q->size - q->tail; 19 | return (end + q->head) % q->size; 20 | } 21 | 22 | /********************* 23 | * 功能: 将数据放入队列 24 | * 参数: T_ROUND_QUEUE * q: 队列指针 25 | * uint16_t data: 待放入队列的数据 26 | * 返回值: SYS_SUCCESS or SYS_FAILED 27 | *****************/ 28 | SYS_RESULT q_push(T_ROUND_QUEUE * q, uint16_t data) 29 | { 30 | 31 | if(((q->head + 1) % q->size) == q->tail) // 队列队尾, 队列已全部填满 32 | { 33 | //os_printf("queue is full\r\n"); 34 | return SYS_FAILED; 35 | } 36 | q->buf[q->head] = data; 37 | q->head = (q->head + 1) % q->size; 38 | // os_printf("q->head = %d, q->size = %d\r\n", q->head, q->size); 39 | return SYS_SUCCESS; 40 | } 41 | 42 | /********************* 43 | * 功能: 将数据从队列中取出 44 | * 参数: T_ROUND_QUEUE * q: 队列指针 45 | * uint16_t * data: 从队列中取出的数据 46 | * 返回值: SYS_SUCCESS or SYS_FAILED 47 | *****************/ 48 | SYS_RESULT q_pull(T_ROUND_QUEUE * q, uint16_t *data) 49 | { 50 | if(q->tail == q->head) // queue is empty 51 | { 52 | //os_printf("queue is empty\r\n"); 53 | return SYS_FAILED; 54 | } 55 | *data = q->buf[q->tail]; 56 | q->tail = (q->tail + 1) % q->size; 57 | // os_printf("q->tail = %d, *data = %d \r\n", q->tail, *data); 58 | return SYS_SUCCESS; 59 | } 60 | 61 | /* 62 | 功能: 队列初始化, 初始化队列缓冲区指针及大小等 63 | */ 64 | void q_init(T_ROUND_QUEUE * q, uint16_t * buf, uint16_t buf_size) 65 | { 66 | q->buf = buf; 67 | q->size = buf_size; 68 | q->head = 0; 69 | q->tail = 0; 70 | } 71 | 72 | extern void CO2_Sensor_Init(void); 73 | extern void CO_Sensor_Init(void); 74 | extern void HCHO_Sensor_Init(void); 75 | extern void PM25_Sensor_Init(void); 76 | extern void SHT20_Init(void); 77 | extern void TVOC_Sensor_Init(void); 78 | extern void PCF8563_Init(void); 79 | 80 | extern void PM25_Sensor_PreInit(void); 81 | 82 | 83 | void Sensor_PreInit(void) 84 | { 85 | #if 0 86 | GPIO_InitTypeDef GPIO_InitStructure; 87 | 88 | /* config USART2 clock */ 89 | RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE); 90 | 91 | 92 | GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; 93 | 94 | GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0; 95 | GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING; 96 | GPIO_Init(GPIOA, &GPIO_InitStructure); 97 | 98 | GPIO_InitStructure.GPIO_Pin = GPIO_Pin_2; 99 | GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING; 100 | GPIO_Init(GPIOA, &GPIO_InitStructure); 101 | #endif 102 | PM25_Sensor_PreInit(); 103 | } 104 | void Sensor_Init(void) 105 | { 106 | Sensor_PreInit(); 107 | CO2_Sensor_Init(); 108 | // CO_Sensor_Init(); 109 | HCHO_Sensor_Init(); 110 | PM25_Sensor_Init(); 111 | SHT20_Init(); 112 | TVOC_Sensor_Init(); 113 | 114 | } 115 | 116 | -------------------------------------------------------------------------------- /Component/TFTLib/ILI9341/inc/TFT_Demo.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef __TFT_DEMO_H__ 3 | #define __TFT_DEMO_H__ 4 | 5 | 6 | void TFT_Demo(void); 7 | 8 | #endif 9 | 10 | -------------------------------------------------------------------------------- /Component/TFTLib/ILI9341/inc/tft_config.h: -------------------------------------------------------------------------------- 1 | #ifndef TEST1_CONFIG_H 2 | #define TEST1_CONFIG_H 3 | 4 | // 5 | 6 | #include "ILI9341_4Line_SPI.h" 7 | 8 | 9 | 10 | 11 | 12 | #define SPI_MASTER SPI3 13 | #define SPI_MASTER_CLK RCC_APB1Periph_SPI3 14 | #define SPI_MASTER_GPIO GPIOB 15 | #define SPI_MASTER_GPIO_CLK RCC_APB2Periph_GPIOB 16 | #define SPI_MASTER_PIN_SCK GPIO_Pin_3 17 | #define SPI_MASTER_PIN_MISO GPIO_Pin_4 18 | #define SPI_MASTER_PIN_MOSI GPIO_Pin_5 19 | 20 | // 21 | 22 | // 23 | 24 | 25 | 26 | // 27 | 28 | #endif //TEST1_CONFIG_H 29 | 30 | -------------------------------------------------------------------------------- /Component/TFTLib/ILI9341/inc/tft_control.h: -------------------------------------------------------------------------------- 1 | #ifndef TEST2_CONTROL_H 2 | #define TEST2_CONTROL_H 3 | 4 | #include "tft_config.h" 5 | #include "tft_commands.h" 6 | 7 | // 8 | #define TFT_DC_SET LCD_RS_SET 9 | #define TFT_DC_RESET LCD_RS_CLR 10 | 11 | #define TFT_RST_SET LCD_RST_SET 12 | #define TFT_RST_RESET LCD_RST_CLR 13 | 14 | #define TFT_CS_SET LCD_CS_SET 15 | #define TFT_CS_RESET LCD_CS_CLR 16 | 17 | 18 | // 19 | 20 | #endif //TEST2_CONTROL_H 21 | 22 | -------------------------------------------------------------------------------- /Component/TFTLib/ILI9341/inc/tft_core.h: -------------------------------------------------------------------------------- 1 | #ifndef TEST1_ILI9341_CORE_H 2 | #define TEST1_ILI9341_CORE_H 3 | 4 | #include 5 | #include 6 | #include "delay.h" 7 | #include "tft_commands.h" 8 | #include "tft_dma.h" 9 | 10 | #define LCD_setAddressWindowToWrite(x1,y1,x2,y2) \ 11 | LCD_setAddressWindow(x1, y1, x2, y2); \ 12 | dmaSendCmd(LCD_GRAM) 13 | 14 | #define LCD_setAddressWindowToRead(x1,y1,x2,y2) \ 15 | LCD_setAddressWindow(x1, y1, x2, y2); \ 16 | dmaSendCmd(LCD_RAMRD) 17 | 18 | extern u16 screen_width; 19 | extern u16 screen_height; 20 | 21 | __INLINE 22 | u16 LCD_getWidth(void) { 23 | return screen_width; 24 | } 25 | 26 | __INLINE 27 | u16 LCD_getHeight(void) { 28 | return screen_height; 29 | } 30 | 31 | 32 | void LCD_Config(void); 33 | 34 | void LCD_setSpi8(void); 35 | void LCD_setSpi16(void); 36 | 37 | void LCD_setOrientation(u8 o); 38 | void LCD_setAddressWindow(u16 x1, u16 y1, u16 x2, u16 y2); 39 | 40 | #endif //TEST1_ILI9341_CORE_H 41 | 42 | -------------------------------------------------------------------------------- /Component/TFTLib/ILI9341/inc/tft_dma.h: -------------------------------------------------------------------------------- 1 | #ifndef TEST1_DMA_H 2 | #define TEST1_DMA_H 3 | 4 | #include "tft_control.h" 5 | #include 6 | #include "RegLib.h" 7 | 8 | #define dmaWait() while(SPI_I2S_GetFlagStatus(SPI_MASTER,SPI_I2S_FLAG_BSY) == SET); 9 | 10 | #if 0 11 | #define dmaStartRx() DMA_Init(DMA1_Channel2, &dmaStructure); \ 12 | DMA_Cmd(DMA1_Channel2, ENABLE); 13 | 14 | #define dmaStartTx() DMA_Init(DMA1_Channel3, &dmaStructure); \ 15 | DMA_Cmd(DMA1_Channel3, ENABLE); 16 | #else 17 | #define dmaStartRx() STM32_DMA_Init(DMA2_Channel1, &dmaStructure); \ 18 | DMA2_Channel1->CCR |= DMA_CCR1_EN; 19 | 20 | 21 | #define dmaStartTx() STM32_DMA_Init(DMA2_Channel2, &dmaStructure); \ 22 | DMA2_Channel2->CCR |= DMA_CCR1_EN; 23 | #endif 24 | 25 | void dmaInit(void); 26 | 27 | void dmaSendCmd(u8 cmd); 28 | void dmaSendCmdCont(u8 cmd); 29 | 30 | void dmaReceiveDataCont8(u8 *data); 31 | 32 | void dmaSendData8(u8 *data, u32 n); 33 | void dmaSendData16(u16 *data, u32 n); 34 | 35 | void dmaSendDataCont8(u8 *data, u32 n); 36 | void dmaSendDataCont16(u16 *data, u32 n); 37 | 38 | void dmaSendDataBuf16(void); 39 | void dmaSendDataContBuf16(u16 *data, u32 n); 40 | 41 | void dmaFill16(u16 color, u32 n); 42 | void dmaFill16Raw(u16 color, u32 n); 43 | 44 | void dmaFill16Rect(u16 * colorBuf, u32 n); 45 | 46 | #endif //TEST1_DMA_H 47 | -------------------------------------------------------------------------------- /Component/TFTLib/ILI9341/inc/tft_encoder.h: -------------------------------------------------------------------------------- 1 | #ifndef TEST2_ENCODER_H 2 | #define TEST2_ENCODER_H 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | #define ENC_CLK_PIN GPIO_Pin_7 9 | #define ENC_DT_PIN GPIO_Pin_6 10 | #define ENC_SW_PIN GPIO_Pin_9 11 | #define ENCODER_GPIOx GPIOB 12 | #define ENCODER_TIMx TIM4 13 | 14 | u16 ENC_getValue(void); 15 | void ENC_init(void); 16 | 17 | #endif //TEST2_ENCODER_H 18 | 19 | -------------------------------------------------------------------------------- /Component/TFTLib/ILI9341/inc/tft_graph.h: -------------------------------------------------------------------------------- 1 | #ifndef TEST1_ILI9341_H 2 | #define TEST1_ILI9341_H 3 | 4 | #include "tft_core.h" 5 | #include "tft_dma.h" 6 | 7 | #ifndef _int16_swap 8 | #define _int16_swap(a, b) { int16_t t = a; a = b; b = t; } 9 | #endif 10 | 11 | #ifndef abs 12 | #define abs(a) ((a)<0?-(a):a) 13 | #endif 14 | 15 | #define ILI9341_COLOR(r, g, b)\ 16 | ((((uint16_t)b) >> 3) |\ 17 | ((((uint16_t)g) << 3) & 0x07E0) |\ 18 | ((((uint16_t)r) << 8) & 0xf800)) 19 | 20 | void LCD_readPixels(u16 x1, u16 y1, u16 x2, u16 y2, u16 *buf); 21 | 22 | void LCD_fillRect(u16 x1, u16 y1, u16 w, u16 h, u16 color); 23 | void LCD_fillScreen(u16 color); 24 | 25 | void LCD_drawRect(u16 x, u16 y, u16 w, u16 h, u16 color); 26 | 27 | void LCD_putPixel(u16 x, u16 y, u16 color); 28 | void LCD_putPixelRect(u16 x1, u16 y1, u16 w, u16 h, u16 * colorBuf); 29 | 30 | void LCD_drawFastHLine(u16 x0, u16 y0, u16 w, u16 color); 31 | void LCD_drawFastVLine(u16 x0, u16 y0, u16 h, u16 color); 32 | void LCD_drawLine(u16 x0, u16 y0, u16 x1, u16 y1, u16 color); 33 | 34 | void LCD_drawCircle(u16 x0, u16 y0, u16 r, u16 color); 35 | void LCD_fillCircle(u16 x0, u16 y0, u16 r, u16 color); 36 | 37 | void LCD_setVerticalScrolling(u16 startY, u16 endY); 38 | void LCD_scroll(u16 v); 39 | 40 | #endif //TEST1_ILI9341_H 41 | 42 | -------------------------------------------------------------------------------- /Component/TFTLib/ILI9341/inc/tft_itoa.h: -------------------------------------------------------------------------------- 1 | #ifndef TEST1_ITOA_H 2 | #define TEST1_ITOA_H 3 | 4 | unsigned long tft_itoa(int value, char *sp, int radix); 5 | 6 | #endif //TEST1_ITOA_H 7 | 8 | -------------------------------------------------------------------------------- /Component/TFTLib/ILI9341/inc/tft_text.h: -------------------------------------------------------------------------------- 1 | #ifndef TEST1_TEXT_H 2 | #define TEST1_TEXT_H 3 | 4 | #include "tft_graph.h" 5 | #include "tft_glcdfont.h" 6 | 7 | #define TRANSPARENT_COLOR CYAN 8 | 9 | #define pgm_read_word(addr) (*(const unsigned short *)(addr)) 10 | #define pgm_read_byte(addr) (*(const unsigned char *)(addr)) 11 | #define pgm_read_pointer(addr) ((void *)pgm_read_word(addr)) 12 | 13 | void LCD_write(uint8_t c); 14 | void LCD_writeString(uint8_t *s); 15 | void LCD_writeString2(uint8_t *string); 16 | 17 | void LCD_setCursor(u16 x, u16 y); 18 | void LCD_setTextSize(u8 size); 19 | void LCD_setTextColor(u16 color); 20 | void LCD_setTextBgColor(u16 color); 21 | 22 | u16 LCD_getCursorX(void); 23 | u16 LCD_getCursorY(void); 24 | 25 | #endif //TEST1_TEXT_H 26 | 27 | -------------------------------------------------------------------------------- /Component/TFTLib/ILI9341/src/tft_demo.c: -------------------------------------------------------------------------------- 1 | 2 | #include "tft_dma.h" 3 | #include "tft_text.h" 4 | #include "tft_itoa.h" 5 | #include "tft_encoder.h" 6 | #include "os_global.h" 7 | 8 | 9 | 10 | 11 | 12 | void TFT_Demo(void) 13 | { 14 | u32 ov = os_get_tick() / 100; 15 | //u16 encVal; 16 | char buf[16]; 17 | 18 | LCD_Config(); 19 | ENC_init(); 20 | LCD_fillScreen(ORANGE); 21 | 22 | LCD_setTextBgColor(GREEN); 23 | LCD_setTextSize(3); 24 | 25 | while (1) 26 | { 27 | if( ov != (os_get_tick() / 100)) 28 | { 29 | ov = os_get_tick() / 100; 30 | LCD_setCursor(0, 0); 31 | tft_itoa((int)ov, buf, 10); 32 | LCD_fillRect(0, 0, 50, 24, BLACK); 33 | LCD_writeString((uint8_t *)buf); 34 | } 35 | delay_ms(10); 36 | } 37 | 38 | //while (1); 39 | } 40 | 41 | -------------------------------------------------------------------------------- /Component/TFTLib/ILI9341/src/tft_encoder.c: -------------------------------------------------------------------------------- 1 | #include "tft_encoder.h" 2 | 3 | u16 ENC_getValue(void) { 4 | return (u16) (ENCODER_TIMx->CNT / 2); 5 | } 6 | 7 | void ENC_init(void) 8 | { 9 | GPIO_InitTypeDef gpio; 10 | TIM_TimeBaseInitTypeDef timer_base; 11 | 12 | RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB, ENABLE); 13 | RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM4, ENABLE); 14 | 15 | gpio.GPIO_Mode = GPIO_Mode_IPU; 16 | gpio.GPIO_Speed = GPIO_Speed_50MHz; 17 | gpio.GPIO_Pin = ENC_CLK_PIN | ENC_DT_PIN; 18 | GPIO_Init(ENCODER_GPIOx, &gpio); 19 | 20 | timer_base.TIM_Period = 0xFFFF; 21 | timer_base.TIM_Prescaler = 0; 22 | timer_base.TIM_CounterMode = TIM_CounterMode_Up; 23 | TIM_TimeBaseInit(ENCODER_TIMx, &timer_base); 24 | 25 | TIM_EncoderInterfaceConfig(ENCODER_TIMx, TIM_EncoderMode_TI1, TIM_ICPolarity_Rising, TIM_ICPolarity_Rising); 26 | TIM_Cmd(ENCODER_TIMx, ENABLE); 27 | } 28 | 29 | -------------------------------------------------------------------------------- /Component/TFTLib/ILI9341/src/tft_itoa.c: -------------------------------------------------------------------------------- 1 | #include "tft_itoa.h" 2 | 3 | unsigned long tft_itoa(int value, char *sp, int radix) { 4 | unsigned long len; 5 | char tmp[16], *tp = tmp; 6 | int i, v, sign = radix == 10 && value < 0; 7 | 8 | v = sign ? -value : value; 9 | 10 | while (v || tp == tmp) { 11 | i = v % radix; 12 | v /= radix; 13 | *tp++ = i < 10 ? (char) (i + '0') : (char) (i + 'a' - 10); 14 | } 15 | 16 | 17 | len = tp - tmp; 18 | 19 | if (sign) { 20 | *sp++ = '-'; 21 | len++; 22 | } 23 | 24 | while (tp > tmp) 25 | *sp++ = *--tp; 26 | 27 | *sp++ = '\0'; 28 | 29 | return len; 30 | } 31 | -------------------------------------------------------------------------------- /Component/TFTLib/ILI9341/src/tft_text.c: -------------------------------------------------------------------------------- 1 | 2 | #include "tft_text.h" 3 | 4 | u8 _cp437 = 0; 5 | 6 | u16 cursorX = 0, 7 | cursorY = 0; 8 | 9 | u8 textSize = 1; 10 | u8 wrap = 1; 11 | 12 | u16 textColor = RED, 13 | textBgColor = TRANSPARENT_COLOR; 14 | 15 | #include "GlobalDef.h" 16 | u16 charPixels[3072]; 17 | 18 | //inline 19 | static void LCD_drawChar(u16 x0, u16 y0, uint8_t c, u16 color, u16 bg, uint8_t size) { 20 | u16 scaledWidth = (u16) (size * 6), 21 | doubleScaledWidth = scaledWidth * size; 22 | 23 | u16 x1 = (u16) (x0 + scaledWidth - 1), 24 | y1 = (u16) (y0 + 8 * size - 1); 25 | 26 | u16 doubleSize = size * size; 27 | u16 count = (u16) (48 * doubleSize); 28 | // u16 charPixels[256]; 29 | //u16 charPixels[count]; 30 | 31 | u16 mx, my; 32 | s8 i, j, sx, sy; 33 | u8 line; 34 | u16 pixelColor; 35 | u16 characterNumber; 36 | u16 cnt = 0; 37 | 38 | // if (x0 >= LCD_getWidth() || y0 >= LCD_getHeight() || x1 < 0 || y1 < 0) return; 39 | if(x0 >= LCD_getWidth() || y0 >= LCD_getHeight()) return; 40 | 41 | if (!_cp437 && (c >= 176)) c++; // Handle 'classic' charset behavior 42 | 43 | characterNumber = (u16) (c * 5); 44 | 45 | if (bg == TRANSPARENT_COLOR) { 46 | LCD_readPixels(x0, y0, x1, y1, charPixels); 47 | } 48 | 49 | LCD_setAddressWindowToWrite(x0, y0, x1, y1); 50 | 51 | for (i = 0; i < 6; i++) { 52 | line = (u8) (i < 5 ? pgm_read_byte(font + characterNumber + i) : 0x0); 53 | my = (u16) (i * size); 54 | 55 | 56 | for (j = 0; j < 8; j++, line >>= 1) { 57 | mx = (u16) (j * doubleScaledWidth); 58 | 59 | pixelColor = line & 0x1 ? color : bg; 60 | 61 | if (pixelColor == TRANSPARENT_COLOR) continue; 62 | 63 | for (sx = 0; sx < size; ++sx) 64 | { 65 | for (sy = 0; sy < size; ++sy) 66 | { 67 | cnt = mx + my + sy * scaledWidth + sx; 68 | if(cnt >= sizeof(charPixels)) 69 | { 70 | os_printf("pixel cnt = %d\n", cnt); 71 | while(1); 72 | //return; 73 | } 74 | charPixels[cnt] = pixelColor; 75 | } 76 | } 77 | } 78 | } 79 | 80 | LCD_setSpi16(); 81 | dmaSendData16(charPixels, count); 82 | LCD_setSpi8(); 83 | } 84 | 85 | //inline 86 | void LCD_write(uint8_t c) { 87 | if (c == '\n') { 88 | cursorY += textSize * 8; 89 | cursorX = 0; 90 | } else if (c == '\r') { 91 | cursorX = 0; 92 | } else { 93 | if (wrap && ((cursorX + textSize * 6) >= LCD_getWidth())) { // Heading off edge? 94 | cursorX = 0; // Reset x to zero 95 | cursorY += textSize * 8; // Advance y one line 96 | } 97 | LCD_drawChar(cursorX, cursorY, c, textColor, textBgColor, textSize); 98 | cursorX += textSize * 6; 99 | } 100 | } 101 | 102 | void LCD_writeString(uint8_t *s) { 103 | while (*(s)) LCD_write(*s++); 104 | } 105 | 106 | void LCD_setCursor(u16 x, u16 y) { 107 | cursorX = x; 108 | cursorY = y; 109 | } 110 | 111 | void LCD_setTextSize(u8 size) { 112 | textSize = size; 113 | } 114 | 115 | void LCD_setTextColor(u16 color) { 116 | textColor = color; 117 | } 118 | 119 | void LCD_setTextBgColor(u16 color) { 120 | textBgColor = color; 121 | } 122 | 123 | u16 LCD_getCursorX(void) { 124 | return cursorX; 125 | } 126 | 127 | u16 LCD_getCursorY(void) { 128 | return cursorY; 129 | } 130 | 131 | -------------------------------------------------------------------------------- /Component/TFTLib/ILI9341_4Line/inc/FONT_API.h: -------------------------------------------------------------------------------- 1 | #ifndef FONT_API_H__ 2 | #define FONT_API_H__ 3 | 4 | #include "GlobalDef.h" 5 | //#include "font32_32_api.h" 6 | 7 | 8 | typedef enum 9 | { 10 | FONT_UNIT_SQUARE = 0, // 2 11 | FONT_UNIT_Cube = 1, // 3 12 | FONT_UNIT_Celsius = 2, // 'C 13 | FONT_UNIT_Percent = 3, // % 14 | 15 | FONT_UNIT_End, 16 | }FONT_UNIT; 17 | 18 | 19 | void FONT3232_DrawNum(u16 x, u16 y, u16 fc, u16 bc, u8 num); 20 | void FONT3224_DrawNum(u16 x, u16 y, u16 fc, u16 bc, u8 num); 21 | void FONT1608_DrawString(u16 x, u16 y, u16 fc, u16 bc, u8 *s); 22 | void FONT2416_DrawString(u16 x, u16 y, u16 fc, u16 bc, u8 *s); 23 | void FONT2416_DrawUnit(u16 x, u16 y, u16 fc, u16 bc, FONT_UNIT unit); 24 | void FONT2012_DrawString(u16 x, u16 y, u16 fc, u16 bc, u8 *s); 25 | void FONT2616_DrawString(u16 x, u16 y, u16 fc, u16 bc, u8 *s); 26 | void FONT1016_Draw_Subscript2(u16 x, u16 y, u16 fc, u16 bc); 27 | void ICON_DrawBatIsCharging(void); 28 | void ICON_DrawBattery(void); 29 | void ICON_SetBatPercent(u8 percent, u8 is_charging, u8 reflush); 30 | 31 | 32 | 33 | void FONT_DrawSpace(u16 x, u16 y, u16 fc, u16 bc, u8 w, u8 h); 34 | void FONT_WriteInt(u16 x, u16 y, u16 fc, u16 bc, u8 width, u8 height, u32 val, uint8_t placeholder_size); 35 | 36 | #endif 37 | 38 | -------------------------------------------------------------------------------- /Component/TFTLib/ILI9341_4Line/inc/Font1.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef __FONT1_H__ 3 | #define __FONT1_H__ 4 | 5 | #include "GlobalDef.h" 6 | 7 | void UserGUI_DrawFont_GBK16(u16 x, u16 y, u16 fc, u16 bc, u8 *s); 8 | void UserGUI_DrawFont_GBK24(u16 x, u16 y, u16 fc, u16 bc, u8 *s); 9 | void UserGUI_DrawFont_Num32(u16 x, u16 y, u16 fc, u16 bc, u16 num) ; 10 | 11 | #endif 12 | 13 | -------------------------------------------------------------------------------- /Component/TFTLib/ILI9341_4Line/inc/QDTFT_demo.h: -------------------------------------------------------------------------------- 1 | #ifndef __QDTFT_DEMO_H 2 | #define __QDTFT_DEMO_H 3 | 4 | 5 | 6 | void Redraw_Mainmenu(void); 7 | void Num_Test(void); 8 | void Font_Test(void); 9 | void Color_Test(void); 10 | 11 | void showimage(const unsigned char *p); 12 | void QDTFT_Test_Demo(void); 13 | void QDTFT_Demo(void); 14 | void QDTFT_DisplaySensor(void); 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /Component/TFTLib/ILI9341_4Line/inc/SnsGUI.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef __SNSGUI_H__ 3 | #define __SNSGUI_H__ 4 | 5 | #if 0 6 | #include "UGUI_Demo.h" 7 | 8 | 9 | 10 | #define SNS_COLOR_BC_WHITE 0xef5d // 背景白 11 | #define SNS_COLOR_OrangeYellow 0xdec3 // 橘黄 12 | 13 | 14 | 15 | 16 | void SnsGUI_DisplayCO2(uint16_t co2_ppm); 17 | void SnsGUI_DisplayPM25(uint16_t pm25, uint8_t lev); 18 | void SnsGUI_DisplayPM10(uint16_t pm10, uint8_t lev); 19 | void SnsGUI_DisplayHCHO(uint16_t ppb); 20 | void SnsGUI_DisplayBatPercent(uint8_t percent); 21 | void SnsGUI_DisplayCO(uint16_t ppm); 22 | void SnsGUI_DisplayTVOC(uint16_t ppb); 23 | void SnsGUI_DisplayTemp(int16_t temp); 24 | void SnsGUI_DisplayHumi(u8 humi); 25 | #else 26 | #include "UGUI_Demo.h" 27 | #include "RTCDrv.h" 28 | 29 | 30 | #define SNS_COLOR_BC_WHITE 0xef5d // 背景白 31 | #define SNS_COLOR_OrangeYellow 0xdec3 // 橘黄 32 | 33 | // 传感器的数据圆形UI显示 34 | typedef struct 35 | { 36 | u16 x0; // 圆心 x 坐标 37 | u16 y0; // 圆心 y 坐标 38 | u8 r; // 圆半径 39 | u8 thick; // 线条粗细 40 | u16 bc; // 圆弧背景色 41 | }SNS_CIRCLE; 42 | 43 | 44 | typedef enum 45 | { 46 | CIRCLE_PM10 = 0, 47 | CIRCLE_TVOC = 1, 48 | CIRCLE_PM2P5 = 2, 49 | CIRCLE_HCHO = 3, 50 | CIRCLE_CO2 = 4, 51 | CIRCLE_CO = 5, 52 | SnsCircle_End, 53 | }SnsCircleIndex; 54 | 55 | typedef enum 56 | { 57 | TIP_WIFI_OK = 0, 58 | TIP_WIFI_UnConn = 1, 59 | TIP_WIFI_TryCon = 2, 60 | TIP_WIFI_Reset = 3, 61 | TIP_WIFI_Failed = 4, 62 | TIP_WIFI_Erase = 5, 63 | TIP_WIFI_ReadyConn = 6, 64 | TIP_WIFI_ReadyReset = 7, 65 | TIP_WIFI_Error, 66 | }WifiTipType; 67 | 68 | typedef enum 69 | { 70 | TIP_CO2_CALI_ON = 0, // 校验 Cali... 71 | TIP_CO2_CALI_OK = 1, // Cali OK 72 | TIP_CO2_CALI_FAILED = 2, // Cali Failed 73 | TIP_CO2_CALI_Erase = 3, 74 | TIP_CO2_CALI_Ready = 4, 75 | TIP_CO2_End, 76 | }CO2TipType; 77 | 78 | void SNSGUI_DrawArcLev(s16 x0, s16 y0, s16 r, u16 thick, u8 lev, u16 bc); 79 | void SNSGUI_DrawIndicateRing(u8 sns, u8 lev); 80 | void SnsGUI_Demo(void); 81 | void SnsGUI_DisplayNormal(void); 82 | void SnsGUI_DisplayVersion(char * version, char * date, char * time); 83 | void SnsGUI_DisplayCO2(uint16_t co2_ppm); 84 | void SnsGUI_DisplayPM25(uint16_t pm25, uint8_t lev); 85 | void SnsGUI_DisplayPM10(uint16_t pm10, uint8_t lev); 86 | void SnsGUI_DisplayHCHO(uint16_t ppb); 87 | void SnsGUI_DisplayBatPercent(uint8_t percent); 88 | void SnsGUI_DisplayCO(uint16_t ppm); 89 | void SnsGUI_DisplayTVOC(uint16_t ppb); 90 | void SnsGUI_TVOCWait(uint8_t sec); 91 | void SnsGUI_DisplayTemp(int16_t temp); 92 | void SnsGUI_DisplayHumi(u8 humi); 93 | void SnsGUI_DisplayTime(T_Calendar_Obj *cal); 94 | void SnsGUI_Wait(void); 95 | void SnsGUI_ClearCircle(SnsCircleIndex index); 96 | void SnsGUI_DisplaySDCardMode(void); 97 | void SnsGUI_DisplayWifiTip(WifiTipType TipType); 98 | void SnsGUI_DisplayCO2Tip(CO2TipType TipType); 99 | 100 | #endif 101 | 102 | 103 | 104 | #endif 105 | 106 | -------------------------------------------------------------------------------- /Component/TFTLib/ILI9341_4Line/inc/UserFont.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaberOnGo/AirDog/e741a01c44aee19c57c81071a268d98cc484962a/Component/TFTLib/ILI9341_4Line/inc/UserFont.h -------------------------------------------------------------------------------- /Component/TFTLib/ILI9341_4Line/inc/UserGUI.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef __USER_GUI_H__ 3 | #define __USER_GUI_H__ 4 | 5 | #include "GlobalDef.h" 6 | 7 | void UserGUI_Circle(u16 X,u16 Y,u16 R,u16 fc); 8 | void UserGUI_DrawLine(u16 x0, u16 y0,u16 x1, u16 y1,u16 Color); 9 | void UserGUI_box(u16 x, u16 y, u16 w, u16 h,u16 bc); 10 | void UserGUI_box2(u16 x,u16 y,u16 w,u16 h, u8 mode); 11 | void UserGUI_DisplayButtonDown(u16 x1,u16 y1,u16 x2,u16 y2); 12 | void UserGUI_DisplayButtonUp(u16 x1,u16 y1,u16 x2,u16 y2); 13 | 14 | 15 | #endif 16 | 17 | -------------------------------------------------------------------------------- /Component/TFTLib/ILI9341_4Line/inc/font10_16.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef __FONT10_16_H__ 3 | #define __FONT10_16_H__ 4 | 5 | /*------------------------------------------------------------------------------ 6 | ; 若数据乱码,请检查字模格式设置,注意选择正确的取模方向和字节位顺序 7 | ; 源文件 / 文字 : 来自:2 8 | ; 宽×高(像素): 10×16 9 | ; 字模格式/大小 : 横向取模,字节正序 / 32字节 10 | ; 数据转换日期 : 2018-03-09/17:19:32 11 | ------------------------------------------------------------------------------*/ 12 | const unsigned char font10_16[] = 13 | { 14 | // 下标 2 15 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x00, 16 | 0x24,0x00,0x04,0x00,0x04,0x00,0x08,0x00,0x18,0x00,0x30,0x00,0x3C,0x00,0x00,0x00, 17 | }; 18 | 19 | 20 | #endif 21 | 22 | -------------------------------------------------------------------------------- /Component/TFTLib/ILI9341_4Line/inc/font32_32_api.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef FONT32_32_API_H__ 3 | #define FONT32_32_API_H__ 4 | 5 | #include "GlobalDef.h" 6 | 7 | typedef enum 8 | { 9 | FONT_UNIT_SQUARE = 0, // 2 10 | FONT_UNIT_Cube = 1, // 3 11 | FONT_UNIT_Celsius = 2, // 'C 12 | FONT_UNIT_Percent = 3, // % 13 | 14 | FONT_UNIT_End, 15 | }FONT_UNIT; 16 | 17 | 18 | 19 | void FT3224_DrawString(u8 row, u8 column, u16 fc, u16 bc, u8 * s); 20 | void FT1608_DrawString(u8 row, u8 column, u16 fc, u16 bc, u8 *s); 21 | void FT2416_DrawString(u8 row, u8 column, u16 fc, u16 bc, u8 *s); 22 | void FT2416_DrawUnit(u8 row, u8 column, u16 fc, u16 bc, FONT_UNIT unit); 23 | 24 | void FT2012_DrawString(u8 row, u8 column, u16 fc, u16 bc, u8 *s); 25 | void FT2616_DrawString(u8 row, u8 column, u16 fc, u16 bc, u8 *s); 26 | 27 | void FT1016_Draw_Subscript2(u8 row, u8 column, u16 fc, u16 bc); 28 | void ICO_DrawBatIsCharging(void); 29 | void ICO_DrawBattery(void); 30 | void ICO_SetBatPercent(u8 percent, u8 is_charging); 31 | 32 | 33 | 34 | void FT_DrawSpace(u16 x, u16 y, u16 fc, u16 bc, u8 w, u8 h); 35 | void FT_WriteInt(u8 row, u8 column, u32 val, uint8_t placeholder_size); 36 | 37 | #endif 38 | 39 | -------------------------------------------------------------------------------- /Component/TFTLib/ILI9341_4Line/src/QDTFT_demo.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaberOnGo/AirDog/e741a01c44aee19c57c81071a268d98cc484962a/Component/TFTLib/ILI9341_4Line/src/QDTFT_demo.c -------------------------------------------------------------------------------- /Component/UGUI/UGUI-master/LICENSE.md: -------------------------------------------------------------------------------- 1 | /* -------------------------------------------------------------------------------- */ 2 | /* -- µGUI - Generic GUI module (C)Achim Döbler, 2015 -- */ 3 | /* -------------------------------------------------------------------------------- */ 4 | // µGUI is a generic GUI module for embedded systems. 5 | // This is a free software that is open for education, research and commercial 6 | // developments under license policy of following terms. 7 | // 8 | // Copyright (C) 2015, Achim Döbler, all rights reserved. 9 | // URL: http://www.embeddedlightning.com/ 10 | // 11 | // * The µGUI module is a free software and there is NO WARRANTY. 12 | // * No restriction on use. You can use, modify and redistribute it for 13 | // personal, non-profit or commercial products UNDER YOUR RESPONSIBILITY. 14 | // * Redistributions of source code must retain the above copyright notice. 15 | // 16 | /* -------------------------------------------------------------------------------- */ 17 | /* -- MY SPECIAL THANKS GO TO -- */ 18 | /* -------------------------------------------------------------------------------- */ 19 | // Andrey Filimonov (-->https://github.com/Sermus) 20 | // for giving valuable suggestions, reporting bugs and adding several new features. 21 | // Andrey also put a lot of work in the implementaion of anti-aliased font support. 22 | // 23 | // Mikhail Podkur (-->https://github.com/MikhailPodkur) 24 | // for adding cyrillic 8x12 font, checkbox feature and RGB565 support. 25 | // 26 | // Gustavo Denardin 27 | // for giving valuable suggestions regarding real-time os support. 28 | // 29 | // Samuel Kleiser 30 | // for reporting bugs and giving examples how to improve µGUI. 31 | /* -------------------------------------------------------------------------------- */ 32 | /* -- REVISION HISTORY -- */ 33 | /* -------------------------------------------------------------------------------- */ 34 | // Dec 20, 2015 V0.31 Checkbox component with all funtions added. 35 | // Cyrillic font 8x12 added. 36 | // RGB565 color schema added. 37 | // Windows components font could be getted from current GUI by default 38 | // Mar 18, 2015 V0.3 Driver support added. 39 | // Window and object support added. 40 | // Touch support added. 41 | // Fixed some minor bugs. 42 | // 43 | // Oct 20, 2014 V0.2 Function UG_DrawRoundFrame() added. 44 | // Function UG_FillRoundFrame() added. 45 | // Function UG_DrawArc() added. 46 | // Fixed some minor bugs. 47 | // 48 | // Oct 11, 2014 V0.1 First release. 49 | /* -------------------------------------------------------------------------------- */ 50 | -------------------------------------------------------------------------------- /Component/UGUI/UGUI-master/README.md: -------------------------------------------------------------------------------- 1 | # Introduction 2 | ## What is µGUI? 3 | µGUI is a free and open source graphic library for embedded systems. It is platform-independent 4 | and can be easily ported to almost any microcontroller system. As long as the display is capable 5 | of showing graphics, µGUI is not restricted to a certain display technology. Therefore, display 6 | technologies such as LCD, TFT, E-Paper, LED or OLED are supported. The whole module 7 | consists of three files: **ugui.c**, **ugui.h** and **ugui_config.h**. 8 | 9 | ## µGUI Features 10 | * µGUI supports any color, grayscale or monochrome display 11 | * µGUI supports any display resolution 12 | * µGUI supports multiple different displays 13 | * µGUI supports any touch screen technology (e.g. AR, PCAP) 14 | * µGUI supports windows and objects (e.g. button, textbox) 15 | * µGUI supports platform-specific hardware acceleration 16 | * 16 different fonts available 17 | * cyrillic fonts supported 18 | * TrueType font converter available ([https://github.com/AriZuu](https://github.com/AriZuu)) 19 | * integrated and free scalable system console 20 | * basic geometric functions (e.g. line, circle, frame etc.) 21 | * can be easily ported to almost any microcontroller system 22 | * no risky dynamic memory allocation required 23 | 24 | ## µGUI Requirements 25 | µGUI is platform-independent, so there is no need to use a certain embedded system. In order to 26 | use µGUI, only two requirements are necessary: 27 | * a C-function which is able to control pixels of the target display. 28 | * integer types for the target platform have to be adjusted in ugui_config.h. 29 | -------------------------------------------------------------------------------- /Component/UGUI/UGUI-master/UGUI_Demo.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef __UGUI_DEMO_H_ 3 | #define __UGUI_DEMO_H_ 4 | 5 | #include "ugui.h" 6 | #include 7 | 8 | 9 | #define SNS_RGB888_0 0x039962 10 | #define SNS_RGB888_1 0xffde35 11 | #define SNS_RGB888_2 0xff9124 12 | #define SNS_RGB888_3 0xe60224 13 | #define SNS_RGB888_4 0x6d1090 14 | #define SNS_RGB888_5 0x8c031e 15 | #define SNS_RGB888_6 0xe9e9e9 // 背景灰 16 | #define SNS_RGB888_7 0xd8d91b // 橘黄 17 | #define SNS_RGB888_8 0xBEBEBE // Grey 18 | #define SNS_RGB888_9 0x778899 // LightSlateGray 19 | 20 | 21 | void UGUI_Demo(void); 22 | u16 UGUI_RGB888_TO_RGB565(u32 rgb); 23 | void UGUI_DrawThickArc(s16 x0, s16 y0, s16 r1, u16 thickness, u8 sector, UG_COLOR color); 24 | void UGUI_DrawThickCircle(s16 x0, s16 y0, s16 r1, u16 thickness, UG_COLOR color); 25 | 26 | #endif 27 | 28 | -------------------------------------------------------------------------------- /Component/UGUI/UGUI-master/ugui.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaberOnGo/AirDog/e741a01c44aee19c57c81071a268d98cc484962a/Component/UGUI/UGUI-master/ugui.c -------------------------------------------------------------------------------- /Component/UGUI/UGUI-master/ugui_config.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaberOnGo/AirDog/e741a01c44aee19c57c81071a268d98cc484962a/Component/UGUI/UGUI-master/ugui_config.h -------------------------------------------------------------------------------- /Component/UGUI/UGUI-master/ugui_font.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaberOnGo/AirDog/e741a01c44aee19c57c81071a268d98cc484962a/Component/UGUI/UGUI-master/ugui_font.c -------------------------------------------------------------------------------- /Component/UGUI/UGUI-master/ugui_font.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef __UGUI_FONT_H__ 3 | #define __UGUI_FONT_H__ 4 | 5 | #include "GlobalDef.h" 6 | #if (UGUI_USE_FONT == FONT_IN_ROM_FLASH) 7 | #include "ugui_fontlib.h" 8 | 9 | 10 | #else 11 | #include "flash_font.h" 12 | 13 | 14 | extern FONT_DESC * font_4x6; 15 | extern FONT_DESC * font_5x8; 16 | extern FONT_DESC * font_5x12; 17 | extern FONT_DESC * font_6x8; 18 | 19 | extern FONT_DESC * font_6x10; 20 | extern FONT_DESC * font_7x12; 21 | extern FONT_DESC * font_8x8; 22 | extern FONT_DESC * font_8x12; 23 | extern FONT_DESC * font_8x14; 24 | 25 | extern FONT_DESC * font_10x16; 26 | extern FONT_DESC * font_12x16; 27 | extern FONT_DESC * font_12x20; 28 | extern FONT_DESC * font_16x26; 29 | 30 | extern FONT_DESC * font_22x36; 31 | extern FONT_DESC * font_24x40; 32 | extern FONT_DESC * font_32x53; 33 | 34 | 35 | 36 | uint8_t UGUI_FONT_GetPixel(FONT_DESC * desc, uint32_t index); 37 | #endif 38 | 39 | #endif 40 | 41 | -------------------------------------------------------------------------------- /Component/USB/LIB/inc/disk_image.h: -------------------------------------------------------------------------------- 1 | //#define MSC_ImageSize 0x00001000 2 | #define MSC_ImageSize 0x400 3 | 4 | //extern const unsigned char DiskImage[MSC_ImageSize]; /* Disk Image */ 5 | 6 | //虚拟U盘从0x8003000开始,使用FAT分区后,格式化参数为 7 | //(1)MBR区(主引导扇区) 8 | //0x8003000: eb 3c 90 4d 53 44 4f 53 35 2e 30 00 04 01 02 00 9 | // 0 3 11 13 14 10 | //00.跳转指令 11 | //03.MSDOS5.3 12 | //11.每扇区字节数 =0x400=1K字节 13 | //13.每簇占用扇区数 =1个 14 | //14.保留扇区 =2个,FAT1开始地址=0x400*2=0x800 15 | //0x8003010: 02 00 02 34 00 f8 01 00 01 00 01 00 00 00 00 00 16 | // 16 17 19 21 22 24 26 28 17 | //16.FAT表数量 =2个, 18 | //17.最大根目录文件数 =0x200=512个 19 | //19.逻辑扇区总数 =0x34=52个,[容量=52K] 20 | //21.媒体描述符 =0xf8,表示硬盘 21 | //22.每个FAT占用扇区数 =1 22 | //24.每个磁道扇区数 =1 23 | //26.磁头数 =1 24 | //28.隐藏扇区数 =0 25 | //根目录扇区位置=FAT表数量*FAT表所占用的扇区数量+隐藏扇区数量=2*1=2 26 | //用户数据开始位置=根目录扇区位置+根目录所占用扇区=2+? 27 | //0x8003020: 00 00 00 00 00 00 29 c8 bf 76 b4 4e 4f 20 4e 41 28 | // 32 36 37 38 39 43 29 | //32.如果BPB_TotSec16是0,则在这里记录扇区总数 30 | //36.中断13的驱动器号 =0 31 | //37.未使用 32 | //38.扩展引导标志 =0x29 33 | //39.卷序列号 =0xbf-76-b4-c8 34 | //43.卷标 =NO NAME 必须是11个字符,不足以空格填充 35 | //0x8003030: 4d 45 20 20 20 20 46 41 54 31 32 20 20 20 33 c9 36 | // 54 37 | //54.文件系统类型 =FAT12 必须是8个字符,不足填充空格 38 | //62.引导代码 由偏移0字节处的短跳转而来 39 | //510.系统引导标识 =0xaa55h 40 | 41 | // (2)DBR区 42 | // (3)FAT区 43 | // (4)DIR区(根目录区) 44 | // (5)数据(DATA)区 45 | //BookKeep = PhysSectPerTrck + 1 + NumFATs * NumSectPerFAT + SectRootDir 46 | 47 | 48 | -------------------------------------------------------------------------------- /Component/USB/LIB/inc/hw_config.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file hw_config.h 4 | * @author MCD Application Team 5 | * @version V4.0.0 6 | * @date 21-January-2013 7 | * @brief Hardware Configuration & Setup 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2013 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | 29 | /* Define to prevent recursive inclusion -------------------------------------*/ 30 | #ifndef __HW_CONFIG_H 31 | #define __HW_CONFIG_H 32 | 33 | /* Includes ------------------------------------------------------------------*/ 34 | 35 | 36 | /* Exported types ------------------------------------------------------------*/ 37 | /* Exported constants --------------------------------------------------------*/ 38 | /* Exported macro ------------------------------------------------------------*/ 39 | /* Exported define -----------------------------------------------------------*/ 40 | #define BULK_MAX_PACKET_SIZE (0x00000040) 41 | #include "usb_type.h" 42 | #include 43 | 44 | /* Exported functions ------------------------------------------------------- */ 45 | void USBSet_System(void); 46 | void USBSet_USBClock(void); 47 | void Enter_LowPowerMode(void); 48 | void Leave_LowPowerMode(void); 49 | void USB_Interrupts_Config(void); 50 | 51 | void USB_Cable_Config (FunctionalState NewState); 52 | void Get_SerialNum(void); 53 | void MAL_Config(void); 54 | 55 | /* External variables --------------------------------------------------------*/ 56 | 57 | #endif /*__HW_CONFIG_H*/ 58 | 59 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 60 | -------------------------------------------------------------------------------- /Component/USB/LIB/inc/mass_mal.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file mass_mal.h 4 | * @author MCD Application Team 5 | * @version V4.0.0 6 | * @date 21-January-2013 7 | * @brief Header for mass_mal.c file. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2013 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | 29 | /* Define to prevent recursive inclusion -------------------------------------*/ 30 | #ifndef __MASS_MAL_H 31 | #define __MASS_MAL_H 32 | #include 33 | #include "GlobalDef.h" 34 | 35 | /* Includes ------------------------------------------------------------------*/ 36 | /* Exported types ------------------------------------------------------------*/ 37 | /* Exported constants --------------------------------------------------------*/ 38 | 39 | 40 | #define MAL_OK 0 41 | #define MAL_FAIL 1 42 | 43 | 44 | extern long long Mass_Memory_Size[MAX_LUN + 1]; 45 | extern uint32_t Mass_Block_Size[MAX_LUN + 1]; 46 | extern uint32_t Mass_Block_Count[MAX_LUN + 1]; 47 | 48 | /* Exported macro ------------------------------------------------------------*/ 49 | /* Exported functions ------------------------------------------------------- */ 50 | 51 | uint16_t MAL_Init (uint8_t lun); 52 | uint16_t MAL_GetStatus (uint8_t lun); 53 | uint16_t MAL_Read(uint8_t lun, uint64_t Memory_Offset, uint32_t *Readbuff, uint16_t Transfer_Length); 54 | uint16_t MAL_Write(uint8_t lun, uint64_t Memory_Offset, uint32_t *Writebuff, uint16_t Transfer_Length); 55 | #endif /* __MASS_MAL_H */ 56 | 57 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 58 | -------------------------------------------------------------------------------- /Component/USB/LIB/inc/memory.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file memory.h 4 | * @author MCD Application Team 5 | * @version V4.0.0 6 | * @date 21-January-2013 7 | * @brief Memory management layer 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2013 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | 29 | /* Define to prevent recursive inclusion -------------------------------------*/ 30 | #ifndef __memory_H 31 | #define __memory_H 32 | 33 | /* Includes ------------------------------------------------------------------*/ 34 | #include "hw_config.h" 35 | /* Exported types ------------------------------------------------------------*/ 36 | /* Exported constants --------------------------------------------------------*/ 37 | #define TXFR_IDLE 0 38 | #define TXFR_ONGOING 1 39 | 40 | extern vu8 USB_STATUS_REG; 41 | 42 | /* Exported macro ------------------------------------------------------------*/ 43 | /* Exported functions ------------------------------------------------------- */ 44 | void Write_Memory (uint8_t lun, uint32_t Memory_Offset, uint32_t Transfer_Length); 45 | void Read_Memory (uint8_t lun, uint32_t Memory_Offset, uint32_t Transfer_Length); 46 | #endif /* __memory_H */ 47 | 48 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 49 | -------------------------------------------------------------------------------- /Component/USB/LIB/inc/usb_conf.h: -------------------------------------------------------------------------------- 1 | /******************** (C) COPYRIGHT 2008 STMicroelectronics ******************** 2 | * File Name : usb_conf.h 3 | * Author : MCD Application Team 4 | * Version : V2.2.0 5 | * Date : 06/13/2008 6 | * Description : Mass Storage Demo configuration header 7 | ******************************************************************************** 8 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 9 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. 10 | * AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, 11 | * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE 12 | * CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING 13 | * INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 14 | *******************************************************************************/ 15 | /* Define to prevent recursive inclusion -------------------------------------*/ 16 | #ifndef __USB_CONF_H 17 | #define __USB_CONF_H 18 | 19 | /*-------------------------------------------------------------*/ 20 | /* EP_NUM */ 21 | /* defines how many endpoints are used by the device */ 22 | /*-------------------------------------------------------------*/ 23 | #define EP_NUM (3) 24 | 25 | /*-------------------------------------------------------------*/ 26 | /* -------------- Buffer Description Table -----------------*/ 27 | /*-------------------------------------------------------------*/ 28 | /* buffer table base address */ 29 | 30 | #define BTABLE_ADDRESS (0x00) 31 | 32 | /* EP0 */ 33 | /* rx/tx buffer base address */ 34 | #define ENDP0_RXADDR (0x18) 35 | #define ENDP0_TXADDR (0x58) 36 | 37 | /* EP1 */ 38 | /* tx buffer base address */ 39 | #define ENDP1_TXADDR (0x98) 40 | 41 | /* EP2 */ 42 | /* Rx buffer base address */ 43 | #define ENDP2_RXADDR (0xD8) 44 | 45 | 46 | /* ISTR events */ 47 | /* IMR_MSK */ 48 | /* mask defining which events has to be handled */ 49 | /* by the device application software */ 50 | //#define IMR_MSK (CNTR_CTRM | CNTR_WKUPM | CNTR_SUSPM | CNTR_ERRM | CNTR_SOFM \ 51 | // | CNTR_ESOFM | CNTR_RESETM ) 52 | 53 | #define IMR_MSK (CNTR_CTRM | CNTR_RESETM) 54 | 55 | /* CTR service routines */ 56 | /* associated to defined endpoints */ 57 | //#define EP1_IN_Callback NOP_Process 58 | #define EP2_IN_Callback NOP_Process 59 | #define EP3_IN_Callback NOP_Process 60 | #define EP4_IN_Callback NOP_Process 61 | #define EP5_IN_Callback NOP_Process 62 | #define EP6_IN_Callback NOP_Process 63 | #define EP7_IN_Callback NOP_Process 64 | 65 | 66 | #define EP1_OUT_Callback NOP_Process 67 | //#define EP2_OUT_Callback NOP_Process 68 | #define EP3_OUT_Callback NOP_Process 69 | #define EP4_OUT_Callback NOP_Process 70 | #define EP5_OUT_Callback NOP_Process 71 | #define EP6_OUT_Callback NOP_Process 72 | #define EP7_OUT_Callback NOP_Process 73 | 74 | #endif /* __USB_CONF_H */ 75 | 76 | /******************* (C) COPYRIGHT 2008 STMicroelectronics *****END OF FILE****/ 77 | -------------------------------------------------------------------------------- /Component/USB/LIB/inc/usb_istr.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usb_istr.h 4 | * @author MCD Application Team 5 | * @version V4.0.0 6 | * @date 21-January-2013 7 | * @brief This file includes the peripherals header files in the user application. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2013 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | 29 | /* Define to prevent recursive inclusion -------------------------------------*/ 30 | #ifndef __USB_ISTR_H 31 | #define __USB_ISTR_H 32 | 33 | /* Includes ------------------------------------------------------------------*/ 34 | #include "usb_conf.h" 35 | 36 | /* Exported types ------------------------------------------------------------*/ 37 | /* Exported constants --------------------------------------------------------*/ 38 | /* Exported macro ------------------------------------------------------------*/ 39 | /* Exported functions ------------------------------------------------------- */ 40 | 41 | void USB_Istr(void); 42 | 43 | /* function prototypes Automatically built defining related macros */ 44 | 45 | void EP1_IN_Callback(void); 46 | void EP2_IN_Callback(void); 47 | void EP3_IN_Callback(void); 48 | void EP4_IN_Callback(void); 49 | void EP5_IN_Callback(void); 50 | void EP6_IN_Callback(void); 51 | void EP7_IN_Callback(void); 52 | 53 | void EP1_OUT_Callback(void); 54 | void EP2_OUT_Callback(void); 55 | void EP3_OUT_Callback(void); 56 | void EP4_OUT_Callback(void); 57 | void EP5_OUT_Callback(void); 58 | void EP6_OUT_Callback(void); 59 | void EP7_OUT_Callback(void); 60 | 61 | #ifdef CTR_CALLBACK 62 | void CTR_Callback(void); 63 | #endif 64 | 65 | #ifdef DOVR_CALLBACK 66 | void DOVR_Callback(void); 67 | #endif 68 | 69 | #ifdef ERR_CALLBACK 70 | void ERR_Callback(void); 71 | #endif 72 | 73 | #ifdef WKUP_CALLBACK 74 | void WKUP_Callback(void); 75 | #endif 76 | 77 | #ifdef SUSP_CALLBACK 78 | void SUSP_Callback(void); 79 | #endif 80 | 81 | #ifdef RESET_CALLBACK 82 | void RESET_Callback(void); 83 | #endif 84 | 85 | #ifdef SOF_CALLBACK 86 | void SOF_Callback(void); 87 | #endif 88 | 89 | #ifdef ESOF_CALLBACK 90 | void ESOF_Callback(void); 91 | #endif 92 | 93 | #endif /*__USB_ISTR_H*/ 94 | 95 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 96 | -------------------------------------------------------------------------------- /Component/USB/LIB/inc/usb_prop.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usb_prop.h 4 | * @author MCD Application Team 5 | * @version V4.0.0 6 | * @date 21-January-2013 7 | * @brief All processing related to Mass Storage Demo (Endpoint 0) 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2013 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | 29 | /* Define to prevent recursive inclusion -------------------------------------*/ 30 | #ifndef __USB_PROP_H 31 | #define __USB_PROP_H 32 | 33 | /* Includes ------------------------------------------------------------------*/ 34 | /* Exported types ------------------------------------------------------------*/ 35 | 36 | /* Exported constants --------------------------------------------------------*/ 37 | #define Mass_Storage_GetConfiguration NOP_Process 38 | /* #define Mass_Storage_SetConfiguration NOP_Process*/ 39 | #define Mass_Storage_GetInterface NOP_Process 40 | #define Mass_Storage_SetInterface NOP_Process 41 | #define Mass_Storage_GetStatus NOP_Process 42 | /* #define Mass_Storage_ClearFeature NOP_Process*/ 43 | #define Mass_Storage_SetEndPointFeature NOP_Process 44 | #define Mass_Storage_SetDeviceFeature NOP_Process 45 | /*#define Mass_Storage_SetDeviceAddress NOP_Process*/ 46 | 47 | /* MASS Storage Requests*/ 48 | #define GET_MAX_LUN 0xFE 49 | #define MASS_STORAGE_RESET 0xFF 50 | #define LUN_DATA_LENGTH 1 51 | #define ENDP2_RXADDR (0xD8) 52 | /* Exported macro ------------------------------------------------------------*/ 53 | /* Exported functions ------------------------------------------------------- */ 54 | void MASS_init(void); 55 | void MASS_Reset(void); 56 | void Mass_Storage_SetConfiguration(void); 57 | void Mass_Storage_ClearFeature(void); 58 | void Mass_Storage_SetDeviceAddress (void); 59 | void MASS_Status_In (void); 60 | void MASS_Status_Out (void); 61 | RESULT MASS_Data_Setup(uint8_t); 62 | RESULT MASS_NoData_Setup(uint8_t); 63 | RESULT MASS_Get_Interface_Setting(uint8_t Interface, uint8_t AlternateSetting); 64 | uint8_t *MASS_GetDeviceDescriptor(uint16_t ); 65 | uint8_t *MASS_GetConfigDescriptor(uint16_t); 66 | uint8_t *MASS_GetStringDescriptor(uint16_t); 67 | uint8_t *Get_Max_Lun(uint16_t Length); 68 | 69 | 70 | #endif /* __USB_PROP_H */ 71 | 72 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 73 | -------------------------------------------------------------------------------- /Component/USB/LIB/inc/usb_pwr.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usb_pwr.h 4 | * @author MCD Application Team 5 | * @version V4.0.0 6 | * @date 21-January-2013 7 | * @brief Connection/disconnection & power management header 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2013 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | /* Define to prevent recursive inclusion -------------------------------------*/ 29 | #ifndef __USB_PWR_H 30 | #define __USB_PWR_H 31 | /* Includes ------------------------------------------------------------------*/ 32 | #include "usb_core.h" 33 | #include "usb_type.h" 34 | 35 | 36 | /* Exported types ------------------------------------------------------------*/ 37 | typedef enum _RESUME_STATE 38 | { 39 | RESUME_EXTERNAL, 40 | RESUME_INTERNAL, 41 | RESUME_LATER, 42 | RESUME_WAIT, 43 | RESUME_START, 44 | RESUME_ON, 45 | RESUME_OFF, 46 | RESUME_ESOF 47 | } RESUME_STATE; 48 | 49 | typedef enum _DEVICE_STATE 50 | { 51 | UNCONNECTED, 52 | ATTACHED, 53 | POWERED, 54 | SUSPENDED, 55 | ADDRESSED, 56 | CONFIGURED 57 | } DEVICE_STATE; 58 | 59 | /* Exported constants --------------------------------------------------------*/ 60 | /* Exported macro ------------------------------------------------------------*/ 61 | /* Exported functions ------------------------------------------------------- */ 62 | void Suspend(void); 63 | void Resume_Init(void); 64 | void Resume(RESUME_STATE eResumeSetVal); 65 | RESULT PowerOn(void); 66 | RESULT PowerOff(void); 67 | 68 | /* External variables --------------------------------------------------------*/ 69 | extern __IO uint32_t bDeviceState; /* USB device status */ 70 | extern __IO bool fSuspendEnabled; /* true when suspend is possible */ 71 | 72 | #endif /*__USB_PWR_H*/ 73 | 74 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 75 | -------------------------------------------------------------------------------- /Component/USB/LIB/src/usb_endp.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usb_endp.c 4 | * @author MCD Application Team 5 | * @version V4.0.0 6 | * @date 21-January-2013 7 | * @brief Endpoint routines 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2013 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | 29 | /* Includes ------------------------------------------------------------------*/ 30 | #include "usb_lib.h" 31 | #include "usb_bot.h" 32 | #include "usb_istr.h" 33 | 34 | /* Private typedef -----------------------------------------------------------*/ 35 | /* Private define ------------------------------------------------------------*/ 36 | /* Private macro -------------------------------------------------------------*/ 37 | /* Private variables ---------------------------------------------------------*/ 38 | /* Private function prototypes -----------------------------------------------*/ 39 | /* Private functions ---------------------------------------------------------*/ 40 | 41 | /******************************************************************************* 42 | * Function Name : EP1_IN_Callback 43 | * Description : EP1 IN Callback Routine 44 | * Input : None. 45 | * Output : None. 46 | * Return : None. 47 | *******************************************************************************/ 48 | void EP1_IN_Callback(void) 49 | { 50 | Mass_Storage_In(); 51 | } 52 | 53 | /******************************************************************************* 54 | * Function Name : EP2_OUT_Callback. 55 | * Description : EP2 OUT Callback Routine. 56 | * Input : None. 57 | * Output : None. 58 | * Return : None. 59 | *******************************************************************************/ 60 | void EP2_OUT_Callback(void) 61 | { 62 | Mass_Storage_Out(); 63 | } 64 | 65 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 66 | 67 | -------------------------------------------------------------------------------- /Component/USB/UsbApp/UsbApp.c: -------------------------------------------------------------------------------- 1 | 2 | #include "stm32f10x.h" 3 | #include "stdio.h" 4 | #include "hw_config.h" 5 | #include "usb_lib.h" 6 | #include "usb_pwr.h" 7 | #include "GlobalDef.h" 8 | 9 | extern uint16_t MAL_Init (uint8_t lun); 10 | 11 | #if 0 12 | typedef void (*pFunction)(void); 13 | #define ApplicationAddress 0x08008800 14 | uint32_t JumpAddress; 15 | pFunction Jump_To_Application; 16 | #endif 17 | 18 | void USB_BspGpioInit(void) 19 | { 20 | GPIO_InitTypeDef GPIO_InitStructure; 21 | RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE); 22 | GPIO_InitStructure.GPIO_Pin = GPIO_Pin_11 | GPIO_Pin_12; 23 | GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; 24 | GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP; 25 | GPIO_Init(GPIOA, &GPIO_InitStructure); 26 | 27 | //GPIO_ResetBits(GPIOA, GPIO_Pin_12); 28 | 29 | //GPIO_InitStructure.GPIO_Pin = GPIO_Pin_8; 30 | //GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPU; 31 | //GPIO_Init(GPIOA, &GPIO_InitStructure); 32 | } 33 | 34 | 35 | 36 | #define DELAY_TIME 0x7ffffful 37 | 38 | void usb_main(void) 39 | { 40 | //SysClockConfig(); 41 | //RCC_PeriphInit(); 42 | 43 | //USB_BspGpioInit(); 44 | uint32_t count = 0; 45 | 46 | 47 | USBSet_System(); 48 | USBSet_USBClock(); 49 | USB_Interrupts_Config(); 50 | USB_Init(); 51 | 52 | 53 | while ((bDeviceState != CONFIGURED) && (count++ <= DELAY_TIME)); 54 | 55 | os_printf("USB config sta = %d\r\n", bDeviceState); 56 | 57 | //关闭USB 接收和发送中断 58 | //NVIC_DisableIRQ(USB_LP_CAN1_RX0_IRQn); 59 | //NVIC_DisableIRQ(USB_HP_CAN1_TX_IRQn); 60 | 61 | #if 0 62 | __set_PRIMASK(1); 63 | if(((*(__IO uint32_t *) ApplicationAddress) & 0x2FFE0000) == 0x20000000) 64 | { 65 | JumpAddress = *(__IO uint32_t *) (ApplicationAddress + 4); 66 | Jump_To_Application = (pFunction) JumpAddress; 67 | 68 | __set_MSP(*(__IO uint32_t *) ApplicationAddress); 69 | Jump_To_Application(); 70 | } 71 | #endif 72 | 73 | } 74 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /Component/USB/UsbApp/UsbApp.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef __USB_APP_H__ 3 | #define __USB_APP_H__ 4 | 5 | 6 | 7 | 8 | void usb_main(void); 9 | 10 | #endif 11 | 12 | -------------------------------------------------------------------------------- /Component/USB/Usb_LIB/inc/usb_def.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usb_def.h 4 | * @author MCD Application Team 5 | * @version V4.0.0 6 | * @date 28-August-2012 7 | * @brief Definitions related to USB Core 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2012 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | /* Define to prevent recursive inclusion -------------------------------------*/ 29 | #ifndef __USB_DEF_H 30 | #define __USB_DEF_H 31 | 32 | /* Includes ------------------------------------------------------------------*/ 33 | /* Exported types ------------------------------------------------------------*/ 34 | typedef enum _RECIPIENT_TYPE 35 | { 36 | DEVICE_RECIPIENT, /* Recipient device */ 37 | INTERFACE_RECIPIENT, /* Recipient interface */ 38 | ENDPOINT_RECIPIENT, /* Recipient endpoint */ 39 | OTHER_RECIPIENT 40 | } RECIPIENT_TYPE; 41 | 42 | 43 | typedef enum _STANDARD_REQUESTS 44 | { 45 | GET_STATUS = 0, 46 | CLEAR_FEATURE, 47 | RESERVED1, 48 | SET_FEATURE, 49 | RESERVED2, 50 | SET_ADDRESS, 51 | GET_DESCRIPTOR, 52 | SET_DESCRIPTOR, 53 | GET_CONFIGURATION, 54 | SET_CONFIGURATION, 55 | GET_INTERFACE, 56 | SET_INTERFACE, 57 | TOTAL_sREQUEST, /* Total number of Standard request */ 58 | SYNCH_FRAME = 12 59 | } STANDARD_REQUESTS; 60 | 61 | /* Definition of "USBwValue" */ 62 | typedef enum _DESCRIPTOR_TYPE 63 | { 64 | DEVICE_DESCRIPTOR = 1, 65 | CONFIG_DESCRIPTOR, 66 | STRING_DESCRIPTOR, 67 | INTERFACE_DESCRIPTOR, 68 | ENDPOINT_DESCRIPTOR 69 | } DESCRIPTOR_TYPE; 70 | 71 | /* Feature selector of a SET_FEATURE or CLEAR_FEATURE */ 72 | typedef enum _FEATURE_SELECTOR 73 | { 74 | ENDPOINT_STALL, 75 | DEVICE_REMOTE_WAKEUP 76 | } FEATURE_SELECTOR; 77 | 78 | /* Exported constants --------------------------------------------------------*/ 79 | /* Definition of "USBbmRequestType" */ 80 | #define REQUEST_TYPE 0x60 /* Mask to get request type */ 81 | #define STANDARD_REQUEST 0x00 /* Standard request */ 82 | #define CLASS_REQUEST 0x20 /* Class request */ 83 | #define VENDOR_REQUEST 0x40 /* Vendor request */ 84 | 85 | #define RECIPIENT 0x1F /* Mask to get recipient */ 86 | 87 | /* Exported macro ------------------------------------------------------------*/ 88 | /* Exported functions ------------------------------------------------------- */ 89 | 90 | #endif /* __USB_DEF_H */ 91 | 92 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 93 | -------------------------------------------------------------------------------- /Component/USB/Usb_LIB/inc/usb_init.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usb_init.h 4 | * @author MCD Application Team 5 | * @version V4.0.0 6 | * @date 28-August-2012 7 | * @brief Initialization routines & global variables 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2012 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | 29 | /* Define to prevent recursive inclusion -------------------------------------*/ 30 | #ifndef __USB_INIT_H 31 | #define __USB_INIT_H 32 | #include 33 | 34 | /* Includes ------------------------------------------------------------------*/ 35 | /* Exported types ------------------------------------------------------------*/ 36 | /* Exported constants --------------------------------------------------------*/ 37 | /* Exported macro ------------------------------------------------------------*/ 38 | /* Exported functions ------------------------------------------------------- */ 39 | void USB_Init(void); 40 | 41 | /* External variables --------------------------------------------------------*/ 42 | /* The number of current endpoint, it will be used to specify an endpoint */ 43 | extern uint8_t EPindex; 44 | /* The number of current device, it is an index to the Device_Table */ 45 | /*extern uint8_t Device_no; */ 46 | /* Points to the DEVICE_INFO structure of current device */ 47 | /* The purpose of this register is to speed up the execution */ 48 | extern DEVICE_INFO* pInformation; 49 | /* Points to the DEVICE_PROP structure of current device */ 50 | /* The purpose of this register is to speed up the execution */ 51 | extern DEVICE_PROP* pProperty; 52 | /* Temporary save the state of Rx & Tx status. */ 53 | /* Whenever the Rx or Tx state is changed, its value is saved */ 54 | /* in this variable first and will be set to the EPRB or EPRA */ 55 | /* at the end of interrupt process */ 56 | extern USER_STANDARD_REQUESTS *pUser_Standard_Requests; 57 | 58 | extern uint16_t SaveState ; 59 | extern uint16_t wInterrupt_Mask; 60 | 61 | #endif /* __USB_INIT_H */ 62 | 63 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 64 | -------------------------------------------------------------------------------- /Component/USB/Usb_LIB/inc/usb_int.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usb_int.h 4 | * @author MCD Application Team 5 | * @version V4.0.0 6 | * @date 28-August-2012 7 | * @brief Endpoint CTR (Low and High) interrupt's service routines prototypes 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2012 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | 29 | /* Define to prevent recursive inclusion -------------------------------------*/ 30 | #ifndef __USB_INT_H 31 | #define __USB_INT_H 32 | #include 33 | 34 | /* Includes ------------------------------------------------------------------*/ 35 | /* Exported types ------------------------------------------------------------*/ 36 | /* Exported constants --------------------------------------------------------*/ 37 | /* Exported macro ------------------------------------------------------------*/ 38 | /* Exported functions ------------------------------------------------------- */ 39 | void CTR_LP(void); 40 | void CTR_HP(void); 41 | 42 | /* External variables --------------------------------------------------------*/ 43 | 44 | #endif /* __USB_INT_H */ 45 | 46 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 47 | -------------------------------------------------------------------------------- /Component/USB/Usb_LIB/inc/usb_lib.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usb_lib.h 4 | * @author MCD Application Team 5 | * @version V4.0.0 6 | * @date 28-August-2012 7 | * @brief USB library include files 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2012 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | 29 | /* Define to prevent recursive inclusion -------------------------------------*/ 30 | #ifndef __USB_LIB_H 31 | #define __USB_LIB_H 32 | 33 | /* Includes ------------------------------------------------------------------*/ 34 | #include "hw_config.h" 35 | #include "usb_type.h" 36 | #include "usb_regs.h" 37 | #include "usb_def.h" 38 | #include "usb_core.h" 39 | #include "usb_init.h" 40 | #include "usb_sil.h" 41 | #include "usb_mem.h" 42 | #include "usb_int.h" 43 | 44 | /* Exported types ------------------------------------------------------------*/ 45 | /* Exported constants --------------------------------------------------------*/ 46 | /* Exported macro ------------------------------------------------------------*/ 47 | /* Exported functions ------------------------------------------------------- */ 48 | /* External variables --------------------------------------------------------*/ 49 | 50 | #endif /* __USB_LIB_H */ 51 | 52 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 53 | -------------------------------------------------------------------------------- /Component/USB/Usb_LIB/inc/usb_mem.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usb_mem.h 4 | * @author MCD Application Team 5 | * @version V4.0.0 6 | * @date 28-August-2012 7 | * @brief Utility prototypes functions for memory/PMA transfers 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2012 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | 29 | /* Define to prevent recursive inclusion -------------------------------------*/ 30 | #ifndef __USB_MEM_H 31 | #define __USB_MEM_H 32 | #include 33 | 34 | /* Includes ------------------------------------------------------------------*/ 35 | /* Exported types ------------------------------------------------------------*/ 36 | /* Exported constants --------------------------------------------------------*/ 37 | /* Exported macro ------------------------------------------------------------*/ 38 | /* Exported functions ------------------------------------------------------- */ 39 | void UserToPMABufferCopy(uint8_t *pbUsrBuf, uint16_t wPMABufAddr, uint16_t wNBytes); 40 | void PMAToUserBufferCopy(uint8_t *pbUsrBuf, uint16_t wPMABufAddr, uint16_t wNBytes); 41 | 42 | /* External variables --------------------------------------------------------*/ 43 | 44 | #endif /*__USB_MEM_H*/ 45 | 46 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 47 | -------------------------------------------------------------------------------- /Component/USB/Usb_LIB/inc/usb_sil.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usb_sil.h 4 | * @author MCD Application Team 5 | * @version V4.0.0 6 | * @date 28-August-2012 7 | * @brief Simplified Interface Layer function prototypes. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2012 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | 29 | /* Define to prevent recursive inclusion -------------------------------------*/ 30 | #ifndef __USB_SIL_H 31 | #define __USB_SIL_H 32 | #include 33 | 34 | /* Includes ------------------------------------------------------------------*/ 35 | /* Exported types ------------------------------------------------------------*/ 36 | /* Exported constants --------------------------------------------------------*/ 37 | /* Exported macro ------------------------------------------------------------*/ 38 | /* Exported functions ------------------------------------------------------- */ 39 | 40 | uint32_t USB_SIL_Init(void); 41 | uint32_t USB_SIL_Write(uint8_t bEpAddr, uint8_t* pBufferPointer, uint32_t wBufferSize); 42 | uint32_t USB_SIL_Read(uint8_t bEpAddr, uint8_t* pBufferPointer); 43 | 44 | /* External variables --------------------------------------------------------*/ 45 | 46 | #endif /* __USB_SIL_H */ 47 | 48 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 49 | -------------------------------------------------------------------------------- /Component/USB/Usb_LIB/inc/usb_type.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usb_type.h 4 | * @author MCD Application Team 5 | * @version V4.0.0 6 | * @date 28-August-2012 7 | * @brief Type definitions used by the USB Library 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2012 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | 29 | /* Define to prevent recursive inclusion -------------------------------------*/ 30 | #ifndef __USB_TYPE_H 31 | #define __USB_TYPE_H 32 | 33 | /* Includes ------------------------------------------------------------------*/ 34 | #include "usb_conf.h" 35 | 36 | /* Exported types ------------------------------------------------------------*/ 37 | /* Exported constants --------------------------------------------------------*/ 38 | #ifndef NULL 39 | #define NULL ((void *)0) 40 | #endif 41 | #include 42 | 43 | typedef enum 44 | { 45 | FALSE = 0, TRUE = !FALSE 46 | } 47 | bool; 48 | 49 | /* Exported macro ------------------------------------------------------------*/ 50 | /* Exported functions ------------------------------------------------------- */ 51 | /* External variables --------------------------------------------------------*/ 52 | 53 | #endif /* __USB_TYPE_H */ 54 | 55 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 56 | -------------------------------------------------------------------------------- /Component/USB/Usb_LIB/src/usb_init.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usb_init.c 4 | * @author MCD Application Team 5 | * @version V4.0.0 6 | * @date 28-August-2012 7 | * @brief Initialization routines & global variables 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2012 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | 29 | /* Includes ------------------------------------------------------------------*/ 30 | #include "usb_lib.h" 31 | 32 | /* Private typedef -----------------------------------------------------------*/ 33 | /* Private define ------------------------------------------------------------*/ 34 | /* Private macro -------------------------------------------------------------*/ 35 | /* Private variables ---------------------------------------------------------*/ 36 | /* The number of current endpoint, it will be used to specify an endpoint */ 37 | uint8_t EPindex; 38 | /* The number of current device, it is an index to the Device_Table */ 39 | /* uint8_t Device_no; */ 40 | /* Points to the DEVICE_INFO structure of current device */ 41 | /* The purpose of this register is to speed up the execution */ 42 | DEVICE_INFO *pInformation; 43 | /* Points to the DEVICE_PROP structure of current device */ 44 | /* The purpose of this register is to speed up the execution */ 45 | DEVICE_PROP *pProperty; 46 | /* Temporary save the state of Rx & Tx status. */ 47 | /* Whenever the Rx or Tx state is changed, its value is saved */ 48 | /* in this variable first and will be set to the EPRB or EPRA */ 49 | /* at the end of interrupt process */ 50 | uint16_t SaveState ; 51 | uint16_t wInterrupt_Mask; 52 | DEVICE_INFO Device_Info; 53 | USER_STANDARD_REQUESTS *pUser_Standard_Requests; 54 | 55 | /* Extern variables ----------------------------------------------------------*/ 56 | /* Private function prototypes -----------------------------------------------*/ 57 | /* Private functions ---------------------------------------------------------*/ 58 | 59 | /******************************************************************************* 60 | * Function Name : USB_Init 61 | * Description : USB system initialization 62 | * Input : None. 63 | * Output : None. 64 | * Return : None. 65 | *******************************************************************************/ 66 | void USB_Init(void) 67 | { 68 | pInformation = &Device_Info; 69 | pInformation->ControlState = 2; 70 | pProperty = &Device_Property; 71 | pUser_Standard_Requests = &User_Standard_Requests; 72 | /* Initialize devices one by one */ 73 | pProperty->Init(); 74 | } 75 | 76 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 77 | -------------------------------------------------------------------------------- /Dev/BSP/board_AirDog_V10.c: -------------------------------------------------------------------------------- 1 | 2 | #include "board_version.h" 3 | #include "os_timer.h" 4 | 5 | 6 | 7 | static void PowerIO_Ctrl(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pinx, E_SW_STATE sta) 8 | { 9 | GPIO_InitTypeDef GPIO_InitStructure; 10 | 11 | GPIO_InitStructure.GPIO_Pin = GPIO_Pinx; 12 | GPIO_InitStructure.GPIO_Speed = GPIO_Speed_10MHz; 13 | 14 | if(SW_OPEN == sta) 15 | { 16 | GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; 17 | STM32_GPIO_Init(GPIOx, &GPIO_InitStructure); 18 | GPIOx->BRR = GPIO_Pinx; // 低电平导通 19 | } 20 | else // 关闭: 输出高电平 21 | { 22 | GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING; 23 | STM32_GPIO_Init(GPIOx, &GPIO_InitStructure); 24 | } 25 | } 26 | 27 | void SNS_Ctrl_Set(E_SW_STATE sta) 28 | { 29 | PowerIO_Ctrl(SNS_Power_Ctrl_PORT, SNS_Power_Ctrl_Pin, sta); 30 | } 31 | 32 | 33 | 34 | void LCD_Ctrl_Set(E_SW_STATE sta) 35 | { 36 | PowerIO_Ctrl(LCD_Power_Ctrl_PORT, LCD_Power_Ctrl_Pin, sta); 37 | } 38 | 39 | 40 | #include "delay.h" 41 | // 设置数据口为输入或输出 42 | // 板级管脚初始化 43 | void Board_GpioInit(void) 44 | { 45 | GPIO_InitTypeDef GPIO_InitStructure; 46 | 47 | // 时钟使能 48 | STM32_RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA | RCC_APB2Periph_GPIOB | RCC_APB2Periph_GPIOC, ENABLE); 49 | 50 | 51 | 52 | #if 1 53 | // PWR_SW, 3.3V稳压器开关 54 | //GPIO_InitStructure.GPIO_Pin = PWR_SW_Pin; 55 | //STM32_GPIO_Init(PWR_SW_PORT, &GPIO_InitStructure); 56 | //PWR_SW_Open(); // 打开电源 57 | 58 | 59 | 60 | // SENSOR_Power Ctrl 61 | SNS_Ctrl_Set(SW_OPEN); 62 | 63 | 64 | 65 | 66 | // WIFI Power Ctrl 67 | GPIO_InitStructure.GPIO_Pin = WIFI_Power_Ctrl_Pin; 68 | GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; 69 | GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPD; 70 | STM32_GPIO_Init(WIFI_Power_Ctrl_PORT, &GPIO_InitStructure); 71 | WIFI_Power_Ctrl_Close(); 72 | 73 | 74 | 75 | // LCD_Power, 屏幕电源开关 76 | LCD_Ctrl_Set(SW_OPEN); 77 | 78 | // BEEP IO 管脚初始化 79 | GPIO_InitStructure.GPIO_Pin = BEEP_IO_Pin; 80 | GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; 81 | GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; 82 | STM32_GPIO_Init(BEEP_IO_PORT, &GPIO_InitStructure); 83 | BEEP_IO_Open(); 84 | 85 | // 按键管脚初始化 86 | //GPIO_InitStructure.GPIO_Pin = KEY0_GPIO_Pin; 87 | //GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPU; // 上拉输入 88 | //STM32_GPIO_Init(KEY0_PORT, &GPIO_InitStructure); 89 | 90 | //GPIO_InitStructure.GPIO_Pin = KEY1_GPIO_Pin; 91 | //STM32_GPIO_Init(KEY1_PORT, &GPIO_InitStructure); 92 | #endif 93 | } 94 | 95 | 96 | void BEEP(uint16_t freq) 97 | { 98 | u32 i; 99 | for(i = 0; i < freq; i++) 100 | { 101 | BEEP_IO_Close(); 102 | delay_ms(100); 103 | BEEP_IO_Open(); 104 | delay_ms(100); 105 | } 106 | 107 | } 108 | 109 | 110 | 111 | -------------------------------------------------------------------------------- /Dev/BSP/board_AirDog_V11.c: -------------------------------------------------------------------------------- 1 | 2 | #include "board_version.h" 3 | #include "os_timer.h" 4 | 5 | 6 | 7 | static void PowerIO_Ctrl(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pinx, E_SW_STATE sta) 8 | { 9 | GPIO_InitTypeDef GPIO_InitStructure; 10 | 11 | GPIO_InitStructure.GPIO_Pin = GPIO_Pinx; 12 | GPIO_InitStructure.GPIO_Speed = GPIO_Speed_10MHz; 13 | 14 | if(SW_OPEN == sta) 15 | { 16 | GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; 17 | STM32_GPIO_Init(GPIOx, &GPIO_InitStructure); 18 | GPIOx->BRR = GPIO_Pinx; // 低电平导通 19 | } 20 | else // 关闭: 输出高电平 21 | { 22 | GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING; 23 | STM32_GPIO_Init(GPIOx, &GPIO_InitStructure); 24 | } 25 | } 26 | 27 | void SNS_Ctrl_Set(E_SW_STATE sta) 28 | { 29 | PowerIO_Ctrl(SNS_Power_Ctrl_PORT, SNS_Power_Ctrl_Pin, sta); 30 | } 31 | 32 | 33 | 34 | void LCD_Ctrl_Set(E_SW_STATE sta) 35 | { 36 | PowerIO_Ctrl(LCD_Power_Ctrl_PORT, LCD_Power_Ctrl_Pin, sta); 37 | } 38 | void LCD_BackLight_Ctrl_Set(E_SW_STATE sta) 39 | { 40 | PowerIO_Ctrl(LCD_BackLight_Ctrl_PORT, LCD_BackLight_Ctrl_Pin , sta); 41 | } 42 | 43 | void TFT_Ctrl(E_SW_STATE sta) 44 | { 45 | LCD_Ctrl_Set(sta); 46 | LCD_BackLight_Ctrl_Set(sta); 47 | } 48 | 49 | #include "delay.h" 50 | // 设置数据口为输入或输出 51 | // 板级管脚初始化 52 | void Board_GpioInit(void) 53 | { 54 | GPIO_InitTypeDef GPIO_InitStructure; 55 | 56 | // 时钟使能 57 | STM32_RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA | RCC_APB2Periph_GPIOB | RCC_APB2Periph_GPIOC, ENABLE); 58 | 59 | 60 | 61 | #if 1 62 | // PWR_SW, 3.3V稳压器开关 63 | //GPIO_InitStructure.GPIO_Pin = PWR_SW_Pin; 64 | //STM32_GPIO_Init(PWR_SW_PORT, &GPIO_InitStructure); 65 | //PWR_SW_Open(); // 打开电源 66 | 67 | 68 | 69 | // SENSOR_Power Ctrl 70 | SNS_Ctrl_Set(SW_OPEN); 71 | 72 | 73 | 74 | 75 | // WIFI Power Ctrl 76 | GPIO_InitStructure.GPIO_Pin = WIFI_Power_Ctrl_Pin; 77 | GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; 78 | GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPD; 79 | STM32_GPIO_Init(WIFI_Power_Ctrl_PORT, &GPIO_InitStructure); 80 | WIFI_Power_Ctrl_Close(); 81 | 82 | 83 | 84 | // LCD_Power, 屏幕电源开关 85 | LCD_Ctrl_Set(SW_OPEN); 86 | // 屏幕背光 87 | LCD_BackLight_Ctrl_Set(SW_OPEN); 88 | 89 | // BEEP IO 管脚初始化 90 | GPIO_InitStructure.GPIO_Pin = BEEP_IO_Pin; 91 | GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; 92 | GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; 93 | STM32_GPIO_Init(BEEP_IO_PORT, &GPIO_InitStructure); 94 | BEEP_IO_Close(); 95 | 96 | // 按键管脚初始化 97 | //GPIO_InitStructure.GPIO_Pin = KEY0_GPIO_Pin; 98 | //GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPU; // 上拉输入 99 | //STM32_GPIO_Init(KEY0_PORT, &GPIO_InitStructure); 100 | 101 | //GPIO_InitStructure.GPIO_Pin = KEY1_GPIO_Pin; 102 | //STM32_GPIO_Init(KEY1_PORT, &GPIO_InitStructure); 103 | #endif 104 | 105 | 106 | GPIO_InitStructure.GPIO_Pin = VIN_DETECT_Pin; 107 | GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING; 108 | STM32_GPIO_Init(VIN_DETECT_PORT, &GPIO_InitStructure); 109 | os_printf("vin read = %d \r\n", VIN_DETECT_Read()); 110 | 111 | GPIO_InitStructure.GPIO_Pin = CHG_STAT_Pin; 112 | GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPU; 113 | STM32_GPIO_Init(CHG_STAT_PORT, &GPIO_InitStructure); 114 | } 115 | 116 | 117 | void BEEP(uint16_t freq) 118 | { 119 | u32 i; 120 | for(i = 0; i < freq; i++) 121 | { 122 | BEEP_IO_Close(); 123 | delay_ms(100); 124 | BEEP_IO_Open(); 125 | delay_ms(100); 126 | } 127 | 128 | } 129 | 130 | 131 | 132 | -------------------------------------------------------------------------------- /Dev/BSP/board_V1_2_3.c: -------------------------------------------------------------------------------- 1 | 2 | #include "board_V1_2_3.h" 3 | #include "os_timer.h" 4 | #include "delay.h" 5 | #include "RegLib.h" 6 | 7 | 8 | 9 | 10 | 11 | 12 | // 设置数据口为输入或输出 13 | // 板级管脚初始化 14 | void Board_GpioInit(void) 15 | { 16 | GPIO_InitTypeDef GPIO_InitStructure; 17 | 18 | // 时钟使能 19 | STM32_RCC_APB2PeriphClockCmd( RCC_APB2Periph_GPIOA | RCC_APB2Periph_GPIOB 20 | | RCC_APB2Periph_GPIOC |RCC_APB2Periph_GPIOD , ENABLE); 21 | 22 | 23 | 24 | GPIO_InitStructure.GPIO_Pin = LED1_Pin; 25 | GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; 26 | GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; 27 | STM32_GPIO_Init(LED1_PORT, &GPIO_InitStructure); 28 | 29 | GPIO_InitStructure.GPIO_Pin = LED0_Pin; 30 | STM32_GPIO_Init(LED0_PORT, &GPIO_InitStructure); 31 | 32 | LED0(0); 33 | LED1(0); 34 | 35 | 36 | 37 | } 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /Dev/BSP/board_V1_2_3.h: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | #ifndef __BOARD_V1_2_3_H__ 5 | #define __BOARD_V1_2_3_H__ 6 | 7 | 8 | 9 | #include "stm32f10x.h" 10 | #include "reglib.h" 11 | #include "GlobalDef.h" 12 | 13 | // LED0 -> PA8 14 | #define LED0_Pin GPIO_Pin_8 15 | #define LED0_PORT GPIOA 16 | #define LED0_H() (LED0_PORT->BSRR = LED0_Pin) 17 | #define LED0_L() (LED0_PORT->BRR = LED0_Pin) 18 | #define LED0(v) (v ? LED0_H() : LED0_L() ) 19 | #define LED0_Read() IO_READ_OUT(LED0_PORT, LED0_Pin) 20 | 21 | 22 | // LED1 -> PD2 23 | #define LED1_Pin GPIO_Pin_2 24 | #define LED1_PORT GPIOD 25 | #define LED1_H() (LED1_PORT->BSRR = LED1_Pin) 26 | #define LED1_L() (LED1_PORT->BRR = LED1_Pin) 27 | #define LED1(v) (v ? LED1_H() : LED1_L() ) 28 | #define LED1_Read() IO_READ_OUT(LED1_PORT, LED1_Pin) 29 | 30 | 31 | 32 | // KEY0 -> PC1 33 | #define KEY0_GPIO_Pin GPIO_Pin_1 34 | #define KEY0_PORT GPIOC 35 | #define KEY0_READ() IO_READ_IN(KEY0_PORT, KEY0_GPIO_Pin) 36 | 37 | // KEY1 -> PC13 38 | #define KEY1_GPIO_Pin GPIO_Pin_13 39 | #define KEY1_PORT GPIOC 40 | #define KEY1_READ() IO_READ_IN(KEY1_PORT, KEY1_GPIO_Pin) 41 | 42 | 43 | void Board_GpioInit(void); 44 | 45 | 46 | 47 | 48 | #endif 49 | 50 | -------------------------------------------------------------------------------- /Dev/Driver/inc/ADC_Drv.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef __ADC_DRV_H__ 3 | #define __ADC_DRV_H__ 4 | 5 | 6 | #include "GlobalDef.h" 7 | 8 | 9 | 10 | void ADCDrv_DMALaunch(void); 11 | void ADCDrv_SilentInit(void); 12 | void ADCDrv_NormalLaunch(void); 13 | void ADCDrv_DrawBatCapacity(uint8_t reflush); 14 | void ADCDrv_TrigBatMeasure(void); 15 | uint16_t ADCDrv_GetFirstCoreTemp(void); 16 | uint16_t ADCDrv_GetCurCoreTemp(void); 17 | 18 | #endif 19 | 20 | -------------------------------------------------------------------------------- /Dev/Driver/inc/BatteryLevel.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef __BATTERY_LEVEL_H__ 3 | #define __BATTERY_LEVEL_H__ 4 | 5 | #include "GlobalDef.h" 6 | 7 | 8 | 9 | uint8_t BatLev_GetPercent(void); 10 | void BatLev_VoltToPercent(uint16_t bat_volt); 11 | uint8_t BatteryIsCharging(void); 12 | 13 | #endif 14 | 15 | -------------------------------------------------------------------------------- /Dev/Driver/inc/ExtiDrv.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef __EXTI_DRV_H__ 3 | #define __EXTI_DRV_H__ 4 | 5 | #include "GlobalDef.h" 6 | 7 | #define USB_PLUGED_MASK 0xF0 8 | #define USB_CHARG_MASK 0x0F 9 | 10 | 11 | extern uint8_t battery_is_charging; 12 | 13 | void ExtiDrv_Init(void); 14 | extern uint8_t App_GetRunMode(void); 15 | void PowerOffDectect_Init(void); 16 | 17 | #endif 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /Dev/Driver/inc/F10X_Flash_If.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef __F10X_FLASH_IF_H__ 3 | #define __F10X_FLASH_IF_H__ 4 | 5 | #include "GlobalDef.h" 6 | 7 | #if defined (STM32F10X_MD) || defined (STM32F10X_MD_VL) 8 | #define PAGE_SIZE (0x400) /* 1 Kbyte */ 9 | #define FLASH_SIZE (0x20000) /* 128 KBytes */ 10 | #elif defined STM32F10X_CL 11 | #define PAGE_SIZE (0x800) /* 2 Kbytes */ 12 | #define FLASH_SIZE (0x40000) /* 256 KBytes */ 13 | #elif defined STM32F10X_HD || defined (STM32F10X_HD_VL) 14 | #define PAGE_SIZE (0x800) /* 2 Kbytes */ 15 | #define FLASH_SIZE (0x80000) /* 512 KBytes */ 16 | #elif defined STM32F10X_XL 17 | #define PAGE_SIZE (0x800) /* 2 Kbytes */ 18 | #define FLASH_SIZE (0x100000) /* 1 MByte */ 19 | #else 20 | #error "Please select first the STM32 device to be used (in stm32f10x.h)" 21 | #endif 22 | 23 | 24 | 25 | #pragma pack(1) 26 | // 存储在FLASH 的升级相关的属性 27 | typedef struct 28 | { 29 | uint8_t fileName[64]; // 是否升级 30 | uint32_t fileVersion; // 版本号 31 | uint32_t fileLen; // 文件大小, unit: Byte 32 | uint32_t fileSum; // 文件校验和 33 | T_RTC_TIME time; // 烧写时间 34 | uint32_t upgrade; // 是否升级 35 | uint32_t upgrade_inverse; // 是否升级的反码 36 | uint32_t checkSum; // 对以上数据的和校验 37 | uint32_t checkSumInverse; // 校验和的反码 38 | }T_APP_FLASH_ATTR; 39 | 40 | // 存储在SPI FLASH 的系统环境变量 41 | typedef struct 42 | { 43 | uint8_t is_hcho_cal; // 甲醛是否已校正 44 | uint8_t hold; // 是否保持显示 45 | uint8_t reserved[2]; 46 | uint16_t cali_ppb; 47 | uint16_t cali_mass; 48 | uint32_t checkSum; // 对以上数据的校验和 49 | uint32_t checkSumInverse; // 校验和的反码 50 | }T_SYS_ENV; 51 | #pragma pack() 52 | 53 | 54 | #define FLASH_SUCCESS 0 55 | #define FLASH_FAILED 1 56 | 57 | 58 | void F10X_FLASH_Init(void); 59 | uint32_t F10X_FLASH_Erase(uint32_t start_addr, uint32_t size); 60 | uint32_t F10X_FLASH_Write(__IO uint32_t * FlashAddress, uint32_t* Data, uint32_t DataLength); 61 | uint8_t F10X_FLASH_GetWriteProtectionFlag(void); 62 | void F10X_FLASH_DisableWriteProtectionPages(void); 63 | uint8_t F10X_FLASH_Upgrade(void); 64 | 65 | 66 | uint8_t F10X_FLASH_WriteAppAttr(uint32_t flashAddress, T_APP_FLASH_ATTR * newAttr); 67 | uint8_t F10X_FLASH_ReadAppAttr(uint32_t flashAddress, T_APP_FLASH_ATTR * outAttr); 68 | 69 | uint8_t F10X_FLASH_WriteSysEnv(T_SYS_ENV * pEnv); 70 | uint8_t F10X_FLASH_ReadSysEnv(T_SYS_ENV * outEnv); 71 | 72 | 73 | #define Sys_ReadAppAttr(pAttr) F10X_FLASH_ReadAppAttr(FLASH_SYS_ENV_START_SECTOR << 12, pAttr) 74 | #define Sys_WriteAppAttr(pAttr) F10X_FLASH_WriteAppAttr(FLASH_SYS_ENV_START_SECTOR << 12, pAttr) 75 | 76 | #endif 77 | 78 | -------------------------------------------------------------------------------- /Dev/Driver/inc/IIC_Drv.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef __IIC_DRV_H__ 3 | #define __IIC_DRV_H__ 4 | 5 | #include "GlobalDef.h" 6 | 7 | typedef struct 8 | { 9 | // uint8_t bit; // 0 - 15 10 | uint16_t Pin; 11 | GPIO_TypeDef* GPIOx; 12 | }bus_io; 13 | 14 | typedef struct 15 | { 16 | bus_io SDA; 17 | bus_io SCL; 18 | }IIC_BUS; 19 | 20 | #define IIC_SDA_H(b) IO_H(b->SDA.GPIOx, b->SDA.Pin) 21 | #define IIC_SDA_L(b) IO_L(b->SDA.GPIOx, b->SDA.Pin) 22 | #define IIC_SCL_H(b) IO_H(b->SCL.GPIOx, b->SCL.Pin) 23 | #define IIC_SCL_L(b) IO_L(b->SCL.GPIOx, b->SCL.Pin) 24 | #define IIC_SDA_READ(b) IO_READ_IN(b->SDA.GPIOx, b->SDA.Pin) 25 | 26 | 27 | 28 | #define IIC_READ 0x01 29 | #define IIC_WRITE 0x00 30 | 31 | void IIC_Init(IIC_BUS * b); 32 | 33 | SYS_RESULT IIC_WriteNByte(IIC_BUS * b, uint8_t sla_addr, uint16_t data_addr, uint8_t * pdata, uint8_t size); 34 | 35 | SYS_RESULT IIC_ReadNByteExt(IIC_BUS * b, uint8_t sla_addr, uint16_t data_addr, uint8_t * pdata, uint8_t size, uint8_t restart_iic); 36 | SYS_RESULT IIC_ReadNByte(IIC_BUS * b, uint8_t sla_addr, uint16_t data_addr, uint8_t * pdata, uint8_t size); 37 | SYS_RESULT IIC_ReadNByteDirectly(IIC_BUS * b, uint8_t sla_addr, uint8_t * pdata, uint8_t size); 38 | 39 | SYS_RESULT TVOC_IIC_ReadNByteDirectly(IIC_BUS * b, uint8_t * pdata, uint8_t size); 40 | 41 | #endif 42 | 43 | -------------------------------------------------------------------------------- /Dev/Driver/inc/ILI9341_Drv.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef __ILI9341_DRV_H 3 | #define __ILI9341_DRV_H 4 | 5 | //#include "ILI9341_3Line_SPI.h" 6 | //#include "ILI9341_4Line_SPI.h" 7 | //#include "ILI9341_1.h" 8 | //#include "TFT_Demo.h" 9 | 10 | #include "TFT_API.h" 11 | 12 | #endif 13 | 14 | -------------------------------------------------------------------------------- /Dev/Driver/inc/Key_Drv.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef __KEY_DRV_H__ 3 | #define __KEY_DRV_H__ 4 | 5 | #include "stm32f10x.h" 6 | #include "GlobalDef.h" 7 | 8 | 9 | #if DEBUG_KEY_EN 10 | #define KEY_DEBUG(fmt, ...) os_printf(fmt, ##__VA_ARGS__) 11 | #else 12 | #define KEY_DEBUG(...) 13 | #endif 14 | 15 | /****************************硬件定义 begin ****************************************/ 16 | 17 | /****************************硬件定义 end ****************************************/ 18 | 19 | #define key_state_0 0 20 | #define key_state_1 1 21 | #define key_state_2 2 22 | #define key_state_3 3 23 | #define key_state_4 4 //按键需退出检测 24 | 25 | 26 | //按键状态 27 | #define N_key 0 //无键 28 | #define S_key 1 //单键 29 | #define D_key 2 //双击 30 | #define L_key 3 //长键 31 | 32 | 33 | #define KEY_MASK 0x03 // 只有2个按键, bit1-bit0 34 | #define NO_KEY 0x03 // 35 | 36 | #define KEY_0 0x02 // 10, BIT0 == 0 37 | #define KEY_1 0x01 // 01, BIT1 == 0 38 | 39 | #define FUNC_KEY KEY_0 40 | #define NEXT_KEY KEY_1 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | void key_gpio_init(void); 49 | uint16_t key_scan(void); 50 | uint16_t key_read(void); 51 | 52 | void key_process(uint16_t keyval); 53 | 54 | extern void key0_hook(uint8_t key_state); 55 | extern void key1_hook(uint8_t key_state); 56 | 57 | #endif 58 | 59 | -------------------------------------------------------------------------------- /Dev/Driver/inc/PCF8563.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef __PCF8563_H__ 3 | #define __PCF8563_H__ 4 | 5 | #include "GlobalDef.h" 6 | 7 | 8 | #define PCF_SEC_REG 0x02 9 | #define PCF_MIN_REG 0x03 10 | #define PCF_HOUR_REG 0x04 11 | #define PCF_DAY_REG 0x05 12 | #define PCF_WEEK_REG 0x06 13 | #define PCF_MON_REG 0x07 14 | #define PCF_YEAR_REG 0x08 15 | 16 | 17 | void PCF8563_Set(T_RTC_TIME * time); 18 | void PCF8563_SetTime(uint8_t hour, uint8_t min, uint8_t sec); 19 | void PCF8563_SetDate(uint8_t year, uint8_t month, uint8_t day, uint8_t weekday); 20 | SYS_RESULT PCF8563_GetTime(T_RTC_TIME * t); 21 | void PCF8563_Init(void); 22 | 23 | 24 | #endif 25 | 26 | -------------------------------------------------------------------------------- /Dev/Driver/inc/PWM.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef __PWM_H__ 3 | #define __PWM_H__ 4 | 5 | 6 | #include "GlobalDef.h" 7 | 8 | typedef enum 9 | { 10 | MC2_PWM_CH = 1, 11 | MC1_PWM_CH = 2, 12 | RF1_PWM_CH = 3, 13 | RF2_PWM_CH = 4, 14 | }PWM_CH; 15 | 16 | void PWM_Init(void); 17 | void PWM_SetDuty(uint16_t pulse); 18 | void PWM_Cmd(FunctionalState NewState); 19 | void PWM_SetFreq(uint16_t freq); 20 | 21 | void PWM_TIM_Cmd(TIM_TypeDef* TIMx, FunctionalState NewState); 22 | 23 | #endif 24 | 25 | 26 | -------------------------------------------------------------------------------- /Dev/Driver/inc/PWM_TIM5.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef __PWM_TIM5_H__ 3 | #define __PWM_TIM5_H__ 4 | 5 | 6 | #include "GlobalDef.h" 7 | 8 | 9 | void PWM_TIM5_Init(void); 10 | void PWM_TIM5_SetDuty(uint16_t pulse); 11 | void PWM_TIM5_Cmd(FunctionalState NewState); 12 | void PWM_TIM5_SetFreq(uint16_t freq); 13 | 14 | 15 | #endif 16 | 17 | -------------------------------------------------------------------------------- /Dev/Driver/inc/PowerCtrl.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef __POWER_CTRL_H__ 3 | #define __POWER_CTRL_H__ 4 | 5 | 6 | 7 | #endif 8 | 9 | 10 | -------------------------------------------------------------------------------- /Dev/Driver/inc/QueueDef.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef __QUEUE_DEF_H__ 3 | #define __QUEUE_DEF_H__ 4 | /**************************************************************************** 5 | 队列数据类型定义文件 6 | ****************************************************************************/ 7 | 8 | #include "GlobalDef.h" 9 | 10 | typedef enum 11 | { 12 | LESS_STATE = 0, //小于 13 | EQUAL_STATE, //等于 14 | MORE_STATE, //大于 15 | }Compare_State; //比较状态值 16 | //信号量的值 17 | typedef enum 18 | { 19 | UART_IDLE = 0, //解锁 20 | UART_BUSY = !UART_IDLE 21 | }Sema_State; 22 | 23 | 24 | typedef ErrorStatus UartStatus; 25 | typedef uint8_t QueueMemType; //队列缓冲区存储类型 26 | typedef uint16_t QueuePointerType; //队列指针类型 27 | 28 | typedef struct 29 | { 30 | QueueMemType *Base; //队列缓冲区存储位置 31 | uint16_t buf_size; // 队列长度 32 | volatile QueuePointerType QHead; //队列头指针, 向队列写入数据 33 | volatile QueuePointerType QTail; //队列尾指针, 对发送来说,输出数据是向串口发送; 对接收来说, 输出是从接收队列中取 34 | }T_UartQueue; 35 | 36 | // 串口队列对象 37 | typedef struct struct_queue_obj T_QueueObj; 38 | 39 | // 队列绑定的设备 40 | typedef struct 41 | { 42 | USART_TypeDef * USARTx; // 绑定的串口设备 43 | uint32_t baudrate; // 波特率 44 | 45 | void (* DevInit)(uint32_t baudrate); // 串口外设初始化 46 | 47 | void (*TxIntEn)(USART_TypeDef * USARTx); // 使能发送中断的函数指针 48 | void (*TxIntDis)(USART_TypeDef * USARTx); // 禁止发送中断的函数指针 49 | void (*RxIntEn)(USART_TypeDef * USARTx); // 使能接收中断的函数指针 50 | void (*RxIntDis)(USART_TypeDef * USARTx); // 禁止接收中断的函数指针 51 | }T_QueueDev; 52 | 53 | // 队列实现的操作: 出队, 入队 54 | typedef struct 55 | { 56 | T_QueueDev dev; // 绑定的串口外设 57 | 58 | T_UartQueue TxQ; // 发送队列 59 | T_UartQueue RxQ; // 接收队列 60 | 61 | volatile uint8_t lock; // 发送的信号量 62 | volatile uint8_t flag; // 接收标志位 63 | 64 | }T_QueueOperation; 65 | 66 | // 串口队列对象 67 | typedef struct struct_queue_obj 68 | { 69 | T_QueueOperation op; 70 | 71 | UartStatus (*QueueSendByte)(T_QueueObj * obj, uint8_t data); // 队列发送一个数据 72 | void (*QueueSendN )(T_QueueObj * obj, uint8_t * buf, uint16_t len); // 队列发送N个数据 73 | void (*QueueSendString)(T_QueueObj * obj, uint8_t * string); // 队列发送字符串 74 | }T_QueueObj; 75 | 76 | 77 | #endif 78 | 79 | -------------------------------------------------------------------------------- /Dev/Driver/inc/RTCDrv.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef __RTC_DRV_H__ 3 | #define __RTC_DRV_H__ 4 | 5 | #include "GlobalDef.h" 6 | 7 | #define ONE_DAY_SEC 86400L // 1 天的秒数 8 | 9 | //时间结构体 10 | #pragma pack(1) 11 | typedef struct 12 | { 13 | vu8 hour; 14 | vu8 min; 15 | vu8 sec; 16 | 17 | //公历日月年周 18 | vu16 year; 19 | vu8 month; 20 | vu8 day; 21 | vu8 week; 22 | }T_Calendar_Obj; 23 | #pragma pack() 24 | 25 | extern const uint8_t mon_table[]; 26 | extern T_Calendar_Obj calendar; 27 | 28 | void RTCDrv_Init(void); 29 | uint8_t RTCDrv_GetTime(T_Calendar_Obj * cal); 30 | uint8_t RTCDrv_SetAlarm(uint16_t syear, uint8_t smon, uint8_t sday, uint8_t hour, uint8_t min, uint8_t sec); 31 | uint8_t RTCDrv_SetTime(uint16_t syear,uint8_t smon, uint8_t sday, uint8_t hour, uint8_t min, uint8_t sec); 32 | uint8_t RTCDrv_SetUnixTimeStamp(uint32_t time_stamp); 33 | 34 | // 获取设备的当前的Unix 时间戳 35 | #define RTCDrv_GetUnixTimeStamp() RTC_GetCounter() 36 | 37 | void RTCDrv_CalToRTCTime(T_RTC_TIME * rtc_time); 38 | 39 | #include "RTCDrv.h" 40 | void RTCDrv_SecToCalendar(uint16_t fromYear, uint32_t sec, T_Calendar_Obj * cal, uint8_t one_more_day); 41 | uint32_t RTCDrv_CalendarToSec(uint16_t fromYear, T_Calendar_Obj * cal); 42 | uint8_t RTCDrv_GetWeek(uint16_t year, uint8_t month, uint8_t day); 43 | 44 | void RTCDrv_Test(void); 45 | 46 | 47 | 48 | #endif 49 | 50 | -------------------------------------------------------------------------------- /Dev/Driver/inc/SW_UART.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef __SW_UART_H__ 3 | #define __SW_UART_H__ 4 | 5 | #include "GlobalDef.h" 6 | 7 | #define SW_UART1_TX_EN 0 // 发送使能:1 ; 0: 禁止 8 | #define SW_UART1_RX_EN 1 // 接收使能(1), 0: 禁止 9 | 10 | 11 | #define SW_UART1_RX_MAX_LEN 64 // 最大接收字节数 12 | 13 | 14 | // SW UART TX: PC.2 15 | #define RCC_APB2Periph_SW_UART1_TX_PIN RCC_APB2Periph_GPIOC 16 | #define SW_UART1_TX_PIN GPIO_Pin_2 17 | #define SW_UART1_TX_PORT GPIOC 18 | #define SW_UART1_TX_H() IO_H(SW_UART1_TX_PORT, SW_UART1_TX_PIN) 19 | #define SW_UART1_TX_L() IO_L(SW_UART1_TX_PORT, SW_UART1_TX_PIN) 20 | 21 | 22 | // SW UART RX: PC.1 23 | #define RCC_APB2Periph_SW_UART1_RX_PIN RCC_APB2Periph_GPIOC 24 | #define SW_UART1_RX_PIN GPIO_Pin_1 // PC 1 25 | #define SW_UART1_RX_PORT GPIOC 26 | #define GPIO_PortSource_SW_UART1_RX GPIO_PortSourceGPIOC 27 | #define GPIO_PinSource_SW_UART1_RX GPIO_PinSource1 28 | #define EXTI_Line_SW_UART1_RX EXTI_Line1 29 | #define EXTI_SW_UART1_RX_IRQn EXTI1_IRQn 30 | 31 | #define EXTI_SW_UART1_RX_IRQHandler EXTI1_IRQHandler 32 | 33 | 34 | 35 | 36 | 37 | void SWUART1_Init(void); 38 | void SWUART1_Send(uint8_t Byte); 39 | 40 | void SW_UART1_IRQHandler(uint8_t data); 41 | 42 | 43 | #endif 44 | 45 | -------------------------------------------------------------------------------- /Dev/Driver/inc/SW_UART2.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef __SW_UART2_H__ 3 | #define __SW_UART2_H__ 4 | 5 | #include "GlobalDef.h" 6 | 7 | #define SW_UART2_TX_EN 0 // 发送使能:1 ; 0: 禁止 8 | #define SW_UART2_RX_EN 1 // 接收使能(1), 0: 禁止 9 | 10 | 11 | #define SW_UART2_RX_MAX_LEN 64 // 最大接收字节数 12 | 13 | 14 | // SW UART2 TX: PA.2 15 | #define RCC_APB2Periph_SW_UART2_TX_PIN RCC_APB2Periph_GPIOA 16 | #define SW_UART2_TX_PIN GPIO_Pin_2 17 | #define SW_UART2_TX_PORT GPIOA 18 | #define SW_UART2_TX_H() IO_H(SW_UART2_TX_PORT, SW_UART2_TX_PIN) 19 | #define SW_UART2_TX_L() IO_L(SW_UART2_TX_PORT, SW_UART2_TX_PIN) 20 | 21 | 22 | // SW UART2 RX: PA.3 23 | #define RCC_APB2Periph_SW_UART2_RX_PIN RCC_APB2Periph_GPIOA 24 | #define SW_UART2_RX_PIN GPIO_Pin_3 25 | #define SW_UART2_RX_PORT GPIOA 26 | #define GPIO_PortSource_SW_UART2_RX GPIO_PortSourceGPIOA 27 | #define GPIO_PinSource_SW_UART2_RX GPIO_PinSource3 28 | #define EXTI_Line_SW_UART2_RX EXTI_Line3 29 | #define EXTI_SW_UART2_RX_IRQn EXTI3_IRQn 30 | #define EXTI_SW_UART2_RX_IRQHandler EXTI3_IRQHandler 31 | 32 | void SWUART2_Init(void); 33 | void SWUART2_Send(uint8_t Byte); 34 | 35 | void SW_UART2_IRQHandler(uint8_t data); 36 | 37 | #endif 38 | 39 | -------------------------------------------------------------------------------- /Dev/Driver/inc/SW_UART3.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef __SW_UART3_H__ 3 | #define __SW_UART3_H__ 4 | 5 | #include "GlobalDef.h" 6 | 7 | #define SW_UART3_TX_EN 0 // 发送使能:1 ; 0: 禁止 8 | #define SW_UART3_RX_EN 1 // 接收使能(1), 0: 禁止 9 | 10 | 11 | #define SW_UART1_RX_MAX_LEN 64 // 最大接收字节数 12 | 13 | 14 | // SW UART TX: PC.2 15 | #define RCC_APB2Periph_SW_UART1_TX_PIN RCC_APB2Periph_GPIOC 16 | #define SW_UART1_TX_PIN GPIO_Pin_2 17 | #define SW_UART1_TX_PORT GPIOC 18 | #define SW_UART1_TX_H() IO_H(SW_UART1_TX_PORT, SW_UART1_TX_PIN) 19 | #define SW_UART1_TX_L() IO_L(SW_UART1_TX_PORT, SW_UART1_TX_PIN) 20 | 21 | 22 | // SW UART RX: PA.1 23 | #define RCC_APB2Periph_SW_UART1_RX_PIN RCC_APB2Periph_GPIOA 24 | #define SW_UART1_RX_PIN GPIO_Pin_0 // PA 0 25 | #define SW_UART1_RX_PORT GPIOA 26 | #define GPIO_PortSource_SW_UART1_RX GPIO_PortSourceGPIOA 27 | #define GPIO_PinSource_SW_UART1_RX GPIO_PinSource1 28 | #define EXTI_Line_SW_UART1_RX EXTI_Line1 29 | #define EXTI_SW_UART3_RX_IRQn EXTI1_IRQn 30 | 31 | #define EXTI_SW_UART3_RX_IRQHandler EXTI1_IRQHandler 32 | 33 | 34 | 35 | 36 | 37 | void SWUART1_Init(void); 38 | void SWUART1_Send(uint8_t Byte); 39 | 40 | void SW_UART1_IRQHandler(uint8_t data); 41 | 42 | 43 | #endif 44 | 45 | -------------------------------------------------------------------------------- /Dev/Driver/inc/TFT_API.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef __TFT_API_H__ 3 | #define __TFT_API_H__ 4 | 5 | #include "GlobalDef.h" 6 | 7 | 8 | #define TFT_SPI_NORMAL 0 9 | #define TFT_SPI_DMA 1 // DMA 10 | 11 | #define TFT_SPI_MODE TFT_SPI_DMA 12 | 13 | 14 | 15 | 16 | 17 | void UserGUI_Init(void); 18 | u16 UserGUI_ReadPoint(u16 x,u16 y); 19 | void UserGUI_LCDClear(u16 Color); 20 | void UserGUI_SetXY(u16 x,u16 y); 21 | void UserGUI_DrawPoint(u16 x,u16 y,u16 Data); 22 | void UserGUI_SetRegion(u16 x1, u16 y1, u16 x2, u16 y2); 23 | void UserGUI_WriteData_16Bit(u16 Data); 24 | void UserGUI_WriteData16Bit_End(void); 25 | void UserGUI_LCDClear(u16 Color); 26 | 27 | #include "tft_graph.h" 28 | __INLINE void UserGUI_DrawRegion(u16 x1, u16 y1, u16 w, u16 h, u16 * colorBuf) 29 | { 30 | LCD_putPixelRect(x1, y1, w, h, colorBuf); 31 | } 32 | 33 | #endif 34 | 35 | -------------------------------------------------------------------------------- /Dev/Driver/inc/TimerManager.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef __TIME_MANAGER_H__ 3 | #define __TIME_MANAGER_H__ 4 | 5 | #include "stm32f10x.h" 6 | #include 7 | 8 | #define SysTick_Open() SysTick->CTRL |= (SysTick_CTRL_ENABLE_Msk) 9 | #define SysTick_Close() SysTick->CTRL &= ~(SysTick_CTRL_ENABLE_Msk) 10 | 11 | 12 | extern uint8_t volatile flag10ms; 13 | extern uint8_t volatile flag100ms; 14 | extern uint8_t volatile flag_switch; 15 | extern volatile uint16_t key_result; 16 | 17 | void SysTick_Increment(void); 18 | void SysTick_Init(void); 19 | uint32_t OS_GetSysTick(void); 20 | 21 | #endif 22 | 23 | -------------------------------------------------------------------------------- /Dev/Driver/inc/Uart_Drv.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef __UART_DRV__ 3 | #define __UART_DRV__ 4 | 5 | #include 6 | #include "stm32f10x.h" 7 | #include "GlobalDef.h" 8 | 9 | #pragma pack(1) 10 | // 传感器接收管理 11 | typedef struct 12 | { 13 | uint16_t size; // 接收缓冲区长度 14 | //volatile 15 | uint16_t rx_cnt; // 接收计数 16 | //volatile 17 | uint16_t rx_len; // 接收的数据长度 18 | //volatile 19 | uint8_t last_val; // 上一次接收的值 20 | //volatile 21 | uint8_t is_rx; // 包接收标志: 是否已接收到 22 | uint8_t * buf; // 接收缓冲区 23 | }T_UART_Rx; 24 | #pragma pack() 25 | 26 | 27 | void USART1_Init(uint32_t baudrate); 28 | void USART2_Init(uint32_t baudrate); 29 | void USART3_Init(uint32_t baudrate); 30 | void USART4_Init(uint32_t baudrate); 31 | void USART5_Init(uint32_t baudrate); 32 | 33 | 34 | //#define PM25_USART_IRQHandler USART2_IRQHandler 35 | #define PM25_USART USART2 36 | #define PM25_USART_Init USART2_Init 37 | 38 | #define DEBUG_UART_RX_BUF_SIZE 1 39 | #define DEBUG_UART_TX_BUF_SIZE 256 40 | 41 | // 串口调试口也是 PM2.5 的接收口 42 | #define DEBUG_UART USART2 43 | #define DebugUart_Init USART2_Init 44 | #define DEBUG_UART_BAUDRATE 9600 45 | #define DEBUG_UART_IRQHandler USART2_IRQHandler 46 | #define DEBUG_UART_Close() {\ 47 | STM32_RCC_APB1PeriphClockCmd(RCC_APB1Periph_USART2, DISABLE);\ 48 | STM32_USART_Cmd(DEBUG_UART, DISABLE);\ 49 | } 50 | 51 | 52 | 53 | #define CO_USART_IRQHandler USART3_IRQHandler 54 | #define CO_USART USART3 55 | #define CO_USART_Init USART3_Init 56 | 57 | 58 | #define HCHO_USART_IRQHandler //USART3_IRQHandler 59 | #define HCHO_USART //USART3 60 | #define HCHO_USART_Init // USART3_Init 61 | 62 | #define WIFI_USART_IRQHandler USART1_IRQHandler 63 | #define WIFI_USART USART1 64 | #define WIFI_USART_Init USART1_Init 65 | #define WIFI_UART_BAUDRATE 9600 66 | #define WIFI_UART_TX_BUF_SIZE 256 67 | #define WIFI_UART_RX_BUF_SIZE 1 68 | 69 | #define CO2_USART_IRQHandler USART3_IRQHandler 70 | #define CO2_USART USART3 71 | #define CO2_USART_Init USART3_Init 72 | 73 | 74 | 75 | #endif 76 | 77 | -------------------------------------------------------------------------------- /Dev/Driver/inc/beep_drv.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef __BEEP_DRV_H__ 3 | #define __BEEP_DRV_H__ 4 | 5 | #include "GlobalDef.h" 6 | 7 | void Beep_Init(void); 8 | void Beep(uint16_t tick, uint32_t freq); 9 | void Beep_Ctrl(void); 10 | 11 | 12 | #endif 13 | 14 | -------------------------------------------------------------------------------- /Dev/Driver/inc/debug_queue.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef __DEBUG_QUEUE_H__ 3 | #define __DEBUG_QUEUE_H__ 4 | 5 | #include "queue.h" 6 | #include "Uart_Drv.h" 7 | 8 | extern T_QueueObj debugQObj; 9 | 10 | // 在新接收的数据是否含有 match 子字符串 11 | __INLINE SYS_RESULT DebugUart_RxQueueStrStr(char * match) 12 | { 13 | return queue_rx_str_str(&debugQObj, (uint8_t *)match); 14 | } 15 | 16 | __INLINE SYS_RESULT DebugUart_RxQueueStrChr(char c) 17 | { 18 | return queue_rx_str_chr(&debugQObj, c); 19 | } 20 | 21 | // 接收是否为空: 1: 为空; 0: 不为空 22 | __INLINE uint8_t DebugUart_IsRxEmpty(void) 23 | { 24 | return queue_is_rx_buf_empty(&debugQObj); 25 | } 26 | 27 | // 读取一个字节并出队 28 | __INLINE UartStatus DebugUart_ReadDequeueByte(uint8_t * pdata) 29 | { 30 | return queue_pull_rx(&debugQObj, (QueueMemType *)pdata); 31 | } 32 | 33 | // 读取buff 并出队 34 | __INLINE uint16_t DebugUart_ReadDequeueBuff(uint8_t * pdata) 35 | { 36 | return queue_pull_rx_all(&debugQObj, (QueueMemType *)pdata); 37 | } 38 | 39 | __INLINE void DebugUart_RxToTx(uint8_t * out_buf, uint16_t size) 40 | { 41 | queue_rx_to_tx(&debugQObj, (QueueMemType *)out_buf, size); 42 | } 43 | 44 | 45 | 46 | __INLINE UartStatus DebugUart_SendByte(uint8_t data) 47 | { 48 | return queue_send(&debugQObj, data); 49 | } 50 | 51 | __INLINE void DebugUart_SendNByte(uint8_t * buf, uint16_t len) 52 | { 53 | queue_send_n(&debugQObj, buf, len); 54 | } 55 | 56 | __INLINE void DebugUart_SendString(uint8_t * sring) 57 | { 58 | queue_send_string(&debugQObj, sring); 59 | } 60 | 61 | 62 | 63 | void DebugQueue_Init(void); 64 | 65 | 66 | #endif 67 | 68 | -------------------------------------------------------------------------------- /Dev/Driver/inc/debugfile.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef __DEBUG_FILE_H__ 3 | #define __DEBUG_FILE_H__ 4 | 5 | 6 | 7 | #include "GlobalDef.h" 8 | 9 | 10 | 11 | 12 | 13 | 14 | #endif 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /Dev/Driver/inc/delay.h: -------------------------------------------------------------------------------- 1 | #ifndef __DELAY_H 2 | #define __DELAY_H 3 | #include "stm32f10x.h" 4 | #include 5 | 6 | ////////////////////////////////////////////////////////////////////////////////// 7 | //本程序只供学习使用,未经作者许可,不得用于其它任何用途 8 | //Mini STM32开发板 9 | //使用SysTick的普通计数模式对延迟进行管理 10 | //包括delay_us,delay_ms 11 | //正点原子@ALIENTEK 12 | //技术论坛:www.openedv.com 13 | //修改日期:2010/5/27 14 | //版本:V1.2 15 | //版权所有,盗版必究。 16 | //Copyright(C) 正点原子 2009-2019 17 | //All rights reserved 18 | //******************************************************************************** 19 | //V1.2修改说明 20 | //修正了中断中调用出现死循环的错误 21 | //防止延时不准确,采用do while结构! 22 | ////////////////////////////////////////////////////////////////////////////////// 23 | //void delay_init(u8 SYSCLK); 24 | void delay_ms(uint32_t nms); 25 | void delay_us(uint32_t nus); 26 | 27 | #endif 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /Dev/Driver/inc/flash_font.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaberOnGo/AirDog/e741a01c44aee19c57c81071a268d98cc484962a/Dev/Driver/inc/flash_font.h -------------------------------------------------------------------------------- /Dev/Driver/inc/gizwits_queue.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef __GIZWITS_QUEUE_H__ 3 | #define __GIZWITS_QUEUE_H__ 4 | 5 | #include "queue.h" 6 | #include "Uart_Drv.h" 7 | 8 | extern T_QueueObj gizwitsQObj; 9 | 10 | 11 | __INLINE UartStatus GizwitsUart_SendByte(uint8_t data) 12 | { 13 | return queue_send(&gizwitsQObj, data); 14 | } 15 | 16 | 17 | void GizwitsQueue_Init(void); 18 | 19 | 20 | 21 | #endif 22 | 23 | -------------------------------------------------------------------------------- /Dev/Driver/inc/queue.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef __QUEUE_H__ 3 | #define __QUEUE_H__ 4 | 5 | #include 6 | #include "QueueDef.h" 7 | 8 | 9 | 10 | 11 | 12 | static __inline void queue_do_nothing(USART_TypeDef * USARTx) 13 | { 14 | 15 | } 16 | 17 | 18 | /***************************************************************************** 19 | * @\fn : queue_disable_tx_int 20 | * @\author : pi 21 | * @\date : 2016 - 6 - 23 22 | * @\brief : 禁止UART TX中断 23 | * @\param[in] : void 24 | * @\param[out] : none 25 | * @\return : 26 | * @\attention : 27 | * @\note [others] : 清除SR寄存器的TC,TXE bit, 禁止TIEN,TCIEN,TEN 28 | 29 | *****************************************************************************/ 30 | static __inline void queue_disable_tx_int(USART_TypeDef * USARTx) 31 | { 32 | CLEAR_REG_32_BIT(USARTx->CR1, USART_CR1_TXEIE); // 禁止发送空中断 33 | CLEAR_REG_32_BIT(USARTx->CR1, USART_CR1_TCIE); // 禁止发送完成中断 34 | CLEAR_REG_32_BIT(USARTx->SR, USART_SR_TC); // 清中断完成标志位 35 | } 36 | 37 | 38 | // 使能发送中断 39 | static __inline void queue_enable_tx_int(USART_TypeDef * USARTx) 40 | { 41 | SET_REG_32_BIT(USARTx->CR1, USART_CR1_TXEIE); //发送使能: 使能发送空中断 42 | } 43 | 44 | 45 | // 禁止接收中断 46 | static __inline void queue_disable_rx_int(USART_TypeDef * USARTx) 47 | { 48 | CLEAR_REG_32_BIT(USARTx->CR1, USART_CR1_RXNEIE); // 禁止接收非空中断 49 | } 50 | 51 | 52 | // 使能接收中断 53 | static __inline void queue_enable_rx_int(USART_TypeDef * USARTx) 54 | { 55 | SET_REG_32_BIT(USARTx->CR1, USART_CR1_RXNEIE); //接收使能: 使能接收非空中断 56 | } 57 | UartStatus queue_push_tx(T_QueueObj * obj, uint8_t data); 58 | UartStatus queue_pull_tx(T_QueueObj * obj); 59 | 60 | UartStatus queue_push_rx(T_QueueObj * obj, QueueMemType data); 61 | UartStatus queue_pull_rx(T_QueueObj * obj, QueueMemType *pdata); 62 | uint16_t queue_pull_rx_all(T_QueueObj * obj, QueueMemType * out_buf); 63 | uint16_t queue_get_rx_all(T_QueueObj * obj, QueueMemType * out_buf); 64 | 65 | void queue_rx_to_tx(T_QueueObj * obj, QueueMemType * ReadOutBuff, uint16_t MaxSize); 66 | 67 | 68 | // 接收队列是否为空 69 | // 返回值: 1: 为空; 0: 不为空 70 | #define queue_is_rx_buf_empty(obj) ((obj)->op.RxQ.QHead == (obj)->op.RxQ.QTail) 71 | void queue_clear_rx_q_buf(T_QueueObj * obj); 72 | SYS_RESULT queue_rx_str_str(T_QueueObj * obj, uint8_t * match); 73 | SYS_RESULT queue_rx_str_chr(T_QueueObj * obj, char c); 74 | 75 | #define queue_send(obj, data) queue_push_tx(obj, data) 76 | void queue_send_n(T_QueueObj * obj, uint8_t * buf, uint16_t len); 77 | void queue_send_string(T_QueueObj * obj, uint8_t * sring); 78 | 79 | 80 | 81 | void Queue_InstanceInit(T_QueueObj * obj, 82 | USART_TypeDef * USARTx, 83 | uint32_t baudrate, 84 | uint8_t *tx_buf, 85 | uint16_t tx_buf_size, 86 | uint8_t *rx_buf, 87 | uint16_t rx_buf_size, 88 | void (* pDevInit)(uint32_t), 89 | void (*TxIntEn) (USART_TypeDef * ), // 发送中断使能函数指针 90 | void (*TxIntDis)(USART_TypeDef * ), // 发送中断禁止的函数指针 91 | void (*RxIntEn) (USART_TypeDef * ), // 接收中断使能函数指针 92 | void (*RxIntDis)(USART_TypeDef * ) ); // 接收中断禁止的函数指针) 93 | 94 | 95 | #endif 96 | 97 | -------------------------------------------------------------------------------- /Dev/Driver/inc/queue2.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef __QUEUE2_H__ 3 | #define __QUEUE2_H__ 4 | 5 | 6 | #include "GlobalDef.h" 7 | 8 | 9 | #endif 10 | 11 | 12 | -------------------------------------------------------------------------------- /Dev/Driver/inc/rom_flash_interface.h: -------------------------------------------------------------------------------- 1 | 2 | /* ******************************MCU FLASH 存储接口访问头文件 ********************************************/ 3 | #ifndef __ROM_FLASH_INTERFACE_H__ 4 | #define __ROM_FLASH_INTERFACE_H__ 5 | 6 | #include 7 | 8 | #include "diskio.h" 9 | #include "Integer.h" 10 | 11 | 12 | // MCU 内部 FLASH 的块定义 13 | #define ROM_FLASH_SIZE (32 * 1024L) // 32 K 14 | #define ROM_FLASH_START_ADDR (0x08000000 + MCU_ROM_SIZE - ROM_FLASH_SIZE) // Flash start address 15 | #define ROM_FLASH_PAGE_SIZE 0x400 // 1K per page 16 | #define ROM_FLASH_SECTOR_SIZE ROM_FLASH_PAGE_SIZE 17 | #define ROM_FLASH_WAIT_TIMEOUT 100000 18 | 19 | 20 | 21 | int32_t rom_flash_initialize(void); 22 | DRESULT rom_flash_ioctl(BYTE lun, BYTE cmd, void *buff); 23 | DRESULT rom_flash_disk_read(BYTE lun, BYTE * buff, DWORD sector, UINT count); 24 | DRESULT rom_flash_disk_write(BYTE lun, const BYTE *buff, DWORD sector, UINT count); 25 | 26 | uint16_t rom_flash_mal_write(uint8_t lun, uint32_t Memory_Offset, uint32_t * Writebuff, uint16_t Transfer_Length); 27 | uint16_t rom_flash_mal_read(uint8_t lun, uint32_t Memory_Offset, uint32_t * Readbuff, uint16_t Transfer_Length); 28 | 29 | 30 | 31 | 32 | 33 | #endif 34 | 35 | 36 | -------------------------------------------------------------------------------- /Dev/Driver/inc/sd_card_interface.h: -------------------------------------------------------------------------------- 1 | 2 | /***************************** SD CARD 存储接口访问头文件 ****************************************************/ 3 | #ifndef __SD_CARD_INTERFACE_H__ 4 | #define __SD_CARD_INTERFACE_H__ 5 | 6 | #include 7 | 8 | #include "diskio.h" 9 | #include "Integer.h" 10 | 11 | #define SD_CARD_DISK_SIZE ((uint64_t)((uint64_t)2 * 1024 * 1024 * 1024)) // 2GB SD 卡 12 | #define SD_CARD_SECTOR_SIZE 512 // 扇区大小 13 | #define SD_CARD_BLOCK_SIZE 512 // 块大小 14 | 15 | int32_t sd_initialize(void); 16 | DRESULT sd_ioctl(BYTE lun, BYTE cmd, void *buff); 17 | DRESULT sd_disk_read(BYTE lun, BYTE * buff, DWORD sector, UINT count); 18 | DRESULT sd_disk_write(BYTE lun, const BYTE *buff, DWORD sector, UINT count); 19 | DRESULT sd_get_init_status(void); 20 | 21 | 22 | uint16_t sd_mal_read(uint8_t lun, uint64_t mem_offset, uint32_t * buff, uint16_t len); 23 | uint16_t sd_mal_write(uint8_t lun, uint64_t mem_offset, uint32_t * buff, uint16_t len); 24 | 25 | #include "sdcard_include.h" 26 | //DRESULT SD_ReadDisk(BYTE lun, const BYTE * buff, DWORD sector, UINT cnt); 27 | //DRESULT SD_WriteDisk(BYTE lun, const BYTE * buf, DWORD sector, UINT cnt); 28 | 29 | #endif 30 | 31 | -------------------------------------------------------------------------------- /Dev/Driver/inc/timer_drv.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef __TIME_DRV_H__ 3 | #define __TIME_DRV_H__ 4 | 5 | 6 | #include "GlobalDef.h" 7 | 8 | void TIM3_Int_Init(u16 arr, u16 psc); 9 | void TIM4_Int_Init(u16 arr, u16 psc); 10 | void TIM5_Int_Init(u16 arr, u16 psc); 11 | 12 | #define SWUART1_TIM TIM4 13 | #define SWUART1_TIM_IRQHandler TIM4_IRQHandler 14 | #define SWUART1_TIM_Init() TIM4_Int_Init(103, SystemCoreClock / FREQ_1MHz -1) 15 | 16 | #define SWUART2_TIM TIM5 17 | #define SWUART2_TIM_IRQHandler TIM5_IRQHandler 18 | #define SWUART2_TIM_Init() TIM5_Int_Init(103, SystemCoreClock / FREQ_1MHz -1) 19 | 20 | 21 | #endif 22 | 23 | -------------------------------------------------------------------------------- /Dev/Driver/inc/uart_queue.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef __UART_QUEUE_H__ 3 | #define __UART_QUEUE_H__ 4 | 5 | 6 | #include "GlobalDef.h" 7 | 8 | #define EN_USART_TCIE() (USART1->CR1 |= USART_CR1_TCIE) 9 | #define DIS_USART_TCIE() (USART1->CR1 &= ~USART_CR1_TCIE) 10 | 11 | #define EN_USART_TXEIE() (USART1->CR1 |= USART_CR1_TXEIE) 12 | #define DIS_USART_TXEIE() (USART1->CR1 &= ~USART_CR1_TXEIE) 13 | 14 | // FIFO 队列 15 | typedef struct 16 | { 17 | uint8_t * buf; // 队列缓冲区指针 18 | uint16_t size; // 队列缓冲区长度 19 | uint16_t head; // 环形队列头, 每接收到一个数据, head + 1 20 | uint16_t tail; // 环形队列尾, 每发送一个数据(该命令缓冲区为空), tail + 1 21 | }T_UART_QUEUE; 22 | 23 | void uart_q_init(void); 24 | void uart_q_push(uint8_t data); 25 | 26 | #endif 27 | 28 | -------------------------------------------------------------------------------- /Dev/Driver/inc/wifi_queue.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef __WIFI_QUEUE_H__ 3 | #define __WIFI_QUEUE_H__ 4 | 5 | #include "queue.h" 6 | #include "Uart_Drv.h" 7 | 8 | extern T_QueueObj WifiQObj; 9 | 10 | 11 | __INLINE UartStatus WifiUart_SendByte(uint8_t data) 12 | { 13 | return queue_send(&WifiQObj, data); 14 | } 15 | 16 | void WifiQueue_Init(void); 17 | 18 | 19 | #endif 20 | 21 | -------------------------------------------------------------------------------- /Dev/Driver/src/ADC_Drv.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaberOnGo/AirDog/e741a01c44aee19c57c81071a268d98cc484962a/Dev/Driver/src/ADC_Drv.c -------------------------------------------------------------------------------- /Dev/Driver/src/BatteryLevel.c: -------------------------------------------------------------------------------- 1 | 2 | /*-----------------------------电池电量显示操作------------------------------------------*/ 3 | 4 | #include "BatteryLevel.h" 5 | #include "os_timer.h" 6 | #include "os_global.h" 7 | #include "ADC_Drv.h" 8 | #include "board_version.h" 9 | //#include "PowerCtrl.h" 10 | #include "font_api.h" 11 | #include "ExtiDrv.h" 12 | 13 | 14 | #if BAT_DEBUG_EN 15 | //#define BAT_DEBUG(fmt, ...) printf(fmt, ##__VA_ARGS__) 16 | #define BAT_DEBUG dbg_print_detail 17 | #else 18 | #define BAT_DEBUG(...) 19 | #endif 20 | 21 | 22 | // 电池电量对应的电量百分比 23 | typedef struct 24 | { 25 | uint8_t percent; // 剩余电量百分比, 如: 15 表示: 15% 26 | uint16_t volt; // 电压: 如 3345 表示: 3.345V, 即单位: mV 27 | }T_BAT_LEVEL_MAP; 28 | 29 | // 30 | static const T_BAT_LEVEL_MAP BatLevMap[] = 31 | { 32 | {0, 3300}, // 0%, 3.300 V: 表示: <= 3.300 V时, 电池电量为 0% 33 | {5, 3380}, 34 | {10, 3450}, // 10 %, 3.45 V, 35 | {25, 3500}, // 25 %, 3.50 V 36 | {30, 3550}, // 30 %, 3.55 V 37 | {40, 3600}, // 40 %, 3.60 V 38 | {50, 3650}, // 50 %, 3.65 V 39 | {60, 3700}, // 60 %, 3.70 V 40 | {70, 3800}, 41 | {80, 3850}, // 80 %, 3.85 V 42 | {85, 3950}, 43 | {90, 4050}, // 90 %, 4.05 V 44 | {95, 4130}, 45 | {98, 4170}, 46 | {100, 4200}, // 100 %, 4.20 V 47 | }; 48 | 49 | #define BAT_LEVELS (sizeof(BatLevMap) / sizeof(BatLevMap[0])) 50 | 51 | uint8_t bat_lev_percent = 0; // 电池电量 52 | 53 | // 获取电池电量百分比 54 | uint8_t BatLev_GetPercent(void) 55 | { 56 | return bat_lev_percent; 57 | } 58 | 59 | 60 | // 将电池电压转换成百分比 61 | //static 62 | // 参数: uint16_t bat_volt, 电池电压, 单位: mV 63 | void BatLev_VoltToPercent(uint16_t bat_volt) 64 | { 65 | uint8_t i; 66 | //uint8_t usb_sta = 0; 67 | 68 | if(bat_volt <= BatLevMap[0].volt){ bat_lev_percent = 0; } 69 | else if(bat_volt >= BatLevMap[BAT_LEVELS - 1].volt ) 70 | { 71 | bat_lev_percent = 100; 72 | } 73 | else 74 | { 75 | for(i = 1; i < BAT_LEVELS; i++) 76 | { 77 | if(BatLevMap[i - 1].volt <= bat_volt && bat_volt < BatLevMap[i].volt) 78 | { 79 | bat_lev_percent = BatLevMap[i - 1].percent; 80 | //BAT_DEBUG("bat lev = %d, bat_volt = %d.%03d V \r\n", i, bat_volt / 1000, bat_volt % 1000); 81 | break; 82 | } 83 | } 84 | } 85 | BAT_DEBUG("bat_volt = %d.%03d V, bat=%02d%%, t = %ld\n", bat_volt / 1000, bat_volt % 1000, 86 | bat_lev_percent, os_get_tick()); 87 | BAT_DEBUG("bat percent = %d, bat_is_charg = %d, BatIsCharg() = %d\n", 88 | bat_lev_percent, battery_is_charging, BatteryIsCharging()); 89 | 90 | 91 | if( (bat_lev_percent < 30) && (VIN_DETECT_Read() == 0) ) // 电量小于 30%, 关闭所有传感器 92 | { 93 | BAT_DEBUG("bat=%02d%%, pwr dn\n", bat_lev_percent); 94 | 95 | // 关闭传感器 96 | SNS_Ctrl_Set(SW_CLOSE); 97 | LCD_BackLight_Ctrl_Set(SW_CLOSE); 98 | LCD_Ctrl_Set(SW_CLOSE); 99 | WIFI_Power_Ctrl_Close(); 100 | } 101 | } 102 | 103 | 104 | uint8_t BatteryIsCharging(void) 105 | { 106 | uint8_t sta = 0; 107 | 108 | if(VIN_DETECT_Read()) 109 | { 110 | sta = CHRG_Indicate_Read(); 111 | if(sta == 0)return E_TRUE; 112 | else{ return E_FALSE; } 113 | } 114 | else 115 | { 116 | return E_FALSE; 117 | } 118 | } 119 | -------------------------------------------------------------------------------- /Dev/Driver/src/PWM_TIM5.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaberOnGo/AirDog/e741a01c44aee19c57c81071a268d98cc484962a/Dev/Driver/src/PWM_TIM5.c -------------------------------------------------------------------------------- /Dev/Driver/src/PowerCtrl.c: -------------------------------------------------------------------------------- 1 | 2 | #include "PowerCtrl.h" 3 | #include "Application.h" 4 | #include "TimerManager.h" 5 | #include "Uart_Drv.h" 6 | void PowerCtrl_LowerPower(void) 7 | { 8 | GLOBAL_DISABLE_IRQ(); 9 | 10 | PowerCtrl_SetClock(); 11 | 12 | #if 0 13 | SysTick_Init(); 14 | #else 15 | SysTick->LOAD = ((SystemCoreClock / 100) & SysTick_LOAD_RELOAD_Msk) - 1; /* set reload register */ 16 | SysTick->VAL = 0; /* Load the SysTick Counter Value */ 17 | SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk | SysTick_CTRL_TICKINT_Msk | SysTick_CTRL_ENABLE_Msk; 18 | #endif 19 | 20 | #if 1 21 | STM32_RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOD | RCC_APB2Periph_AFIO 22 | | RCC_APB2Periph_ADC1 | RCC_APB2Periph_USART1, DISABLE); 23 | STM32_RCC_APB1PeriphClockCmd(RCC_APB1Periph_USB | RCC_APB1Periph_USART3| RCC_APB1Periph_SPI2, DISABLE); 24 | STM32_RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR | RCC_APB1Periph_BKP, DISABLE); 25 | #endif 26 | 27 | USART1->CR1 &=~ USART_CR1_UE; 28 | 29 | USART3->CR1 &=~ USART_CR1_UE; 30 | 31 | #if (EXTI_DEBUG_EN == 0) 32 | USART2->CR1 &=~ USART_CR1_UE; 33 | STM32_RCC_APB1PeriphClockCmd(RCC_APB1Periph_USART2, DISABLE); 34 | #endif 35 | 36 | //USART2_Init(FREQ_1MHz, 9600); 37 | 38 | GLOBAL_ENABLE_IRQ(); 39 | } 40 | 41 | void PowerCtrl_ResumePower(void) 42 | { 43 | GLOBAL_DISABLE_IRQ(); 44 | RCC_DeInit(); 45 | SysClockConfig(); 46 | SysTick_Config(SystemCoreClock / 100); // 10 ms 中断一次 47 | 48 | #if 0 49 | STM32_RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB | RCC_APB2Periph_GPIOC 50 | | RCC_APB2Periph_GPIOD | RCC_APB2Periph_AFIO 51 | | RCC_APB2Periph_ADC1, ENABLE); 52 | STM32_RCC_APB1PeriphClockCmd(RCC_APB1Periph_USB | RCC_APB1Periph_USART2 | RCC_APB1Periph_USART3 53 | | RCC_APB1Periph_SPI2 | RCC_APB1Periph_TIM2, ENABLE); 54 | #endif 55 | 56 | GLOBAL_ENABLE_IRQ(); 57 | } 58 | 59 | -------------------------------------------------------------------------------- /Dev/Driver/src/SW_UART.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaberOnGo/AirDog/e741a01c44aee19c57c81071a268d98cc484962a/Dev/Driver/src/SW_UART.c -------------------------------------------------------------------------------- /Dev/Driver/src/SW_UART2.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaberOnGo/AirDog/e741a01c44aee19c57c81071a268d98cc484962a/Dev/Driver/src/SW_UART2.c -------------------------------------------------------------------------------- /Dev/Driver/src/TFT_API.c: -------------------------------------------------------------------------------- 1 | 2 | #include "TFT_API.h" 3 | #include "ILI9341_4Line_SPI.h" 4 | 5 | 6 | #if (TFT_SPI_MODE == TFT_SPI_NORMAL) 7 | extern u16 Lcd_ReadPoint(u16 x,u16 y); 8 | extern void Lcd_Clear(u16 Color); 9 | extern void Lcd_SetXY(u16 x,u16 y); 10 | extern void Gui_DrawPoint(u16 x,u16 y,u16 Data); 11 | extern void Lcd_SetRegion(u16 x1, u16 y1, u16 x2, u16 y2); 12 | extern void LCD_Setup(void); 13 | #else 14 | #include "tft_dma.h" 15 | #include "tft_text.h" 16 | #include "tft_itoa.h" 17 | #include "tft_encoder.h" 18 | #include "os_global.h" 19 | #include "tft_core.h" 20 | #endif 21 | 22 | void UserGUI_Init(void) 23 | { 24 | #if (TFT_SPI_MODE == TFT_SPI_DMA) 25 | LCD_Config(); 26 | #else 27 | LCD_Setup(); 28 | #endif 29 | } 30 | 31 | u16 UserGUI_ReadPoint(u16 x,u16 y) 32 | { 33 | #if (TFT_SPI_MODE == TFT_SPI_DMA) 34 | u16 pixel = 0; 35 | 36 | LCD_readPixels(x, y, x, y, &pixel); 37 | 38 | return pixel; 39 | #else 40 | Lcd_ReadPoint(x, y); 41 | #endif 42 | } 43 | 44 | 45 | void UserGUI_LCDClear(u16 Color) 46 | { 47 | #if (TFT_SPI_MODE == TFT_SPI_DMA) 48 | LCD_fillScreen(Color); 49 | #else 50 | Lcd_Clear(Color); 51 | #endif 52 | } 53 | 54 | void UserGUI_SetXY(u16 x,u16 y) 55 | { 56 | #if (TFT_SPI_MODE == TFT_SPI_DMA) 57 | LCD_setCursor(x, y); 58 | #else 59 | Lcd_SetXY(x, y); 60 | #endif 61 | } 62 | 63 | void UserGUI_DrawPoint(u16 x,u16 y,u16 Data) 64 | { 65 | u16 rp = 0; 66 | 67 | #if (TFT_SPI_MODE == TFT_SPI_DMA) 68 | LCD_putPixel(x, y, Data); 69 | #else 70 | Gui_DrawPoint(x, y, Data); 71 | #endif 72 | 73 | rp = UserGUI_ReadPoint(x, y); 74 | if(rp != Data) 75 | { 76 | rp_err_cnt++; 77 | } 78 | else 79 | { 80 | rp_ok_cnt++; 81 | } 82 | } 83 | 84 | void UserGUI_SetRegion(u16 x1, u16 y1, u16 x2, u16 y2) 85 | { 86 | #if (TFT_SPI_MODE == TFT_SPI_DMA) 87 | LCD_setAddressWindowToWrite(x1, y1, x2, y2); 88 | #else 89 | Lcd_SetRegion(x1, y1, x2, y2); 90 | #endif 91 | } 92 | 93 | 94 | void UserGUI_WriteData_16Bit(u16 Data) 95 | { 96 | #if (TFT_SPI_MODE == TFT_SPI_DMA) 97 | LCD_setSpi16(); 98 | dmaFill16Raw(Data, 1); 99 | //LCD_setSpi8(); 100 | #else 101 | Lcd_WriteData_16Bit(Data); 102 | #endif 103 | } 104 | 105 | void UserGUI_WriteData16Bit_End(void) 106 | { 107 | #if (TFT_SPI_MODE == TFT_SPI_DMA) 108 | LCD_setSpi8(); 109 | #endif 110 | } 111 | 112 | 113 | 114 | 115 | 116 | -------------------------------------------------------------------------------- /Dev/Driver/src/TimerManager.c: -------------------------------------------------------------------------------- 1 | 2 | #include "TimerManager.h" 3 | #include "stm32f10x.h" 4 | #include "stm32f10x_it.h" 5 | #include "GlobalDef.h" 6 | 7 | uint8_t volatile flag10ms = 0; 8 | uint8_t volatile flag_switch = 0; 9 | 10 | void SysTick_Init(void) 11 | { 12 | if(SysTick_Config(SystemCoreClock / (1000 / OS_PER_TICK_MS))) // 10 ms 中断一次 13 | { 14 | while(1); 15 | } 16 | 17 | } 18 | 19 | #if (! SYS_RTOS_EN) 20 | static volatile uint32_t sSysTick = 0; 21 | 22 | #include "key_drv.h" 23 | volatile uint16_t key_result; 24 | 25 | void SysTick_Increment(void) 26 | { 27 | sSysTick++; 28 | flag10ms = 1; 29 | 30 | 31 | flag_switch ^= 1; 32 | } 33 | #endif 34 | 35 | uint32_t OS_GetSysTick(void) 36 | { 37 | #if SYS_RTOS_EN 38 | return OSTimeGet(); 39 | #else 40 | return sSysTick; 41 | #endif 42 | } 43 | 44 | 45 | -------------------------------------------------------------------------------- /Dev/Driver/src/beep_drv.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaberOnGo/AirDog/e741a01c44aee19c57c81071a268d98cc484962a/Dev/Driver/src/beep_drv.c -------------------------------------------------------------------------------- /Dev/Driver/src/debug_queue.c: -------------------------------------------------------------------------------- 1 | 2 | #include "debug_queue.h" 3 | #include "Uart_Drv.h" 4 | #include "os_global.h" 5 | #include "sensor.h" 6 | 7 | 8 | //#include "nos_api.h" 9 | 10 | static QueueMemType debug_rx_buf[DEBUG_UART_RX_BUF_SIZE] = {0}; 11 | static QueueMemType debug_tx_buf[DEBUG_UART_TX_BUF_SIZE] = {0}; 12 | 13 | T_QueueObj debugQObj; 14 | 15 | 16 | 17 | void DebugQueue_Init(void) 18 | { 19 | Queue_InstanceInit(&debugQObj, 20 | DEBUG_UART, 21 | DEBUG_UART_BAUDRATE, 22 | debug_tx_buf, 23 | DEBUG_UART_TX_BUF_SIZE, 24 | debug_rx_buf, 25 | DEBUG_UART_RX_BUF_SIZE, 26 | DebugUart_Init, 27 | queue_enable_tx_int, 28 | queue_disable_tx_int, 29 | queue_enable_rx_int, 30 | queue_disable_rx_int); 31 | } 32 | 33 | 34 | 35 | 36 | #if PM25_UART_TYPE == HW_UART_TYPE 37 | extern void HW_USART2_IRQHandler(void); 38 | #endif 39 | 40 | void DEBUG_UART_IRQHandler(void) 41 | { 42 | #if 0 43 | if(STM32_USART_ReadFlagStatus(DEBUG_UART, USART_SR_RXNE)) // 接收非空 44 | { 45 | uint8_t data = STM32_USART_ReceiveData(DEBUG_UART); 46 | 47 | /* Read one byte from the receive data register */ 48 | 49 | queue_push_rx(&debugQObj, data); 50 | if(data == '\n') 51 | { 52 | cloud_sem_release_rx_debug_uart(); 53 | } 54 | } 55 | #else 56 | #if (PM25_UART_TYPE == HW_UART_TYPE) 57 | HW_USART2_IRQHandler(); 58 | #endif 59 | #endif 60 | 61 | #if (PRINT_SELECT != UART_BLOCK) 62 | //if(USART_GetFlagStatus(DEBUG_UART, USART_FLAG_TC)) // 发送数据空 63 | if(STM32_USART_ReadFlagStatus(DEBUG_UART, USART_SR_TXE)) // 发送数据空 64 | { 65 | /* Write one byte to the transmit data register */ 66 | queue_pull_tx(&debugQObj); 67 | } 68 | #endif 69 | } 70 | 71 | 72 | 73 | 74 | -------------------------------------------------------------------------------- /Dev/Driver/src/debugfile.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaberOnGo/AirDog/e741a01c44aee19c57c81071a268d98cc484962a/Dev/Driver/src/debugfile.c -------------------------------------------------------------------------------- /Dev/Driver/src/flash_font.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaberOnGo/AirDog/e741a01c44aee19c57c81071a268d98cc484962a/Dev/Driver/src/flash_font.c -------------------------------------------------------------------------------- /Dev/Driver/src/gizwits_queue.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaberOnGo/AirDog/e741a01c44aee19c57c81071a268d98cc484962a/Dev/Driver/src/gizwits_queue.c -------------------------------------------------------------------------------- /Dev/Driver/src/queue2.c: -------------------------------------------------------------------------------- 1 | 2 | #include "queue2.h" 3 | #include "fifo_queue.h" 4 | 5 | void queue2_init(void) 6 | { 7 | byte_queue_init(); 8 | } 9 | 10 | -------------------------------------------------------------------------------- /Dev/Driver/src/timer_drv.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaberOnGo/AirDog/e741a01c44aee19c57c81071a268d98cc484962a/Dev/Driver/src/timer_drv.c -------------------------------------------------------------------------------- /Dev/Driver/src/uart_queue.c: -------------------------------------------------------------------------------- 1 | 2 | #include "uart_queue.h" 3 | #include "delay.h" 4 | 5 | uint8_t uart_snd_buf[64]; 6 | 7 | void uart_fifo_push(T_UART_QUEUE * q, uint8_t data) 8 | { 9 | 10 | if(((q->head + 1) % q->size) == q->tail) // 队列头已到队列尾后面 11 | { 12 | // 丢弃一个数据, 确保 q->tail 指向最早的数据 13 | //q->tail = (q->tail + 1) % q->size; 14 | uint32_t cnt = 2000; 15 | 16 | do 17 | { 18 | delay_us(1); 19 | } 20 | while(((q->head + 1) % q->size) == q->tail && cnt--); 21 | } 22 | q->buf[q->head] = data; 23 | q->head = (q->head + 1) % q->size; 24 | } 25 | 26 | SYS_RESULT uart_fifo_pull(T_UART_QUEUE * q, uint8_t * data) 27 | { 28 | if(q->tail == q->head) // queue is empty 29 | { 30 | return SYS_FAILED; 31 | } 32 | *data = q->buf[q->tail]; 33 | q->tail = (q->tail + 1) % q->size; 34 | return SYS_SUCCESS; 35 | } 36 | 37 | static void uart_fifo_init(T_UART_QUEUE * q, uint8_t * buf, uint16_t buf_size) 38 | { 39 | q->buf = buf; 40 | q->size = buf_size; 41 | q->head = 0; 42 | q->tail = 0; 43 | } 44 | 45 | T_UART_QUEUE uart_q; 46 | void uart_q_init(void) 47 | { 48 | uart_fifo_init(&uart_q, uart_snd_buf, sizeof(uart_snd_buf)); 49 | } 50 | 51 | //volatile uint8_t lock_snd = 0; 52 | void uart_q_push(uint8_t data) 53 | { 54 | uart_fifo_push(&uart_q, data); 55 | EN_USART_TXEIE(); 56 | 57 | } 58 | 59 | #if PM25_UART_TYPE == HW_UART_TYPE 60 | extern void HW_USART2_IRQHandler(void); 61 | #endif 62 | 63 | void USART2_IRQHandler(void) 64 | { 65 | #if PM25_UART_TYPE == HW_UART_TYPE 66 | HW_USART2_IRQHandler(); 67 | #endif 68 | if(USART2->SR & USART_SR_TXE) 69 | { 70 | uint8_t data = 0; 71 | 72 | USART2->SR &= ~ (USART_SR_TXE); 73 | if(! uart_fifo_pull(&uart_q, &data)) 74 | { 75 | USART2->DR = (data & (uint16_t)0x01FF); 76 | } 77 | else 78 | { 79 | DIS_USART_TXEIE(); 80 | } 81 | } 82 | } 83 | 84 | -------------------------------------------------------------------------------- /Dev/Driver/src/wifi_queue.c: -------------------------------------------------------------------------------- 1 | 2 | #include "wifi_queue.h" 3 | 4 | static QueueMemType wifi_rx_buf[WIFI_UART_RX_BUF_SIZE] = {0}; 5 | static QueueMemType wifi_tx_buf[WIFI_UART_TX_BUF_SIZE] = {0}; 6 | 7 | T_QueueObj WifiQObj; 8 | 9 | 10 | 11 | void WifiQueue_Init(void) 12 | { 13 | Queue_InstanceInit(&WifiQObj, 14 | WIFI_USART, 15 | WIFI_UART_BAUDRATE, 16 | wifi_tx_buf, 17 | WIFI_UART_TX_BUF_SIZE, 18 | wifi_rx_buf, 19 | WIFI_UART_RX_BUF_SIZE, 20 | WIFI_USART_Init, 21 | queue_enable_tx_int, 22 | queue_disable_tx_int, 23 | queue_enable_rx_int, 24 | queue_disable_rx_int); 25 | } 26 | 27 | -------------------------------------------------------------------------------- /Library/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 | -------------------------------------------------------------------------------- /Library/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 | -------------------------------------------------------------------------------- /Library/src/stm32f10x_flash.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaberOnGo/AirDog/e741a01c44aee19c57c81071a268d98cc484962a/Library/src/stm32f10x_flash.c -------------------------------------------------------------------------------- /Library/src/stm32f10x_i2c.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaberOnGo/AirDog/e741a01c44aee19c57c81071a268d98cc484962a/Library/src/stm32f10x_i2c.c -------------------------------------------------------------------------------- /Library/src/stm32f10x_usart.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaberOnGo/AirDog/e741a01c44aee19c57c81071a268d98cc484962a/Library/src/stm32f10x_usart.c -------------------------------------------------------------------------------- /OS/inc/os_timer.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef __OS_TIMER_H__ 3 | #define __OS_TIMER_H__ 4 | 5 | #include "os_global.h" 6 | #include 7 | 8 | 9 | 10 | #define TIMER_DEBUG_EN 0 11 | 12 | #if TIMER_DEBUG_EN 13 | #define TIMER_DEBUG os_printf 14 | #else 15 | #define TIMER_DEBUG(...) 16 | #endif 17 | 18 | #define OS_TIMER_FLAG_DEACTIVATED 0x00 // 去激活定时器 19 | #define OS_TIMER_FLAG_ACTIVATED 0x01 // 激活定时器 20 | #define OS_TIMER_FLAG_ONE_SHOT 0x00 // 单次定时 21 | #define OS_TIMER_FLAG_PERIODIC 0x02 // 周期定时 22 | 23 | #define OS_TIMER_FLAG_PARAM_INITED 0x80 // 表明定时器参数已初始化 24 | 25 | #define TIMER_ONE 0 // 只定时一次 26 | #define TIMER_REPEAT 1 // 重复定时 27 | 28 | typedef void (*timeout_callback)(void * param); 29 | struct struct_os_timer; 30 | 31 | typedef void os_timer_func_t(void *timer_arg); 32 | 33 | 34 | 35 | 36 | typedef struct struct_os_timer 37 | { 38 | struct struct_os_timer * prev; // 2B 39 | struct struct_os_timer * next; // 2B 40 | uint8_t flag; 41 | uint32_t init_tick; 42 | uint32_t timeout_tick; 43 | timeout_callback timeout_func; // 2B 44 | void * param; 45 | }T_OS_TIMER; 46 | typedef T_OS_TIMER os_timer_t; 47 | 48 | void OS_TimerInit(T_OS_TIMER * timer, timeout_callback timeout_func, void * param, uint32_t time, uint8_t flag); 49 | OS_RESULT OS_TimerStart(T_OS_TIMER * timer); 50 | void OS_TimerStop(T_OS_TIMER * timer); 51 | uint8_t OS_TimerIsStop(T_OS_TIMER * timer); 52 | void OS_TimerCheck(void); 53 | void OS_TimerTickIncrease(uint32_t tick); 54 | //void OS_TimerTask(void); 55 | 56 | #define os_timer_disarm(timer) OS_TimerStop(timer) 57 | #if 0 58 | void os_timer_setfn(os_timer_t *timer, os_timer_func_t * func, void *parg) // 函数实现 59 | #else 60 | #define os_timer_setfn(timer, func, parg) OS_TimerInit(timer, func, parg, 0, 0) // 宏实现 61 | #endif 62 | void os_timer_arm(os_timer_t * timer, uint32_t tick, uint8_t is_repeat); 63 | #define os_timer_is_stop(timer) OS_TimerIsStop(timer) 64 | 65 | #endif 66 | 67 | 68 | -------------------------------------------------------------------------------- /Project/AirDog.plg: -------------------------------------------------------------------------------- 1 | 2 | 3 |
 4 | 

礦ision Build Log

5 |

Project:

6 | H:\MCU_file\MCU_File\STM32\STM Code\STM Mine\Lesson\2_Lesson_10_08\Pro\2_Lession_GPIO_2015_10_11.uvproj 7 | Project File Date: 10/11/2015 8 | 9 |

Output:

10 | Rebuild target 'Target 1' 11 | creating preprocessor file for misc.c... 12 | compiling misc.c... 13 | creating preprocessor file for stm32f10x_rcc.c... 14 | compiling stm32f10x_rcc.c... 15 | creating preprocessor file for stm32f10x_gpio.c... 16 | compiling stm32f10x_gpio.c... 17 | creating preprocessor file for stm32f10x_fsmc.c... 18 | compiling stm32f10x_fsmc.c... 19 | creating preprocessor file for main.c... 20 | compiling main.c... 21 | creating preprocessor file for stm32f10x_it.c... 22 | compiling stm32f10x_it.c... 23 | creating preprocessor file for delay.c... 24 | compiling delay.c... 25 | creating preprocessor file for led.c... 26 | compiling led.c... 27 | creating preprocessor file for fsmc.c... 28 | compiling fsmc.c... 29 | creating preprocessor file for tft.c... 30 | compiling tft.c... 31 | creating preprocessor file for usart.c... 32 | compiling usart.c... 33 | creating preprocessor file for core_cm3.c... 34 | compiling core_cm3.c... 35 | creating preprocessor file for system_stm32f10x.c... 36 | compiling system_stm32f10x.c... 37 | assembling startup_stm32f10x_hd.s... 38 | linking... 39 | ..\Obj\2_Lession_GPIO_2015_10_11.axf: Error: L6218E: Undefined symbol assert_failed (referred from misc.o). 40 | Target not created 41 | -------------------------------------------------------------------------------- /Project/JLinkSettings.ini: -------------------------------------------------------------------------------- 1 | [BREAKPOINTS] 2 | ShowInfoWin = 1 3 | EnableFlashBP = 2 4 | BPDuringExecution = 0 5 | [CFI] 6 | CFISize = 0x00 7 | CFIAddr = 0x00 8 | [CPU] 9 | OverrideMemMap = 0 10 | AllowSimulation = 1 11 | ScriptFile="" 12 | [FLASH] 13 | MinNumBytesFlashDL = 0 14 | SkipProgOnCRCMatch = 1 15 | VerifyDownload = 1 16 | AllowCaching = 1 17 | EnableFlashDL = 2 18 | Override = 0 19 | Device="AD7160" 20 | [GENERAL] 21 | WorkRAMSize = 0x00 22 | WorkRAMAddr = 0x00 23 | [SWO] 24 | SWOLogFile="" 25 | [MEM] 26 | RdOverrideOrMask = 0x00 27 | RdOverrideAndMask = 0xFFFFFFFF 28 | RdOverrideAddr = 0xFFFFFFFF 29 | WrOverrideOrMask = 0x00 30 | WrOverrideAndMask = 0xFFFFFFFF 31 | WrOverrideAddr = 0xFFFFFFFF 32 | -------------------------------------------------------------------------------- /Project/Target 1.BAT: -------------------------------------------------------------------------------- 1 | SET PATH=D:\InstalledSoft\MDK_454\ARM\BIN40;D:\360 data\STM8_TOOL\asm;C:\Program Files\STMicroelectronics\st_toolset\asm;C:\windows\system32;C:\Program Files\Java\jdk1.7.0_25\bin;C:\Program Files\Java\jdk1.7.0_25\jre\bin;C:\windows;C:\windows\System32\Wbem;C:\windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\ATI Technologies\ATI.ACE\Core-Static;D:\360 data\study sofware\MTLAB\runtime\win32;D:\360 data\study sofware\MTLAB\bin;c:\Program Files\Common Files\Ulead Systems\MPEG;D:\360 data\Altium Designer 6.9\System;H:\Android\adt\bundle\sdk\tools;D:\360 data\study sofware\WinMerge\WinMerge;E:\tomcat_servers\apache-tomcat-7.0.42-windows-x86\apache-tomcat-7.0.42\bin;H:\Android\adt\bundle\sdk\platform-tools;D:\360 data\code_doc_mange\doxygen\doxygen\bin;D:\360 data\Calibre\;E:\Eclipse\eclipse_4.3.0_C;E:\Eclipse\Mingw/bin;C:\Python27\Scripts;C:\Program Files\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\;C:\Program Files\Windows Kits\8.0\Windows Performance Toolkit\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;E:\Eclipse\eclipse_4.3.0_C; 2 | SET ARMCC41INC=D:\InstalledSoft\MDK_454\ARM\RV31\Inc 3 | SET ARMCC41LIB=D:\InstalledSoft\MDK_454\ARM\RV31\Lib 4 | SET CPU_TYPE=STM32F103C8 5 | SET CPU_VENDOR=STMicroelectronics 6 | SET UV2_TARGET=Target 1 7 | SET CPU_CLOCK=0x007A1200 8 | "D:\InstalledSoft\MDK_454\ARM\BIN40\ArmCC" --Via ".\List\misc._ip" 9 | "D:\InstalledSoft\MDK_454\ARM\BIN40\ArmCC" --Via ".\obj\misc.__i" 10 | "D:\InstalledSoft\MDK_454\ARM\BIN40\ArmCC" --Via ".\List\STM32F~1._IP" 11 | "D:\InstalledSoft\MDK_454\ARM\BIN40\ArmCC" --Via ".\obj\stm32f10x_rcc.__i" 12 | "D:\InstalledSoft\MDK_454\ARM\BIN40\ArmCC" --Via ".\List\STM32F~2._IP" 13 | "D:\InstalledSoft\MDK_454\ARM\BIN40\ArmCC" --Via ".\obj\stm32f10x_gpio.__i" 14 | "D:\InstalledSoft\MDK_454\ARM\BIN40\ArmCC" --Via ".\List\STM32F~3._IP" 15 | "D:\InstalledSoft\MDK_454\ARM\BIN40\ArmCC" --Via ".\obj\stm32f10x_fsmc.__i" 16 | "D:\InstalledSoft\MDK_454\ARM\BIN40\ArmCC" --Via ".\List\main._ip" 17 | "D:\InstalledSoft\MDK_454\ARM\BIN40\ArmCC" --Via ".\obj\main.__i" 18 | "D:\InstalledSoft\MDK_454\ARM\BIN40\ArmCC" --Via ".\List\STM32F~4._IP" 19 | "D:\InstalledSoft\MDK_454\ARM\BIN40\ArmCC" --Via ".\obj\stm32f10x_it.__i" 20 | "D:\InstalledSoft\MDK_454\ARM\BIN40\ArmCC" --Via ".\List\core_cm3._ip" 21 | "D:\InstalledSoft\MDK_454\ARM\BIN40\ArmCC" --Via ".\obj\core_cm3.__i" 22 | "D:\InstalledSoft\MDK_454\ARM\BIN40\ArmCC" --Via ".\List\SYSTEM~1._IP" 23 | "D:\InstalledSoft\MDK_454\ARM\BIN40\ArmCC" --Via ".\obj\system_stm32f10x.__i" 24 | "D:\InstalledSoft\MDK_454\ARM\BIN40\ArmAsm" --Via ".\obj\startup_stm32f10x_hd._ia" 25 | "D:\InstalledSoft\MDK_454\ARM\BIN40\ArmLink" --Via ".\Obj\1_PM25Sensor_0221.lnp" 26 | -------------------------------------------------------------------------------- /SI/1_AirDog_180713.IAB: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaberOnGo/AirDog/e741a01c44aee19c57c81071a268d98cc484962a/SI/1_AirDog_180713.IAB -------------------------------------------------------------------------------- /SI/1_AirDog_180713.IAD: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaberOnGo/AirDog/e741a01c44aee19c57c81071a268d98cc484962a/SI/1_AirDog_180713.IAD -------------------------------------------------------------------------------- /SI/1_AirDog_180713.IMB: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaberOnGo/AirDog/e741a01c44aee19c57c81071a268d98cc484962a/SI/1_AirDog_180713.IMB -------------------------------------------------------------------------------- /SI/1_AirDog_180713.IMD: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaberOnGo/AirDog/e741a01c44aee19c57c81071a268d98cc484962a/SI/1_AirDog_180713.IMD -------------------------------------------------------------------------------- /SI/1_AirDog_180713.PFI: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaberOnGo/AirDog/e741a01c44aee19c57c81071a268d98cc484962a/SI/1_AirDog_180713.PFI -------------------------------------------------------------------------------- /SI/1_AirDog_180713.PO: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaberOnGo/AirDog/e741a01c44aee19c57c81071a268d98cc484962a/SI/1_AirDog_180713.PO -------------------------------------------------------------------------------- /SI/1_AirDog_180713.PR: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaberOnGo/AirDog/e741a01c44aee19c57c81071a268d98cc484962a/SI/1_AirDog_180713.PR -------------------------------------------------------------------------------- /SI/1_AirDog_180713.PRI: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaberOnGo/AirDog/e741a01c44aee19c57c81071a268d98cc484962a/SI/1_AirDog_180713.PRI -------------------------------------------------------------------------------- /SI/1_AirDog_180713.PS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaberOnGo/AirDog/e741a01c44aee19c57c81071a268d98cc484962a/SI/1_AirDog_180713.PS -------------------------------------------------------------------------------- /SI/1_AirDog_180713.SearchResults: -------------------------------------------------------------------------------- 1 | ---- LCD_Ctrl_Set Matches (15 in 9 files) ---- 2 | board_AirDog_V10.c (dev\bsp):void LCD_Ctrl_Set(E_SW_STATE sta) 3 | board_AirDog_V10.c (dev\bsp): LCD_Ctrl_Set(SW_OPEN); 4 | board_AirDog_V10.h (dev\bsp):void LCD_Ctrl_Set(E_SW_STATE sta); 5 | board_AirDog_V11.c (dev\bsp):void LCD_Ctrl_Set(E_SW_STATE sta) 6 | board_AirDog_V11.c (dev\bsp): LCD_Ctrl_Set(sta); 7 | board_AirDog_V11.c (dev\bsp): LCD_Ctrl_Set(SW_OPEN); 8 | board_AirDog_V11.h (dev\bsp):void LCD_Ctrl_Set(E_SW_STATE sta); 9 | board_AirDog_V12.c (dev\bsp):void LCD_Ctrl_Set(E_SW_STATE sta) 10 | board_AirDog_V12.c (dev\bsp): //LCD_Ctrl_Set(sta); 11 | board_AirDog_V12.h (dev\bsp):void LCD_Ctrl_Set(E_SW_STATE sta); 12 | board_AT_V1203.c (dev\bsp):void LCD_Ctrl_Set(E_SW_STATE sta) 13 | board_AT_V1203.c (dev\bsp): LCD_Ctrl_Set(SW_OPEN); 14 | board_AT_V1203.h (dev\bsp):void LCD_Ctrl_Set(E_SW_STATE sta); 15 | ExtiDrv.c (dev\driver\src): LCD_Ctrl_Set(SW_OPEN); 16 | ExtiDrv.c (dev\driver\src): LCD_Ctrl_Set(SW_CLOSE); 17 | -------------------------------------------------------------------------------- /SI/1_AirDog_180713.WK3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaberOnGo/AirDog/e741a01c44aee19c57c81071a268d98cc484962a/SI/1_AirDog_180713.WK3 -------------------------------------------------------------------------------- /SI/新建文本文档.txt: -------------------------------------------------------------------------------- 1 | 5cfb3 2 | 55fd1 3 | c44df 4 | 49db5 5 | 152cb 6 | 1104b 7 | b8 8 | 9 | PM2.5 10 | PM10 11 | HCHO 12 | Temp 13 | Humi 14 | TVOC 15 | CO2 -------------------------------------------------------------------------------- /System/CMSIS/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 | -------------------------------------------------------------------------------- /User/inc/Application.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef __APPLICATION_H__ 3 | #define __APPLICATION_H__ 4 | 5 | void AppInit(void); 6 | void SysClockConfig(void); 7 | void PowerCtrl_SetClock(void); 8 | void RCC_PeriphInit(void); 9 | void NVIC_Configuration(void); 10 | uint8_t App_GetRunMode(void); 11 | void App_StartCO2BackgndCali(void); 12 | void SysClockHSEConfig(void); 13 | 14 | #define SOFT_VERSION "HV1.32 SV1.86" 15 | 16 | #endif 17 | 18 | -------------------------------------------------------------------------------- /User/inc/SDRR.h: -------------------------------------------------------------------------------- 1 | 2 | /******************** Sensor Data Record Repository 传感器数据记录存储头文件 *********************** */ 3 | #ifndef __SDRR_H__ 4 | #define __SDRR_H__ 5 | 6 | #include "GlobalDef.h" 7 | 8 | // 传感器枚举 9 | typedef enum 10 | { 11 | SENSOR_PM25 = 0, 12 | SENSOR_HCHO = 1, 13 | SENSOR_TEMP = 2, 14 | SENSOR_HUMI = 3, 15 | 16 | SENSOR_Light = 4, 17 | SENSOR_TVOC = 5, 18 | SENSOR_CO2 = 6, 19 | 20 | SENSOR_CO = 7, 21 | SENSOR_PM10, // PM10 22 | SENSOR_BATTERY, // 电池 23 | SENSOR_TIME, 24 | 25 | SENSOR_0P3_UM, // PM0.3 粒子计数 26 | SENSOR_PM10_UM, // PM10 粒子计数 27 | SENSOR_RESERVED, // 保留 28 | 29 | SENSOR_END, 30 | }E_SnsType; 31 | 32 | typedef struct struct_sensor_item T_SENSOR_ITEM; 33 | typedef struct struct_fl_sns_item T_FL_SNS_ITEM; 34 | 35 | 36 | // 每个扇区内能保存的传感器条目数 37 | #define ITEM_SIZE_PER_SECTOR (4096L / sizeof(T_FL_SNS_ITEM)) 38 | 39 | 40 | extern char sector_buf[]; 41 | 42 | extern T_SENSOR_ITEM tSDRR; 43 | 44 | #define SNS_ITEM_LEN 85 // 单条传感器条目的字符串长度 45 | 46 | 47 | void SDRR_Init(void); 48 | void FILE_ReadConfig(void); 49 | E_RESULT SDRR_PushItemToFile(T_SENSOR_ITEM * item); 50 | E_RESULT SDRR_SaveSensorPoint(E_SnsType type, void * data); 51 | uint32_t FILE_GetLastItemIndex(uint32_t time_stamp); 52 | 53 | 54 | 55 | #endif 56 | 57 | -------------------------------------------------------------------------------- /User/inc/board_version.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef __BOARD_VERSION_H__ 3 | #define __BOARD_VERSION_H__ 4 | 5 | //#include "board_V1_2_3.h" 6 | //#include "board_AT_V1203.h" 7 | #include "board_AirDog_V12.h" 8 | 9 | #endif 10 | 11 | -------------------------------------------------------------------------------- /User/inc/cfg_variable.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaberOnGo/AirDog/e741a01c44aee19c57c81071a268d98cc484962a/User/inc/cfg_variable.h -------------------------------------------------------------------------------- /User/inc/stm32f10x_conf.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file GPIO/IOToggle/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 | -------------------------------------------------------------------------------- /User/inc/stm32f10x_it.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file DAC/DualModeDMA_SineWave/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 | /* Includes ------------------------------------------------------------------*/ 27 | #include "stm32f10x.h" 28 | 29 | /* Exported types ------------------------------------------------------------*/ 30 | /* Exported constants --------------------------------------------------------*/ 31 | /* Exported macro ------------------------------------------------------------*/ 32 | /* Exported functions ------------------------------------------------------- */ 33 | 34 | void NMI_Handler(void); 35 | void HardFault_Handler(void); 36 | void MemManage_Handler(void); 37 | void BusFault_Handler(void); 38 | void UsageFault_Handler(void); 39 | void SVC_Handler(void); 40 | void DebugMon_Handler(void); 41 | void PendSV_Handler(void); 42 | void SysTick_Handler(void); 43 | 44 | #ifndef STM32F10X_CL 45 | void USB_HP_CAN1_TX_IRQHandler(void); 46 | void USB_LP_CAN1_RX0_IRQHandler(void); 47 | #endif /* STM32F10X_CL */ 48 | 49 | #if defined(STM32F10X_HD) || defined(STM32F10X_XL) 50 | void SDIO_IRQHandler(void); 51 | #endif /* STM32F10X_HD | STM32F10X_XL */ 52 | 53 | #ifdef STM32F10X_CL 54 | void OTG_FS_IRQHandler(void); 55 | #endif /* STM32F10X_CL */ 56 | 57 | 58 | #endif /* __STM32F10x_IT_H */ 59 | 60 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ 61 | -------------------------------------------------------------------------------- /User/src/cfg_variable.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaberOnGo/AirDog/e741a01c44aee19c57c81071a268d98cc484962a/User/src/cfg_variable.c -------------------------------------------------------------------------------- /User/src/main.c: -------------------------------------------------------------------------------- 1 | 2 | #include "GlobalDef.h" 3 | #include "Application.h" 4 | #include "os_timer.h" 5 | #include "TimerManager.h" 6 | #include "gizwits_port.h" 7 | #include "key_drv.h" 8 | #include "board_version.h" 9 | 10 | extern void Sensor_SetHCHOCaliBase(void); 11 | 12 | int main(void) 13 | { 14 | //uint16_t key_result; 15 | //uint32_t pressed_time; 16 | 17 | AppInit(); 18 | while(1) 19 | { 20 | if(flag10ms) 21 | { 22 | flag10ms = 0; 23 | key_result = key_read(); 24 | key_process(key_result); 25 | } 26 | 27 | 28 | if(flag_switch) 29 | { 30 | OS_TimerCheck(); 31 | } 32 | else 33 | { 34 | #if GIZWITS_TYPE 35 | gizwits_user_task(); 36 | #endif 37 | 38 | } 39 | 40 | if(KEY_INPUT == 0 ) 41 | { 42 | App_StartCO2BackgndCali(); 43 | Sensor_SetHCHOCaliBase(); 44 | while(!KEY_INPUT); 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /bin/AirDog-App-HV1.32 SV1.86.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaberOnGo/AirDog/e741a01c44aee19c57c81071a268d98cc484962a/bin/AirDog-App-HV1.32 SV1.86.bin -------------------------------------------------------------------------------- /bin/AirDog-App-HV1.32 SV1.87.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaberOnGo/AirDog/e741a01c44aee19c57c81071a268d98cc484962a/bin/AirDog-App-HV1.32 SV1.87.bin -------------------------------------------------------------------------------- /bin/AirDog-App-HV1.32 SV2.02.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaberOnGo/AirDog/e741a01c44aee19c57c81071a268d98cc484962a/bin/AirDog-App-HV1.32 SV2.02.bin -------------------------------------------------------------------------------- /bin/AirDog-App-HV1.32 SV2.05.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaberOnGo/AirDog/e741a01c44aee19c57c81071a268d98cc484962a/bin/AirDog-App-HV1.32 SV2.05.bin -------------------------------------------------------------------------------- /bin/readme.txt: -------------------------------------------------------------------------------- 1 | booloader文件烧写地址: 0x08000000, 最大: 32KB 2 | 应用程序文件烧写地址: 0x08008000, 最大 200 KB 3 | 4 | bootloader rom address: 0x08000000, max: 32KB, range: 0x08000000 ~ 0x08007FFF 5 | application rom address: 0x08008000, max: 200 KB 6 | 7 | 8 | 9 | Application: 10 | 11 | 【1】 AirDog-App-HV1.32 SV1.86.bin: 12 | 1 fix always charging, do not prompt the problem of full charge. 13 | 2 increase the calibration of formaldehyde 14 | 3 increase debug file redirection to file system 15 | 16 | 17 | 【2】 AirDog-App-HV1.32 SV1.87.bin 18 | fix: 19 | 1 Repair temperature and humidity can not be displayed 20 | 21 | AirDog-App-HV1.32 SV1.87.bin 版本修复: 22 | 1 温湿度不能显示的问题 23 | 24 | 【3】 25 | 文件名: AirDog-App-HV1.32 SV2.02.bin 26 | 版本号: HV1.32 SV2.02 27 | 修复问题: 与 IOS & Android APP 匹配固件 28 | 29 | 30 | 【4】 31 | 文件名: AirDog-App-HV1.32 SV2.05.bin 32 | 版本号:HV1.32 SV2.05 33 | 修复问题: 电池充电状态和电量无法正确显示 34 | 35 | FileName: AirDog-App-HV1.32 SV2.05.bin 36 | Version: HV1.32 SV2.05 37 | Bug Fixed: Battery charge status and battery level are not displayed correctly. 38 | 39 | 【如何升级?】 40 | 见文档: https://github.com/SaberOnGo/AirDog/blob/master/doc/AIRDOG%E7%A9%BA%E6%B0%94%E8%B4%A8%E9%87%8F%E6%A3%80%E6%B5%8B%E4%BB%AA%E8%AF%B4%E6%98%8E%E4%B9%A6-V0.3-PDF-Ver.pdf 41 | 42 | 【How To Upgrade Firmware ?】 43 | Please see the Doc: 44 | https://github.com/SaberOnGo/AirDog/blob/master/doc/AIRDOG_%20Instruction%20manual-V0.3-PDF-Ver.pdf 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /doc/AIRDOG_ Instruction manual-V0.3-PDF-Ver.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaberOnGo/AirDog/e741a01c44aee19c57c81071a268d98cc484962a/doc/AIRDOG_ Instruction manual-V0.3-PDF-Ver.pdf -------------------------------------------------------------------------------- /doc/AIRDOG_ Instruction manual-V0.3.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaberOnGo/AirDog/e741a01c44aee19c57c81071a268d98cc484962a/doc/AIRDOG_ Instruction manual-V0.3.docx -------------------------------------------------------------------------------- /doc/AIRDOG空气质量检测仪说明书-V0.3-PDF-Ver.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaberOnGo/AirDog/e741a01c44aee19c57c81071a268d98cc484962a/doc/AIRDOG空气质量检测仪说明书-V0.3-PDF-Ver.pdf -------------------------------------------------------------------------------- /doc/AIRDOG空气质量检测仪说明书-V0.3.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaberOnGo/AirDog/e741a01c44aee19c57c81071a268d98cc484962a/doc/AIRDOG空气质量检测仪说明书-V0.3.docx -------------------------------------------------------------------------------- /doc/APP文件/AIRDOG_安卓APP.apk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaberOnGo/AirDog/e741a01c44aee19c57c81071a268d98cc484962a/doc/APP文件/AIRDOG_安卓APP.apk -------------------------------------------------------------------------------- /doc/APP文件/Android.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaberOnGo/AirDog/e741a01c44aee19c57c81071a268d98cc484962a/doc/APP文件/Android.zip -------------------------------------------------------------------------------- /doc/Data Sheet/3A-Switch-Charger-ETA974X.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaberOnGo/AirDog/e741a01c44aee19c57c81071a268d98cc484962a/doc/Data Sheet/3A-Switch-Charger-ETA974X.zip -------------------------------------------------------------------------------- /doc/Data Sheet/Handling manual Size Counts.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaberOnGo/AirDog/e741a01c44aee19c57c81071a268d98cc484962a/doc/Data Sheet/Handling manual Size Counts.pdf -------------------------------------------------------------------------------- /doc/Data Sheet/Modbus documentation Size Counts.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaberOnGo/AirDog/e741a01c44aee19c57c81071a268d98cc484962a/doc/Data Sheet/Modbus documentation Size Counts.pdf -------------------------------------------------------------------------------- /doc/Data Sheet/Operation-Manual-for-HCHO-Module-final.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaberOnGo/AirDog/e741a01c44aee19c57c81071a268d98cc484962a/doc/Data Sheet/Operation-Manual-for-HCHO-Module-final.pdf -------------------------------------------------------------------------------- /doc/Data Sheet/PMS7003-攀藤激光传感器数据手册.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaberOnGo/AirDog/e741a01c44aee19c57c81071a268d98cc484962a/doc/Data Sheet/PMS7003-攀藤激光传感器数据手册.pdf -------------------------------------------------------------------------------- /doc/Data Sheet/RM0090-CN.rar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaberOnGo/AirDog/e741a01c44aee19c57c81071a268d98cc484962a/doc/Data Sheet/RM0090-CN.rar -------------------------------------------------------------------------------- /doc/Data Sheet/RM0090-EN.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaberOnGo/AirDog/e741a01c44aee19c57c81071a268d98cc484962a/doc/Data Sheet/RM0090-EN.pdf -------------------------------------------------------------------------------- /doc/Data Sheet/S8 LP Product sheet.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaberOnGo/AirDog/e741a01c44aee19c57c81071a268d98cc484962a/doc/Data Sheet/S8 LP Product sheet.pdf -------------------------------------------------------------------------------- /doc/Data Sheet/S8 LP Product specification.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaberOnGo/AirDog/e741a01c44aee19c57c81071a268d98cc484962a/doc/Data Sheet/S8 LP Product specification.pdf -------------------------------------------------------------------------------- /doc/Data Sheet/SADK S8 Installation manual.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaberOnGo/AirDog/e741a01c44aee19c57c81071a268d98cc484962a/doc/Data Sheet/SADK S8 Installation manual.pdf -------------------------------------------------------------------------------- /doc/Data Sheet/SHT20 中文技术手册 (1).rar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaberOnGo/AirDog/e741a01c44aee19c57c81071a268d98cc484962a/doc/Data Sheet/SHT20 中文技术手册 (1).rar -------------------------------------------------------------------------------- /doc/Data Sheet/STM32F103xC-xD-xE-datasheet.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaberOnGo/AirDog/e741a01c44aee19c57c81071a268d98cc484962a/doc/Data Sheet/STM32F103xC-xD-xE-datasheet.pdf -------------------------------------------------------------------------------- /doc/Data Sheet/Sensirion_Humidity_Sensors_SHT20_Datasheet.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaberOnGo/AirDog/e741a01c44aee19c57c81071a268d98cc484962a/doc/Data Sheet/Sensirion_Humidity_Sensors_SHT20_Datasheet.pdf -------------------------------------------------------------------------------- /doc/Data Sheet/ZM01-VOCs-Winsensor-CN.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaberOnGo/AirDog/e741a01c44aee19c57c81071a268d98cc484962a/doc/Data Sheet/ZM01-VOCs-Winsensor-CN.pdf -------------------------------------------------------------------------------- /doc/Data Sheet/plantower-pms5003-manual_v2-3.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaberOnGo/AirDog/e741a01c44aee19c57c81071a268d98cc484962a/doc/Data Sheet/plantower-pms5003-manual_v2-3.pdf -------------------------------------------------------------------------------- /doc/Data Sheet/达特WZ-S型甲醛检测模组.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaberOnGo/AirDog/e741a01c44aee19c57c81071a268d98cc484962a/doc/Data Sheet/达特WZ-S型甲醛检测模组.pdf -------------------------------------------------------------------------------- /doc/disk config file/config.txt: -------------------------------------------------------------------------------- 1 | #gap: 0-600, 0: default: 60 seconds to save sensor data 2 | #action: 0-2; 0: do nothing; 1: set rtc time for only once; 2: set rtc time every time when system is powered 3 | #gap: 系统每隔几秒保存传感器数据,默认30秒, 将会记录在SD卡或FLASH的/sensor/目录下 4 | #设置时间方法: 修改好date, time时间后, 将action设置为1,即action=1, 重新开机,即可 5 | #FirstLcdBackLightSec: 第一次开机背光时间, 默认180秒 6 | #LcdBackLightSec:无动作后屏幕等待进入休眠时间, 默认45秒 7 | #SnsRemainRunTime: 无动作后传感器等待关闭时间, 默认5分钟(300) 8 | 9 | gap=30 10 | date=2018-11-30 11 | time=15:40:30 12 | action=0 13 | FirstLcdBackLightSec=180 14 | LcdBackLightSec=60 15 | SnsRemainRunTime=65535 16 | product_key="5cfb355fd1c44df49db5152cb1104bb8" 17 | product_secret="27e232cf2d4344febbc27e6982e55706" 18 | -------------------------------------------------------------------------------- /doc/disk config file/default: -------------------------------------------------------------------------------- 1 | font=1 2 | wifi_en=1 3 | dbg_file=1 4 | DiskFreeSize=1024 5 | -------------------------------------------------------------------------------- /doc/disk config file/font/22.7z: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaberOnGo/AirDog/e741a01c44aee19c57c81071a268d98cc484962a/doc/disk config file/font/22.7z -------------------------------------------------------------------------------- /doc/disk config file/font/22.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaberOnGo/AirDog/e741a01c44aee19c57c81071a268d98cc484962a/doc/disk config file/font/22.bin -------------------------------------------------------------------------------- /doc/disk config file/sensor/40-06-08.txt: -------------------------------------------------------------------------------- 1 | Number Date-Time PM2.5 PM10 HCHO TVOC Temp Humi Battery CO2 CO Reserved 2 | 0-65535 Y-Mon-Day HH:MM:SS ug/m3 ug/m3 ppb ppb 'C % % ppm ppm reserved 3 | -------------------------------------------------------------------------------- /doc/disk config file/sensor/sensor_data.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaberOnGo/AirDog/e741a01c44aee19c57c81071a268d98cc484962a/doc/disk config file/sensor/sensor_data.txt -------------------------------------------------------------------------------- /doc/disk config file/system: -------------------------------------------------------------------------------- 1 | product_key="5cfb355fd1c44df49db5152cb1104bb8" 2 | product_secret="27e232cf2d4344febbc27e6982e55706" 3 | 4 | -------------------------------------------------------------------------------- /doc/dv: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /doc/pcb/16-AirDog_V1.311_180920.~(3).PcbDoc.Zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaberOnGo/AirDog/e741a01c44aee19c57c81071a268d98cc484962a/doc/pcb/16-AirDog_V1.311_180920.~(3).PcbDoc.Zip -------------------------------------------------------------------------------- /doc/pcb/AirDog_V1.307_2018-03-29_1.~(2).PcbDoc.Zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaberOnGo/AirDog/e741a01c44aee19c57c81071a268d98cc484962a/doc/pcb/AirDog_V1.307_2018-03-29_1.~(2).PcbDoc.Zip -------------------------------------------------------------------------------- /doc/schematic/16-AirDog_V1.311-180114.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaberOnGo/AirDog/e741a01c44aee19c57c81071a268d98cc484962a/doc/schematic/16-AirDog_V1.311-180114.pdf -------------------------------------------------------------------------------- /doc/schematic/readme.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaberOnGo/AirDog/e741a01c44aee19c57c81071a268d98cc484962a/doc/schematic/readme.txt -------------------------------------------------------------------------------- /uCOS-II/Ports/os_cpu_a.asm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaberOnGo/AirDog/e741a01c44aee19c57c81071a268d98cc484962a/uCOS-II/Ports/os_cpu_a.asm --------------------------------------------------------------------------------