Browse Source

完成debug、全部功能

master
htujun 3 years ago
parent
commit
5142c3562f
  1. 4
      stm32/HARDWARE/DCmotor/motor.h
  2. 74
      stm32/HARDWARE/DHT11/dht11.c
  3. 265
      stm32/HARDWARE/DS1302/DS1302.c
  4. 86
      stm32/HARDWARE/DS1302/DS1302.h
  5. 4
      stm32/HARDWARE/LED/led.c
  6. 4
      stm32/HARDWARE/LED/led.h
  7. BIN
      stm32/OBJ/Template.axf
  8. 26
      stm32/OBJ/Template.build_log.htm
  9. 2099
      stm32/OBJ/Template.hex
  10. 1390
      stm32/OBJ/Template.htm
  11. 16
      stm32/OBJ/Template_Target 1.dep
  12. BIN
      stm32/OBJ/dht11.crf
  13. BIN
      stm32/OBJ/dht11.o
  14. BIN
      stm32/OBJ/ds1302.crf
  15. 31
      stm32/OBJ/ds1302.d
  16. BIN
      stm32/OBJ/ds1302.o
  17. BIN
      stm32/OBJ/led.crf
  18. BIN
      stm32/OBJ/led.o
  19. BIN
      stm32/OBJ/main.crf
  20. BIN
      stm32/OBJ/main.o
  21. BIN
      stm32/OBJ/motor.crf
  22. BIN
      stm32/OBJ/motor.o
  23. BIN
      stm32/OBJ/timer.crf
  24. BIN
      stm32/OBJ/timer.o
  25. 107
      stm32/USER/.vscode/c_cpp_properties.json
  26. 4
      stm32/USER/.vscode/keil-assistant.log
  27. 2
      stm32/USER/.vscode/uv4.log
  28. 1
      stm32/USER/.vscode/uv4.log.lock
  29. 1062
      stm32/USER/Template.map
  30. 50
      stm32/USER/Template.uvguix.QY
  31. 130
      stm32/USER/main.c
  32. 2
      wifi/WiFiTelnetToSerial/WiFiTelnetToSerial.ino

4
stm32/HARDWARE/DCmotor/motor.h

@ -3,8 +3,8 @@ @@ -3,8 +3,8 @@
#include "sys.h"
#define FAN PCout(14) // PC12
#define CLEAN PCout(13) // PC13
#define MOTOR PCout(14) // PC12
#define FAN PCout(13) // PC13
void motor_Init(void);//<EFBFBD><EFBFBD><EFBFBD>IO<EFBFBD>ڳ<EFBFBD>ʼ<EFBFBD><EFBFBD>

74
stm32/HARDWARE/DHT11/dht11.c

@ -5,50 +5,50 @@ void DHT11_IO_IN(void) @@ -5,50 +5,50 @@ void DHT11_IO_IN(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB, ENABLE); //使能PB端口时钟
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB, ENABLE); //ʹ<EFBFBD><EFBFBD>PB<EFBFBD>˿<EFBFBD>ʱ<EFBFBD><EFBFBD>
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_15; //PG11端口配置
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_15; //PG11<EFBFBD>˿<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPU; //
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(GPIOB, &GPIO_InitStructure); //初始化IO口
GPIO_Init(GPIOB, &GPIO_InitStructure); //<EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD>IO<EFBFBD><EFBFBD>
}
void DHT11_IO_OUT(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB, ENABLE); //使能PB端口时钟
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB, ENABLE); //ʹ<EFBFBD><EFBFBD>PB<EFBFBD>˿<EFBFBD>ʱ<EFBFBD><EFBFBD>
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_15; //PG11端口配置
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_15; //PG11<EFBFBD>˿<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; //
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(GPIOB, &GPIO_InitStructure); //初始化IO口
GPIO_Init(GPIOB, &GPIO_InitStructure); //<EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD>IO<EFBFBD><EFBFBD>
}
//复位DHT11
//<EFBFBD><EFBFBD>λDHT11
void DHT11_Rst(void)
{
DHT11_IO_OUT(); //SET OUTPUT
DHT11_DQ_OUT=0; //拉低DQ54热水澡
delay_ms(20); //拉低至少18ms
DHT11_DQ_OUT=0; //<EFBFBD><EFBFBD><EFBFBD><EFBFBD>DQ54<EFBFBD><EFBFBD>ˮ<EFBFBD><EFBFBD>
delay_ms(20); //<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>18ms
DHT11_DQ_OUT=1; //DQ=1
delay_us(30); //主机拉高20~40us
delay_us(30); //<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>20~40us
}
//等待DHT11的回应
//返回1:未检测到DHT11的存在
//返回0:存在
//<EFBFBD>ȴ<EFBFBD>DHT11<EFBFBD>Ļ<EFBFBD>Ӧ
//<EFBFBD><EFBFBD><EFBFBD><EFBFBD>1:δ<EFBFBD><EFBFBD>⵽DHT11<EFBFBD>Ĵ<EFBFBD><EFBFBD><EFBFBD>
//<EFBFBD><EFBFBD><EFBFBD><EFBFBD>0:<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
u8 DHT11_Check(void)
{
u8 retry=0;
DHT11_IO_IN();//SET INPUT
while (DHT11_DQ_IN&&retry<100)//DHT11会拉低40~80us
while (DHT11_DQ_IN&&retry<100)//DHT11<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>40~80us
{
retry++;
delay_us(1);
};
if(retry>=100)return 1;
else retry=0;
while (!DHT11_DQ_IN&&retry<100)//DHT11拉低后会再次拉高40~80us
while (!DHT11_DQ_IN&&retry<100)//DHT11<EFBFBD><EFBFBD><EFBFBD>ͺ<EFBFBD><EFBFBD><EFBFBD>ٴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>40~80us
{
retry++;
delay_us(1);
@ -56,28 +56,28 @@ u8 DHT11_Check(void) @@ -56,28 +56,28 @@ u8 DHT11_Check(void)
if(retry>=100)return 1;
return 0;
}
//从DHT11读取一个位
//返回值:1/0
//<EFBFBD><EFBFBD>DHT11<EFBFBD><EFBFBD>ȡһ<EFBFBD><EFBFBD>λ
//<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD>1/0
u8 DHT11_Read_Bit(void)
{
u8 retry=0;
while(DHT11_DQ_IN&&retry<100)//等待变为低电平
while(DHT11_DQ_IN&&retry<100)//<EFBFBD>ȴ<EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD>͵<EFBFBD>ƽ
{
retry++;
delay_us(1);
}
retry=0;
while(!DHT11_DQ_IN&&retry<100)//等待变高电平
while(!DHT11_DQ_IN&&retry<100)//<EFBFBD>ȴ<EFBFBD><EFBFBD><EFBFBD>ߵ<EFBFBD>ƽ
{
retry++;
delay_us(1);
}
delay_us(40);//等待40us
delay_us(40);//<EFBFBD>ȴ<EFBFBD>40us
if(DHT11_DQ_IN)return 1;
else return 0;
}
//从DHT11读取一个字节
//返回值:读到的数据
//<EFBFBD><EFBFBD>DHT11<EFBFBD><EFBFBD>ȡһ<EFBFBD><EFBFBD><EFBFBD>ֽ<EFBFBD>
//<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
u8 DHT11_Read_Byte(void)
{
u8 i,dat;
@ -89,10 +89,10 @@ u8 DHT11_Read_Byte(void) @@ -89,10 +89,10 @@ u8 DHT11_Read_Byte(void)
}
return dat;
}
//从DHT11读取一次数据
//temp:温度值(范围:0~50°)
//humi:湿度值(范围:20%~90%)
//返回值:0,正常;1,读取失败
//<EFBFBD><EFBFBD>DHT11<EFBFBD><EFBFBD>ȡһ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
//temp:<EFBFBD><EFBFBD>ֵ(<EFBFBD><EFBFBD>Χ:0~50<EFBFBD><EFBFBD>)
//humi:ʪ<EFBFBD><EFBFBD>ֵ(<EFBFBD><EFBFBD>Χ:20%~90%)
//<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD>0,<EFBFBD><EFBFBD><EFBFBD><EFBFBD>;1,<EFBFBD><EFBFBD>ȡʧ<EFBFBD><EFBFBD>
u8 DHT11_Read_Data(u8 *temp,u8 *humi)
{
u8 buf[5];
@ -100,7 +100,7 @@ u8 DHT11_Read_Data(u8 *temp,u8 *humi) @@ -100,7 +100,7 @@ u8 DHT11_Read_Data(u8 *temp,u8 *humi)
DHT11_Rst();
if(DHT11_Check()==0)
{
for(i=0;i<5;i++)//读取40位数据
for(i=0;i<5;i++)//<EFBFBD><EFBFBD>ȡ40λ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
{
buf[i]=DHT11_Read_Byte();
}
@ -112,23 +112,23 @@ u8 DHT11_Read_Data(u8 *temp,u8 *humi) @@ -112,23 +112,23 @@ u8 DHT11_Read_Data(u8 *temp,u8 *humi)
}else return 1;
return 0;
}
//初始化DHT11的IO口 DQ 同时检测DHT11的存在
//返回1:不存在
//返回0:存在
//<EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD>DHT11<EFBFBD><EFBFBD>IO<EFBFBD><EFBFBD> DQ ͬʱ<EFBFBD><EFBFBD><EFBFBD>DHT11<EFBFBD>Ĵ<EFBFBD><EFBFBD><EFBFBD>
//<EFBFBD><EFBFBD><EFBFBD><EFBFBD>1:<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
//<EFBFBD><EFBFBD><EFBFBD><EFBFBD>0:<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
u8 DHT11_Init(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB, ENABLE); //使能PB端口时钟
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB, ENABLE); //ʹ<EFBFBD><EFBFBD>PB<EFBFBD>˿<EFBFBD>ʱ<EFBFBD><EFBFBD>
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_15; //PG11端口配置
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; //推挽输出
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_15; //PG11<EFBFBD>˿<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; //<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(GPIOB, &GPIO_InitStructure); //初始化IO口
GPIO_SetBits(GPIOB,GPIO_Pin_15); //PG11 输出高
GPIO_Init(GPIOB, &GPIO_InitStructure); //<EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD>IO<EFBFBD><EFBFBD>
GPIO_SetBits(GPIOB,GPIO_Pin_15); //PG11 <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
DHT11_Rst(); //复位DHT11
return DHT11_Check();//等待DHT11的回应
DHT11_Rst(); //<EFBFBD><EFBFBD>λDHT11
return DHT11_Check();//<EFBFBD>ȴ<EFBFBD>DHT11<EFBFBD>Ļ<EFBFBD>Ӧ
}

265
stm32/HARDWARE/DS1302/DS1302.c

@ -0,0 +1,265 @@ @@ -0,0 +1,265 @@
#include"DS1302.h"
/*****************************************
* void DS1302_GPIOInit(void)
* DS1302 GPIO配置
*
*
*
CLK---PB5,
IO--->PB6,
RES--->PB7,
*************************************/
void DS1302_GPIOInit(void)
{
GPIO_InitTypeDef GPIO_InitStructre;
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB,ENABLE); /*open GPIO clock*/
GPIO_InitStructre.GPIO_Pin= GPIO_Pin_5|GPIO_Pin_6|GPIO_Pin_7;
GPIO_InitStructre.GPIO_Speed=GPIO_Speed_50MHz;
GPIO_InitStructre.GPIO_Mode=GPIO_Mode_Out_PP;
GPIO_Init(DS1302_PORT, &GPIO_InitStructre);
}
/*****************************************
* void DS1302_IO_GPIO(void)
* DS1302 IO GPIO
* FLAG标志位
*
* OUT:IN:
FLAG
*************************************/
void DS1302_IO_GPIO(uchar FLAG)
{
GPIO_InitTypeDef GPIO_InitStructre;
//RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB,ENABLE); /*open GPIO clock*/
/**********配置数据IO端口 输出 **********/
if(FLAG==0x01)
{
GPIO_InitStructre.GPIO_Pin= GPIO_Pin_6;//配置IO_GPIO
GPIO_InitStructre.GPIO_Speed=GPIO_Speed_50MHz;
GPIO_InitStructre.GPIO_Mode=GPIO_Mode_Out_PP;
GPIO_Init(DS1302_PORT, &GPIO_InitStructre);
}
/**********配置数据IO端口 输入**********/
else if(FLAG==0x00)
{
GPIO_InitStructre.GPIO_Pin= GPIO_Pin_6;//配置IO_GPIO
GPIO_InitStructre.GPIO_Speed=GPIO_Speed_50MHz;
GPIO_InitStructre.GPIO_Mode=GPIO_Mode_IPU; //配置上拉输入
GPIO_Init(DS1302_PORT, &GPIO_InitStructre);
}
}
/*****************************************
* void DS1302_delay(u8 dd)
*
*
*
*
*************************************/
void DS1302_delay(u8 dd)
{
u8 i;
for(;dd>0;dd--)
for(i=110;i>0;i--);
}
/*****************************************
* void DS1302_Write(uchar add,uchar dat)
* DS1302写指令和数据
* add:dat
*
*
*************************************/
void DS1302_Write(uchar add,uchar dat)
{
uchar i,temp1,temp2;
temp1=add;
temp2=dat;
RES_Set_1;//RET=1;
//发送地址
for(i=0;i<8;i++)
{
if(temp1&0x01)
{IO_Set_1; } //IO=1;
else
{ IO_Reset_0;} //IO=0;
temp1=temp1>>1;
CLK_Set_1; //CLK=1;
DS1302_delay(2);
CLK_Reset_0; //CLK=0;
}
//发送数据
for(i=0;i<8;i++)
{
/*IO=(temp2>>i)&0x01;这一句代替下面屏蔽的内容 */
if(temp2&0x01)
{IO_Set_1; } //IO=1;
else
{ IO_Reset_0;} //IO=0;
temp2=temp2>>1;
CLK_Set_1; //CLK=1;
DS1302_delay(2);
CLK_Reset_0; //CLK=0;
}
RES_Reset_0;// RET=0;
}
/*****************************************
* uchar DS1302_Read(uchar add)
* DS1302读数据
* add:
*
*
*************************************/
uchar DS1302_Read(uchar add)
{
uchar i,suf,temp,mm,nn,value;
temp=add;
RES_Set_1;//RET=1;
//写地址
for(i=0;i<8;i++)
{
if(temp&0x01)
{IO_Set_1; } //IO=1;
else
{ IO_Reset_0;} //IO=0;
temp=temp>>1;
CLK_Set_1; //CLK=1;
DS1302_delay(2);
CLK_Reset_0; //CLK=0;
}
//读数据
DS1302_IO_GPIO(IN);//配置IO为输入
for(i=0;i<8;i++)
{
suf=suf>>1;//读数据变量
if(IO_Read) //IO=1
{
suf=suf|0x80;
}
else //IO=0
{
suf=suf&0x7f;
}
CLK_Set_1; //CLK=1;
DS1302_delay(2);
CLK_Reset_0; //CLK=0;
}
RES_Reset_0; // RET=0;
DS1302_IO_GPIO(OUT);//配置IO为输出,恢复正常状态
//数据处理转化十进制
mm=suf/16;
nn=suf%16;
value=mm*10+nn;
return value;
}
/*****************************************
* void DS1302_SetTime(uchar *ad)
* DS1302
* add:
*
*
*************************************/
void DS1302_SetTime(uchar *ad)
{
DS1302_Write(0x8e,0x00); //WP=0 允许数据写入DS1302
/**********以下对时分秒的初始化*************/
DS1302_Write(ds1302_sec_addr,ad[5]); //秒
DS1302_Write(ds1302_min_addr,ad[4]); //分
DS1302_Write(ds1302_hour_addr,ad[3]); //时
/**********以下对年月日的初始化*************/
DS1302_Write(ds1302_day_addr,ad[2]);
DS1302_Write(ds1302_month_addr,ad[1]);
DS1302_Write(ds1302_year_addr,ad[0]);
DS1302_Write(0x8e,0x80); //0x8e控制字节地址,bit7=WP WP=1 禁止数据写入DS1302
}
/*****************************************
* void DS1302_OFF(void)
* DS1302时间禁止走时
*
*
*
*************************************/
void DS1302_OFF(void)
{
uchar temp;
temp=DS1302_Read(0x81);//读取表地址时间
DS1302_Write(0x8e,0x00);//WP=0 允许数据写入DS1302
temp=temp|(1<<7);
DS1302_Write(0x80,temp);//WP=1 禁止数据写入DS1302
}
/*****************************************
* void DS1302_ON(void)
* DS1302时间开始运行
*
*
*
*************************************/
void DS1302_ON(void)
{
uchar temp;
temp=DS1302_Read(0x81);
DS1302_Write(0x8e,0x00);//WP=0 允许数据写入DS1302
temp=temp|(0<<7);
DS1302_Write(0x80,temp);//WP=0 允许数据写入DS1302
}
/*****************************************
* void DS1302_init(uchar *time)
* DS1302初始化
*
*
*
*************************************/
void DS1302_init(uchar *time)
{
DS1302_GPIOInit();//GPIO初始化配置
DS1302_delay(2);
RES_Reset_0; //RET=0;
CLK_Reset_0;// CLK=0;
//下面是对DS1302启动电池,不掉电 设置时间
DS1302_Write(0x8e,0x00);//WP=0 允许数据写入DS1302
DS1302_Write(0x90,0xA7);//充电(1个二极管+8K电阻)
DS1302_Write(0x8E,0X80);//开启保护 WP=1
if(DS1302_Read(0X81)&0X80)//查询DS302时钟是否启动,如果时钟停止走动:启动时钟+初始化时钟
{
DS1302_SetTime(time);//设置设置初始时钟
}
//否则跳过
}
/*****************************************
* void DS1302_Readtime(void)
* DS1302时间读出
*
*
*
*************************************/
void DS1302_Readtime(void)
{
nowTime.year = DS1302_Read( 0x8D);
nowTime.mon = DS1302_Read( 0x89);
nowTime.day = DS1302_Read( 0x87);
nowTime.hour = DS1302_Read( 0x85);
nowTime.min = DS1302_Read( 0x83);
nowTime.sec = DS1302_Read( 0x81);
}

86
stm32/HARDWARE/DS1302/DS1302.h

@ -0,0 +1,86 @@ @@ -0,0 +1,86 @@
/*
* @Author: your name
* @Date: 2022-04-12 22:48:31
* @LastEditTime: 2022-04-13 00:45:47
* @LastEditors: your name
* @Description: koroFileHeader查看配置 : https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
* @FilePath: \20220410-IntelligentPiggery\stm32\HARDWARE\DS1302\DS1302.h
*/
#ifndef __DS1302_H__
#define __DS1302_H__
#include <stm32f10x.h>
#define uchar unsigned char
#define uint unsigned int
/***DS1302时钟芯片****************************/
//CLK--->PB5
//IO---->PB6
//RES--->PB7
/****************************/
#define OUT 0x01
#define IN 0x00
typedef int BOOL;
#define TRUE 1
#define FALSE 0
struct ctime{
int day;
int hour;
int min;
int sec;
};
struct timing{
int year;
int mon;
int day;
int hour;
int min;
int sec;
BOOL run;
BOOL alive;
struct ctime time;
};
extern struct timing nowTime;
//extern uchar Settime[6]={0x17,0x04,0x18,0x16,0x57,0x30}; //设置时间函数
#define DS1302_PORT GPIOB
#define CLK_Reset_0 GPIOB->BRR=GPIO_Pin_5
#define CLK_Set_1 GPIOB->BSRR=GPIO_Pin_5
#define IO_Reset_0 GPIOB->BRR=GPIO_Pin_6
#define IO_Set_1 GPIOB->BSRR=GPIO_Pin_6
#define RES_Reset_0 GPIOB->BRR=GPIO_Pin_7
#define RES_Set_1 GPIOB->BSRR=GPIO_Pin_7
#define IO_Read GPIO_ReadInputDataBit(GPIOB,GPIO_Pin_6)
/*************************/
#define Time_24_Hour 0x00 //24小时制
#define Time_Start 0x00 //开始走时
//DS1302寄存器操作指令定义时间地址
#define ds1302_sec_addr 0x80 //秒
#define ds1302_min_addr 0x82 //分
#define ds1302_hour_addr 0x84 //时
#define ds1302_day_addr 0x86 //日
#define ds1302_month_addr 0x88 //月
#define ds1302_year_addr 0x8c //年
/********************/
void DS1302_GPIOInit(void);
void DS1302_IO_GPIO(uchar FLAG);//配置IO的方向
void DS1302_delay(u8 dd);
void DS1302_Write(uchar add,uchar dat);
uchar DS1302_Read(uchar add);
void DS1302_SetTime(uchar *ad);
void DS1302_OFF(void);
void DS1302_ON(void);
void DS1302_init(uchar *time);
void DS1302_Readtime(void);
#endif

4
stm32/HARDWARE/LED/led.c

