修复2*1Mib驱动

This commit is contained in:
wu58430 2024-01-14 13:00:57 +08:00
parent 8b3b6a07a7
commit 215ad08f48
3 changed files with 23 additions and 23 deletions

View file

@ -20,7 +20,7 @@
</configurations> </configurations>
</component> </component>
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="cea36e80-e289-4d69-9030-7186d540ac0e" name="更改" comment="修复侧键与MDC联系人冲突"> <list default="true" id="cea36e80-e289-4d69-9030-7186d540ac0e" name="更改" comment="支持两个AT24C1024堆叠">
<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$/Makefile" beforeDir="false" afterPath="$PROJECT_DIR$/Makefile" afterDir="false" /> <change beforePath="$PROJECT_DIR$/Makefile" beforeDir="false" afterPath="$PROJECT_DIR$/Makefile" afterDir="false" />
<change beforePath="$PROJECT_DIR$/driver/eeprom.c" beforeDir="false" afterPath="$PROJECT_DIR$/driver/eeprom.c" afterDir="false" /> <change beforePath="$PROJECT_DIR$/driver/eeprom.c" beforeDir="false" afterPath="$PROJECT_DIR$/driver/eeprom.c" afterDir="false" />
@ -109,11 +109,6 @@
<option name="CLION.COMPOUND.BUILD" enabled="true" /> <option name="CLION.COMPOUND.BUILD" enabled="true" />
</method> </method>
</configuration> </configuration>
<configuration default="true" type="CMakeRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" PASS_PARENT_ENVS_2="true">
<method v="2">
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
</method>
</configuration>
<configuration name="Makefile" type="MAKEFILE_TARGET_RUN_CONFIGURATION" factoryName="Makefile"> <configuration name="Makefile" type="MAKEFILE_TARGET_RUN_CONFIGURATION" factoryName="Makefile">
<makefile filename="$PROJECT_DIR$/Makefile" target="" workingDirectory="" arguments=""> <makefile filename="$PROJECT_DIR$/Makefile" target="" workingDirectory="" arguments="">
<envs /> <envs />
@ -297,14 +292,9 @@
<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="5733000" /> <workItem from="1705149583084" duration="8245000" />
</task> <workItem from="1705198506848" duration="2491000" />
<task id="LOCAL-00078" summary="重构"> <workItem from="1705208410022" duration="2000" />
<created>1702092719871</created>
<option name="number" value="00078" />
<option name="presentableId" value="LOCAL-00078" />
<option name="project" value="LOCAL" />
<updated>1702092719871</updated>
</task> </task>
<task id="LOCAL-00079" summary="clion"> <task id="LOCAL-00079" summary="clion">
<created>1702093273462</created> <created>1702093273462</created>
@ -642,7 +632,14 @@
<option name="project" value="LOCAL" /> <option name="project" value="LOCAL" />
<updated>1705154185626</updated> <updated>1705154185626</updated>
</task> </task>
<option name="localTasksCounter" value="127" /> <task id="LOCAL-00127" summary="支持两个AT24C1024堆叠">
<created>1705156006875</created>
<option name="number" value="00127" />
<option name="presentableId" value="LOCAL-00127" />
<option name="project" value="LOCAL" />
<updated>1705156006875</updated>
</task>
<option name="localTasksCounter" value="128" />
<servers /> <servers />
</component> </component>
<component name="TypeScriptGeneratedFilesManager"> <component name="TypeScriptGeneratedFilesManager">
@ -669,7 +666,6 @@
</option> </option>
</component> </component>
<component name="VcsManagerConfiguration"> <component name="VcsManagerConfiguration">
<MESSAGE value="110" />
<MESSAGE value="中英文字符对齐" /> <MESSAGE value="中英文字符对齐" />
<MESSAGE value="支持中文编译选项ENABLE_CHINESE_FULL" /> <MESSAGE value="支持中文编译选项ENABLE_CHINESE_FULL" />
<MESSAGE value="中文" /> <MESSAGE value="中文" />
@ -694,7 +690,8 @@
<MESSAGE value="赞助" /> <MESSAGE value="赞助" />
<MESSAGE value="修改侧键" /> <MESSAGE value="修改侧键" />
<MESSAGE value="修复侧键与MDC联系人冲突" /> <MESSAGE value="修复侧键与MDC联系人冲突" />
<option name="LAST_COMMIT_MESSAGE" value="修复侧键与MDC联系人冲突" /> <MESSAGE value="支持两个AT24C1024堆叠" />
<option name="LAST_COMMIT_MESSAGE" value="支持两个AT24C1024堆叠" />
</component> </component>
<component name="XDebuggerManager"> <component name="XDebuggerManager">
<breakpoint-manager> <breakpoint-manager>

View file

@ -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_TYPE = 2 #0:1*1Mib 1:2*2Mib 2:2*1Mib ENABLE_EEPROM_TYPE = 1 #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

View file

@ -27,17 +27,20 @@ void EEPROM_ReadBuffer(uint32_t Address, void *pBuffer, uint8_t Size) {
if (Size == 0)return; if (Size == 0)return;
I2C_Start(); I2C_Start();
uint32_t offset=0;
uint8_t IIC_ADD = 0xA0 | ((Address / 0x10000) << 1); uint8_t IIC_ADD = 0xA0 | ((Address / 0x10000) << 1);
#if ENABLE_EEPROM_TYPE==1 #if ENABLE_EEPROM_TYPE==1
offset=0X40000;
if (Address >= 0x40000) if (Address >= 0x40000)
{IIC_ADD = 0xA8 | (((Address - 0x40000) / 0x10000) << 1); {IIC_ADD = 0xA8 | (((Address - 0x40000) / 0x10000) << 1);
Address-=0x40000; Address-=0x40000;
} }
#elif ENABLE_EEPROM_4M==2 #elif ENABLE_EEPROM_4M==2
offset=0X20000;
if (Address >= 0x20000) if (Address >= 0x20000)
{IIC_ADD = 0xA8 | (((Address - 0x20000) / 0x10000) << 1); {IIC_ADD = 0xA4 | (((Address - 0x20000) / 0x10000) << 1);
Address-=0x20000; Address-=0x20000;
} }
#endif #endif
@ -70,14 +73,14 @@ void EEPROM_WriteBuffer(uint32_t Address, const void *pBuffer, uint8_t WRITE_SIZ
offset=0x40000; offset=0x40000;
#elif ENABLE_EEPROM_TYPE==2 #elif ENABLE_EEPROM_TYPE==2
if(Address>=0x20000) if(Address>=0x20000)
IIC_ADD = 0xA8 | (((Address - 0x20000) / 0x10000) << 1); IIC_ADD = 0xA4 | (((Address - 0x20000) / 0x10000) << 1);
offset=0x20000; offset=0x20000;
#endif #endif
I2C_Write(IIC_ADD); I2C_Write(IIC_ADD);
I2C_Write(((Address>=offset?Address:Address-offset) >> 8) & 0xFF); I2C_Write((Address >> 8) & 0xFF);
I2C_Write(((Address>=offset?Address:Address-offset) >> 0) & 0xFF); I2C_Write((Address ) & 0xFF);
I2C_WriteBuffer(pBuffer, WRITE_SIZE); I2C_WriteBuffer(pBuffer, WRITE_SIZE);
I2C_Stop(); I2C_Stop();
} }