214 lines
6.8 KiB
C
214 lines
6.8 KiB
C
#ifndef __APPS_GATHER_H
|
||
#define __APPS_GATHER_H
|
||
/**********************************************Drivers**********************************************/
|
||
#include "main.h"
|
||
#include "tm1650.h"
|
||
#include "mux_signal.h"
|
||
#include "JLX240-00301-BN.h"
|
||
#include <string.h>
|
||
#include "gpio.h"
|
||
#include "modbus.h"
|
||
#include "ble.h"
|
||
#include "hart.h"
|
||
#include "rn7302.h"
|
||
#include "SIG24130.h"
|
||
#include "FreeRTOS.h"
|
||
#include "task.h"
|
||
#include "timer.h"
|
||
#include "stdio.h"
|
||
#include "ip5310_i2c.h"
|
||
#include "eeprom_spi.h"
|
||
#include "stdlib.h"
|
||
#include "cmsis_os.h"
|
||
#include "tim.h"
|
||
|
||
extern osThreadId task_lcdHandle;
|
||
extern osThreadId task_menuHandle;
|
||
extern uint8_t screen_suspend_flag;
|
||
/**********************************************Drivers**********************************************/
|
||
//
|
||
//
|
||
//
|
||
/**********************************************LVGL**********************************************/
|
||
#include "lvgl.h" // 它为整个LVGL提供了更完整的头文件引用
|
||
#include "lv_port_disp.h" // LVGL的显示
|
||
#include "gui_guider.h" // Gui Guider 生成的界面和控件的声明
|
||
#include "events_init.h" // Gui Guider 生成的初始化事件、回调函数
|
||
//#include "lv_demo_benchmark.h"
|
||
|
||
//LVGL相关外部变量
|
||
extern lv_ui guider_ui;
|
||
extern const lv_img_dsc_t * screen_main_animimg_battery_imgs[6];
|
||
extern const lv_img_dsc_t * screen_main_ani_in_0_imgs[11];
|
||
extern const lv_img_dsc_t * screen_main_ani_in_1_imgs[11];
|
||
extern const lv_img_dsc_t * screen_main_ani_in_2_imgs[11];
|
||
extern const lv_img_dsc_t * screen_main_ani_in_3_imgs[11];
|
||
extern const lv_img_dsc_t * screen_main_ani_in_4_imgs[11];
|
||
extern const lv_img_dsc_t * screen_main_ani_in_5_imgs[11];
|
||
extern const lv_img_dsc_t * screen_main_ani_in_6_imgs[11];
|
||
extern const lv_img_dsc_t * screen_main_ani_out_0_imgs[11];
|
||
extern const lv_img_dsc_t * screen_main_ani_out_1_imgs[11];
|
||
extern const lv_img_dsc_t * screen_main_ani_out_2_imgs[11];
|
||
extern const lv_img_dsc_t * screen_main_ani_out_3_imgs[11];
|
||
extern const lv_img_dsc_t * screen_main_ani_out_4_imgs[11];
|
||
extern const lv_img_dsc_t * screen_main_ani_out_5_imgs[11];
|
||
extern const lv_img_dsc_t * screen_main_ani_out_6_imgs[11];
|
||
extern const lv_img_dsc_t * screen_main_ani_in_sign_imgs[3];
|
||
extern const lv_img_dsc_t * screen_main_ani_out_sign_imgs[3];
|
||
/**********************************************LVGL**********************************************/
|
||
//
|
||
//
|
||
//
|
||
/**********************************************Functions**********************************************/
|
||
typedef enum
|
||
{
|
||
SIG_CURRENT = 0, //电流
|
||
SIG_VOLTAGE, //电压
|
||
SIG_RESISTANT, //电阻
|
||
SIG_FREQUENCE, //频率
|
||
SIG_TC, //热电偶
|
||
SIG_RTD //热电阻
|
||
}SIG_FUNCTIONS;
|
||
|
||
typedef enum
|
||
{
|
||
CURRENT_MA = 0, //电流mA
|
||
VOLTAGE_MV, //电压mV
|
||
VOLTAGE_V, //电压V
|
||
RESISTANT_OHM, //电阻Ω
|
||
FREQUENCE_KHZ, //频率KHz
|
||
TC_K, //热电偶K
|
||
TC_S, //热电偶S
|
||
TC_N, //热电偶N
|
||
TC_B, //热电偶B
|
||
TC_E, //热电偶E
|
||
TC_J, //热电偶J
|
||
TC_R, //热电偶R
|
||
TC_T, //热电偶T
|
||
RTD_DC //热电阻摄氏度
|
||
}SIG_FUNCTIONS_TYPE;
|
||
|
||
typedef struct
|
||
{
|
||
SIG_FUNCTIONS tag; //物理量标签
|
||
SIG_FUNCTIONS_TYPE typ; //类型
|
||
int16_t up; //上限
|
||
int16_t low; //下限
|
||
float32 pv; //当前值
|
||
}PHYSICAL_QUANTITY;
|
||
|
||
typedef enum
|
||
{
|
||
SCREEN_INIT = 0,
|
||
SCREEN_MAIN,
|
||
SCREEN_SETTING
|
||
}SCREENS;
|
||
|
||
typedef enum
|
||
{
|
||
MENU_SIMPLYFY_CHINESE = 0,
|
||
MENU_ENGLISH
|
||
}LANGUAGES;
|
||
|
||
typedef enum
|
||
{
|
||
OPENNING_ANIME = 0, //播放开机动画
|
||
MAIN_FUNCTION, //主要功能:输入&输出、曲线显示等
|
||
SET_ITEM_CHOOSE, //设置菜单:选项卡选择
|
||
SET_CONTENT_CHOOSE, //设置菜单:内容选择
|
||
SET_CONTENT_MODIFY, //设置菜单:内容修改
|
||
SET_SHOW_LOG //设置菜单:查看记录
|
||
}OPERATIONS;
|
||
|
||
typedef enum
|
||
{
|
||
TRANS_NONE = 0,
|
||
TRANS_HART,
|
||
TRANS_BLUETOOTH,
|
||
TRANS_MODBUS
|
||
}SIG_TRANSMISSION;
|
||
|
||
typedef struct
|
||
{
|
||
uint16_t lvgl_stack_consume; //LVGL栈占用
|
||
uint16_t menu_stack_consume; //menu栈占用
|
||
uint8_t cpu_consume; //cpu使用率,0-100
|
||
uint8_t mem_consume; //内存使用率,0-100
|
||
uint8_t mem_consume_max; //最大内存占用占用,0-100
|
||
uint8_t eeprom_read_error; //eeprom读是否出现过错误
|
||
uint8_t eeprom_write_error; //eeprom写是否出现过错误
|
||
uint8_t eeprom_current_status; //eeprom状态
|
||
|
||
}SYSTEM_STATUS_WATCH;
|
||
|
||
#include "app_screen_main.h"
|
||
#include "app_screen_setting.h"
|
||
#include "scr_setting_item_text.h"
|
||
#include "scr_setting_item_value.h"
|
||
#include "key_functions.h"
|
||
#include "scr_setting_text.h"
|
||
|
||
extern PHYSICAL_QUANTITY VOL[2]; //电压,VOL[0]-V, VOL[1]-mV
|
||
extern PHYSICAL_QUANTITY CUR; //电流,mA
|
||
extern PHYSICAL_QUANTITY RES; //电阻,Ω
|
||
extern PHYSICAL_QUANTITY FRE; //频率,KHz
|
||
extern PHYSICAL_QUANTITY TC[8]; //热电偶,共8种
|
||
extern PHYSICAL_QUANTITY RTD; //热电阻
|
||
extern OPERATIONS current_operation; //当前操作
|
||
extern SYSTEM_STATUS_WATCH system_sts; //系统状态监控
|
||
extern SIG_TRANSMISSION sig_trans; //通讯模式
|
||
|
||
//绝对值计算
|
||
#define MY_ABS(pa) ( ( (pa) >= 0 )?( (pa) ):( 0 - (pa) ) )
|
||
#define LVGL_BREATHE_INTERVAL 5
|
||
#define BLE_TASK_PERIOD 100
|
||
|
||
//屏幕显示
|
||
void screen_run(void);
|
||
|
||
//计算a的b次方
|
||
float32 my_power(int a, int b);
|
||
|
||
//物理量内容初始化
|
||
void physical_quantity_init(void);
|
||
|
||
//热电偶数据初始化
|
||
void TC_init(void);
|
||
|
||
//通道选择与切换
|
||
void sig_channel_select(uint8_t io, SIG_FUNCTIONS_TYPE type);
|
||
|
||
//更新设定值(根据ON\OFF状态)
|
||
void sig_sv_update(void);
|
||
|
||
//数据转换,mux_signal.pv -> real_value
|
||
float32 mux2real(float32 mux_pv);
|
||
|
||
//数据转换,real_value -> mux_signal.sv
|
||
float32 real2mux(float32 real_value);
|
||
|
||
//数据转换,将输入热电偶电压值转换为实际温度值℃
|
||
float32 tcmv2temp(SIG_FUNCTIONS_TYPE type, float32 mv);
|
||
|
||
//数据转换,将需要模拟的温度值℃转化为热电偶对应的mv
|
||
float32 temp2tcmv(SIG_FUNCTIONS_TYPE type, float32 temp);
|
||
|
||
//数据转换,热电阻阻值 Ω 转化为温度 ℃
|
||
float32 ohm2temp(float32 ohm);
|
||
|
||
//数据转换,温度 ℃ 转化为热电阻阻值 Ω
|
||
float32 temp2ohm(float32 temp);
|
||
|
||
//初始化打包
|
||
void my_inits_gather(void);
|
||
|
||
|
||
|
||
/**********************************************Functions**********************************************/
|
||
//
|
||
//
|
||
//
|
||
#endif
|
||
|
||
|