更新:EEPROM 参数批量读&写成功
This commit is contained in:
parent
f5495479f1
commit
f7f5d16292
|
@ -2,7 +2,7 @@
|
|||
* @Author: wujunchao wujunchao@wuxismart.com
|
||||
* @Date: 2025-03-17 14:38:22
|
||||
* @LastEditors: wujunchao wujunchao@wuxismart.com
|
||||
* @LastEditTime: 2025-03-17 14:52:16
|
||||
* @LastEditTime: 2025-04-01 14:42:01
|
||||
* @FilePath: \signal_generator\App\APP_WU\Inc\eeprom_spi.h
|
||||
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
||||
*/
|
||||
|
@ -32,18 +32,63 @@
|
|||
//MISO->PB4
|
||||
#define EEPROM_MISO HAL_GPIO_ReadPin(EEPROM_MISO_GPIO_Port, EEPROM_MISO_Pin)
|
||||
|
||||
//eeprom cmd
|
||||
#define WRITE_ENABLE 0x06
|
||||
#define WRITE_DISABLE 0x04
|
||||
#define WRITE_MEMORY 0x02
|
||||
#define READ_MEMORY 0x03
|
||||
#define READ_STATUS 0x05
|
||||
|
||||
//my address
|
||||
//{
|
||||
#define EE_START_ADDR 0x000000
|
||||
#define EE_INTERVAL 16
|
||||
|
||||
#define VOL_V_UP_ADDR EE_START_ADDR
|
||||
#define VOL_V_LOW_ADDR (VOL_V_UP_ADDR + EE_INTERVAL)
|
||||
#define VOL_MV_UP_ADDR (VOL_V_LOW_ADDR + EE_INTERVAL)
|
||||
#define VOL_MV_LOW_ADDR (VOL_MV_UP_ADDR + EE_INTERVAL)
|
||||
#define CUR_UP_ADDR (VOL_MV_LOW_ADDR + EE_INTERVAL)
|
||||
#define CUR_LOW_ADDR (CUR_UP_ADDR + EE_INTERVAL)
|
||||
#define RES_UP_ADDR (CUR_LOW_ADDR + EE_INTERVAL)
|
||||
#define RES_LOW_ADDR (RES_UP_ADDR + EE_INTERVAL)
|
||||
#define FRE_UP_ADDR (RES_LOW_ADDR + EE_INTERVAL)
|
||||
#define FRE_LOW_ADDR (FRE_UP_ADDR + EE_INTERVAL)
|
||||
#define TC_K_UP_ADDR (FRE_LOW_ADDR + EE_INTERVAL)
|
||||
#define TC_K_LOW_ADDR (TC_K_UP_ADDR + EE_INTERVAL)
|
||||
#define TC_S_UP_ADDR (TC_K_LOW_ADDR + EE_INTERVAL)
|
||||
#define TC_S_LOW_ADDR (TC_S_UP_ADDR + EE_INTERVAL)
|
||||
#define TC_N_UP_ADDR (TC_S_LOW_ADDR + EE_INTERVAL)
|
||||
#define TC_N_LOW_ADDR (TC_N_UP_ADDR + EE_INTERVAL)
|
||||
#define TC_B_UP_ADDR (TC_N_LOW_ADDR + EE_INTERVAL)
|
||||
#define TC_B_LOW_ADDR (TC_B_UP_ADDR + EE_INTERVAL)
|
||||
#define TC_E_UP_ADDR (TC_B_LOW_ADDR + EE_INTERVAL)
|
||||
#define TC_E_LOW_ADDR (TC_E_UP_ADDR + EE_INTERVAL)
|
||||
#define TC_J_UP_ADDR (TC_E_LOW_ADDR + EE_INTERVAL)
|
||||
#define TC_J_LOW_ADDR (TC_J_UP_ADDR + EE_INTERVAL)
|
||||
#define TC_R_UP_ADDR (TC_J_LOW_ADDR + EE_INTERVAL)
|
||||
#define TC_R_LOW_ADDR (TC_R_UP_ADDR + EE_INTERVAL)
|
||||
#define TC_T_UP_ADDR (TC_R_LOW_ADDR + EE_INTERVAL)
|
||||
#define TC_T_LOW_ADDR (TC_T_UP_ADDR + EE_INTERVAL)
|
||||
#define RTD_UP_ADDR (TC_T_LOW_ADDR + EE_INTERVAL)
|
||||
#define RTD_LOW_ADDR (RTD_UP_ADDR + EE_INTERVAL)
|
||||
//}
|
||||
|
||||
extern uint8_t eeprom_wrt_error_flag;
|
||||
extern uint8_t eeprom_rd_error_flag;
|
||||
|
||||
void eeprom_spi_init(void);
|
||||
void eeprom_spi_writebyte(uint8_t wrt_data);
|
||||
uint8_t SPI_WriteReadByte(uint8_t data);
|
||||
uint8_t eeprom_spi_readbyte(void);
|
||||
void eeprom_writedata(uint8_t addr[3], uint8_t txd);
|
||||
uint8_t eeprom_readdata(uint8_t addr[3]);
|
||||
void eeprom_writedata(int32_t addr_long, uint8_t txd);
|
||||
uint8_t eeprom_readdata(int32_t addr_long);
|
||||
|
||||
//存储参数
|
||||
void eeprom_datasave(void);
|
||||
|
||||
//开机上电后读取参数
|
||||
void eeprom_dataread(void);
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -29,6 +29,13 @@ void tab_data_init(void)
|
|||
void item0_data_init(void)
|
||||
{
|
||||
tabdata.item0_page0_vunit = VOLTAGE_V; //电压单位
|
||||
tabdata.item0_page1_TCtype = TC_K; //默认为K类型的热电偶
|
||||
|
||||
eeprom_dataread();
|
||||
|
||||
//读取过程中出现过错误
|
||||
if( eeprom_rd_error_flag )
|
||||
{
|
||||
tabdata.item0_page0_vup[0] = VOL[0].up; //电压V上限
|
||||
tabdata.item0_page0_vlow[0] = VOL[0].low; //电压V下限
|
||||
tabdata.item0_page0_vup[1] = VOL[1].up; //电压mV上限
|
||||
|
@ -39,7 +46,6 @@ void item0_data_init(void)
|
|||
tabdata.item0_page1_rlow = RES.low; //电阻下限
|
||||
tabdata.item0_page1_fup = FRE.up; //频率上限
|
||||
tabdata.item0_page1_flow = FRE.low; //频率下限
|
||||
tabdata.item0_page1_TCtype = TC_K; //默认为K类型的热电偶
|
||||
tabdata.item0_page1_TCup[0] = TC[0].up; //TCK上限
|
||||
tabdata.item0_page1_TClow[0] = TC[0].low; //TCK下限
|
||||
tabdata.item0_page1_TCup[1] = TC[1].up; //TCS上限
|
||||
|
@ -59,6 +65,7 @@ void item0_data_init(void)
|
|||
tabdata.item0_page2_RTDup = RTD.up; //RTD上限
|
||||
tabdata.item0_page2_RTDlow = RTD.low; //RTD下限
|
||||
}
|
||||
}
|
||||
|
||||
//KEY_SETTING
|
||||
void key_functions_setting(void)
|
||||
|
@ -1520,6 +1527,8 @@ void set_item1_value(uint8_t con, int8_t step)
|
|||
tabdata.item1_page0_saveflag = 1;
|
||||
|
||||
//执行保存
|
||||
set_item1_text(DATA_SAVE);
|
||||
eeprom_datasave();
|
||||
save_cnt = 0;
|
||||
}
|
||||
}
|
||||
|
@ -1797,18 +1806,33 @@ void tab_window_deal(void)
|
|||
|
||||
}
|
||||
|
||||
// uint8_t eep_test_flag = 0;
|
||||
// uint8_t tx = 0, rx = 0;
|
||||
// uint8_t addr_test[3] = {0};
|
||||
void scr_setting_run(void) //详细设置界面
|
||||
{
|
||||
if(tabdata.item1_page0_saveflag == 1)
|
||||
{
|
||||
save_cnt++;
|
||||
if(save_cnt > 10)
|
||||
if(save_cnt > 5)
|
||||
{
|
||||
save_cnt = 0;
|
||||
|
||||
if(eeprom_wrt_error_flag == 0)
|
||||
{
|
||||
//未出错
|
||||
tabdata.item1_page0_saveflag = 2;
|
||||
|
||||
set_item1_text(DATA_SAVE);
|
||||
}
|
||||
else
|
||||
{
|
||||
//出现过错误
|
||||
tabdata.item1_page0_saveflag = 0;
|
||||
|
||||
set_item1_text(DATA_SAVE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(tabdata.item1_page0_resetflag == 1)
|
||||
|
@ -1822,6 +1846,18 @@ void scr_setting_run(void) //详细设置界面
|
|||
set_item1_text(DATA_RESET);
|
||||
}
|
||||
}
|
||||
|
||||
// if(eep_test_flag == 1)
|
||||
// {
|
||||
// eep_test_flag = 0;
|
||||
|
||||
// int addr_test_long = 0;
|
||||
// addr_test_long += addr_test[0]<<16;
|
||||
// addr_test_long += addr_test[1]<<8;
|
||||
// addr_test_long += addr_test[2];
|
||||
|
||||
// rx = eeprom_readdata(addr_test_long);
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* @Author: wujunchao wujunchao@wuxismart.com
|
||||
* @Date: 2025-03-17 14:38:34
|
||||
* @LastEditors: wujunchao wujunchao@wuxismart.com
|
||||
* @LastEditTime: 2025-03-19 11:08:41
|
||||
* @LastEditTime: 2025-04-01 15:45:37
|
||||
* @FilePath: \signal_generator\App\APP_WU\Src\eeprom_spi.c
|
||||
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
||||
*/
|
||||
|
@ -115,11 +115,20 @@ uint8_t SPI_WriteReadByte(uint8_t data)
|
|||
return(data);
|
||||
}
|
||||
|
||||
void eeprom_writedata(uint8_t addr[3], uint8_t txd)
|
||||
|
||||
uint8_t eeprom_wrt_error_flag = 0;
|
||||
void eeprom_writedata(int32_t addr_long, uint8_t txd)
|
||||
{
|
||||
uint8_t write_en_flag = 0;
|
||||
uint8_t ee_status = 0;
|
||||
uint8_t addr[3];
|
||||
addr[0] = addr_long >> 16;
|
||||
addr[1] = addr_long >> 8;
|
||||
addr[2] = addr_long;
|
||||
|
||||
int16_t wait_max = 0;
|
||||
do
|
||||
{
|
||||
EEPROM_CS_L;
|
||||
delay_cnt(10);
|
||||
eeprom_spi_writebyte(WRITE_ENABLE);
|
||||
|
@ -133,9 +142,17 @@ void eeprom_writedata(uint8_t addr[3], uint8_t txd)
|
|||
delay_cnt(10);
|
||||
EEPROM_CS_H;
|
||||
|
||||
write_en_flag = ee_status & 0x02;
|
||||
if(write_en_flag)
|
||||
write_en_flag = ee_status & 0x03;
|
||||
|
||||
wait_max++;
|
||||
if(wait_max > 500)
|
||||
{
|
||||
eeprom_wrt_error_flag = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
} while (write_en_flag != 0x02);
|
||||
|
||||
EEPROM_CS_L;
|
||||
delay_cnt(10);
|
||||
eeprom_spi_writebyte(WRITE_MEMORY);
|
||||
|
@ -145,15 +162,23 @@ void eeprom_writedata(uint8_t addr[3], uint8_t txd)
|
|||
eeprom_spi_writebyte(txd);
|
||||
delay_cnt(10);
|
||||
EEPROM_CS_H;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
uint8_t eeprom_readdata(uint8_t addr[3])
|
||||
uint8_t eeprom_rd_error_flag = 0;
|
||||
uint8_t eeprom_readdata(int32_t addr_long)
|
||||
{
|
||||
uint8_t rxd = 0;
|
||||
uint8_t write_en_flag = 0;
|
||||
uint8_t ee_status = 0;
|
||||
uint8_t addr[3];
|
||||
addr[0] = addr_long >> 16;
|
||||
addr[1] = addr_long >> 8;
|
||||
addr[2] = addr_long ;
|
||||
|
||||
int16_t wait_max = 0;
|
||||
do
|
||||
{
|
||||
EEPROM_CS_L;
|
||||
delay_cnt(10);
|
||||
eeprom_spi_writebyte(WRITE_ENABLE);
|
||||
|
@ -167,9 +192,17 @@ uint8_t eeprom_readdata(uint8_t addr[3])
|
|||
delay_cnt(10);
|
||||
EEPROM_CS_H;
|
||||
|
||||
write_en_flag = ee_status & 0x02;
|
||||
if(write_en_flag)
|
||||
write_en_flag = ee_status & 0x01;
|
||||
|
||||
wait_max++;
|
||||
if(wait_max > 500)
|
||||
{
|
||||
eeprom_rd_error_flag = 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
} while (write_en_flag);
|
||||
|
||||
EEPROM_CS_L;
|
||||
delay_cnt(10);
|
||||
eeprom_spi_writebyte(READ_MEMORY);
|
||||
|
@ -179,9 +212,302 @@ uint8_t eeprom_readdata(uint8_t addr[3])
|
|||
rxd = eeprom_spi_readbyte();
|
||||
delay_cnt(10);
|
||||
EEPROM_CS_H;
|
||||
}
|
||||
|
||||
return rxd;
|
||||
}
|
||||
|
||||
|
||||
//存储参数
|
||||
void eeprom_datasave(void)
|
||||
{
|
||||
uint8_t temp_h = 0, temp_l = 0;
|
||||
|
||||
//VOL V
|
||||
temp_h = tabdata.item0_page0_vup[0] >> 8;
|
||||
temp_l = tabdata.item0_page0_vup[0] & 0xFF;
|
||||
eeprom_writedata(VOL_V_UP_ADDR, temp_h);
|
||||
eeprom_writedata(VOL_V_UP_ADDR + 8, temp_l);
|
||||
|
||||
temp_h = tabdata.item0_page0_vlow[0] >> 8;
|
||||
temp_l = tabdata.item0_page0_vlow[0] & 0xFF;
|
||||
eeprom_writedata(VOL_V_LOW_ADDR, temp_h);
|
||||
eeprom_writedata(VOL_V_LOW_ADDR + 8, temp_l);
|
||||
|
||||
//VOL mV
|
||||
temp_h = tabdata.item0_page0_vup[1] >> 8;
|
||||
temp_l = tabdata.item0_page0_vup[1] & 0xFF;
|
||||
eeprom_writedata(VOL_MV_UP_ADDR, temp_h);
|
||||
eeprom_writedata(VOL_MV_UP_ADDR + 8, temp_l);
|
||||
|
||||
temp_h = tabdata.item0_page0_vlow[1] >> 8;
|
||||
temp_l = tabdata.item0_page0_vlow[1] & 0xFF;
|
||||
eeprom_writedata(VOL_MV_LOW_ADDR, temp_h);
|
||||
eeprom_writedata(VOL_MV_LOW_ADDR + 8, temp_l);
|
||||
|
||||
//CUR
|
||||
temp_h = tabdata.item0_page0_cup >> 8;
|
||||
temp_l = tabdata.item0_page0_cup & 0xFF;
|
||||
eeprom_writedata(CUR_UP_ADDR, temp_h);
|
||||
eeprom_writedata(CUR_UP_ADDR + 8, temp_l);
|
||||
|
||||
temp_h = tabdata.item0_page0_clow >> 8;
|
||||
temp_l = tabdata.item0_page0_clow & 0xFF;
|
||||
eeprom_writedata(CUR_LOW_ADDR, temp_h);
|
||||
eeprom_writedata(CUR_LOW_ADDR + 8, temp_l);
|
||||
|
||||
//RES
|
||||
temp_h = tabdata.item0_page0_rup >> 8;
|
||||
temp_l = tabdata.item0_page0_rup & 0xFF;
|
||||
eeprom_writedata(RES_UP_ADDR, temp_h);
|
||||
eeprom_writedata(RES_UP_ADDR + 8, temp_l);
|
||||
|
||||
temp_h = tabdata.item0_page1_rlow >> 8;
|
||||
temp_l = tabdata.item0_page1_rlow & 0xFF;
|
||||
eeprom_writedata(RES_LOW_ADDR, temp_h);
|
||||
eeprom_writedata(RES_LOW_ADDR + 8, temp_l);
|
||||
|
||||
//FRE
|
||||
temp_h = tabdata.item0_page1_fup >> 8;
|
||||
temp_l = tabdata.item0_page1_fup & 0xFF;
|
||||
eeprom_writedata(FRE_UP_ADDR, temp_h);
|
||||
eeprom_writedata(FRE_UP_ADDR + 8, temp_l);
|
||||
|
||||
temp_h = tabdata.item0_page1_flow >> 8;
|
||||
temp_l = tabdata.item0_page1_flow & 0xFF;
|
||||
eeprom_writedata(FRE_LOW_ADDR, temp_h);
|
||||
eeprom_writedata(FRE_LOW_ADDR + 8, temp_l);
|
||||
|
||||
//TC K
|
||||
temp_h = tabdata.item0_page1_TCup[0] >> 8;
|
||||
temp_l = tabdata.item0_page1_TCup[0] & 0xFF;
|
||||
eeprom_writedata(TC_K_UP_ADDR, temp_h);
|
||||
eeprom_writedata(TC_K_UP_ADDR + 8, temp_l);
|
||||
|
||||
temp_h = tabdata.item0_page1_TClow[0] >> 8;
|
||||
temp_l = tabdata.item0_page1_TClow[0] & 0xFF;
|
||||
eeprom_writedata(TC_K_LOW_ADDR, temp_h);
|
||||
eeprom_writedata(TC_K_LOW_ADDR + 8, temp_l);
|
||||
|
||||
//TC S
|
||||
temp_h = tabdata.item0_page1_TCup[1] >> 8;
|
||||
temp_l = tabdata.item0_page1_TCup[1] & 0xFF;
|
||||
eeprom_writedata(TC_S_UP_ADDR, temp_h);
|
||||
eeprom_writedata(TC_S_UP_ADDR + 8, temp_l);
|
||||
|
||||
temp_h = tabdata.item0_page1_TClow[1] >> 8;
|
||||
temp_l = tabdata.item0_page1_TClow[1] & 0xFF;
|
||||
eeprom_writedata(TC_S_LOW_ADDR, temp_h);
|
||||
eeprom_writedata(TC_S_LOW_ADDR + 8, temp_l);
|
||||
|
||||
//TC N
|
||||
temp_h = tabdata.item0_page1_TCup[2] >> 8;
|
||||
temp_l = tabdata.item0_page1_TCup[2] & 0xFF;
|
||||
eeprom_writedata(TC_N_UP_ADDR, temp_h);
|
||||
eeprom_writedata(TC_N_UP_ADDR + 8, temp_l);
|
||||
|
||||
temp_h = tabdata.item0_page1_TClow[2] >> 8;
|
||||
temp_l = tabdata.item0_page1_TClow[2] & 0xFF;
|
||||
eeprom_writedata(TC_N_LOW_ADDR, temp_h);
|
||||
eeprom_writedata(TC_N_LOW_ADDR + 8, temp_l);
|
||||
|
||||
//TC B
|
||||
temp_h = tabdata.item0_page1_TCup[3] >> 8;
|
||||
temp_l = tabdata.item0_page1_TCup[3] & 0xFF;
|
||||
eeprom_writedata(TC_B_UP_ADDR, temp_h);
|
||||
eeprom_writedata(TC_B_UP_ADDR + 8, temp_l);
|
||||
|
||||
temp_h = tabdata.item0_page1_TClow[3] >> 8;
|
||||
temp_l = tabdata.item0_page1_TClow[3] & 0xFF;
|
||||
eeprom_writedata(TC_B_LOW_ADDR, temp_h);
|
||||
eeprom_writedata(TC_B_LOW_ADDR + 8, temp_l);
|
||||
|
||||
//TC E
|
||||
temp_h = tabdata.item0_page1_TCup[4] >> 8;
|
||||
temp_l = tabdata.item0_page1_TCup[4] & 0xFF;
|
||||
eeprom_writedata(TC_E_UP_ADDR, temp_h);
|
||||
eeprom_writedata(TC_E_UP_ADDR + 8, temp_l);
|
||||
|
||||
temp_h = tabdata.item0_page1_TClow[4] >> 8;
|
||||
temp_l = tabdata.item0_page1_TClow[4] & 0xFF;
|
||||
eeprom_writedata(TC_E_LOW_ADDR, temp_h);
|
||||
eeprom_writedata(TC_E_LOW_ADDR + 8, temp_l);
|
||||
|
||||
//TC J
|
||||
temp_h = tabdata.item0_page1_TCup[5] >> 8;
|
||||
temp_l = tabdata.item0_page1_TCup[5] & 0xFF;
|
||||
eeprom_writedata(TC_J_UP_ADDR, temp_h);
|
||||
eeprom_writedata(TC_J_UP_ADDR + 8, temp_l);
|
||||
|
||||
temp_h = tabdata.item0_page1_TClow[5] >> 8;
|
||||
temp_l = tabdata.item0_page1_TClow[5] & 0xFF;
|
||||
eeprom_writedata(TC_J_LOW_ADDR, temp_h);
|
||||
eeprom_writedata(TC_J_LOW_ADDR + 8, temp_l);
|
||||
|
||||
//TC R
|
||||
temp_h = tabdata.item0_page1_TCup[6] >> 8;
|
||||
temp_l = tabdata.item0_page1_TCup[6] & 0xFF;
|
||||
eeprom_writedata(TC_R_UP_ADDR, temp_h);
|
||||
eeprom_writedata(TC_R_UP_ADDR + 8, temp_l);
|
||||
|
||||
temp_h = tabdata.item0_page1_TClow[6] >> 8;
|
||||
temp_l = tabdata.item0_page1_TClow[6] & 0xFF;
|
||||
eeprom_writedata(TC_R_LOW_ADDR, temp_h);
|
||||
eeprom_writedata(TC_R_LOW_ADDR + 8, temp_l);
|
||||
|
||||
//TC T
|
||||
temp_h = tabdata.item0_page1_TCup[7] >> 8;
|
||||
temp_l = tabdata.item0_page1_TCup[7] & 0xFF;
|
||||
eeprom_writedata(TC_T_UP_ADDR, temp_h);
|
||||
eeprom_writedata(TC_T_UP_ADDR + 8, temp_l);
|
||||
|
||||
temp_h = tabdata.item0_page1_TClow[7] >> 8;
|
||||
temp_l = tabdata.item0_page1_TClow[7] & 0xFF;
|
||||
eeprom_writedata(TC_T_LOW_ADDR, temp_h);
|
||||
eeprom_writedata(TC_T_LOW_ADDR + 8, temp_l);
|
||||
|
||||
//RTD
|
||||
temp_h = tabdata.item0_page2_RTDup >> 8;
|
||||
temp_l = tabdata.item0_page2_RTDup & 0xFF;
|
||||
eeprom_writedata(RTD_UP_ADDR, temp_h);
|
||||
eeprom_writedata(RTD_UP_ADDR + 8, temp_l);
|
||||
|
||||
temp_h = tabdata.item0_page2_RTDlow >> 8;
|
||||
temp_l = tabdata.item0_page2_RTDlow & 0xFF;
|
||||
eeprom_writedata(RTD_LOW_ADDR, temp_h);
|
||||
eeprom_writedata(RTD_LOW_ADDR + 8, temp_l);
|
||||
|
||||
}
|
||||
|
||||
//开机上电后读取参数
|
||||
void eeprom_dataread(void)
|
||||
{
|
||||
uint8_t temp_h = 0, temp_l = 0;
|
||||
|
||||
//VOL V
|
||||
temp_h = eeprom_readdata(VOL_V_UP_ADDR);
|
||||
temp_l = eeprom_readdata(VOL_V_UP_ADDR + 8);
|
||||
tabdata.item0_page0_vup[0] = ( temp_h << 8 ) + temp_l;
|
||||
|
||||
temp_h = eeprom_readdata(VOL_V_LOW_ADDR);
|
||||
temp_l = eeprom_readdata(VOL_V_LOW_ADDR + 8);
|
||||
tabdata.item0_page0_vlow[0] = ( temp_h << 8 ) + temp_l;
|
||||
|
||||
//VOL mV
|
||||
temp_h = eeprom_readdata(VOL_MV_UP_ADDR);
|
||||
temp_l = eeprom_readdata(VOL_MV_UP_ADDR + 8);
|
||||
tabdata.item0_page0_vup[1] = ( temp_h << 8 ) + temp_l;
|
||||
|
||||
temp_h = eeprom_readdata(VOL_MV_LOW_ADDR);
|
||||
temp_l = eeprom_readdata(VOL_MV_LOW_ADDR + 8);
|
||||
tabdata.item0_page0_vlow[1] = ( temp_h << 8 ) + temp_l;
|
||||
|
||||
//CUR
|
||||
//temp_h = eeprom_readdata(CUR_UP_ADDR);
|
||||
temp_l = eeprom_readdata(CUR_UP_ADDR + 8);
|
||||
tabdata.item0_page0_cup = temp_l;
|
||||
|
||||
//temp_h = eeprom_readdata(CUR_LOW_ADDR);
|
||||
temp_l = eeprom_readdata(CUR_LOW_ADDR + 8);
|
||||
tabdata.item0_page0_clow = temp_l;
|
||||
|
||||
//RES
|
||||
temp_h = eeprom_readdata(RES_UP_ADDR);
|
||||
temp_l = eeprom_readdata(RES_UP_ADDR + 8);
|
||||
tabdata.item0_page0_rup = ( temp_h << 8 ) + temp_l;
|
||||
|
||||
temp_h = eeprom_readdata(RES_LOW_ADDR);
|
||||
temp_l = eeprom_readdata(RES_LOW_ADDR + 8);
|
||||
tabdata.item0_page1_rlow = ( temp_h << 8 ) + temp_l;
|
||||
|
||||
//FRE
|
||||
//temp_h = eeprom_readdata(FRE_UP_ADDR);
|
||||
temp_l = eeprom_readdata(FRE_UP_ADDR + 8);
|
||||
tabdata.item0_page1_fup = temp_l;
|
||||
|
||||
//temp_h = eeprom_readdata(FRE_LOW_ADDR);
|
||||
temp_l = eeprom_readdata(FRE_LOW_ADDR + 8);
|
||||
tabdata.item0_page1_flow = temp_l;
|
||||
|
||||
//TC K
|
||||
temp_h = eeprom_readdata(TC_K_UP_ADDR);
|
||||
temp_l = eeprom_readdata(TC_K_UP_ADDR + 8);
|
||||
tabdata.item0_page1_TCup[0] = ( temp_h << 8 ) + temp_l;
|
||||
|
||||
temp_h = eeprom_readdata(TC_K_LOW_ADDR);
|
||||
temp_l = eeprom_readdata(TC_K_LOW_ADDR + 8);
|
||||
tabdata.item0_page1_TClow[0] = ( temp_h << 8 ) + temp_l;
|
||||
|
||||
//TC S
|
||||
temp_h = eeprom_readdata(TC_S_UP_ADDR);
|
||||
temp_l = eeprom_readdata(TC_S_UP_ADDR + 8);
|
||||
tabdata.item0_page1_TCup[1] = ( temp_h << 8 ) + temp_l;
|
||||
|
||||
temp_h = eeprom_readdata(TC_S_LOW_ADDR);
|
||||
temp_l = eeprom_readdata(TC_S_LOW_ADDR + 8);
|
||||
tabdata.item0_page1_TClow[1] = ( temp_h << 8 ) + temp_l;
|
||||
|
||||
//TC N
|
||||
temp_h = eeprom_readdata(TC_N_UP_ADDR);
|
||||
temp_l = eeprom_readdata(TC_N_UP_ADDR + 8);
|
||||
tabdata.item0_page1_TCup[2] = ( temp_h << 8 ) + temp_l;
|
||||
|
||||
temp_h = eeprom_readdata(TC_N_LOW_ADDR);
|
||||
temp_l = eeprom_readdata(TC_N_LOW_ADDR + 8);
|
||||
tabdata.item0_page1_TClow[2] = ( temp_h << 8 ) + temp_l;
|
||||
|
||||
//TC B
|
||||
temp_h = eeprom_readdata(TC_B_UP_ADDR);
|
||||
temp_l = eeprom_readdata(TC_B_UP_ADDR + 8);
|
||||
tabdata.item0_page1_TCup[3] = ( temp_h << 8 ) + temp_l;
|
||||
|
||||
temp_h = eeprom_readdata(TC_B_LOW_ADDR);
|
||||
temp_l = eeprom_readdata(TC_B_LOW_ADDR + 8);
|
||||
tabdata.item0_page1_TClow[3] = ( temp_h << 8 ) + temp_l;
|
||||
|
||||
//TC E
|
||||
temp_h = eeprom_readdata(TC_E_UP_ADDR);
|
||||
temp_l = eeprom_readdata(TC_E_UP_ADDR + 8);
|
||||
tabdata.item0_page1_TCup[4] = ( temp_h << 8 ) + temp_l;
|
||||
|
||||
temp_h = eeprom_readdata(TC_E_LOW_ADDR);
|
||||
temp_l = eeprom_readdata(TC_E_LOW_ADDR + 8);
|
||||
tabdata.item0_page1_TClow[4] = ( temp_h << 8 ) + temp_l;
|
||||
|
||||
//TC J
|
||||
temp_h = eeprom_readdata(TC_J_UP_ADDR);
|
||||
temp_l = eeprom_readdata(TC_J_UP_ADDR + 8);
|
||||
tabdata.item0_page1_TCup[5] = ( temp_h << 8 ) + temp_l;
|
||||
|
||||
temp_h = eeprom_readdata(TC_J_LOW_ADDR);
|
||||
temp_l = eeprom_readdata(TC_J_LOW_ADDR + 8);
|
||||
tabdata.item0_page1_TClow[5] = ( temp_h << 8 ) + temp_l;
|
||||
|
||||
//TC R
|
||||
temp_h = eeprom_readdata(TC_R_UP_ADDR);
|
||||
temp_l = eeprom_readdata(TC_R_UP_ADDR + 8);
|
||||
tabdata.item0_page1_TCup[6] = ( temp_h << 8 ) + temp_l;
|
||||
|
||||
temp_h = eeprom_readdata(TC_R_LOW_ADDR);
|
||||
temp_l = eeprom_readdata(TC_R_LOW_ADDR + 8);
|
||||
tabdata.item0_page1_TClow[6] = ( temp_h << 8 ) + temp_l;
|
||||
|
||||
//TC T
|
||||
temp_h = eeprom_readdata(TC_T_UP_ADDR);
|
||||
temp_l = eeprom_readdata(TC_T_UP_ADDR + 8);
|
||||
tabdata.item0_page1_TCup[7] = ( temp_h << 8 ) + temp_l;
|
||||
|
||||
temp_h = eeprom_readdata(TC_T_LOW_ADDR);
|
||||
temp_l = eeprom_readdata(TC_T_LOW_ADDR + 8);
|
||||
tabdata.item0_page1_TClow[7] = ( temp_h << 8 ) + temp_l;
|
||||
|
||||
//RTD
|
||||
temp_h = eeprom_readdata(RTD_UP_ADDR);
|
||||
temp_l = eeprom_readdata(RTD_UP_ADDR + 8);
|
||||
tabdata.item0_page2_RTDup = ( temp_h << 8 ) + temp_l;
|
||||
|
||||
temp_h = eeprom_readdata(RTD_LOW_ADDR);
|
||||
temp_l = eeprom_readdata(RTD_LOW_ADDR + 8);
|
||||
tabdata.item0_page2_RTDlow = ( temp_h << 8 ) + temp_l;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* @Author: wujunchao wujunchao@wuxismart.com
|
||||
* @Date: 2024-12-27 11:44:23
|
||||
* @LastEditors: wujunchao wujunchao@wuxismart.com
|
||||
* @LastEditTime: 2025-03-17 15:08:43
|
||||
* @LastEditTime: 2025-04-01 16:21:10
|
||||
* @FilePath: \signal_generator\App\APP_WU\timer.c
|
||||
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
||||
*/
|
||||
|
|
|
@ -305,7 +305,7 @@ int16_t menu_stack_watch = 0; // Word
|
|||
void start_menu(void const * argument)
|
||||
{
|
||||
/* USER CODE BEGIN start_menu */
|
||||
|
||||
screen_data_init();
|
||||
/* Infinite loop */
|
||||
for(;;)
|
||||
{
|
||||
|
|
|
@ -113,6 +113,7 @@ int main(void)
|
|||
MX_USART3_UART_Init();
|
||||
MX_I2C3_Init();
|
||||
/* USER CODE BEGIN 2 */
|
||||
eeprom_spi_init();
|
||||
tm1650_init(&hi2c1);
|
||||
// lcd_initial(); // LCD初始化,迁移至lv_port_disp_init()内部
|
||||
lv_init(); // LVGL 初始化
|
||||
|
@ -124,8 +125,6 @@ int main(void)
|
|||
setup_ui(&guider_ui); // 初始化UI,设置与加载初始界面
|
||||
events_init(&guider_ui); // 初始化事件
|
||||
|
||||
eeprom_spi_init();
|
||||
screen_data_init();
|
||||
/* USER CODE END 2 */
|
||||
|
||||
/* Call init function for freertos objects (in cmsis_os2.c) */
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -285,7 +285,24 @@
|
|||
<WinNumber>1</WinNumber>
|
||||
<ItemText>memuse_max,0x0A</ItemText>
|
||||
</Ww>
|
||||
<Ww>
|
||||
<count>26</count>
|
||||
<WinNumber>1</WinNumber>
|
||||
<ItemText>eeprom_wrt_error_flag,0x0A</ItemText>
|
||||
</Ww>
|
||||
<Ww>
|
||||
<count>27</count>
|
||||
<WinNumber>1</WinNumber>
|
||||
<ItemText>eeprom_rd_error_flag,0x0A</ItemText>
|
||||
</Ww>
|
||||
</WatchWindow1>
|
||||
<WatchWindow2>
|
||||
<Ww>
|
||||
<count>0</count>
|
||||
<WinNumber>2</WinNumber>
|
||||
<ItemText>tx</ItemText>
|
||||
</Ww>
|
||||
</WatchWindow2>
|
||||
<MemoryWindow1>
|
||||
<Mm>
|
||||
<WinNumber>1</WinNumber>
|
||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue