发给吴工的完整版显示+电量计程序
(电量计程序和之前发的不一样 之前发的是五个390k的版本 当前的是3个620的版本 检测结果存在10V的差异)
This commit is contained in:
parent
6cba2b3b78
commit
2251469662
BIN
8F_5AW_Display/8F_5AW新显示屏液晶驱动程序.zip
Normal file
BIN
8F_5AW_Display/8F_5AW新显示屏液晶驱动程序.zip
Normal file
Binary file not shown.
560
8F_5AW_Display/8f_5aw_display.c
Normal file
560
8F_5AW_Display/8f_5aw_display.c
Normal file
@ -0,0 +1,560 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file 8f_5aw_display.c
|
||||
* @author Motor Control SDK Team, Yuwell Software XiangenWang
|
||||
* @brief Voice Recognition Module Initialization Section,
|
||||
including peripheral initialization and message node insertion, etc.
|
||||
* @version 1.0
|
||||
* @changelog version 1.0 初始版本 2026.1.8
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* <h2><center>© Copyright (c) 2025 Yuwell Software Danyang.Jiangsu.China.
|
||||
* All rights reserved.</center></h2>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted, provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistribution of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of Yuwell Software nor the names of other
|
||||
* contributors to this software may be used to endorse or promote products
|
||||
* derived from this software without specific written permission.
|
||||
* 4. This software, including modifications and/or derivative works of this
|
||||
* software, must execute solely and exclusively on microcontroller or
|
||||
* microprocessor devices manufactured by or for Yuwell Software.
|
||||
* 5. Redistribution and use of this software other than as permitted under
|
||||
* this license is void and will automatically terminate your rights under
|
||||
* this license.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY Yuwell Software AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
||||
* PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY
|
||||
* RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT
|
||||
* SHALL Yuwell Software OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
||||
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
/* USER CODE END Header */
|
||||
|
||||
#include "8f_5aw_display.h"
|
||||
|
||||
|
||||
uint8_t display_buffer[BL55072A_DISP_BUF_SIZE];
|
||||
|
||||
// 面板显示信息结构体
|
||||
volatile PanelDisplayInfo panel_display_info;
|
||||
|
||||
|
||||
#define ENABLE_PRECISE_I2C_DELAY (1)
|
||||
#define configCPU_CLOCK_HZ (8000000)
|
||||
|
||||
|
||||
/************************************************** 外部映射API **************************************************/
|
||||
#define SDA_SET BL55072A_SDA_SET
|
||||
#define SCL_SET BL55072A_SCL_SET
|
||||
|
||||
#define SDA_CLEAR BL55072A_SDA_CLEAR
|
||||
#define SCL_CLEAR BL55072A_SCL_CLEAR
|
||||
|
||||
|
||||
/************************************************** 静态子函数定义 **************************************************/
|
||||
|
||||
/**
|
||||
* @brief I2C专用us级延时函数(仅用volatile,无编译器属性)
|
||||
* @param us: 要延时的微秒数
|
||||
* @note 循环体填充无用指令,进一步防止编译器优化
|
||||
*/
|
||||
|
||||
static void I2C_Delay_us(uint32_t us)
|
||||
{
|
||||
|
||||
#if ENABLE_PRECISE_I2C_DELAY
|
||||
|
||||
const uint32_t cycles_per_us = configCPU_CLOCK_HZ / 1000000UL;
|
||||
const uint32_t Calib_Num = 8;
|
||||
const uint32_t Calib_Den = 10;
|
||||
|
||||
uint32_t total_cycles = (us * cycles_per_us * Calib_Num) / Calib_Den;
|
||||
|
||||
if (total_cycles == 0 && us > 0)
|
||||
{
|
||||
total_cycles = 1;
|
||||
}
|
||||
|
||||
volatile uint32_t i, j = 0;
|
||||
for (i = 0; i < total_cycles; i++)
|
||||
{
|
||||
j++;
|
||||
j--;
|
||||
__NOP();
|
||||
}
|
||||
|
||||
|
||||
#else
|
||||
|
||||
// 主频过高时不适用
|
||||
for(uint32_t i = 0;i < us;i++)
|
||||
{
|
||||
__NOP();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief I2C起始条件:SCL高电平时,SDA从高变低
|
||||
* @param NONE
|
||||
* @retval NONE
|
||||
* @note 根据飞利浦I2C官方文档编写
|
||||
* @author jarvis
|
||||
* @data 2025.11.25
|
||||
*/
|
||||
static void I2C_Start(void)
|
||||
{
|
||||
SDA_SET();
|
||||
SCL_SET();
|
||||
I2C_Delay_us(1);
|
||||
SDA_CLEAR();
|
||||
I2C_Delay_us(1);
|
||||
SCL_CLEAR();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief I2C停止条件:SCL高电平时,SDA从低变高
|
||||
* @param NONE
|
||||
* @retval NONE
|
||||
* @note 根据飞利浦I2C官方文档编写,停止后释放I2C总线控制权
|
||||
* @author jarvis
|
||||
* @date 2025.11.25
|
||||
*/
|
||||
static void I2C_Stop(void)
|
||||
{
|
||||
SDA_CLEAR();
|
||||
SCL_SET();
|
||||
I2C_Delay_us(1);
|
||||
SDA_SET();
|
||||
I2C_Delay_us(1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief I2C接收应答信号
|
||||
* @param NONE
|
||||
* @retval uint8_t - 应答检测结果:0表示接收到应答(ACK),1表示未接收到应答(NACK)
|
||||
* @note SDA引脚需配置为输入模式,通过检测PC11引脚电平判断应答状态,遵循I2C协议时序
|
||||
* @author jarvis
|
||||
* @date 2025.11.25
|
||||
*/
|
||||
static uint8_t I2C_ReceiveAck(void)
|
||||
{
|
||||
|
||||
uint8_t ack = 1;
|
||||
SCL_CLEAR();
|
||||
SDA_SET(); // 释放SDA总线
|
||||
I2C_Delay_us(1);
|
||||
SCL_SET();
|
||||
I2C_Delay_us(1);
|
||||
|
||||
|
||||
if((FL_GPIO_ReadInputPort(BL55072A_SDA_GPIO_PORT)&BL55072A_SDA_GPIO_PIN) == 0)
|
||||
{
|
||||
ack = 0; // 检测到应答
|
||||
}
|
||||
SCL_CLEAR();
|
||||
|
||||
return ack;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief I2C发送一个字节数据
|
||||
* @param data - 待发送的8位数据
|
||||
* @retval NONE
|
||||
* @note 高位先行(MSB first),遵循I2C协议时序,SCL高电平时数据有效
|
||||
* @author jarvis
|
||||
* @date 2025.11.25
|
||||
*/
|
||||
static void I2C_SendByte(uint8_t data)
|
||||
{
|
||||
uint8_t i;
|
||||
SCL_CLEAR();
|
||||
for(i = 0; i < 8; i++)
|
||||
{
|
||||
if(data & 0x80)
|
||||
{
|
||||
SDA_SET(); // 发送最高位
|
||||
}else{
|
||||
SDA_CLEAR();
|
||||
}
|
||||
data <<= 1;
|
||||
I2C_Delay_us(1);
|
||||
SCL_SET();
|
||||
I2C_Delay_us(1);
|
||||
SCL_CLEAR();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/************************** 常量定义 **************************/
|
||||
static const PanelDisplayInfo panel_display_default =
|
||||
{
|
||||
.timer =
|
||||
{
|
||||
.hours = 88,
|
||||
.minutes = 88,
|
||||
.is_light = LIGHT_ON
|
||||
},
|
||||
|
||||
.total_time =
|
||||
{
|
||||
.time_mode = MODE_TOTAL_TIME,
|
||||
.hours = 88888,
|
||||
.first8_segtable_index = 10,
|
||||
.second8_segtable_index = 10,
|
||||
.third8_segtable_index = 10,
|
||||
.fourth8_segtable_index = 10,
|
||||
.fifth8_segtable_index = 10,
|
||||
.is_light = LIGHT_ON
|
||||
},
|
||||
|
||||
|
||||
.error =
|
||||
{
|
||||
.first8_segtable_index = 8,
|
||||
.second8_segtable_index = 8,
|
||||
.is_light = LIGHT_ON
|
||||
},
|
||||
|
||||
.oxg =
|
||||
{
|
||||
.value = 888,
|
||||
.is_light = LIGHT_ON
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
|
||||
#define SEG_TABLE_SIZE (20) // 断码表大小
|
||||
|
||||
const uint8_t SEG_TAB[SEG_TABLE_SIZE] =
|
||||
{
|
||||
//--0--,--1--,--2--,--3--,--4--,--5--,--6--,--7--,--8--,--9--,
|
||||
0x5F, 0x50, 0x6B, 0x79, 0x74, 0x3D, 0x3F, 0x58, 0x7F, 0x7D,
|
||||
//'-', ' ', 'E', 'L', 'P', 'H', 'C', 'F', 'U', 'A',
|
||||
0x20, 0x00, 0x2F, 0x07, 0x6E, 0x76, 0x0F, 0x2E, 0x57, 0x7E,
|
||||
};
|
||||
|
||||
/************************** 供外部调用的API函数 **************************/
|
||||
/**
|
||||
* @brief BL55072A液晶显示芯片初始化函数
|
||||
* @note 完成GPIO初始化、I2C总线初始化、芯片基础配置及显存清空
|
||||
* 初始化后屏幕处于关闭状态,需调用user_display_refresh开启显示
|
||||
* @param 无
|
||||
* @retval 无
|
||||
* @author jarvis
|
||||
* @date 2026.01.09
|
||||
*/
|
||||
void user_display_init(void)
|
||||
{
|
||||
|
||||
// 初始化I2C引脚GPIO配置
|
||||
FL_GPIO_InitTypeDef GPIO_InitStruct;
|
||||
|
||||
GPIO_InitStruct.pin = BL55072A_SDA_GPIO_PIN;
|
||||
GPIO_InitStruct.mode = FL_GPIO_MODE_OUTPUT;
|
||||
GPIO_InitStruct.pull = FL_DISABLE;
|
||||
GPIO_InitStruct.remapPin = FL_DISABLE;
|
||||
GPIO_InitStruct.analogSwitch = FL_DISABLE;
|
||||
GPIO_InitStruct.outputType = FL_GPIO_OUTPUT_OPENDRAIN;
|
||||
|
||||
FL_GPIO_Init(BL55072A_SDA_GPIO_PORT, &GPIO_InitStruct); // 初始化SDA引脚
|
||||
|
||||
GPIO_InitStruct.pin = BL55072A_SCL_GPIO_PIN;
|
||||
GPIO_InitStruct.pull = FL_ENABLE;
|
||||
GPIO_InitStruct.outputType = FL_GPIO_OUTPUT_PUSHPULL;
|
||||
|
||||
FL_GPIO_Init(BL55072A_SCL_GPIO_PORT, &GPIO_InitStruct); // 初始化SCL引脚
|
||||
|
||||
|
||||
// 初始化显示缓冲区为全1
|
||||
memset(display_buffer, 0xFF, sizeof(display_buffer));
|
||||
|
||||
// 初始化屏幕配置结构体
|
||||
panel_display_info = panel_display_default;
|
||||
|
||||
// ------------------- I2C总线及芯片初始化流程 -------------------
|
||||
// 确保I2C总线处于停止状态,避免总线异常
|
||||
I2C_Stop();
|
||||
I2C_Delay_us(100); // 总线稳定延时(100us)
|
||||
|
||||
// 发送I2C起始条件
|
||||
I2C_Start();
|
||||
|
||||
// 发送芯片写地址(0x7C),忽略ACK检测(仅显示场景)
|
||||
I2C_SendByte(BL55072A_I2C_ADDR_W);
|
||||
(void)I2C_ReceiveAck(); // 显式忽略返回值,避免编译器警告
|
||||
|
||||
// 发送ICSET命令:芯片基础配置(内部振荡器、不复位)
|
||||
I2C_SendByte(BL55072A_CMD_ICSET);
|
||||
(void)I2C_ReceiveAck();
|
||||
|
||||
// 发送DISCTL命令:显示驱动参数配置(帧频、驱动模式)
|
||||
I2C_SendByte(BL55072A_CMD_DISCTL);
|
||||
(void)I2C_ReceiveAck();
|
||||
|
||||
// 发送MODESET命令:关闭显示(1/3偏置)
|
||||
I2C_SendByte(MODESET_BASIC | MODESET_DISP_OFF | MODESET_BIAS_1_3);
|
||||
(void)I2C_ReceiveAck();
|
||||
|
||||
// 发送ADSET命令:设置显示寄存器起始地址为SEG0
|
||||
I2C_SendByte(BL55072A_CMD_ADSET);
|
||||
(void)I2C_ReceiveAck();
|
||||
|
||||
// 清空显存(0x00~0x23地址),防止脏数据导致显示异常
|
||||
for(uint8_t i = 0; i < BL55072A_DISP_BUF_SIZE; i++)
|
||||
{
|
||||
I2C_SendByte(0x00);
|
||||
(void)I2C_ReceiveAck();
|
||||
}
|
||||
|
||||
// 发送I2C停止条件,确认数据写入生效
|
||||
I2C_Stop();
|
||||
|
||||
// 显示稳定延时(100us)
|
||||
I2C_Delay_us(100);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief BL55072A液晶显示刷新函数
|
||||
* @note 加载显示缓冲区数据到芯片显存,并开启显示
|
||||
* 需在初始化完成后调用,或更新display_buffer后调用
|
||||
* @param 无
|
||||
* @retval 无
|
||||
* @author jarvis
|
||||
* @date 2026.01.09
|
||||
*/
|
||||
void user_display_refresh(void)
|
||||
{
|
||||
|
||||
uint8_t timer_hour_ten; // 小时十位(0-9)
|
||||
uint8_t timer_hour_unit; // 小时个位(0-9)
|
||||
|
||||
uint8_t timer_minute_ten; // 分钟十位(0-9)
|
||||
uint8_t timer_minute_unit; // 分钟个位(0-9)
|
||||
|
||||
uint8_t total_time_unit; // 存储累时的个、十、百、千、万位,定义变量
|
||||
uint8_t total_time_ten;
|
||||
uint8_t total_time_hundred;
|
||||
uint8_t total_time_thousand;
|
||||
uint8_t total_time_ten_thousand;
|
||||
|
||||
uint8_t oxg_ten; // 存储浓度的个、十、小数点
|
||||
uint8_t oxg_unit;
|
||||
uint8_t oxg_decimal;
|
||||
|
||||
|
||||
// ------------------- 根据配置内容更改显存 -------------------
|
||||
memset(display_buffer, 0x00, sizeof(display_buffer));
|
||||
|
||||
// 确定定时部分显存数据
|
||||
if(panel_display_info.timer.is_light == LIGHT_ON)
|
||||
{
|
||||
timer_hour_ten = (panel_display_info.timer.hours / 10) % 10; // 十位:先除10再取余10
|
||||
timer_hour_unit = panel_display_info.timer.hours % 10;
|
||||
|
||||
timer_minute_ten = (panel_display_info.timer.minutes / 10) % 10; // 十位:先除10再取余10
|
||||
timer_minute_unit = panel_display_info.timer.minutes % 10;
|
||||
|
||||
display_buffer[TIMER_FIRST8_AFED_SEG_NUM/2] |= (SEG_TAB[timer_hour_ten]&0x0F)<<4;
|
||||
display_buffer[TIMER_FIRST8_BGC_SEG_NUM/2] |= (SEG_TAB[timer_hour_ten]&0xF0)>>4;
|
||||
|
||||
display_buffer[TIMER_SECOND8_AFED_SEG_NUM/2] |= (SEG_TAB[timer_hour_unit]&0x0F)<<4;
|
||||
display_buffer[TIMER_SECOND8_BGC_SEG_NUM/2] |= (SEG_TAB[timer_hour_unit]&0xF0)>>4;
|
||||
|
||||
|
||||
display_buffer[TIMER_THIRD8_AFED_SEG_NUM/2] |= (SEG_TAB[timer_minute_ten]&0x0F)<<4;
|
||||
display_buffer[TIMER_THIRD8_BGC_SEG_NUM/2] |= (SEG_TAB[timer_minute_ten]&0xF0)>>4;
|
||||
|
||||
display_buffer[TIMER_FOURTH8_AFED_SEG_NUM/2] |= (SEG_TAB[timer_minute_unit]&0x0F)<<4;
|
||||
display_buffer[TIMER_FOURTH8_BGC_SEG_NUM/2] |= (SEG_TAB[timer_minute_unit]&0xF0)>>4;
|
||||
|
||||
display_buffer[TIMER_COL_ARRAY_INDEX] |= ADDITION_SEG_POS;
|
||||
display_buffer[TIMER_H1_ARRAY_INDEX] |= ADDITION_SEG_POS;
|
||||
}
|
||||
|
||||
// 确定累时部分显存数据
|
||||
if(panel_display_info.total_time.is_light == LIGHT_ON)
|
||||
{
|
||||
|
||||
if(panel_display_info.total_time.time_mode == MODE_TOTAL_TIME)
|
||||
{
|
||||
// 永远只取前五位 不用防止溢出
|
||||
total_time_unit = panel_display_info.total_time.hours % 10;
|
||||
total_time_ten = (panel_display_info.total_time.hours / 10) % 10; // 十位:先除10再取余10
|
||||
total_time_hundred = (panel_display_info.total_time.hours / 100) % 10; // 百位:先除100再取余10
|
||||
total_time_thousand = (panel_display_info.total_time.hours / 1000) % 10; // 千位:先除1000再取余10
|
||||
total_time_ten_thousand = (panel_display_info.total_time.hours / 10000) % 10; // 万位:先除10000再取余10
|
||||
|
||||
display_buffer[TIME_FIRST8_AFED_SEG_NUM/2] |= (SEG_TAB[total_time_ten_thousand]&0x0F)<<4;
|
||||
display_buffer[TIME_FIRST8_BGC_SEG_NUM/2] |= (SEG_TAB[total_time_ten_thousand]&0xF0)>>4;
|
||||
|
||||
display_buffer[TIME_SECOND8_AFED_SEG_NUM/2] |= (SEG_TAB[total_time_thousand]&0x0F)<<4;
|
||||
display_buffer[TIME_SECOND8_BGC_SEG_NUM/2] |= (SEG_TAB[total_time_thousand]&0xF0)>>4;
|
||||
|
||||
display_buffer[TIME_THIRD8_AFED_SEG_NUM/2] |= (SEG_TAB[total_time_hundred]&0x0F)<<4;
|
||||
display_buffer[TIME_THIRD8_BGC_SG_NUM/2] |= (SEG_TAB[total_time_hundred]&0xF0)>>4;
|
||||
|
||||
display_buffer[TIME_FOURTH8_AFED_SEG_NUM/2] |= (SEG_TAB[total_time_ten]&0x0F)<<4;
|
||||
display_buffer[TIME_FOURTH8_BGC_SEG_NUM/2] |= (SEG_TAB[total_time_ten]&0xF0)>>4;
|
||||
|
||||
display_buffer[TIME_FIFTH8_AFED_SEG_NUM/2] |= (SEG_TAB[total_time_unit]&0x0F)<<4;
|
||||
display_buffer[TIME_FIFTH8_BGC_SEG_NUM/2] |= (SEG_TAB[total_time_unit]&0xF0)>>4;
|
||||
|
||||
display_buffer[TOTAL_TIME_H2_ARRAY_INDEX] |= ADDITION_SEG_POS;
|
||||
|
||||
}else if(panel_display_info.total_time.time_mode == MODE_INDEX)
|
||||
{
|
||||
// 中间累时部分按照索引显示
|
||||
display_buffer[TIME_FIRST8_AFED_SEG_NUM/2] |= (SEG_TAB[panel_display_info.total_time.first8_segtable_index]&0x0F)<<4;
|
||||
display_buffer[TIME_FIRST8_BGC_SEG_NUM/2] |= (SEG_TAB[panel_display_info.total_time.first8_segtable_index]&0xF0)>>4;
|
||||
|
||||
display_buffer[TIME_SECOND8_AFED_SEG_NUM/2] |= (SEG_TAB[panel_display_info.total_time.second8_segtable_index]&0x0F)<<4;
|
||||
display_buffer[TIME_SECOND8_BGC_SEG_NUM/2] |= (SEG_TAB[panel_display_info.total_time.second8_segtable_index]&0xF0)>>4;
|
||||
|
||||
display_buffer[TIME_THIRD8_AFED_SEG_NUM/2] |= (SEG_TAB[panel_display_info.total_time.third8_segtable_index]&0x0F)<<4;
|
||||
display_buffer[TIME_THIRD8_BGC_SG_NUM/2] |= (SEG_TAB[panel_display_info.total_time.third8_segtable_index]&0xF0)>>4;
|
||||
|
||||
display_buffer[TIME_FOURTH8_AFED_SEG_NUM/2] |= (SEG_TAB[panel_display_info.total_time.fourth8_segtable_index]&0x0F)<<4;
|
||||
display_buffer[TIME_FOURTH8_BGC_SEG_NUM/2] |= (SEG_TAB[panel_display_info.total_time.fourth8_segtable_index]&0xF0)>>4;
|
||||
|
||||
display_buffer[TIME_FIFTH8_AFED_SEG_NUM/2] |= (SEG_TAB[panel_display_info.total_time.fifth8_segtable_index]&0x0F)<<4;
|
||||
display_buffer[TIME_FIFTH8_BGC_SEG_NUM/2] |= (SEG_TAB[panel_display_info.total_time.fifth8_segtable_index]&0xF0)>>4;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// 故障码显示
|
||||
if(panel_display_info.error.is_light == LIGHT_ON)
|
||||
{
|
||||
// 防止超出断码表范围
|
||||
panel_display_info.error.first8_segtable_index = panel_display_info.error.first8_segtable_index >= SEG_TABLE_SIZE?\
|
||||
(SEG_TABLE_SIZE-1):panel_display_info.error.first8_segtable_index;
|
||||
|
||||
panel_display_info.error.second8_segtable_index = panel_display_info.error.second8_segtable_index >= SEG_TABLE_SIZE?\
|
||||
(SEG_TABLE_SIZE-1):panel_display_info.error.second8_segtable_index;
|
||||
|
||||
display_buffer[ERROR_FIRT8_AFED_SEG_NUM/2] |= (SEG_TAB[panel_display_info.error.first8_segtable_index]&0x0F);
|
||||
display_buffer[ERROR_FIRT8_BGC_SEG_NUM/2] |= (SEG_TAB[panel_display_info.error.first8_segtable_index]&0xF0);
|
||||
|
||||
display_buffer[ERROR_SECOND8_AFED_SEG_NUM/2] |= (SEG_TAB[panel_display_info.error.second8_segtable_index]&0x0F);
|
||||
display_buffer[ERROR_SECOND8_BGC_SEG_NUM/2] |= (SEG_TAB[panel_display_info.error.second8_segtable_index]&0xF0);
|
||||
}
|
||||
|
||||
|
||||
// 氧浓度显示
|
||||
if(panel_display_info.oxg.is_light == LIGHT_ON)
|
||||
{
|
||||
|
||||
oxg_decimal = panel_display_info.oxg.value % 10;
|
||||
oxg_unit = (panel_display_info.oxg.value / 10) % 10;
|
||||
oxg_ten = (panel_display_info.oxg.value / 100) % 10;
|
||||
|
||||
display_buffer[OXG_FIRST8_AFED_SEG_NUM/2] |= (SEG_TAB[oxg_ten]&0x0F);
|
||||
display_buffer[OXG_FIRST8_BGC_SEG_NUM/2] |= (SEG_TAB[oxg_ten]&0xF0);
|
||||
|
||||
display_buffer[OXG_SECOND8_AFED_SEG_NUM/2] |= (SEG_TAB[oxg_unit]&0x0F);
|
||||
display_buffer[OXG_SECOND8_BGC_SEG_NUM/2] |= (SEG_TAB[oxg_unit]&0xF0);
|
||||
|
||||
display_buffer[OXG_THIRD8_AFED_SEG_NUM/2] |= (SEG_TAB[oxg_decimal]&0x0F);
|
||||
display_buffer[OXG_THIRD8_BGC_SG_NUM/2] |= (SEG_TAB[oxg_decimal]&0xF0);
|
||||
|
||||
display_buffer[OXG_S1_ARRAY_INDEX] |= ADDITION_SEG_POS<<4;
|
||||
display_buffer[OXG_POINT_ARRAY_INDEX] |= ADDITION_SEG_POS<<4;
|
||||
display_buffer[OXG_PERCEENET_ARRAY_INDEX] |= ADDITION_SEG_POS<<4;
|
||||
}
|
||||
|
||||
|
||||
// ------------------- 加载显示缓冲区数据 -------------------
|
||||
// 发送I2C起始条件
|
||||
I2C_Start();
|
||||
|
||||
// 发送芯片写地址
|
||||
I2C_SendByte(BL55072A_I2C_ADDR_W);
|
||||
(void)I2C_ReceiveAck(); // 显式忽略返回值,避免编译器警告
|
||||
|
||||
// 发送BLKCTL命令:关闭闪烁功能
|
||||
I2C_SendByte(BL55072A_CMD_BLKCTL);
|
||||
(void)I2C_ReceiveAck();
|
||||
|
||||
// 发送DISCTL命令:配置显示驱动参数
|
||||
I2C_SendByte(BL55072A_CMD_DISCTL);
|
||||
(void)I2C_ReceiveAck();
|
||||
|
||||
// 发送ICSET命令:芯片基础参数配置
|
||||
I2C_SendByte(BL55072A_CMD_ICSET);
|
||||
(void)I2C_ReceiveAck();
|
||||
|
||||
// 发送ADSET命令:设置显示寄存器起始地址
|
||||
I2C_SendByte(BL55072A_CMD_ADSET);
|
||||
(void)I2C_ReceiveAck();
|
||||
|
||||
// 将显示缓冲区数据写入芯片显存(0x00~0x23地址)
|
||||
for(uint8_t i = 0; i < BL55072A_DISP_BUF_SIZE; i++)
|
||||
{
|
||||
I2C_SendByte(display_buffer[i]);
|
||||
(void)I2C_ReceiveAck();
|
||||
}
|
||||
|
||||
// 停止I2C传输,确认数据写入
|
||||
I2C_Stop();
|
||||
|
||||
// ------------------- 开启显示 -------------------
|
||||
I2C_Delay_us(100); // 总线稳定延时(100us)
|
||||
|
||||
// 发送I2C起始条件
|
||||
I2C_Start();
|
||||
|
||||
// 发送芯片写地址(0x7C)
|
||||
I2C_SendByte(BL55072A_I2C_ADDR_W);
|
||||
(void)I2C_ReceiveAck(); // 显式忽略返回值,避免编译器警告
|
||||
|
||||
// 发送MODESET命令:开启显示(核心步骤)
|
||||
I2C_SendByte(BL55072A_CMD_MODESET);
|
||||
(void)I2C_ReceiveAck();
|
||||
|
||||
// 停止I2C传输,完成显示开启
|
||||
I2C_Stop();
|
||||
}
|
||||
|
||||
|
||||
/************************ (C) COPYRIGHT YUWELL *****END OF FILE****/
|
||||
261
8F_5AW_Display/8f_5aw_display.h
Normal file
261
8F_5AW_Display/8f_5aw_display.h
Normal file
@ -0,0 +1,261 @@
|
||||
/* USER CODE BEGIN Header */
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file : 8f_5aw_display.h
|
||||
* @brief : 8f-5aw显示驱动芯片
|
||||
* @version : 1.0
|
||||
* @changelog : version 1.0 初始版本 2026.1.8
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2025 Yuwell Software Danyang.Jiangsu.China
|
||||
* THIS SOFTWARE is licensed under the Mulan PSL v1.
|
||||
* can use this software according to the terms and conditions of the Mulan PSL v1.
|
||||
* You may obtain a copy of Mulan PSL v1 at:
|
||||
* http://license.coscl.org.cn/MulanPSL
|
||||
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR
|
||||
* PURPOSE.
|
||||
* See the Mulan PSL v1 for more details.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
/* USER CODE END Header */
|
||||
|
||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
||||
#ifndef __8F_5AW_DISPLAY_H
|
||||
#define __8F_5AW_DISPLAY_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include "mf_config.h"
|
||||
#include "string.h"
|
||||
|
||||
|
||||
/************************** 硬件参数重映射 **************************/
|
||||
// 对硬件进行重定向
|
||||
#define BL55072A_SCL_GPIO_PORT GPIOD
|
||||
#define BL55072A_SCL_GPIO_PIN FL_GPIO_PIN_2
|
||||
#define BL55072A_SDA_GPIO_PORT GPIOD
|
||||
#define BL55072A_SDA_GPIO_PIN FL_GPIO_PIN_3
|
||||
|
||||
|
||||
/************************** 宏函数定义 *************************/
|
||||
#define BL55072A_SDA_CLEAR() FL_GPIO_ResetOutputPin(BL55072A_SDA_GPIO_PORT,BL55072A_SDA_GPIO_PIN);
|
||||
#define BL55072A_SDA_SET() FL_GPIO_SetOutputPin(BL55072A_SDA_GPIO_PORT,BL55072A_SDA_GPIO_PIN);
|
||||
|
||||
#define BL55072A_SCL_CLEAR() FL_GPIO_ResetOutputPin(BL55072A_SCL_GPIO_PORT,BL55072A_SCL_GPIO_PIN);
|
||||
#define BL55072A_SCL_SET() FL_GPIO_SetOutputPin(BL55072A_SCL_GPIO_PORT,BL55072A_SCL_GPIO_PIN);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/************************** 显示芯片配置 **************************/
|
||||
#define BL55072A_I2C_ADDR_R 0x7D
|
||||
#define BL55072A_I2C_ADDR_W 0x7C
|
||||
|
||||
|
||||
#define BL55072A_DISP_BUF_SIZE 18 // 显示缓冲区大小
|
||||
|
||||
|
||||
// 1. 模式设置命令 MODESET (Bit7=C=1 表示后续仍为命令,C=0表示最后一个命令)
|
||||
#define MODESET_BASIC 0xC0 // Bit7=C=1, Bit6=1, Bit5=0(固定格式)
|
||||
#define MODESET_DISP_OFF 0x00 // Bit3=0:显示关闭(默认)
|
||||
#define MODESET_DISP_ON 0x08 // Bit3=1:显示开启
|
||||
#define MODESET_BIAS_1_3 0x00 // Bit2=0:1/3偏置(默认)
|
||||
#define MODESET_BIAS_1_2 0x04 // Bit2=1:1/2偏置
|
||||
#define BL55072A_CMD_MODESET (MODESET_BASIC | MODESET_DISP_ON | MODESET_BIAS_1_3)
|
||||
|
||||
|
||||
// 2. 地址设置命令 ADSET
|
||||
#define BL55072A_CMD_ADSET 0x00 // Bit7=C=0, Bit6=0, Bit5=0 下发之后发送显存
|
||||
|
||||
|
||||
|
||||
// 3. 显示控制命令 DISCTL
|
||||
#define DISCTL_BASIC 0xA0 // Bit7=C=1, Bit6=0(固定格式)
|
||||
// 帧频选择(Bit4~Bit3)
|
||||
#define DISCTL_FR_80HZ 0x00 // 00:80Hz(默认)
|
||||
#define DISCTL_FR_71HZ 0x08 // 01:71Hz
|
||||
#define DISCTL_FR_64HZ 0x10 // 10:64Hz
|
||||
#define DISCTL_FR_53HZ 0x18 // 11:53Hz
|
||||
// 驱动模式(Bit2)
|
||||
#define DISCTL_DM_LINE_INV 0x00 // 0:行反转模式(默认)
|
||||
#define DISCTL_DM_FRAME_INV 0x04 // 1:帧反转模式
|
||||
// 省电模式(Bit1~Bit0)
|
||||
#define DISCTL_SR_MODE1 0x00 // 00:省电模式1
|
||||
#define DISCTL_SR_MODE2 0x01 // 01:省电模式2
|
||||
#define DISCTL_SR_NORMAL 0x02 // 10:正常模式(默认)
|
||||
#define DISCTL_SR_HIGH_POWER 0x03 // 11:高功耗模式
|
||||
#define BL55072A_CMD_DISCTL (DISCTL_BASIC | DISCTL_FR_80HZ | DISCTL_DM_LINE_INV |DISCTL_SR_NORMAL)
|
||||
|
||||
|
||||
// 4. 芯片设置命令 ICSET
|
||||
#define ICSET_BASIC 0xE0 // Bit7=C=1, Bit6=1, Bit5=1(固定格式)
|
||||
#define ICSET_SOFT_RST_DIS 0x00 // Bit1=0:软件复位关闭(默认)
|
||||
#define ICSET_SOFT_RST_EN 0x02 // Bit1=1:软件复位使能
|
||||
#define ICSET_OSC_INNER 0x00 // Bit0=0:内部振荡器(默认,OSCIO接VSS)
|
||||
#define ICSET_OSC_OUTER 0x01 // Bit0=1:外部振荡器(OSCIO接外部时钟)
|
||||
#define BL55072A_CMD_ICSET (ICSET_BASIC | ICSET_SOFT_RST_DIS |ICSET_OSC_INNER)
|
||||
|
||||
|
||||
|
||||
// 5. 闪烁控制命令 BLKCTL
|
||||
#define BLKCTL_BASIC 0xF0 // Bit7=C=1, Bit6=1, Bit5=1, Bit4=1(固定格式)
|
||||
#define BLKCTL_OFF 0x00 // 000:闪烁关闭(默认)
|
||||
#define BLKCTL_0_5HZ 0x01 // 001:0.5Hz闪烁
|
||||
#define BLKCTL_1HZ 0x02 // 010:1Hz闪烁
|
||||
#define BLKCTL_2HZ 0x03 // 011:2Hz闪烁
|
||||
#define BLKCTL_0_3HZ 0x04 // 100:0.3Hz闪烁(手册为0.3s?按手册定义)
|
||||
#define BLKCTL_0_2HZ 0x05 // 101:0.2Hz闪烁(手册为0.2s?按手册定义)
|
||||
#define BL55072A_CMD_BLKCTL (BLKCTL_BASIC | BLKCTL_OFF)
|
||||
|
||||
|
||||
|
||||
// 6. 全显控制命令 APCTL
|
||||
#define APCTL_BASIC 0xFC // Bit7=C=1, Bit6=1, Bit5=1, Bit4=1, Bit3=1, Bit2=1(固定格式)
|
||||
#define APCTL_NORMAL 0x00 // 正常显示(默认)
|
||||
#define APCTL_ALL_ON 0x02 // Bit1=1:全亮
|
||||
#define APCTL_ALL_OFF 0x01 // Bit0=1:全暗(优先级高于全亮)
|
||||
#define BL55072A_CMD_APCTL (APCTL_BASIC | APCTL_NORMAL)
|
||||
|
||||
|
||||
|
||||
/************************** 原理图SEG地址与液晶屏SEG顺序对照 **************************/
|
||||
|
||||
#define TIMER_FIRST8_AFED_SEG_NUM (30) // 定时部分第一个8 AFED段 所在SEG
|
||||
#define TIMER_FIRST8_BGC_SEG_NUM (29)
|
||||
|
||||
#define TIMER_SECOND8_AFED_SEG_NUM (28)
|
||||
#define TIMER_SECOND8_BGC_SEG_NUM (27)
|
||||
|
||||
#define TIMER_THIRD8_AFED_SEG_NUM (26)
|
||||
#define TIMER_THIRD8_BGC_SEG_NUM (25)
|
||||
|
||||
#define TIMER_FOURTH8_AFED_SEG_NUM (18)
|
||||
#define TIMER_FOURTH8_BGC_SEG_NUM (17)
|
||||
|
||||
#define TIME_FIRST8_AFED_SEG_NUM (16) // 累时部分第一个8 AFED段 所在SEG
|
||||
#define TIME_FIRST8_BGC_SEG_NUM (15)
|
||||
|
||||
#define TIME_SECOND8_AFED_SEG_NUM (14)
|
||||
#define TIME_SECOND8_BGC_SEG_NUM (13)
|
||||
|
||||
#define TIME_THIRD8_AFED_SEG_NUM (12)
|
||||
#define TIME_THIRD8_BGC_SG_NUM (11)
|
||||
|
||||
#define TIME_FOURTH8_AFED_SEG_NUM (10)
|
||||
#define TIME_FOURTH8_BGC_SEG_NUM (9)
|
||||
|
||||
#define TIME_FIFTH8_AFED_SEG_NUM (8)
|
||||
#define TIME_FIFTH8_BGC_SEG_NUM (7)
|
||||
|
||||
#define ERROR_FIRT8_AFED_SEG_NUM (31) // 故障码显示第一个8
|
||||
#define ERROR_FIRT8_BGC_SEG_NUM (32)
|
||||
|
||||
#define ERROR_SECOND8_AFED_SEG_NUM (33)
|
||||
#define ERROR_SECOND8_BGC_SEG_NUM (34)
|
||||
|
||||
#define OXG_FIRST8_AFED_SEG_NUM (35) // 氧浓度第一个8 AFED段 所在SEG
|
||||
#define OXG_FIRST8_BGC_SEG_NUM (0)
|
||||
|
||||
#define OXG_SECOND8_AFED_SEG_NUM (1)
|
||||
#define OXG_SECOND8_BGC_SEG_NUM (2)
|
||||
|
||||
#define OXG_THIRD8_AFED_SEG_NUM (3)
|
||||
#define OXG_THIRD8_BGC_SG_NUM (4)
|
||||
|
||||
#define ADDITION_SEG_POS (0x08) // 除数字之外其他附加字符所在位置
|
||||
|
||||
#define TIMER_COL_ARRAY_INDEX (13)
|
||||
#define TIMER_H1_ARRAY_INDEX (8)
|
||||
#define TOTAL_TIME_H2_ARRAY_INDEX (3)
|
||||
#define OXG_S1_ARRAY_INDEX (17)
|
||||
#define OXG_POINT_ARRAY_INDEX (1)
|
||||
#define OXG_PERCEENET_ARRAY_INDEX (2)
|
||||
|
||||
|
||||
/************************** 显示内容配置结构体定义 **************************/
|
||||
// 定义灯的状态枚举
|
||||
typedef enum
|
||||
{
|
||||
LIGHT_OFF = 0, // 灯灭,值为0
|
||||
LIGHT_ON = 1 // 亮起,值为1
|
||||
}LightState;
|
||||
|
||||
// 用于选择累时部分显示模式
|
||||
typedef enum
|
||||
{
|
||||
MODE_TOTAL_TIME, // 累时部分五个8按照total_time的值进行显示 用于显示H及累时
|
||||
MODE_INDEX // 累时部分五个8使用index的值进行显示,不显示H 用于上电显示Hello
|
||||
|
||||
}Time_Mode;
|
||||
|
||||
// 用于设置界面显示的内容的结构体
|
||||
typedef struct
|
||||
{
|
||||
struct
|
||||
{
|
||||
uint8_t hours; // 定时小时数
|
||||
uint8_t minutes; // 定时分钟数
|
||||
|
||||
LightState is_light; // 显示控制 用于控制定时部分内容是否显示
|
||||
}timer;
|
||||
|
||||
struct
|
||||
{
|
||||
Time_Mode time_mode; // 显示累时还是HELLO MODE_TOTAL_TIME显示累时 MODE_INDEX用于按照索引值显示
|
||||
|
||||
uint32_t hours; // 累时小时数
|
||||
|
||||
uint8_t first8_segtable_index; // 从左向右数第一个8显示内容对应断码表索引
|
||||
uint8_t second8_segtable_index;
|
||||
uint8_t third8_segtable_index;
|
||||
uint8_t fourth8_segtable_index;
|
||||
uint8_t fifth8_segtable_index; // 从左向右第五个8 显示内容对应断码表索引
|
||||
|
||||
LightState is_light; // 显示控制
|
||||
}total_time;
|
||||
|
||||
struct
|
||||
{
|
||||
uint8_t first8_segtable_index; // 从左向右第1个8 显示内容对应断码表索引
|
||||
uint8_t second8_segtable_index;
|
||||
|
||||
LightState is_light; // 故障码显示控制
|
||||
}error;
|
||||
|
||||
struct
|
||||
{
|
||||
uint16_t value; // 浓度值 999对应99.9%
|
||||
LightState is_light; // 显示控制
|
||||
}oxg;
|
||||
|
||||
|
||||
|
||||
}PanelDisplayInfo;
|
||||
|
||||
// 导出屏幕内容显示变量
|
||||
extern volatile PanelDisplayInfo panel_display_info;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/************************** 供外部调用的API函数 **************************/
|
||||
void user_display_init(void); // 上电后执行 用于初始化GPIO 显示屏显存内容
|
||||
void user_display_refresh(void); // 每隔500ms执行一次 用于周期性刷新屏幕
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __8F_5AW_DISPLAY_H */
|
||||
|
||||
/************************ (C) COPYRIGHT Yuwell *****END OF FILE****/
|
||||
@ -94,14 +94,18 @@ extern "C" {
|
||||
// 功率转换系数=3537*1毫欧*0.51K*1000/(1.218*1.218)/(390K*5+0.51K)=623.39 ,整数运算考虑,放大10倍,*10=6234
|
||||
// 电流转换系数=305978*1毫欧/1.218=251213,整数运算考虑,防止运算溢出,缩小10倍,/10=25121
|
||||
// 电流转换系数=305978*2毫欧/1.218=502426,整数运算考虑,防止运算溢出,缩小10倍,/10=50243
|
||||
// 电压转换系数=73989*0.51K*1000/1.218/(390K*5+0.51K)=15883 0
|
||||
// 电压转换系数=73989*0.51K*1000/1.218/(390K*5+0.51K)=15883 0
|
||||
|
||||
// 更换电压采样电阻后的转换系数(使用3个620k的电阻取代五个390k的电阻)
|
||||
// = 16650
|
||||
|
||||
// 电能系数=3600000*Power_K/1638.4/256=5350.6,对应于1度电的脉冲计数
|
||||
// 电流采用1毫欧电阻采样,电压采用390K*5+0.51K进行分压,实际测试发现电阻存在偏差,进行微调
|
||||
// BL0942评估版,立创直接贴片合金电阻(台湾厚声MS121WF100NT4E ),实际测量比1毫欧偏小,约0.93毫欧
|
||||
|
||||
#define Power_K 6234; // 理论值
|
||||
#define Current_K 25121; // 理论值
|
||||
#define Voltage_K 15883; // 理论值
|
||||
#define Voltage_K 16650; // 理论值
|
||||
#define Energy_K 4976; // 理论值
|
||||
|
||||
//采用美隆1毫欧贴片合金电阻,实际比1毫欧偏大,约1.023毫欧
|
||||
@ -138,10 +142,10 @@ typedef enum
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
||||
// 从以下三个成员中读取计算数据
|
||||
uint16_t bus_rms_current_mA; // 总线供电电路有效值 单位为mA
|
||||
uint16_t bus_rms_voltage_V; // 总线供电电压有效值 单位为V
|
||||
uint16_t bus_active_power_watt; // 总线有功功率 单位为瓦特
|
||||
uint16_t bus_active_power_watt; // 总线有功功率*10 单位为瓦特*10
|
||||
|
||||
uint32_t power_raw;
|
||||
uint8_t power_array[4];
|
||||
|
||||
31585
MDK-ARM/JLinkLog.txt
31585
MDK-ARM/JLinkLog.txt
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
@ -120,6 +120,7 @@
|
||||
<SetRegEntry>
|
||||
<Number>0</Number>
|
||||
<Key>DLGUARM</Key>
|
||||
<Name>岏~</Name>
|
||||
</SetRegEntry>
|
||||
<SetRegEntry>
|
||||
<Number>0</Number>
|
||||
@ -154,6 +155,16 @@
|
||||
<WinNumber>1</WinNumber>
|
||||
<ItemText>elec_v_data,0x0A</ItemText>
|
||||
</Ww>
|
||||
<Ww>
|
||||
<count>1</count>
|
||||
<WinNumber>1</WinNumber>
|
||||
<ItemText>display_buffer</ItemText>
|
||||
</Ww>
|
||||
<Ww>
|
||||
<count>2</count>
|
||||
<WinNumber>1</WinNumber>
|
||||
<ItemText>panel_display_info,0x0A</ItemText>
|
||||
</Ww>
|
||||
</WatchWindow1>
|
||||
<WatchWindow2>
|
||||
<Ww>
|
||||
@ -168,7 +179,7 @@
|
||||
<DebugFlag>
|
||||
<trace>0</trace>
|
||||
<periodic>1</periodic>
|
||||
<aLwin>1</aLwin>
|
||||
<aLwin>0</aLwin>
|
||||
<aCover>0</aCover>
|
||||
<aSer1>0</aSer1>
|
||||
<aSer2>0</aSer2>
|
||||
@ -308,6 +319,18 @@
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>3</GroupNumber>
|
||||
<FileNumber>7</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\8F_5AW_Display\8f_5aw_display.c</PathWithFileName>
|
||||
<FilenameWithoutPath>8f_5aw_display.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
</Group>
|
||||
|
||||
<Group>
|
||||
@ -318,7 +341,7 @@
|
||||
<RteFlg>0</RteFlg>
|
||||
<File>
|
||||
<GroupNumber>4</GroupNumber>
|
||||
<FileNumber>7</FileNumber>
|
||||
<FileNumber>8</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
@ -338,7 +361,7 @@
|
||||
<RteFlg>0</RteFlg>
|
||||
<File>
|
||||
<GroupNumber>5</GroupNumber>
|
||||
<FileNumber>8</FileNumber>
|
||||
<FileNumber>9</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
@ -350,7 +373,7 @@
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>5</GroupNumber>
|
||||
<FileNumber>9</FileNumber>
|
||||
<FileNumber>10</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
@ -362,7 +385,7 @@
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>5</GroupNumber>
|
||||
<FileNumber>10</FileNumber>
|
||||
<FileNumber>11</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
@ -374,7 +397,7 @@
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>5</GroupNumber>
|
||||
<FileNumber>11</FileNumber>
|
||||
<FileNumber>12</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
@ -386,7 +409,7 @@
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>5</GroupNumber>
|
||||
<FileNumber>12</FileNumber>
|
||||
<FileNumber>13</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
@ -398,7 +421,7 @@
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>5</GroupNumber>
|
||||
<FileNumber>13</FileNumber>
|
||||
<FileNumber>14</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
@ -410,7 +433,7 @@
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>5</GroupNumber>
|
||||
<FileNumber>14</FileNumber>
|
||||
<FileNumber>15</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
@ -422,7 +445,7 @@
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>5</GroupNumber>
|
||||
<FileNumber>15</FileNumber>
|
||||
<FileNumber>16</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
@ -434,7 +457,7 @@
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>5</GroupNumber>
|
||||
<FileNumber>16</FileNumber>
|
||||
<FileNumber>17</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
@ -446,7 +469,7 @@
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>5</GroupNumber>
|
||||
<FileNumber>17</FileNumber>
|
||||
<FileNumber>18</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
@ -458,7 +481,7 @@
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>5</GroupNumber>
|
||||
<FileNumber>18</FileNumber>
|
||||
<FileNumber>19</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
@ -470,7 +493,7 @@
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>5</GroupNumber>
|
||||
<FileNumber>19</FileNumber>
|
||||
<FileNumber>20</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
@ -482,7 +505,7 @@
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>5</GroupNumber>
|
||||
<FileNumber>20</FileNumber>
|
||||
<FileNumber>21</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
@ -494,7 +517,7 @@
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>5</GroupNumber>
|
||||
<FileNumber>21</FileNumber>
|
||||
<FileNumber>22</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
@ -506,7 +529,7 @@
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>5</GroupNumber>
|
||||
<FileNumber>22</FileNumber>
|
||||
<FileNumber>23</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
@ -518,7 +541,7 @@
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>5</GroupNumber>
|
||||
<FileNumber>23</FileNumber>
|
||||
<FileNumber>24</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
@ -530,7 +553,7 @@
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>5</GroupNumber>
|
||||
<FileNumber>24</FileNumber>
|
||||
<FileNumber>25</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
@ -542,7 +565,7 @@
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>5</GroupNumber>
|
||||
<FileNumber>25</FileNumber>
|
||||
<FileNumber>26</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
@ -554,7 +577,7 @@
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>5</GroupNumber>
|
||||
<FileNumber>26</FileNumber>
|
||||
<FileNumber>27</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
@ -566,7 +589,7 @@
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>5</GroupNumber>
|
||||
<FileNumber>27</FileNumber>
|
||||
<FileNumber>28</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
@ -578,7 +601,7 @@
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>5</GroupNumber>
|
||||
<FileNumber>28</FileNumber>
|
||||
<FileNumber>29</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
@ -590,7 +613,7 @@
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>5</GroupNumber>
|
||||
<FileNumber>29</FileNumber>
|
||||
<FileNumber>30</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
@ -602,7 +625,7 @@
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>5</GroupNumber>
|
||||
<FileNumber>30</FileNumber>
|
||||
<FileNumber>31</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
@ -614,7 +637,7 @@
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>5</GroupNumber>
|
||||
<FileNumber>31</FileNumber>
|
||||
<FileNumber>32</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
@ -626,7 +649,7 @@
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>5</GroupNumber>
|
||||
<FileNumber>32</FileNumber>
|
||||
<FileNumber>33</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
@ -638,7 +661,7 @@
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>5</GroupNumber>
|
||||
<FileNumber>33</FileNumber>
|
||||
<FileNumber>34</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
@ -650,7 +673,7 @@
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>5</GroupNumber>
|
||||
<FileNumber>34</FileNumber>
|
||||
<FileNumber>35</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
@ -662,7 +685,7 @@
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>5</GroupNumber>
|
||||
<FileNumber>35</FileNumber>
|
||||
<FileNumber>36</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
@ -674,7 +697,7 @@
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>5</GroupNumber>
|
||||
<FileNumber>36</FileNumber>
|
||||
<FileNumber>37</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
@ -686,7 +709,7 @@
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>5</GroupNumber>
|
||||
<FileNumber>37</FileNumber>
|
||||
<FileNumber>38</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
@ -698,7 +721,7 @@
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>5</GroupNumber>
|
||||
<FileNumber>38</FileNumber>
|
||||
<FileNumber>39</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
@ -710,7 +733,7 @@
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>5</GroupNumber>
|
||||
<FileNumber>39</FileNumber>
|
||||
<FileNumber>40</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
@ -722,7 +745,7 @@
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>5</GroupNumber>
|
||||
<FileNumber>40</FileNumber>
|
||||
<FileNumber>41</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
@ -734,7 +757,7 @@
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>5</GroupNumber>
|
||||
<FileNumber>41</FileNumber>
|
||||
<FileNumber>42</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
@ -746,7 +769,7 @@
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>5</GroupNumber>
|
||||
<FileNumber>42</FileNumber>
|
||||
<FileNumber>43</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
@ -758,7 +781,7 @@
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>5</GroupNumber>
|
||||
<FileNumber>43</FileNumber>
|
||||
<FileNumber>44</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
<TargetName>Coulombmeter</TargetName>
|
||||
<ToolsetNumber>0x4</ToolsetNumber>
|
||||
<ToolsetName>ARM-ADS</ToolsetName>
|
||||
<pCCUsed>5060960::V5.06 update 7 (build 960)::.\ARMCLANG506</pCCUsed>
|
||||
<pCCUsed>5060960::V5.06 update 7 (build 960)::.\ARM_Compiler_5.06u7</pCCUsed>
|
||||
<uAC6>0</uAC6>
|
||||
<TargetOption>
|
||||
<TargetCommonOption>
|
||||
@ -340,7 +340,7 @@
|
||||
<MiscControls></MiscControls>
|
||||
<Define>FM33LG0XX,USE_FULL_ASSERT</Define>
|
||||
<Undefine></Undefine>
|
||||
<IncludePath>..\Drivers\CMSIS;..\Drivers\FM33LG0xx_FL_Driver\Inc;..\Inc;..\MF-config\Inc;..\8F_5AW_PowerMeter</IncludePath>
|
||||
<IncludePath>..\Drivers\CMSIS;..\Drivers\FM33LG0xx_FL_Driver\Inc;..\Inc;..\MF-config\Inc;..\8F_5AW_PowerMeter;..\8F_5AW_Display</IncludePath>
|
||||
</VariousControls>
|
||||
</Cads>
|
||||
<Aads>
|
||||
@ -424,6 +424,11 @@
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\8F_5AW_PowerMeter\8f_5aw_powerMeter.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>8f_5aw_display.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\8F_5AW_Display\8f_5aw_display.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
|
||||
15
Src/main.c
15
Src/main.c
@ -52,6 +52,7 @@
|
||||
#include "fm33_assert.h"
|
||||
|
||||
#include "8f_5aw_powerMeter.h"
|
||||
#include "8f_5aw_display.h"
|
||||
|
||||
|
||||
#define FREQ_CHECK_ENABLE (1) // 选择是否使能频率检查 仅在debug阶段使用
|
||||
@ -93,7 +94,7 @@ int main(void)
|
||||
|
||||
FL_GPIO_SetOutputPin(GPIOC, FL_GPIO_PIN_12);
|
||||
|
||||
|
||||
user_display_init();
|
||||
|
||||
// 初始化定时器任务
|
||||
#if FREQ_CHECK
|
||||
@ -106,15 +107,23 @@ int main(void)
|
||||
|
||||
User_PowerMeter_Init(); // 初始化电量计芯片
|
||||
|
||||
panel_display_info.error.is_light = LIGHT_OFF;
|
||||
while(1)
|
||||
{
|
||||
FL_DelayMs(1000);
|
||||
FL_DelayMs(500);
|
||||
|
||||
User_Power_refresh();
|
||||
|
||||
// LED灯闪烁
|
||||
FL_GPIO_ToggleOutputPin(GPIOD, FL_GPIO_PIN_5);
|
||||
|
||||
|
||||
panel_display_info.oxg.value = elec_v_data.bus_rms_voltage_V;
|
||||
panel_display_info.total_time.hours = elec_v_data.bus_rms_current_mA;
|
||||
|
||||
panel_display_info.timer.hours = elec_v_data.bus_active_power_watt / 100;
|
||||
panel_display_info.timer.minutes = elec_v_data.bus_active_power_watt % 100;
|
||||
|
||||
user_display_refresh();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user