进一步迭代优化统一管理
This commit is contained in:
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user