├── Common ├── Common.c └── Common.h ├── ESP8266 ├── bsp_esp8266.c └── bsp_esp8266.h ├── Flash ├── flash.c ├── flash.h ├── spi_flash.c └── spi_flash.h ├── README.md ├── RTC ├── rtc.c └── rtc.h ├── SysTick ├── bsp_SysTick.c └── bsp_SysTick.h ├── TIM2 ├── tim2.c └── tim2.h ├── Test ├── test.c └── test.h ├── device ├── HX711.c ├── HX711.h ├── delay.c ├── delay.h ├── device.c ├── device.h ├── sys.c └── sys.h ├── dht11 ├── bsp_dht11.c └── bsp_dht11.h ├── led ├── led.c └── led.h ├── main.c ├── network ├── network.c └── network.h ├── stm32f10x_conf.h ├── stm32f10x_it.c ├── stm32f10x_it.h ├── struct ├── linked_list.c └── linked_list.h └── usart ├── bsp_usart1.c └── bsp_usart1.h /Common/Common.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ooxoop/PetFeeder/20be0f81184a0dcbafa720be15d778d8192869bc/Common/Common.c -------------------------------------------------------------------------------- /Common/Common.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ooxoop/PetFeeder/20be0f81184a0dcbafa720be15d778d8192869bc/Common/Common.h -------------------------------------------------------------------------------- /ESP8266/bsp_esp8266.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ooxoop/PetFeeder/20be0f81184a0dcbafa720be15d778d8192869bc/ESP8266/bsp_esp8266.c -------------------------------------------------------------------------------- /ESP8266/bsp_esp8266.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ooxoop/PetFeeder/20be0f81184a0dcbafa720be15d778d8192869bc/ESP8266/bsp_esp8266.h -------------------------------------------------------------------------------- /Flash/flash.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ooxoop/PetFeeder/20be0f81184a0dcbafa720be15d778d8192869bc/Flash/flash.c -------------------------------------------------------------------------------- /Flash/flash.h: -------------------------------------------------------------------------------- 1 | #ifndef __FLASH_H 2 | #define __FLASH_H 3 | 4 | #include "stm32f10x.h" 5 | 6 | uint8_t* getFlashData(void); 7 | void setFlashData(uint8_t*); 8 | char* getClientID(void); 9 | uint8_t* flash_strcpy(uint8_t*, uint8_t*); 10 | char* flash_getData(char*); 11 | int isFirstUse(void); 12 | 13 | 14 | 15 | #endif 16 | -------------------------------------------------------------------------------- /Flash/spi_flash.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ooxoop/PetFeeder/20be0f81184a0dcbafa720be15d778d8192869bc/Flash/spi_flash.c -------------------------------------------------------------------------------- /Flash/spi_flash.h: -------------------------------------------------------------------------------- 1 | #ifndef __SPI_FLASH_H 2 | #define __SPI_FLASH_H 3 | 4 | #include "stm32f10x.h" 5 | 6 | #define SPI_FLASH_SPI SPI1 7 | #define SPI_FLASH_SPI_CLK RCC_APB2Periph_SPI1 8 | #define SPI_FLASH_SPI_SCK_PIN GPIO_Pin_5 /* PA.05 */ 9 | #define SPI_FLASH_SPI_SCK_GPIO_PORT GPIOA /* GPIOA */ 10 | #define SPI_FLASH_SPI_SCK_GPIO_CLK RCC_APB2Periph_GPIOA 11 | #define SPI_FLASH_SPI_MISO_PIN GPIO_Pin_6 /* PA.06 */ 12 | #define SPI_FLASH_SPI_MISO_GPIO_PORT GPIOA /* GPIOA */ 13 | #define SPI_FLASH_SPI_MISO_GPIO_CLK RCC_APB2Periph_GPIOA 14 | #define SPI_FLASH_SPI_MOSI_PIN GPIO_Pin_7 /* PA.07 */ 15 | #define SPI_FLASH_SPI_MOSI_GPIO_PORT GPIOA /* GPIOA */ 16 | #define SPI_FLASH_SPI_MOSI_GPIO_CLK RCC_APB2Periph_GPIOA 17 | #define SPI_FLASH_CS_PIN GPIO_Pin_4 /* PC.04 */ 18 | #define SPI_FLASH_CS_GPIO_PORT GPIOA /* GPIOC */ 19 | #define SPI_FLASH_CS_GPIO_CLK RCC_APB2Periph_GPIOA 20 | 21 | 22 | #define SPI_FLASH_CS_LOW() GPIO_ResetBits(GPIOA, GPIO_Pin_4) 23 | #define SPI_FLASH_CS_HIGH() GPIO_SetBits(GPIOA, GPIO_Pin_4) 24 | 25 | 26 | void SPI_FLASH_Init(void); 27 | void SPI_FLASH_SectorErase(u32 SectorAddr); 28 | void SPI_FLASH_BulkErase(void); 29 | void SPI_FLASH_PageWrite(u8* pBuffer, u32 WriteAddr, u16 NumByteToWrite); 30 | void SPI_FLASH_BufferWrite(u8* pBuffer, u32 WriteAddr, u16 NumByteToWrite); 31 | void SPI_FLASH_BufferRead(u8* pBuffer, u32 ReadAddr, u16 NumByteToRead); 32 | u32 SPI_FLASH_ReadID(void); 33 | u32 SPI_FLASH_ReadDeviceID(void); 34 | void SPI_FLASH_StartReadSequence(u32 ReadAddr); 35 | void SPI_Flash_PowerDown(void); 36 | void SPI_Flash_WAKEUP(void); 37 | 38 | 39 | u8 SPI_FLASH_ReadByte(void); 40 | u8 SPI_FLASH_SendByte(u8 byte); 41 | u16 SPI_FLASH_SendHalfWord(u16 HalfWord); 42 | void SPI_FLASH_WriteEnable(void); 43 | void SPI_FLASH_WaitForWriteEnd(void); 44 | 45 | #endif /* __SPI_FLASH_H */ 46 | 47 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # PetFeeder 2 | 基于STM32的一个智能宠物喂食系统 3 | -------------------------------------------------------------------------------- /RTC/rtc.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ooxoop/PetFeeder/20be0f81184a0dcbafa720be15d778d8192869bc/RTC/rtc.c -------------------------------------------------------------------------------- /RTC/rtc.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ooxoop/PetFeeder/20be0f81184a0dcbafa720be15d778d8192869bc/RTC/rtc.h -------------------------------------------------------------------------------- /SysTick/bsp_SysTick.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ooxoop/PetFeeder/20be0f81184a0dcbafa720be15d778d8192869bc/SysTick/bsp_SysTick.c -------------------------------------------------------------------------------- /SysTick/bsp_SysTick.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ooxoop/PetFeeder/20be0f81184a0dcbafa720be15d778d8192869bc/SysTick/bsp_SysTick.h -------------------------------------------------------------------------------- /TIM2/tim2.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ooxoop/PetFeeder/20be0f81184a0dcbafa720be15d778d8192869bc/TIM2/tim2.c -------------------------------------------------------------------------------- /TIM2/tim2.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ooxoop/PetFeeder/20be0f81184a0dcbafa720be15d778d8192869bc/TIM2/tim2.h -------------------------------------------------------------------------------- /Test/test.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ooxoop/PetFeeder/20be0f81184a0dcbafa720be15d778d8192869bc/Test/test.c -------------------------------------------------------------------------------- /Test/test.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ooxoop/PetFeeder/20be0f81184a0dcbafa720be15d778d8192869bc/Test/test.h -------------------------------------------------------------------------------- /device/HX711.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ooxoop/PetFeeder/20be0f81184a0dcbafa720be15d778d8192869bc/device/HX711.c -------------------------------------------------------------------------------- /device/HX711.h: -------------------------------------------------------------------------------- 1 | #ifndef __HX711_H 2 | #define __HX711_H 3 | 4 | #include "sys.h" 5 | 6 | #define HX711_SCK PBout(0)// PB0 7 | #define HX711_DOUT PBin(1)// PB1 8 | 9 | extern int w; 10 | 11 | extern void Init_HX711pin(void); 12 | extern u32 HX711_Read(void); 13 | extern void Get_Maopi(void); 14 | extern void Get_Weight(void); 15 | 16 | extern u32 HX711_Buffer; 17 | extern u32 Weight_Maopi; 18 | extern s32 Weight_Shiwu; 19 | extern u8 Flag_Error; 20 | 21 | #endif 22 | 23 | -------------------------------------------------------------------------------- /device/delay.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ooxoop/PetFeeder/20be0f81184a0dcbafa720be15d778d8192869bc/device/delay.c -------------------------------------------------------------------------------- /device/delay.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ooxoop/PetFeeder/20be0f81184a0dcbafa720be15d778d8192869bc/device/delay.h -------------------------------------------------------------------------------- /device/device.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ooxoop/PetFeeder/20be0f81184a0dcbafa720be15d778d8192869bc/device/device.c -------------------------------------------------------------------------------- /device/device.h: -------------------------------------------------------------------------------- 1 | #ifndef __DEVICE_H 2 | #define __DEVICE_H 3 | 4 | #include "stm32f10x.h" 5 | 6 | extern int Motor_Status; 7 | 8 | void motor_init(void); 9 | void motor_status(int); 10 | 11 | #endif 12 | -------------------------------------------------------------------------------- /device/sys.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ooxoop/PetFeeder/20be0f81184a0dcbafa720be15d778d8192869bc/device/sys.c -------------------------------------------------------------------------------- /device/sys.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ooxoop/PetFeeder/20be0f81184a0dcbafa720be15d778d8192869bc/device/sys.h -------------------------------------------------------------------------------- /dht11/bsp_dht11.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ooxoop/PetFeeder/20be0f81184a0dcbafa720be15d778d8192869bc/dht11/bsp_dht11.c -------------------------------------------------------------------------------- /dht11/bsp_dht11.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ooxoop/PetFeeder/20be0f81184a0dcbafa720be15d778d8192869bc/dht11/bsp_dht11.h -------------------------------------------------------------------------------- /led/led.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ooxoop/PetFeeder/20be0f81184a0dcbafa720be15d778d8192869bc/led/led.c -------------------------------------------------------------------------------- /led/led.h: -------------------------------------------------------------------------------- 1 | #ifndef __LED_H 2 | #define __LED_H 3 | 4 | void led_Init(void); 5 | void led1_status(int); 6 | void led2_status(int); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /main.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ooxoop/PetFeeder/20be0f81184a0dcbafa720be15d778d8192869bc/main.c -------------------------------------------------------------------------------- /network/network.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ooxoop/PetFeeder/20be0f81184a0dcbafa720be15d778d8192869bc/network/network.c -------------------------------------------------------------------------------- /network/network.h: -------------------------------------------------------------------------------- 1 | #ifndef __NETWORK_H 2 | #define __NETWORK_H 3 | 4 | #include "stm32f10x.h" 5 | 6 | void net_linkToServer(int); 7 | void net_bind(void); 8 | void net_receive(char *); 9 | void net_status(void); 10 | 11 | 12 | 13 | #endif 14 | 15 | -------------------------------------------------------------------------------- /stm32f10x_conf.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file Project/STM32F10x_StdPeriph_Template/stm32f10x_conf.h 4 | * @author MCD Application Team 5 | * @version V3.5.0 6 | * @date 08-April-2011 7 | * @brief Library configuration file. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 12 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 13 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 14 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 15 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 16 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 17 | * 18 | *

