mirror of
https://github.com/silenty4ng/uv-k5-firmware-chinese-lts
synced 2025-01-15 14:54:40 +00:00
中文字库
This commit is contained in:
parent
285e9f855a
commit
f57f344672
7 changed files with 19373 additions and 22 deletions
|
@ -22,9 +22,12 @@
|
|||
<component name="ChangeListManager">
|
||||
<list default="true" id="cea36e80-e289-4d69-9030-7186d540ac0e" name="更改" comment="中英文字符对齐">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/app.c" beforeDir="false" afterPath="$PROJECT_DIR$/app/app.c" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Makefile" beforeDir="false" afterPath="$PROJECT_DIR$/Makefile" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/driver/bk4819.c" beforeDir="false" afterPath="$PROJECT_DIR$/driver/bk4819.c" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/ui/helper.c" beforeDir="false" afterPath="$PROJECT_DIR$/ui/helper.c" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/font.h" beforeDir="false" afterPath="$PROJECT_DIR$/font.h" 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" />
|
||||
<change beforePath="$PROJECT_DIR$/uv-k5font/font_new/font.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/uv-k5font/font_new/font.cpp" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
|
|
8
Makefile
8
Makefile
|
@ -49,6 +49,8 @@ ENABLE_MDC1200 ?= 1
|
|||
ENABLE_MDC1200_SHOW_OP_ARG ?= 1
|
||||
ENABLE_MDC1200_SIDE_BEEP ?= 0
|
||||
ENABLE_MDC1200_CONTACT ?= 1
|
||||
ENABLE_CHINESE_FULL1 ?= 0
|
||||
ENABLE_CHINESE_FULL2 ?= 0
|
||||
|
||||
|
||||
# ---- DEBUGGING ----
|
||||
|
@ -262,6 +264,12 @@ endif
|
|||
ifeq ($(ENABLE_MDC1200_CONTACT),1)
|
||||
CFLAGS += -DENABLE_MDC1200_CONTACT
|
||||
endif
|
||||
ifeq ($(ENABLE_CHINESE_FULL1),1)
|
||||
CFLAGS += -DENABLE_CHINESE_FULL1
|
||||
endif
|
||||
ifeq ($(ENABLE_CHINESE_FULL2),1)
|
||||
CFLAGS += -DENABLE_CHINESE_FULL2
|
||||
endif
|
||||
ifeq ($(ENABLE_MDC1200_SHOW_OP_ARG),1)
|
||||
CFLAGS += -DENABLE_MDC1200_SHOW_OP_ARG
|
||||
endif
|
||||
|
|
|
@ -38,7 +38,6 @@ void EEPROM_ReadBuffer(uint16_t Address, void *pBuffer, uint8_t Size)
|
|||
|
||||
I2C_Stop();
|
||||
}
|
||||
|
||||
void EEPROM_WriteBuffer(uint16_t Address, const void *pBuffer)
|
||||
{
|
||||
if (pBuffer == NULL || Address >= 0x2000)
|
||||
|
@ -60,3 +59,65 @@ void EEPROM_WriteBuffer(uint16_t Address, const void *pBuffer)
|
|||
// give the EEPROM time to burn the data in (apparently takes 5ms)
|
||||
SYSTEM_DelayMs(8);
|
||||
}
|
||||
|
||||
#define AT24C1024_ADDRESS 0xA4
|
||||
#define AT24C1024_PAGE_SIZE 64
|
||||
|
||||
void E1EPROM_ReadBuffer_1024(uint32_t Address, void *pBuffer, uint16_t Size) {
|
||||
if (pBuffer == NULL || Address >= 0x20000) // Address limit for AT24C1024 (17-bit address)
|
||||
return;
|
||||
|
||||
uint16_t bytesRead = 0;
|
||||
uint8_t* dataPointer = (uint8_t*)pBuffer;
|
||||
|
||||
while (bytesRead < Size) {
|
||||
uint16_t bytesToRead = (Size - bytesRead < AT24C1024_PAGE_SIZE) ? (Size - bytesRead) : AT24C1024_PAGE_SIZE;
|
||||
uint16_t offset = Address % AT24C1024_PAGE_SIZE;
|
||||
|
||||
I2C_Start();
|
||||
I2C_Write(AT24C1024_ADDRESS | ((Address >> 16) & 0x01)); // Sending device address and MSB of memory address
|
||||
I2C_Write((uint8_t)(Address >> 8)); // Sending address high byte
|
||||
I2C_Write((uint8_t)(Address & 0xFF)); // Sending address low byte
|
||||
I2C_Start();
|
||||
I2C_Write(AT24C1024_ADDRESS | 0x01); // Sending device address with read bit
|
||||
|
||||
uint8_t buffer[AT24C1024_PAGE_SIZE];
|
||||
I2C_ReadBuffer(buffer, AT24C1024_PAGE_SIZE);
|
||||
|
||||
// Copy the relevant portion of the buffer to the output buffer
|
||||
memcpy(dataPointer, buffer + offset, bytesToRead);
|
||||
|
||||
bytesRead += bytesToRead;
|
||||
dataPointer += bytesToRead;
|
||||
Address += bytesToRead;
|
||||
|
||||
I2C_Stop();
|
||||
}
|
||||
}
|
||||
|
||||
void E1EPROM_WriteBuffer_1024(uint32_t Address, const void *pBuffer, uint16_t Size) {
|
||||
if (pBuffer == NULL || Address >= 0x20000) // Address limit for AT24C1024 (17-bit address)
|
||||
return;
|
||||
|
||||
uint8_t buffer[AT24C1024_PAGE_SIZE];
|
||||
uint32_t endAddress = Address + Size;
|
||||
for (uint32_t addr = Address; addr < endAddress; addr += AT24C1024_PAGE_SIZE) {
|
||||
uint16_t bytesToWrite = (endAddress - addr < AT24C1024_PAGE_SIZE) ? (endAddress - addr) : AT24C1024_PAGE_SIZE;
|
||||
uint16_t offset = Address % AT24C1024_PAGE_SIZE;
|
||||
uint16_t remaining = AT24C1024_PAGE_SIZE - offset;
|
||||
bytesToWrite = (bytesToWrite < remaining) ? bytesToWrite : remaining;
|
||||
|
||||
EEPROM_ReadBuffer(addr - offset, buffer, AT24C1024_PAGE_SIZE);
|
||||
if (memcmp(pBuffer, buffer + offset, bytesToWrite) != 0) {
|
||||
I2C_Start();
|
||||
I2C_Write(AT24C1024_ADDRESS | ((addr >> 16) & 0x01)); // Sending device address and MSB of memory address
|
||||
I2C_Write((uint8_t)(addr >> 8)); // Sending address high byte
|
||||
I2C_Write((uint8_t)(addr & 0xFF)); // Sending address low byte
|
||||
I2C_WriteBuffer(pBuffer, bytesToWrite);
|
||||
I2C_Stop();
|
||||
}
|
||||
pBuffer += bytesToWrite;
|
||||
// give the EEPROM time to burn the data in (assuming 5ms per page write)
|
||||
SYSTEM_DelayMs(5);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,6 +21,8 @@
|
|||
|
||||
void EEPROM_ReadBuffer(uint16_t Address, void *pBuffer, uint8_t Size);
|
||||
void EEPROM_WriteBuffer(uint16_t Address, const void *pBuffer);
|
||||
void E1EPROM_ReadBuffer_1024(uint32_t Address, void *pBuffer, uint16_t Size) ;
|
||||
void E1EPROM_WriteBuffer_1024(uint32_t Address, const void *pBuffer, uint16_t Size) ;
|
||||
|
||||
#endif
|
||||
|
||||
|
|
6
font.h
6
font.h
|
@ -29,6 +29,12 @@ extern const uint8_t gFontSmall[95 - 1][6];
|
|||
#ifdef ENABLE_SMALL_BOLD
|
||||
extern const uint8_t gFontSmallBold[95 - 1][6];
|
||||
#endif
|
||||
#ifdef ENABLE_CHINESE_FULL1
|
||||
extern uint8_t gFontChinese_out1[57742];
|
||||
|
||||
#elifdef ENABLE_CHINESE_FULL2
|
||||
|
||||
extern uint8_t gFontChinese_out2[57742];
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
|
16
main.c
16
main.c
|
@ -81,7 +81,14 @@ void Main(void)
|
|||
#ifdef ENABLE_UART
|
||||
UART_Init();
|
||||
#endif
|
||||
SETTINGS_InitEEPROM();
|
||||
#ifdef ENABLE_CHINESE_FULL1
|
||||
SETTINGS_InitEEPROM();
|
||||
|
||||
#elifdef ENABLE_CHINESE_FULL2
|
||||
SETTINGS_InitEEPROM();
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
memset(gDTMF_String, '-', sizeof(gDTMF_String));
|
||||
|
@ -205,6 +212,15 @@ void Main(void)
|
|||
// for (int i =MDC_ADD[0]; i < MDC_ADD[0]+16; ++i) {
|
||||
// EEPROM_WriteBuffer(i,&A[i-MDC_ADD[0]]);
|
||||
// }
|
||||
uint8_t B[64];
|
||||
memset(B,'B',sizeof (B));
|
||||
E1EPROM_WriteBuffer_1024(0x10000,B,64);
|
||||
E1EPROM_ReadBuffer_1024(0x10000,B,64);
|
||||
UART_Send(B,64);
|
||||
while(1)
|
||||
{
|
||||
|
||||
}
|
||||
while (1)
|
||||
{
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue