77 lines
1.7 KiB
C
77 lines
1.7 KiB
C
|
/*
|
||
|
* user.h
|
||
|
*
|
||
|
* Created on: Nov 11, 2024
|
||
|
* Author: 10425
|
||
|
*/
|
||
|
|
||
|
#ifndef INC_USER_H_
|
||
|
#define INC_USER_H_
|
||
|
|
||
|
#include "main.h"
|
||
|
#include "adc.h"
|
||
|
#include "dma.h"
|
||
|
#include "i2c.h"
|
||
|
#include "tim.h"
|
||
|
#include "usart.h"
|
||
|
#include "gpio.h"
|
||
|
#include "iwdg.h"
|
||
|
|
||
|
#include "AHT20.h"
|
||
|
#include "AT24C16.h"
|
||
|
#include "user_stick.h"
|
||
|
#include "string.h"
|
||
|
#include "math.h"
|
||
|
#include "stdlib.h"
|
||
|
|
||
|
#define BUFF_LEN 128
|
||
|
#define ADCBUFF_LEN 300
|
||
|
|
||
|
#define ENABLE_INT() __set_PRIMASK(0) /* 使能全局中断 */
|
||
|
#define DISABLE_INT() __set_PRIMASK(1) /* 禁止全局中断 */
|
||
|
|
||
|
|
||
|
extern volatile uint8_t usart1_count ; //串口接收数据个数
|
||
|
extern uint8_t RxBuff1[BUFF_LEN]; //串口接收缓冲区
|
||
|
extern uint8_t TXBuff1[BUFF_LEN]; //串口发送缓冲区
|
||
|
extern uint8_t uBuff1[BUFF_LEN];
|
||
|
|
||
|
extern volatile uint8_t usart3_count ; //串口接收数据个数
|
||
|
extern uint8_t RxBuff3[BUFF_LEN]; //串口接收缓冲区
|
||
|
extern uint8_t TXBuff3[BUFF_LEN]; //串口发送缓冲区
|
||
|
extern uint8_t uBuff3[BUFF_LEN];
|
||
|
|
||
|
extern uint16_t RegularConvData_Tab[ADCBUFF_LEN];
|
||
|
|
||
|
struct REGISTER
|
||
|
{
|
||
|
|
||
|
int16_t addr;
|
||
|
int16_t version; //版本信息
|
||
|
int16_t electric_X; //电场强度
|
||
|
int16_t electric_Y;
|
||
|
int16_t electric_Z;
|
||
|
int16_t electric_V;
|
||
|
|
||
|
int16_t magnetic_X; //磁场强度
|
||
|
int16_t magnetic_Y;
|
||
|
int16_t magnetic_Z;
|
||
|
int16_t magnetic_V;
|
||
|
|
||
|
int16_t tempe;
|
||
|
int16_t humidness; //温湿度
|
||
|
|
||
|
int16_t REF; //参考电压
|
||
|
};
|
||
|
extern volatile struct REGISTER dev_reg;
|
||
|
|
||
|
void user_main();
|
||
|
void ADC_MAX(void);
|
||
|
void send_data(UART_HandleTypeDef*huart,uint8_t* data,uint16_t len);
|
||
|
void Usart_Receive();
|
||
|
void MODBUS_03H();
|
||
|
void send_UI(uint8_t a);
|
||
|
void MODBUS_10H();
|
||
|
void change_addr();
|
||
|
#endif /* INC_USER_H_ */
|