Skip to content

Commit

Permalink
Merge pull request #254 from VocalFan/main
Browse files Browse the repository at this point in the history
Small optimizations
  • Loading branch information
solosky authored May 20, 2024
2 parents b99fd2c + 1b35552 commit e836a4c
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 56 deletions.
66 changes: 38 additions & 28 deletions fw/application/src/hal/hal_spi_flash.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,38 +149,48 @@ ret_code_t hal_spi_flash_info(flash_info_t *info) {
memory_type_capacity = rx[1];
memory_type_capacity = (memory_type_capacity << 8) | rx[2];

if (memory_type_capacity == MTC_MX25L25645_GM2I) {
NRF_LOG_INFO("MX25L25645GM2I-10G detection");
info->block_count = 8192;
} else if (memory_type_capacity == MTC_W25Q128_BV) {
NRF_LOG_INFO("W25Q128BV detection");
info->block_count = 4096;
} else if (memory_type_capacity == MTC_W25Q64_BV_CV) {
NRF_LOG_INFO("W25Q64BV or W25Q64CV detection");
info->block_count = 2048;
} else if (memory_type_capacity == MTC_W25Q64_DW) {
NRF_LOG_INFO("W25Q64DW detection");
info->block_count = 2048;
} else if (memory_type_capacity == MTC_W25Q32_BV) {
NRF_LOG_INFO("W25Q32BV detection");
info->block_count = 1024;
} else if (memory_type_capacity == MTC_W25Q32_DW) {
NRF_LOG_INFO("W25Q32DW detection");
info->block_count = 1024;
} else if (memory_type_capacity == MTC_W25Q16_BV_CL_CV) {
NRF_LOG_INFO("W25Q16BV or W25Q16CL or W25Q16CV detection");
info->block_count = 512;
} else if (memory_type_capacity == MTC_W25Q16_DW) {
NRF_LOG_INFO("W25Q16DW detection");
info->block_count = 512;
} else {
NRF_LOG_INFO("Memory Capacity error! %d", memory_type_capacity);
info->block_count = 0;
return NRF_ERROR_INVALID_PARAM;
switch (memory_type_capacity) {
case MTC_MX25L25645_GM2I:
NRF_LOG_INFO("MX25L25645GM2I-10G detection");
info->block_count = 8192;
break;
case MTC_W25Q128_BV:
NRF_LOG_INFO("W25Q128BV detection");
info->block_count = 4096;
break;
case MTC_W25Q64_BV_CV:
NRF_LOG_INFO("W25Q64BV or W25Q64CV detection");
info->block_count = 2048;
break;
case MTC_W25Q64_DW:
NRF_LOG_INFO("W25Q64DW detection");
info->block_count = 2048;
break;
case MTC_W25Q32_BV:
NRF_LOG_INFO("W25Q32BV detection");
info->block_count = 1024;
break;
case MTC_W25Q32_DW:
NRF_LOG_INFO("W25Q32DW detection");
info->block_count = 1024;
break;
case MTC_W25Q16_BV_CL_CV:
NRF_LOG_INFO("W25Q16BV or W25Q16CL or W25Q16CV detection");
info->block_count = 512;
break;
case MTC_W25Q16_DW:
NRF_LOG_INFO("W25Q16DW detection");
info->block_count = 512;
break;
default:
NRF_LOG_INFO("Memory Capacity error! %d", memory_type_capacity);
info->block_count = 0;
return NRF_ERROR_INVALID_PARAM;
}
return NRF_SUCCESS;
}


ret_code_t hal_spi_flash_read(uint32_t address, void *buffer, size_t size) {

uint8_t tx[4];
Expand Down
57 changes: 29 additions & 28 deletions fw/application/src/i18n/language.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,34 +32,35 @@ const char *getLangString(L_StringID stringID) {
void setLanguage(Language lang) { currentLanguage = lang; }

const char *getLangDesc(Language lang) {
if (lang == LANGUAGE_ZH_HANS) {
return "简体中文";
} else if (lang == LANGUAGE_EN_US) {
return "English";
} else if (lang == LANGUAGE_ZH_TW) {
return "繁體中文(臺灣)";
} else if (lang == LANGUAGE_ES_ES) {
return "Español";
} else if (lang == LANGUAGE_IT_IT) {
return "Italiano";
} else if (lang == LANGUAGE_HU_HU) {
return "Magyar";
} else if (lang == LANGUAGE_DE_DE) {
return "Deutsch";
} else if (lang == LANGUAGE_FR_FR) {
return "Français";
} else if (lang == LANGUAGE_NL_NL) {
return "Dutch (Nederlands)";
} else if (lang == LANGUAGE_PT_BR) {
return "Português(Brazil)";
} else if (lang == LANGUAGE_JA_JP) {
return "日本語";
} else if (lang == LANGUAGE_PT_PT) {
return "Português(Portugal)";
} else if (lang == LANGUAGE_RU_RU) {
return "Русский";
} else {
return "@@LANG@@";
switch (lang) {
case LANGUAGE_ZH_HANS:
return "简体中文";
case LANGUAGE_EN_US:
return "English";
case LANGUAGE_ZH_TW:
return "繁體中文(臺灣)";
case LANGUAGE_ES_ES:
return "Español";
case LANGUAGE_IT_IT:
return "Italiano";
case LANGUAGE_HU_HU:
return "Magyar";
case LANGUAGE_DE_DE:
return "Deutsch";
case LANGUAGE_FR_FR:
return "Français";
case LANGUAGE_NL_NL:
return "Dutch (Nederlands)";
case LANGUAGE_PT_BR:
return "Português(Brazil)";
case LANGUAGE_JA_JP:
return "日本語";
case LANGUAGE_PT_PT:
return "Português(Portugal)";
case LANGUAGE_RU_RU:
return "Русский";
default:
return "@@LANG@@";
}
}

Expand Down

0 comments on commit e836a4c

Please sign in to comment.