@ -1,7 +1,7 @@ @@ -1,7 +1,7 @@
/*
* @Author: your name
* @Date: 2022-04-10 10:08:56
* @LastEditTime: 2022-04-13 03:15:55
* @LastEditTime: 2022-04-16 14:47:16
* @LastEditors: Please set LastEditors
* @Description: koroFileHeader查看配置 : https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
* @FilePath: \20220410-IntelligentPiggery\stm32\HARDWARE\LED\led.c
@ -23,7 +23,7 @@ void LED_Init(void) @@ -23,7 +23,7 @@ void LED_Init(void)
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; //IO<EFBFBD><EFBFBD><EFBFBD>ٶ<EFBFBD>Ϊ50MHz
GPIO_Init(GPIOB, &GPIO_InitStructure); //<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD>GPIOA.8
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_15;
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_15 | GPIO_Pin_11;
GPIO_Init(GPIOA, &GPIO_InitStructure);
GPIO_SetBits(GPIOB,GPIO_Pin_12 | GPIO_Pin_13 | GPIO_Pin_14 ); //PA.8 <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
}

4
stm32/HARDWARE/LED/led.h

@ -1,7 +1,7 @@ @@ -1,7 +1,7 @@
/*
* @Author: your name
* @Date: 2022-04-10 10:08:56
* @LastEditTime: 2022-04-13 03:15:41
* @LastEditTime: 2022-04-16 14:47:34
* @LastEditors: Please set LastEditors
* @Description: koroFileHeader查看配置 : https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%A
* @FilePath: \20220410-IntelligentPiggery\stm32\HARDWARE\LED\led.h
@ -19,7 +19,7 @@ @@ -19,7 +19,7 @@
// 水枪
#define LED_WATER_GUN PBout(14) // PB7
#define BEEP PAout(15)
#define BEEP PAout(11)
void LED_Init(void);//<EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD>
void Relay_Beep_Init(void);

BIN
stm32/OBJ/Template.axf

Binary file not shown.

26
stm32/OBJ/Template.build_log.htm

@ -21,7 +21,7 @@ Target DLL: STLink\ST-LINKIII-KEIL_SWO.dll V3.0.1.0 @@ -21,7 +21,7 @@ Target DLL: STLink\ST-LINKIII-KEIL_SWO.dll V3.0.1.0
Dialog DLL: TCM.DLL V1.35.1.0
<h2>Project:</h2>
E:\ÏîÄ¿\¼æÖ°ÏîÄ¿\20220410-IntelligentPiggery\stm32\USER\Template.uvprojx
e:\ÏîÄ¿\¼æÖ°ÏîÄ¿\20220410-IntelligentPiggery\stm32\USER\Template.uvprojx
Project File Date: 04/12/2022
<h2>Output:</h2>
@ -30,27 +30,23 @@ Build target 'Target 1' @@ -30,27 +30,23 @@ Build target 'Target 1'
compiling main.c...
..\HARDWARE\DS1302\DS1302.h(86): warning: #1-D: last line of file ends without a newline
#endif
main.c(46): warning: #1295-D: Deprecated declaration SendUserInfo - give arg types
main.c(50): warning: #1295-D: Deprecated declaration SendUserInfo - give arg types
void SendUserInfo();
main.c(47): warning: #1295-D: Deprecated declaration SendTime - give arg types
main.c(51): warning: #1295-D: Deprecated declaration SendTime - give arg types
void SendTime();
main.c(52): warning: #187-D: use of "=" where "==" may have been intended
if(flag = 0){
main.c(51): warning: #550-D: variable "flag" was set but never used
static int flag = 0, time_min = 0;
main.c(152): warning: #42-D: operand types are incompatible ("char *" and "u8 *")
main.c(226): warning: #42-D: operand types are incompatible ("char *" and "u8 *")
target1 = strstr((const char*)USART_RX_BUF, "(") - USART_RX_BUF;
main.c(152): warning: #993-D: subtraction of pointer types "char *" and "u8 *" is nonstandard
main.c(226): warning: #993-D: subtraction of pointer types "char *" and "u8 *" is nonstandard
target1 = strstr((const char*)USART_RX_BUF, "(") - USART_RX_BUF;
main.c(153): warning: #42-D: operand types are incompatible ("char *" and "u8 *")
main.c(227): warning: #42-D: operand types are incompatible ("char *" and "u8 *")
target2 = strstr((const char*)USART_RX_BUF, ")") - USART_RX_BUF;
main.c(153): warning: #993-D: subtraction of pointer types "char *" and "u8 *" is nonstandard
main.c(227): warning: #993-D: subtraction of pointer types "char *" and "u8 *" is nonstandard
target2 = strstr((const char*)USART_RX_BUF, ")") - USART_RX_BUF;
main.c: 9 warnings, 0 errors
main.c: 7 warnings, 0 errors
linking...
Program Size: Code=16028 RO-data=344 RW-data=96 ZI-data=1384
Program Size: Code=16604 RO-data=396 RW-data=100 ZI-data=1388
FromELF: creating hex file...
"..\OBJ\Template.axf" - 0 Error(s), 9 Warning(s).
"..\OBJ\Template.axf" - 0 Error(s), 7 Warning(s).
<h2>Software Packages used:</h2>
@ -64,7 +60,7 @@ Package Vendor: Keil @@ -64,7 +60,7 @@ Package Vendor: Keil
D:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\2.3.0\Device\Include
<h2>Collection of Component Files used:</h2>
Build Time Elapsed: 00:00:01
Build Time Elapsed: 00:00:04
</pre>
</body>
</html>

2099
stm32/OBJ/Template.hex

File diff suppressed because it is too large Load Diff

1390
stm32/OBJ/Template.htm

File diff suppressed because it is too large Load Diff

16
stm32/OBJ/Template_Target 1.dep

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
Dependencies for Project 'Template', Target 'Target 1': (DO NOT MODIFY !)
F (.\main.c)(0x6255D4E1)(-c --cpu Cortex-M3 -D__MICROLIB -g -O0 --apcs=interwork -I ..\HARDWARE\LED -I ..\SYSTEM\delay -I ..\SYSTEM\sys -I ..\SYSTEM\usart -I ..\USER -I ..\STM32F10x_FWLib\inc -I ..\CORE -I ..\HARDWARE\ESP8266 -I ..\HARDWARE\DHT11 -I ..\HARDWARE\LCD1602 -I ..\HARDWARE\ADC -I ..\HARDWARE\TIMER -I ..\HARDWARE\DS18B20 -I ..\HARDWARE\cJSON -I ..\HARDWARE\DCmotor -I ..\HARDWARE\DS1302 -I.\RTE\_Target_1 -ID:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\2.3.0\Device\Include -ID:\Keil_v5\ARM\CMSIS\Include -D__UVISION_VERSION="525" -DSTM32F10X_MD -DSTM32F10X_MD -DUSE_STDPERIPH_DRIVER -o ..\obj\main.o --omf_browse ..\obj\main.crf --depend ..\obj\main.d)
I (..\HARDWARE\LED\led.h)(0x6255CFDF)
F (.\main.c)(0x625B95B9)(-c --cpu Cortex-M3 -D__MICROLIB -g -O0 --apcs=interwork -I ..\HARDWARE\LED -I ..\SYSTEM\delay -I ..\SYSTEM\sys -I ..\SYSTEM\usart -I ..\USER -I ..\STM32F10x_FWLib\inc -I ..\CORE -I ..\HARDWARE\ESP8266 -I ..\HARDWARE\DHT11 -I ..\HARDWARE\LCD1602 -I ..\HARDWARE\ADC -I ..\HARDWARE\TIMER -I ..\HARDWARE\DS18B20 -I ..\HARDWARE\cJSON -I ..\HARDWARE\DCmotor -I ..\HARDWARE\DS1302 -I.\RTE\_Target_1 -ID:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\2.3.0\Device\Include -ID:\Keil_v5\ARM\CMSIS\Include -D__UVISION_VERSION="525" -DSTM32F10X_MD -DSTM32F10X_MD -DUSE_STDPERIPH_DRIVER -o ..\obj\main.o --omf_browse ..\obj\main.crf --depend ..\obj\main.d)
I (..\HARDWARE\LED\led.h)(0x625A668C)
I (..\SYSTEM\sys\sys.h)(0x550F951B)
I (..\USER\stm32f10x.h)(0x5E83791A)
I (..\CORE\core_cm3.h)(0x4D523B58)
@ -41,7 +41,7 @@ I (..\HARDWARE\TIMER\timer.h)(0x532BBAA7) @@ -41,7 +41,7 @@ I (..\HARDWARE\TIMER\timer.h)(0x532BBAA7)
I (D:\Keil_v5\ARM\ARMCC\include\string.h)(0x599ECD2C)
I (..\HARDWARE\DS18B20\ds18b20.h)(0x6255C13A)
I (D:\Keil_v5\ARM\ARMCC\include\stdlib.h)(0x599ECD2C)
I (..\HARDWARE\DCmotor\motor.h)(0x6255BC50)
I (..\HARDWARE\DCmotor\motor.h)(0x625A6ACE)
I (..\HARDWARE\DS1302\DS1302.h)(0x6255ACBC)
F (.\stm32f10x_it.c)(0x4EBEACB0)(-c --cpu Cortex-M3 -D__MICROLIB -g -O0 --apcs=interwork -I ..\HARDWARE\LED -I ..\SYSTEM\delay -I ..\SYSTEM\sys -I ..\SYSTEM\usart -I ..\USER -I ..\STM32F10x_FWLib\inc -I ..\CORE -I ..\HARDWARE\ESP8266 -I ..\HARDWARE\DHT11 -I ..\HARDWARE\LCD1602 -I ..\HARDWARE\ADC -I ..\HARDWARE\TIMER -I ..\HARDWARE\DS18B20 -I ..\HARDWARE\cJSON -I ..\HARDWARE\DCmotor -I ..\HARDWARE\DS1302 -I.\RTE\_Target_1 -ID:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\2.3.0\Device\Include -ID:\Keil_v5\ARM\CMSIS\Include -D__UVISION_VERSION="525" -DSTM32F10X_MD -DSTM32F10X_MD -DUSE_STDPERIPH_DRIVER -o ..\obj\stm32f10x_it.o --omf_browse ..\obj\stm32f10x_it.crf --depend ..\obj\stm32f10x_it.d)
I (stm32f10x_it.h)(0x4D99A426)
@ -104,8 +104,8 @@ I (..\STM32F10x_FWLib\inc\stm32f10x_tim.h)(0x4D783BB4) @@ -104,8 +104,8 @@ I (..\STM32F10x_FWLib\inc\stm32f10x_tim.h)(0x4D783BB4)
I (..\STM32F10x_FWLib\inc\stm32f10x_usart.h)(0x504F415E)
I (..\STM32F10x_FWLib\inc\stm32f10x_wwdg.h)(0x4D783BB4)
I (..\STM32F10x_FWLib\inc\misc.h)(0x4D783BB4)
F (..\HARDWARE\LED\led.c)(0x6255D009)(-c --cpu Cortex-M3 -D__MICROLIB -g -O0 --apcs=interwork -I ..\HARDWARE\LED -I ..\SYSTEM\delay -I ..\SYSTEM\sys -I ..\SYSTEM\usart -I ..\USER -I ..\STM32F10x_FWLib\inc -I ..\CORE -I ..\HARDWARE\ESP8266 -I ..\HARDWARE\DHT11 -I ..\HARDWARE\LCD1602 -I ..\HARDWARE\ADC -I ..\HARDWARE\TIMER -I ..\HARDWARE\DS18B20 -I ..\HARDWARE\cJSON -I ..\HARDWARE\DCmotor -I ..\HARDWARE\DS1302 -I.\RTE\_Target_1 -ID:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\2.3.0\Device\Include -ID:\Keil_v5\ARM\CMSIS\Include -D__UVISION_VERSION="525" -DSTM32F10X_MD -DSTM32F10X_MD -DUSE_STDPERIPH_DRIVER -o ..\obj\led.o --omf_browse ..\obj\led.crf --depend ..\obj\led.d)
I (..\HARDWARE\LED\led.h)(0x6255CFDF)
F (..\HARDWARE\LED\led.c)(0x625A6681)(-c --cpu Cortex-M3 -D__MICROLIB -g -O0 --apcs=interwork -I ..\HARDWARE\LED -I ..\SYSTEM\delay -I ..\SYSTEM\sys -I ..\SYSTEM\usart -I ..\USER -I ..\STM32F10x_FWLib\inc -I ..\CORE -I ..\HARDWARE\ESP8266 -I ..\HARDWARE\DHT11 -I ..\HARDWARE\LCD1602 -I ..\HARDWARE\ADC -I ..\HARDWARE\TIMER -I ..\HARDWARE\DS18B20 -I ..\HARDWARE\cJSON -I ..\HARDWARE\DCmotor -I ..\HARDWARE\DS1302 -I.\RTE\_Target_1 -ID:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\2.3.0\Device\Include -ID:\Keil_v5\ARM\CMSIS\Include -D__UVISION_VERSION="525" -DSTM32F10X_MD -DSTM32F10X_MD -DUSE_STDPERIPH_DRIVER -o ..\obj\led.o --omf_browse ..\obj\led.crf --depend ..\obj\led.d)
I (..\HARDWARE\LED\led.h)(0x625A668C)
I (..\SYSTEM\sys\sys.h)(0x550F951B)
I (..\USER\stm32f10x.h)(0x5E83791A)
I (..\CORE\core_cm3.h)(0x4D523B58)
@ -168,7 +168,7 @@ I (..\STM32F10x_FWLib\inc\stm32f10x_wwdg.h)(0x4D783BB4) @@ -168,7 +168,7 @@ I (..\STM32F10x_FWLib\inc\stm32f10x_wwdg.h)(0x4D783BB4)
I (..\STM32F10x_FWLib\inc\misc.h)(0x4D783BB4)
I (D:\Keil_v5\ARM\ARMCC\include\string.h)(0x599ECD2C)
I (..\SYSTEM\delay\delay.h)(0x55CC2E59)
F (..\HARDWARE\DHT11\dht11.c)(0x60786CD8)(-c --cpu Cortex-M3 -D__MICROLIB -g -O0 --apcs=interwork -I ..\HARDWARE\LED -I ..\SYSTEM\delay -I ..\SYSTEM\sys -I ..\SYSTEM\usart -I ..\USER -I ..\STM32F10x_FWLib\inc -I ..\CORE -I ..\HARDWARE\ESP8266 -I ..\HARDWARE\DHT11 -I ..\HARDWARE\LCD1602 -I ..\HARDWARE\ADC -I ..\HARDWARE\TIMER -I ..\HARDWARE\DS18B20 -I ..\HARDWARE\cJSON -I ..\HARDWARE\DCmotor -I ..\HARDWARE\DS1302 -I.\RTE\_Target_1 -ID:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\2.3.0\Device\Include -ID:\Keil_v5\ARM\CMSIS\Include -D__UVISION_VERSION="525" -DSTM32F10X_MD -DSTM32F10X_MD -DUSE_STDPERIPH_DRIVER -o ..\obj\dht11.o --omf_browse ..\obj\dht11.crf --depend ..\obj\dht11.d)
F (..\HARDWARE\DHT11\dht11.c)(0x625A5DBE)(-c --cpu Cortex-M3 -D__MICROLIB -g -O0 --apcs=interwork -I ..\HARDWARE\LED -I ..\SYSTEM\delay -I ..\SYSTEM\sys -I ..\SYSTEM\usart -I ..\USER -I ..\STM32F10x_FWLib\inc -I ..\CORE -I ..\HARDWARE\ESP8266 -I ..\HARDWARE\DHT11 -I ..\HARDWARE\LCD1602 -I ..\HARDWARE\ADC -I ..\HARDWARE\TIMER -I ..\HARDWARE\DS18B20 -I ..\HARDWARE\cJSON -I ..\HARDWARE\DCmotor -I ..\HARDWARE\DS1302 -I.\RTE\_Target_1 -ID:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\2.3.0\Device\Include -ID:\Keil_v5\ARM\CMSIS\Include -D__UVISION_VERSION="525" -DSTM32F10X_MD -DSTM32F10X_MD -DUSE_STDPERIPH_DRIVER -o ..\obj\dht11.o --omf_browse ..\obj\dht11.crf --depend ..\obj\dht11.d)
I (..\HARDWARE\DHT11\dht11.h)(0x62525B1C)
I (..\SYSTEM\sys\sys.h)(0x550F951B)
I (..\USER\stm32f10x.h)(0x5E83791A)
@ -295,7 +295,7 @@ I (..\STM32F10x_FWLib\inc\stm32f10x_tim.h)(0x4D783BB4) @@ -295,7 +295,7 @@ I (..\STM32F10x_FWLib\inc\stm32f10x_tim.h)(0x4D783BB4)
I (..\STM32F10x_FWLib\inc\stm32f10x_usart.h)(0x504F415E)
I (..\STM32F10x_FWLib\inc\stm32f10x_wwdg.h)(0x4D783BB4)
I (..\STM32F10x_FWLib\inc\misc.h)(0x4D783BB4)
I (..\HARDWARE\LED\led.h)(0x6255CFDF)
I (..\HARDWARE\LED\led.h)(0x625A668C)
I (..\HARDWARE\ESP8266\wifi.h)(0x5E5164A3)
F (..\HARDWARE\DS18B20\ds18b20.c)(0x6255C148)(-c --cpu Cortex-M3 -D__MICROLIB -g -O0 --apcs=interwork -I ..\HARDWARE\LED -I ..\SYSTEM\delay -I ..\SYSTEM\sys -I ..\SYSTEM\usart -I ..\USER -I ..\STM32F10x_FWLib\inc -I ..\CORE -I ..\HARDWARE\ESP8266 -I ..\HARDWARE\DHT11 -I ..\HARDWARE\LCD1602 -I ..\HARDWARE\ADC -I ..\HARDWARE\TIMER -I ..\HARDWARE\DS18B20 -I ..\HARDWARE\cJSON -I ..\HARDWARE\DCmotor -I ..\HARDWARE\DS1302 -I.\RTE\_Target_1 -ID:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\2.3.0\Device\Include -ID:\Keil_v5\ARM\CMSIS\Include -D__UVISION_VERSION="525" -DSTM32F10X_MD -DSTM32F10X_MD -DUSE_STDPERIPH_DRIVER -o ..\obj\ds18b20.o --omf_browse ..\obj\ds18b20.crf --depend ..\obj\ds18b20.d)
I (..\HARDWARE\DS18B20\ds18b20.h)(0x6255C13A)
@ -330,7 +330,7 @@ I (..\STM32F10x_FWLib\inc\stm32f10x_wwdg.h)(0x4D783BB4) @@ -330,7 +330,7 @@ I (..\STM32F10x_FWLib\inc\stm32f10x_wwdg.h)(0x4D783BB4)
I (..\STM32F10x_FWLib\inc\misc.h)(0x4D783BB4)
I (..\SYSTEM\delay\delay.h)(0x55CC2E59)
F (..\HARDWARE\DCmotor\motor.c)(0x6255BC45)(-c --cpu Cortex-M3 -D__MICROLIB -g -O0 --apcs=interwork -I ..\HARDWARE\LED -I ..\SYSTEM\delay -I ..\SYSTEM\sys -I ..\SYSTEM\usart -I ..\USER -I ..\STM32F10x_FWLib\inc -I ..\CORE -I ..\HARDWARE\ESP8266 -I ..\HARDWARE\DHT11 -I ..\HARDWARE\LCD1602 -I ..\HARDWARE\ADC -I ..\HARDWARE\TIMER -I ..\HARDWARE\DS18B20 -I ..\HARDWARE\cJSON -I ..\HARDWARE\DCmotor -I ..\HARDWARE\DS1302 -I.\RTE\_Target_1 -ID:\Keil_v5\ARM\PACK\Keil\STM32F1xx_DFP\2.3.0\Device\Include -ID:\Keil_v5\ARM\CMSIS\Include -D__UVISION_VERSION="525" -DSTM32F10X_MD -DSTM32F10X_MD -DUSE_STDPERIPH_DRIVER -o ..\obj\motor.o --omf_browse ..\obj\motor.crf --depend ..\obj\motor.d)
I (..\HARDWARE\DCmotor\motor.h)(0x6255BC50)
I (..\HARDWARE\DCmotor\motor.h)(0x625A6ACE)
I (..\SYSTEM\sys\sys.h)(0x550F951B)
I (..\USER\stm32f10x.h)(0x5E83791A)
I (..\CORE\core_cm3.h)(0x4D523B58)

BIN
stm32/OBJ/dht11.crf

Binary file not shown.

BIN
stm32/OBJ/dht11.o

Binary file not shown.

BIN
stm32/OBJ/ds1302.crf

Binary file not shown.

31
stm32/OBJ/ds1302.d

@ -0,0 +1,31 @@ @@ -0,0 +1,31 @@
..\obj\ds1302.o: ..\HARDWARE\DS1302\DS1302.c
..\obj\ds1302.o: ..\HARDWARE\DS1302\DS1302.h
..\obj\ds1302.o: ..\USER\stm32f10x.h
..\obj\ds1302.o: ..\CORE\core_cm3.h
..\obj\ds1302.o: D:\Keil_v5\ARM\ARMCC\Bin\..\include\stdint.h
..\obj\ds1302.o: ..\USER\system_stm32f10x.h
..\obj\ds1302.o: ..\USER\stm32f10x_conf.h
..\obj\ds1302.o: ..\STM32F10x_FWLib\inc\stm32f10x_adc.h
..\obj\ds1302.o: ..\USER\stm32f10x.h
..\obj\ds1302.o: ..\STM32F10x_FWLib\inc\stm32f10x_bkp.h
..\obj\ds1302.o: ..\STM32F10x_FWLib\inc\stm32f10x_can.h
..\obj\ds1302.o: ..\STM32F10x_FWLib\inc\stm32f10x_cec.h
..\obj\ds1302.o: ..\STM32F10x_FWLib\inc\stm32f10x_crc.h
..\obj\ds1302.o: ..\STM32F10x_FWLib\inc\stm32f10x_dac.h
..\obj\ds1302.o: ..\STM32F10x_FWLib\inc\stm32f10x_dbgmcu.h
..\obj\ds1302.o: ..\STM32F10x_FWLib\inc\stm32f10x_dma.h
..\obj\ds1302.o: ..\STM32F10x_FWLib\inc\stm32f10x_exti.h
..\obj\ds1302.o: ..\STM32F10x_FWLib\inc\stm32f10x_flash.h
..\obj\ds1302.o: ..\STM32F10x_FWLib\inc\stm32f10x_fsmc.h
..\obj\ds1302.o: ..\STM32F10x_FWLib\inc\stm32f10x_gpio.h
..\obj\ds1302.o: ..\STM32F10x_FWLib\inc\stm32f10x_i2c.h
..\obj\ds1302.o: ..\STM32F10x_FWLib\inc\stm32f10x_iwdg.h
..\obj\ds1302.o: ..\STM32F10x_FWLib\inc\stm32f10x_pwr.h
..\obj\ds1302.o: ..\STM32F10x_FWLib\inc\stm32f10x_rcc.h
..\obj\ds1302.o: ..\STM32F10x_FWLib\inc\stm32f10x_rtc.h
..\obj\ds1302.o: ..\STM32F10x_FWLib\inc\stm32f10x_sdio.h
..\obj\ds1302.o: ..\STM32F10x_FWLib\inc\stm32f10x_spi.h
..\obj\ds1302.o: ..\STM32F10x_FWLib\inc\stm32f10x_tim.h
..\obj\ds1302.o: ..\STM32F10x_FWLib\inc\stm32f10x_usart.h
..\obj\ds1302.o: ..\STM32F10x_FWLib\inc\stm32f10x_wwdg.h
..\obj\ds1302.o: ..\STM32F10x_FWLib\inc\misc.h

BIN
stm32/OBJ/ds1302.o

Binary file not shown.

BIN
stm32/OBJ/led.crf

Binary file not shown.

BIN
stm32/OBJ/led.o

Binary file not shown.

BIN
stm32/OBJ/main.crf

Binary file not shown.

BIN
stm32/OBJ/main.o

Binary file not shown.

BIN
stm32/OBJ/motor.crf

Binary file not shown.

BIN
stm32/OBJ/motor.o

Binary file not shown.

BIN
stm32/OBJ/timer.crf

Binary file not shown.

BIN
stm32/OBJ/timer.o

Binary file not shown.

107
stm32/USER/.vscode/c_cpp_properties.json vendored

@ -0,0 +1,107 @@ @@ -0,0 +1,107 @@
{
"configurations": [
{
"name": "Target 1",
"includePath": [
"e:\\项目\\兼职项目\\20220410-IntelligentPiggery\\stm32\\HARDWARE\\LED",
"e:\\项目\\兼职项目\\20220410-IntelligentPiggery\\stm32\\SYSTEM\\delay",
"e:\\项目\\兼职项目\\20220410-IntelligentPiggery\\stm32\\SYSTEM\\sys",
"e:\\项目\\兼职项目\\20220410-IntelligentPiggery\\stm32\\SYSTEM\\usart",
"e:\\项目\\兼职项目\\20220410-IntelligentPiggery\\stm32\\USER",
"e:\\项目\\兼职项目\\20220410-IntelligentPiggery\\stm32\\STM32F10x_FWLib\\inc",
"e:\\项目\\兼职项目\\20220410-IntelligentPiggery\\stm32\\CORE",
"e:\\项目\\兼职项目\\20220410-IntelligentPiggery\\stm32\\HARDWARE\\ESP8266",
"e:\\项目\\兼职项目\\20220410-IntelligentPiggery\\stm32\\HARDWARE\\DHT11",
"e:\\项目\\兼职项目\\20220410-IntelligentPiggery\\stm32\\HARDWARE\\LCD1602",
"e:\\项目\\兼职项目\\20220410-IntelligentPiggery\\stm32\\HARDWARE\\ADC",
"e:\\项目\\兼职项目\\20220410-IntelligentPiggery\\stm32\\HARDWARE\\TIMER",
"e:\\项目\\兼职项目\\20220410-IntelligentPiggery\\stm32\\HARDWARE\\DS18B20",
"e:\\项目\\兼职项目\\20220410-IntelligentPiggery\\stm32\\HARDWARE\\cJSON",
"e:\\项目\\兼职项目\\20220410-IntelligentPiggery\\stm32\\HARDWARE\\DCmotor",
"e:\\项目\\兼职项目\\20220410-IntelligentPiggery\\stm32\\HARDWARE\\DS1302",
"D:\\Keil_v5\\ARM\\ARMCC\\include",
"D:\\Keil_v5\\ARM\\ARMCC\\include\\rw",
"e:\\项目\\兼职项目\\20220410-IntelligentPiggery\\stm32\\STM32F10x_FWLib\\src",
"e:\\项目\\兼职项目\\20220410-IntelligentPiggery\\stm32"
],
"defines": [
"STM32F10X_MD",
"USE_STDPERIPH_DRIVER",
"__CC_ARM",
"__arm__",
"__align(x)=",
"__ALIGNOF__(x)=",
"__alignof__(x)=",
"__asm(x)=",
"__forceinline=",
"__restrict=",
"__global_reg(n)=",
"__inline=",
"__int64=long long",
"__INTADDR__(expr)=0",
"__irq=",
"__packed=",
"__pure=",
"__smc(n)=",
"__svc(n)=",
"__svc_indirect(n)=",
"__svc_indirect_r7(n)=",
"__value_in_regs=",
"__weak=",
"__writeonly=",
"__declspec(x)=",
"__attribute__(x)=",
"__nonnull__(x)=",
"__register=",
"__breakpoint(x)=",
"__cdp(x,y,z)=",
"__clrex()=",
"__clz(x)=0U",
"__current_pc()=0U",
"__current_sp()=0U",
"__disable_fiq()=",
"__disable_irq()=",
"__dmb(x)=",
"__dsb(x)=",
"__enable_fiq()=",
"__enable_irq()=",
"__fabs(x)=0.0",
"__fabsf(x)=0.0f",
"__force_loads()=",
"__force_stores()=",
"__isb(x)=",
"__ldrex(x)=0U",
"__ldrexd(x)=0U",
"__ldrt(x)=0U",
"__memory_changed()=",
"__nop()=",
"__pld(...)=",
"__pli(...)=",
"__qadd(x,y)=0",
"__qdbl(x)=0",
"__qsub(x,y)=0",
"__rbit(x)=0U",
"__rev(x)=0U",
"__return_address()=0U",
"__ror(x,y)=0U",
"__schedule_barrier()=",
"__semihost(x,y)=0",
"__sev()=",
"__sqrt(x)=0.0",
"__sqrtf(x)=0.0f",
"__ssat(x,y)=0",
"__strex(x,y)=0U",
"__strexd(x,y)=0",
"__strt(x,y)=",
"__swp(x,y)=0U",
"__usat(x,y)=0U",
"__wfe()=",
"__wfi()=",
"__yield()=",
"__vfp_status(x,y)=0"
],
"intelliSenseMode": "${default}"
}
],
"version": 4
}

4
stm32/USER/.vscode/keil-assistant.log vendored

@ -0,0 +1,4 @@ @@ -0,0 +1,4 @@
[info] Log at : 2022/4/16|13:16:04|GMT+0800
[info] Log at : 2022/4/17|11:44:45|GMT+0800

2
stm32/USER/.vscode/uv4.log vendored

@ -0,0 +1,2 @@ @@ -0,0 +1,2 @@
Load "..\\OBJ\\Template.axf"
Erase Done.Programming Done.Verify OK.Flash Load finished at 12:29:02

1
stm32/USER/.vscode/uv4.log.lock vendored

@ -0,0 +1 @@ @@ -0,0 +1 @@
2022/4/17 12:29:03

1062
stm32/USER/Template.map

File diff suppressed because it is too large Load Diff

50
stm32/USER/Template.uvguix.QY

File diff suppressed because one or more lines are too long

130
stm32/USER/main.c

@ -29,6 +29,10 @@ struct timing nowTime; @@ -29,6 +29,10 @@ struct timing nowTime;
// 切换模式 0 自动模式, 1 手动模式
int model = 0;
// 记录时间
int recordDate = 0;
// 用户数据的结构体
struct UserInfo{
u8 humi_value; // 湿度
@ -47,34 +51,99 @@ void SendUserInfo(); @@ -47,34 +51,99 @@ void SendUserInfo();
void SendTime();
/**
* @description:
* @param {int} year
* @return {*}
*/
int isYear(int year){
return (year%4==0)&&( year %400==0 || year %100!= 0) ? 1:0;
}
/**
* @description:
* @param {int} year
* @param {int} month
* @return {*}
*/
int getDayOfMonth(int year , int month) {
int dayArr[] = {0,31,28,31,30,31,30,31,31,30,31,30,31};
return (month == 2 && isYear(year)==1) ? dayArr[month]+1 : dayArr[month] ;
}
/**
* @description:
* @param {*}
* @return {*}
*/
void Warning(){
BEEP = 1;
delay_ms(100);
BEEP = 0;
}
/**
* @description:
* @param {int} data
* @return {*}
*/
int getCleanTime(int data){
int max;
data += 3;
if(data < 27) return data;
max = getDayOfMonth(nowTime.year, nowTime.mon);
if(data <= max) return data;
data = max - data;
return data;
}
/**
* @description:
* @param {*}
* @return {*}
*/
int getTempResult(){
static int flag = 0, time_min = 0;
if(flag = 0){
if(flag == 0){
// 温度 15 - 20 风扇待机
if(userInfo.temp_value > 15 && userInfo.temp_value <= 20){
if(userInfo.temp_value >= 15 && userInfo.temp_value <= 20){
LED_CONDITIONER = 0;
FAN = 1;
FAN = 0;
if(userInfo.humi_value < 50) LED_NAPPE = 1;
else LED_NAPPE = 0;
}else if(userInfo.temp_value < 15){ // 风扇停, 空调亮灯
LED_CONDITIONER = 1;
FAN = 0;
if(userInfo.humi_value < 50) LED_NAPPE = 1;
else LED_NAPPE = 0;
}else if(userInfo.temp_value > 20 && userInfo.temp_value <= 28){// 风扇转
LED_CONDITIONER = 0;
FAN = 1;
if(userInfo.humi_value < 50) LED_NAPPE = 1;
else LED_NAPPE = 0;
}else if( userInfo.temp_value > 28){
Warning();
time_min = nowTime.min;
// 设定的洒水时间 3分钟
time_min += 3;
if(time_min > 59) time_min = time_min - 59;
flag = 1;
LED_CONDITIONER = 0;
LED_NAPPE = 1;
FAN = 1;
printf("watering\r\n");
}
}else{
if(time_min == nowTime.min){
LED_CONDITIONER = 0;
LED_NAPPE = 0;
FAN = 0;
flag = 0;
Warning();
printf("Stop the water\r\n");
if(userInfo.humi_value < 50) LED_NAPPE = 1;
else LED_NAPPE = 0;
}else{
LED_CONDITIONER = 0;
LED_NAPPE = 1;
@ -82,9 +151,10 @@ int getTempResult(){ @@ -82,9 +151,10 @@ int getTempResult(){
}
}
if(userInfo.temp_pig > 40){
BEEP = ~BEEP;
BEEP = 1;
LED_WATER_GUN = 1;
delay_ms(100);
BEEP = 0;
}else{
BEEP = 0;
LED_WATER_GUN = 0;
@ -92,10 +162,14 @@ int getTempResult(){ @@ -92,10 +162,14 @@ int getTempResult(){
return 0;
}
/**
* @description: 湿
* @param {*}
* @return {*}
*/
int getHumiResult(){
// 湿度 75% - 80% 风扇待机, 不亮
if(userInfo.humi_value > 75 && userInfo.humi_value <= 80){
if(userInfo.humi_value >= 75 && userInfo.humi_value <= 80){
LED_NAPPE = 0;
FAN = 0;
}else if(userInfo.humi_value < 50){ // 水帘亮灯
@ -133,8 +207,8 @@ void Data_Deal() @@ -133,8 +207,8 @@ void Data_Deal()
userInfo.temp_pig = DS18B20_Get_Temp() / 10;
}
if(model != 2){
getTempResult();
getHumiResult();
getTempResult();
}
getData();
}
@ -177,13 +251,21 @@ void Receive_data(void) @@ -177,13 +251,21 @@ void Receive_data(void)
SendTime();
}
if(strstr((const char*)USART_RX_BUF, "feed") != NULL){
if(strstr((const char*)USART_RX_BUF, "fan") != NULL){
if(model == 0 || model == 1) printf("Please switch to manual2 mode\r\n");
else FAN = ~FAN;
}
if(strstr((const char*)USART_RX_BUF, "feed") != NULL){
if(model == 0 || model == 1) printf("Please switch to manual2 mode\r\n");
else MOTOR = ~MOTOR;
}
if(strstr((const char*)USART_RX_BUF, "clean") != NULL){
if(model == 0 || model == 1) printf("Please switch to manual2 mode\r\n");
else CLEAN = ~CLEAN;
else{
LED_WATER_GUN = ~LED_WATER_GUN;
MOTOR = LED_WATER_GUN;
}
}
if(strstr((const char*)USART_RX_BUF, "setTemp") != NULL){
@ -193,7 +275,7 @@ void Receive_data(void) @@ -193,7 +275,7 @@ void Receive_data(void)
printf("set temp_value OK\r\n");
}
}
if(strstr((const char*)USART_RX_BUF, "setTemp_pig") != NULL){
if(strstr((const char*)USART_RX_BUF, "setPigTemp") != NULL){
if(model == 0) printf("Please switch to manual1 mode\r\n");
else {
userInfo.temp_pig = getValue();
@ -222,18 +304,35 @@ void Crontab() @@ -222,18 +304,35 @@ void Crontab()
{
// 时间范围早上六点 到 晚上10点 投喂三次
if(nowTime.hour == 6 || nowTime.hour == 14 || nowTime.hour == 22 ){
// 开始结束各报警一次
if(nowTime.sec == 0 || nowTime.sec == 59) Warning();
// 投喂一分钟
if(nowTime.min == 0){
MOTOR = 1;
}
else {
MOTOR = 0;
}
}
if(recordDate == nowTime.day && nowTime.hour == 0){
// 开始结束各报警一次
if(nowTime.sec == 0 || nowTime.sec == 59) Warning();
// 清洁一分钟
if(nowTime.min == 0){
MOTOR = 1;
LED_WATER_GUN = 1;
CLEAN = 1;
}
else{
MOTOR = 0;
LED_WATER_GUN = 0;
CLEAN = 0;
// 记录三天后清洁的日期
recordDate = getCleanTime(nowTime.day);
}
}
}
void Sys_Init(void)
{
delay_init();
@ -245,6 +344,9 @@ void Sys_Init(void) @@ -245,6 +344,9 @@ void Sys_Init(void)
DHT11_Init();
DS18B20_Init();
motor_Init();
MOTOR = 0;
DS1302_Readtime();
recordDate = getCleanTime(nowTime.day);
}
/**
@ -271,6 +373,7 @@ void SendTime() @@ -271,6 +373,7 @@ void SendTime()
int main(void)
{
Sys_Init();
BEEP = 1;
delay_ms(1000);
DS1302_SetTime(Settime);
BEEP = 0;
@ -279,6 +382,7 @@ int main(void) @@ -279,6 +382,7 @@ int main(void)
Data_Deal();
Receive_data();
DS1302_Readtime();
Crontab();
delay_ms(200);
}
}

2
wifi/WiFiTelnetToSerial/WiFiTelnetToSerial.ino

@ -57,7 +57,7 @@ void setup() { @@ -57,7 +57,7 @@ void setup() {
return;
}
// 登录
client.write("{\"usr\":\"admin1\", \"pwd\":\"147258369\"}");
client.write("{\"usr\":\"admin2\", \"pwd\":\"789456123\"}");
}
// loop函数

Loading…
Cancel
Save