进一步迭代优化统一管理

This commit is contained in:
冯佳
2026-01-23 14:35:51 +08:00
parent 988cc7ad4a
commit 075e8299cf
36 changed files with 6146 additions and 1590 deletions

View File

@ -64,30 +64,34 @@ const bsp_board_config_t* bsp_board_get_by_name(const char* name) {
/**
* @brief Set current board configuration by index
* @param index: Board configuration index
* @retval 0 if successful, -1 if invalid index
* @retval HAL status code
*/
int8_t bsp_board_set_by_index(uint8_t index) {
hal_ret_t bsp_board_set_by_index(uint8_t index) {
if (index < bsp_board_get_count()) {
current_board_index = index;
return 0;
return HAL_RET_OK;
}
return -1;
return HAL_RET_INVALID_PARAM;
}
/**
* @brief Set current board configuration by name
* @param name: Board name string
* @retval 0 if successful, -1 if not found
* @retval HAL status code
*/
int8_t bsp_board_set_by_name(const char* name) {
hal_ret_t bsp_board_set_by_name(const char* name) {
if (name == NULL) {
return HAL_RET_INVALID_PARAM;
}
for (uint8_t i = 0; i < bsp_board_get_count(); i++) {
if (supported_boards[i]->name != NULL &&
strcmp(supported_boards[i]->name, name) == 0) {
current_board_index = i;
return 0;
return HAL_RET_OK;
}
}
return -1;
return HAL_RET_ERROR;
}
/**