© COPYRIGHT 2011 STMicroelectronics

19 | ****************************************************************************** 20 | */ 21 | 22 | /* Define to prevent recursive inclusion -------------------------------------*/ 23 | #ifndef __STM32F10x_CONF_H 24 | #define __STM32F10x_CONF_H 25 | 26 | /* Includes ------------------------------------------------------------------*/ 27 | /* Uncomment/Comment the line below to enable/disable peripheral header file inclusion */ 28 | //#include "stm32f10x_adc.h" 29 | #include "stm32f10x_bkp.h" 30 | //#include "stm32f10x_can.h" 31 | //#include "stm32f10x_cec.h" 32 | //#include "stm32f10x_crc.h" 33 | //#include "stm32f10x_dac.h" 34 | //#include "stm32f10x_dbgmcu.h" 35 | //#include "stm32f10x_dma.h" 36 | //#include "stm32f10x_exti.h" 37 | //#include "stm32f10x_flash.h" 38 | //#include "stm32f10x_fsmc.h" 39 | #include "stm32f10x_gpio.h" 40 | //#include "stm32f10x_i2c.h" 41 | //#include "stm32f10x_iwdg.h" 42 | #include "stm32f10x_pwr.h" 43 | #include "stm32f10x_rcc.h" 44 | #include "stm32f10x_rtc.h" 45 | //#include "stm32f10x_sdio.h" 46 | #include "stm32f10x_spi.h" 47 | #include "stm32f10x_tim.h" 48 | #include "stm32f10x_usart.h" 49 | //#include "stm32f10x_wwdg.h" 50 | #include "misc.h" /* High level functions for NVIC and SysTick (add-on to CMSIS functions) */ 51 | 52 | /* Exported types ------------------------------------------------------------*/ 53 | /* Exported constants --------------------------------------------------------*/ 54 | /* Uncomment the line below to expanse the "assert_param" macro in the 55 | Standard Peripheral Library drivers code */ 56 | /* #define USE_FULL_ASSERT 1 */ 57 | 58 | /* Exported macro ------------------------------------------------------------*/ 59 | #ifdef USE_FULL_ASSERT 60 | 61 | /** 62 | * @brief The assert_param macro is used for function's parameters check. 63 | * @param expr: If expr is false, it calls assert_failed function which reports 64 | * the name of the source file and the source line number of the call 65 | * that failed. If expr is true, it returns no value. 66 | * @retval None 67 | */ 68 | #define assert_param(expr) ((expr) ? (void)0 : assert_failed((uint8_t *)__FILE__, __LINE__)) 69 | /* Exported functions ------------------------------------------------------- */ 70 | void assert_failed(uint8_t* file, uint32_t line); 71 | #else 72 | #define assert_param(expr) ((void)0) 73 | #endif /* USE_FULL_ASSERT */ 74 | 75 | #endif /* __STM32F10x_CONF_H */ 76 | 77 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ 78 | -------------------------------------------------------------------------------- /stm32f10x_it.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ooxoop/PetFeeder/20be0f81184a0dcbafa720be15d778d8192869bc/stm32f10x_it.c -------------------------------------------------------------------------------- /stm32f10x_it.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file Project/STM32F10x_StdPeriph_Template/stm32f10x_it.h 4 | * @author MCD Application Team 5 | * @version V3.5.0 6 | * @date 08-April-2011 7 | * @brief This file contains the headers of the interrupt handlers. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 12 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 13 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 14 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 15 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 16 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 17 | * 18 | *

© COPYRIGHT 2011 STMicroelectronics

19 | ****************************************************************************** 20 | */ 21 | 22 | /* Define to prevent recursive inclusion -------------------------------------*/ 23 | #ifndef __STM32F10x_IT_H 24 | #define __STM32F10x_IT_H 25 | 26 | #ifdef __cplusplus 27 | extern "C" { 28 | #endif 29 | 30 | /* Includes ------------------------------------------------------------------*/ 31 | #include "stm32f10x.h" 32 | 33 | /* Exported types ------------------------------------------------------------*/ 34 | /* Exported constants --------------------------------------------------------*/ 35 | /* Exported macro ------------------------------------------------------------*/ 36 | /* Exported functions ------------------------------------------------------- */ 37 | 38 | void NMI_Handler(void); 39 | void HardFault_Handler(void); 40 | void MemManage_Handler(void); 41 | void BusFault_Handler(void); 42 | void UsageFault_Handler(void); 43 | void SVC_Handler(void); 44 | void DebugMon_Handler(void); 45 | void PendSV_Handler(void); 46 | void SysTick_Handler(void); 47 | 48 | #ifdef __cplusplus 49 | } 50 | #endif 51 | 52 | #endif /* __STM32F10x_IT_H */ 53 | 54 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ 55 | -------------------------------------------------------------------------------- /struct/linked_list.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ooxoop/PetFeeder/20be0f81184a0dcbafa720be15d778d8192869bc/struct/linked_list.c -------------------------------------------------------------------------------- /struct/linked_list.h: -------------------------------------------------------------------------------- 1 | #ifndef __LINKLIST_LIST_H 2 | #define __LINKLIST_LIST_H 3 | 4 | #include 5 | #include 6 | 7 | 8 | 9 | typedef struct LinkNode{ 10 | int timecount; 11 | int weight; 12 | struct LinkNode *pNext; 13 | }node, *pNode; 14 | 15 | 16 | pNode list_saveDiet(char*); 17 | void list_free(pNode pHead); 18 | 19 | extern pNode pList; 20 | 21 | //extern node pNode; 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /usart/bsp_usart1.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ooxoop/PetFeeder/20be0f81184a0dcbafa720be15d778d8192869bc/usart/bsp_usart1.c -------------------------------------------------------------------------------- /usart/bsp_usart1.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ooxoop/PetFeeder/20be0f81184a0dcbafa720be15d778d8192869bc/usart/bsp_usart1.h --------------------------------------------------------------------------------