mirror of
https://github.com/silenty4ng/uv-k5-firmware-chinese-lts
synced 2025-01-15 14:54:40 +00:00
支持两个AT24C1024堆叠
This commit is contained in:
parent
e8dd6f2522
commit
49d04be340
4 changed files with 67 additions and 32 deletions
|
@ -20,15 +20,11 @@
|
||||||
</configurations>
|
</configurations>
|
||||||
</component>
|
</component>
|
||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="cea36e80-e289-4d69-9030-7186d540ac0e" name="更改" comment="修改侧键">
|
<list default="true" id="cea36e80-e289-4d69-9030-7186d540ac0e" name="更改" comment="修复侧键与MDC联系人冲突">
|
||||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/CMakeLists.txt" beforeDir="false" afterPath="$PROJECT_DIR$/CMakeLists.txt" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/Makefile" beforeDir="false" afterPath="$PROJECT_DIR$/Makefile" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/clion-Debug-log.txt" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/clion-Debug-log.txt" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/driver/eeprom.c" beforeDir="false" afterPath="$PROJECT_DIR$/driver/eeprom.c" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/uv_k5_firmware_custom_0_17.dir/includes_C.rsp" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/uv_k5_firmware_custom_0_17.dir/includes_C.rsp" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/uv_k5_firmware_custom_0_17.dir/includes_CXX.rsp" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug/CMakeFiles/uv_k5_firmware_custom_0_17.dir/includes_CXX.rsp" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/cmake-build-debug/uv_k5_firmware_custom_0_17.cbp" beforeDir="false" afterPath="$PROJECT_DIR$/cmake-build-debug/uv_k5_firmware_custom_0_17.cbp" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/main.c" beforeDir="false" afterPath="$PROJECT_DIR$/main.c" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/main.c" beforeDir="false" afterPath="$PROJECT_DIR$/main.c" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/settings.c" beforeDir="false" afterPath="$PROJECT_DIR$/settings.c" afterDir="false" />
|
|
||||||
</list>
|
</list>
|
||||||
<option name="SHOW_DIALOG" value="false" />
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||||
|
@ -301,14 +297,7 @@
|
||||||
<workItem from="1705070925031" duration="721000" />
|
<workItem from="1705070925031" duration="721000" />
|
||||||
<workItem from="1705072019086" duration="184000" />
|
<workItem from="1705072019086" duration="184000" />
|
||||||
<workItem from="1705123936006" duration="13772000" />
|
<workItem from="1705123936006" duration="13772000" />
|
||||||
<workItem from="1705149583084" duration="4224000" />
|
<workItem from="1705149583084" duration="5733000" />
|
||||||
</task>
|
|
||||||
<task id="LOCAL-00077" summary="readme add">
|
|
||||||
<created>1702026692058</created>
|
|
||||||
<option name="number" value="00077" />
|
|
||||||
<option name="presentableId" value="LOCAL-00077" />
|
|
||||||
<option name="project" value="LOCAL" />
|
|
||||||
<updated>1702026692059</updated>
|
|
||||||
</task>
|
</task>
|
||||||
<task id="LOCAL-00078" summary="重构">
|
<task id="LOCAL-00078" summary="重构">
|
||||||
<created>1702092719871</created>
|
<created>1702092719871</created>
|
||||||
|
@ -646,7 +635,14 @@
|
||||||
<option name="project" value="LOCAL" />
|
<option name="project" value="LOCAL" />
|
||||||
<updated>1705147244740</updated>
|
<updated>1705147244740</updated>
|
||||||
</task>
|
</task>
|
||||||
<option name="localTasksCounter" value="126" />
|
<task id="LOCAL-00126" summary="修复侧键与MDC联系人冲突">
|
||||||
|
<created>1705154185626</created>
|
||||||
|
<option name="number" value="00126" />
|
||||||
|
<option name="presentableId" value="LOCAL-00126" />
|
||||||
|
<option name="project" value="LOCAL" />
|
||||||
|
<updated>1705154185626</updated>
|
||||||
|
</task>
|
||||||
|
<option name="localTasksCounter" value="127" />
|
||||||
<servers />
|
<servers />
|
||||||
</component>
|
</component>
|
||||||
<component name="TypeScriptGeneratedFilesManager">
|
<component name="TypeScriptGeneratedFilesManager">
|
||||||
|
@ -673,7 +669,6 @@
|
||||||
</option>
|
</option>
|
||||||
</component>
|
</component>
|
||||||
<component name="VcsManagerConfiguration">
|
<component name="VcsManagerConfiguration">
|
||||||
<MESSAGE value="MDC PY" />
|
|
||||||
<MESSAGE value="110" />
|
<MESSAGE value="110" />
|
||||||
<MESSAGE value="中英文字符对齐" />
|
<MESSAGE value="中英文字符对齐" />
|
||||||
<MESSAGE value="支持中文编译选项ENABLE_CHINESE_FULL" />
|
<MESSAGE value="支持中文编译选项ENABLE_CHINESE_FULL" />
|
||||||
|
@ -698,7 +693,8 @@
|
||||||
<MESSAGE value="信道长度" />
|
<MESSAGE value="信道长度" />
|
||||||
<MESSAGE value="赞助" />
|
<MESSAGE value="赞助" />
|
||||||
<MESSAGE value="修改侧键" />
|
<MESSAGE value="修改侧键" />
|
||||||
<option name="LAST_COMMIT_MESSAGE" value="修改侧键" />
|
<MESSAGE value="修复侧键与MDC联系人冲突" />
|
||||||
|
<option name="LAST_COMMIT_MESSAGE" value="修复侧键与MDC联系人冲突" />
|
||||||
</component>
|
</component>
|
||||||
<component name="XDebuggerManager">
|
<component name="XDebuggerManager">
|
||||||
<breakpoint-manager>
|
<breakpoint-manager>
|
||||||
|
|
6
Makefile
6
Makefile
|
@ -49,7 +49,7 @@ ENABLE_MDC1200_SIDE_BEEP ?= 0
|
||||||
ENABLE_MDC1200_CONTACT ?= 1
|
ENABLE_MDC1200_CONTACT ?= 1
|
||||||
ENABLE_UART_RW_BK_REGS ?= 0
|
ENABLE_UART_RW_BK_REGS ?= 0
|
||||||
ENABLE_AUDIO_BAR_DEFAULT ?= 0
|
ENABLE_AUDIO_BAR_DEFAULT ?= 0
|
||||||
ENABLE_EEPROM_4M ?= 1
|
ENABLE_EEPROM_TYPE = 2 #0:1*1Mib 1:2*2Mib 2:2*1Mib
|
||||||
ENABLE_CHINESE_FULL = 4
|
ENABLE_CHINESE_FULL = 4
|
||||||
ENABLE_DOCK ?= 1
|
ENABLE_DOCK ?= 1
|
||||||
ENABLE_CUSTOM_SIDEFUNCTIONS ?= 1
|
ENABLE_CUSTOM_SIDEFUNCTIONS ?= 1
|
||||||
|
@ -83,6 +83,7 @@ ifeq ($(ENABLE_CHINESE_FULL),4)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(ENABLE_CHINESE_FULL),0)
|
ifeq ($(ENABLE_CHINESE_FULL),0)
|
||||||
|
ENABLE_EEPROM_TYPE=0
|
||||||
$(info Normal)
|
$(info Normal)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -289,6 +290,9 @@ CFLAGS += -Wextra
|
||||||
#CFLAGS += -Wpedantic
|
#CFLAGS += -Wpedantic
|
||||||
|
|
||||||
# 设置PACKED_FILE_SUFFIX,根据ENABLE_CHINESE_FULL的值设置不同的后缀
|
# 设置PACKED_FILE_SUFFIX,根据ENABLE_CHINESE_FULL的值设置不同的后缀
|
||||||
|
|
||||||
|
CFLAGS += -DENABLE_EEPROM_TYPE=$(ENABLE_EEPROM_TYPE)
|
||||||
|
|
||||||
CFLAGS += -DENABLE_CHINESE_FULL=$(ENABLE_CHINESE_FULL)
|
CFLAGS += -DENABLE_CHINESE_FULL=$(ENABLE_CHINESE_FULL)
|
||||||
CFLAGS += -DPACKED_FILE_SUFFIX=\"$(PACKED_FILE_SUFFIX)\"
|
CFLAGS += -DPACKED_FILE_SUFFIX=\"$(PACKED_FILE_SUFFIX)\"
|
||||||
CFLAGS += -DPRINTF_INCLUDE_CONFIG_H
|
CFLAGS += -DPRINTF_INCLUDE_CONFIG_H
|
||||||
|
|
|
@ -28,12 +28,17 @@ void EEPROM_ReadBuffer(uint32_t Address, void *pBuffer, uint8_t Size) {
|
||||||
|
|
||||||
I2C_Start();
|
I2C_Start();
|
||||||
uint8_t IIC_ADD = 0xA0 | ((Address / 0x10000) << 1);
|
uint8_t IIC_ADD = 0xA0 | ((Address / 0x10000) << 1);
|
||||||
#ifdef ENABLE_EEPROM_4M
|
#if ENABLE_EEPROM_TYPE==1
|
||||||
|
|
||||||
|
if (Address >= 0x40000)
|
||||||
|
{IIC_ADD = 0xA8 | (((Address - 0x40000) / 0x10000) << 1);
|
||||||
|
Address-=0x40000;
|
||||||
|
|
||||||
|
}
|
||||||
|
#elif ENABLE_EEPROM_4M==2
|
||||||
if (Address >= 0x20000)
|
if (Address >= 0x20000)
|
||||||
{IIC_ADD = 0xA8 | (((Address - 0x20000) / 0x10000) << 1);
|
{IIC_ADD = 0xA8 | (((Address - 0x20000) / 0x10000) << 1);
|
||||||
Address-=0x20000;
|
Address-=0x20000;
|
||||||
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
I2C_Write(IIC_ADD);
|
I2C_Write(IIC_ADD);
|
||||||
|
@ -54,17 +59,25 @@ void EEPROM_WriteBuffer(uint32_t Address, const void *pBuffer, uint8_t WRITE_SIZ
|
||||||
if (pBuffer == NULL)
|
if (pBuffer == NULL)
|
||||||
return;
|
return;
|
||||||
uint8_t buffer[128];
|
uint8_t buffer[128];
|
||||||
|
uint32_t offset=0;
|
||||||
EEPROM_ReadBuffer(Address, buffer, WRITE_SIZE);
|
EEPROM_ReadBuffer(Address, buffer, WRITE_SIZE);
|
||||||
if (memcmp(pBuffer, buffer, WRITE_SIZE) != 0) {
|
if (memcmp(pBuffer, buffer, WRITE_SIZE) != 0) {
|
||||||
uint8_t IIC_ADD=0xA0 | ((Address / 0x10000) << 1);
|
uint8_t IIC_ADD=0xA0 | ((Address / 0x10000) << 1);
|
||||||
I2C_Start();
|
I2C_Start();
|
||||||
#ifdef ENABLE_EEPROM_4M
|
#if ENABLE_EEPROM_TYPE==1
|
||||||
|
if(Address>=0x40000)
|
||||||
|
IIC_ADD = 0xA8 | (((Address - 0x40000) / 0x10000) << 1);
|
||||||
|
offset=0x40000;
|
||||||
|
#elif ENABLE_EEPROM_TYPE==2
|
||||||
if(Address>=0x20000)
|
if(Address>=0x20000)
|
||||||
IIC_ADD = 0xA8 | (((Address - 0x20000) / 0x10000) << 1);
|
IIC_ADD = 0xA8 | (((Address - 0x20000) / 0x10000) << 1);
|
||||||
|
offset=0x20000;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
I2C_Write(IIC_ADD);
|
I2C_Write(IIC_ADD);
|
||||||
I2C_Write(((Address>=0x20000?Address:Address-0x20000) >> 8) & 0xFF);
|
|
||||||
I2C_Write(((Address>=0x20000?Address:Address-0x20000) >> 0) & 0xFF);
|
I2C_Write(((Address>=offset?Address:Address-offset) >> 8) & 0xFF);
|
||||||
|
I2C_Write(((Address>=offset?Address:Address-offset) >> 0) & 0xFF);
|
||||||
I2C_WriteBuffer(pBuffer, WRITE_SIZE);
|
I2C_WriteBuffer(pBuffer, WRITE_SIZE);
|
||||||
I2C_Stop();
|
I2C_Stop();
|
||||||
}
|
}
|
||||||
|
|
36
main.c
36
main.c
|
@ -339,29 +339,51 @@ void Main(void) {
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
//}
|
//}
|
||||||
|
// memset(gStatusLine, 0, sizeof(gStatusLine));
|
||||||
UI_DisplayWelcome();
|
// UI_DisplayClear();
|
||||||
|
|
||||||
// while(1)
|
// while(1)
|
||||||
// {
|
// {
|
||||||
// char A[128]; char B[128];
|
// char A[128]; char B[128];
|
||||||
//
|
//
|
||||||
// memset(A,'A',sizeof (A));//0x20000 128K 0X40000 256K
|
// memset(A,'A',sizeof (A));//0x20000 128K 0X40000 256K
|
||||||
// EEPROM_WriteBuffer(0x50000, A, 128);
|
// uint32_t ADD;
|
||||||
// EEPROM_ReadBuffer(0x50000, B, 128) ;
|
//
|
||||||
|
//#if ENABLE_EEPROM_TYPE==1
|
||||||
|
// ADD=0x50000;
|
||||||
|
//#elif ENABLE_EEPROM_TYPE==2
|
||||||
|
// ADD=0x30000;
|
||||||
|
//#endif
|
||||||
|
// EEPROM_WriteBuffer(ADD, A, 128);
|
||||||
|
// EEPROM_ReadBuffer(ADD, B, 128) ;
|
||||||
// if (memcmp(A,B,128)==0)
|
// if (memcmp(A,B,128)==0)
|
||||||
// {
|
// {
|
||||||
// UI_PrintStringSmall("Double 2Mb Eeprom\nInstall OK!", 0, 127, 2);
|
//#if ENABLE_EEPROM_TYPE==1
|
||||||
|
// UI_PrintStringSmall("Double 2Mb Eeprom", 0, 127, 2);
|
||||||
|
// UI_PrintStringSmall("Install OK!", 0, 127, 3);
|
||||||
|
//
|
||||||
|
//#elif ENABLE_EEPROM_TYPE==2
|
||||||
|
// UI_PrintStringSmall("Double 1Mb Eeprom", 0, 127, 2);
|
||||||
|
// UI_PrintStringSmall("Install OK!", 0, 127, 3);
|
||||||
|
//#endif
|
||||||
// ST7565_BlitStatusLine(); // blank status line
|
// ST7565_BlitStatusLine(); // blank status line
|
||||||
// ST7565_BlitFullScreen();
|
// ST7565_BlitFullScreen();
|
||||||
// } else
|
// } else
|
||||||
// {
|
// {
|
||||||
// UI_PrintStringSmall("Double 2Mb Eeprom\nInstall Failed!", 0, 127, 2);
|
//#if ENABLE_EEPROM_TYPE==1
|
||||||
|
// UI_PrintStringSmall("Double 2Mb Eeprom", 0, 127, 2);
|
||||||
|
// UI_PrintStringSmall("Install Failed!", 0, 127, 3);
|
||||||
|
//
|
||||||
|
//#elif ENABLE_EEPROM_TYPE==2
|
||||||
|
// UI_PrintStringSmall("Double 1Mb Eeprom", 0, 127, 2);
|
||||||
|
// UI_PrintStringSmall("Install Failed!", 0, 127, 3);
|
||||||
|
//#endif
|
||||||
// ST7565_BlitStatusLine(); // blank status line
|
// ST7565_BlitStatusLine(); // blank status line
|
||||||
// ST7565_BlitFullScreen();
|
// ST7565_BlitFullScreen();
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// }
|
// }
|
||||||
|
UI_DisplayWelcome();
|
||||||
|
|
||||||
|
|
||||||
boot_counter_10ms = 250;
|
boot_counter_10ms = 250;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue