From 68fdd119f38c37ab28066474086b0e352d991baf Mon Sep 17 00:00:00 2001 From: Kshitij Sisodia Date: Wed, 6 Apr 2022 13:03:20 +0100 Subject: MLECO-3096: Removing data_acq and data_psn Further to the HAL refactoring done in previous commits, this CR simpifies HAL by removing data_acq and data_psn "modules". The associated function pointers have been removed. Change-Id: I04c194c08dfe0aff98ce4e0f0f056bac254c137d Signed-off-by: Kshitij Sisodia --- source/use_case/asr/src/MainLoop.cc | 4 ++-- source/use_case/asr/src/UseCaseHandler.cc | 23 +++++++++-------------- 2 files changed, 11 insertions(+), 16 deletions(-) (limited to 'source/use_case/asr/src') diff --git a/source/use_case/asr/src/MainLoop.cc b/source/use_case/asr/src/MainLoop.cc index 40624f3..058211a 100644 --- a/source/use_case/asr/src/MainLoop.cc +++ b/source/use_case/asr/src/MainLoop.cc @@ -121,7 +121,7 @@ void main_loop(hal_platform& platform) int menuOption = MENU_OPT_RUN_INF_NEXT; if (bUseMenu) { DisplayMenu(); - menuOption = arm::app::ReadUserInputAsInt(platform); + menuOption = arm::app::ReadUserInputAsInt(); printf("\n"); } switch (menuOption) { @@ -136,7 +136,7 @@ void main_loop(hal_platform& platform) NUMBER_OF_FILES-1); fflush(stdout); auto clipIndex = static_cast( - arm::app::ReadUserInputAsInt(platform)); + arm::app::ReadUserInputAsInt()); executionSuccessful = ClassifyAudioHandler(caseContext, clipIndex, false); diff --git a/source/use_case/asr/src/UseCaseHandler.cc b/source/use_case/asr/src/UseCaseHandler.cc index 7bce2c6..420f725 100644 --- a/source/use_case/asr/src/UseCaseHandler.cc +++ b/source/use_case/asr/src/UseCaseHandler.cc @@ -36,13 +36,10 @@ namespace app { /** * @brief Presents inference results using the data presentation * object. - * @param[in] platform Reference to the hal platform object. * @param[in] results Vector of classification results to be displayed. * @return true if successful, false otherwise. **/ - static bool PresentInferenceResult( - hal_platform& platform, - const std::vector& results); + static bool PresentInferenceResult(const std::vector& results); /* Audio inference classification handler. */ bool ClassifyAudioHandler(ApplicationContext& ctx, uint32_t clipIndex, bool runAll) @@ -50,8 +47,7 @@ namespace app { constexpr uint32_t dataPsnTxtInfStartX = 20; constexpr uint32_t dataPsnTxtInfStartY = 40; - auto& platform = ctx.Get("platform"); - platform.data_psn->clear(COLOR_BLACK); + hal_lcd_clear(COLOR_BLACK); auto& profiler = ctx.Get("profiler"); @@ -103,7 +99,7 @@ namespace app { /* Loop to process audio clips. */ do { - platform.data_psn->clear(COLOR_BLACK); + hal_lcd_clear(COLOR_BLACK); /* Get current audio clip index. */ auto currentIndex = ctx.Get("clipIndex"); @@ -136,7 +132,7 @@ namespace app { /* Display message on the LCD - inference running. */ std::string str_inf{"Running inference... "}; - platform.data_psn->present_data_text( + hal_lcd_display_text( str_inf.c_str(), str_inf.size(), dataPsnTxtInfStartX, dataPsnTxtInfStartY, 0); @@ -192,13 +188,13 @@ namespace app { /* Erase. */ str_inf = std::string(str_inf.size(), ' '); - platform.data_psn->present_data_text( + hal_lcd_display_text( str_inf.c_str(), str_inf.size(), dataPsnTxtInfStartX, dataPsnTxtInfStartY, 0); ctx.Set>("results", results); - if (!PresentInferenceResult(platform, results)) { + if (!PresentInferenceResult(results)) { return false; } @@ -212,14 +208,13 @@ namespace app { } - static bool PresentInferenceResult(hal_platform& platform, - const std::vector& results) + static bool PresentInferenceResult(const std::vector& results) { constexpr uint32_t dataPsnTxtStartX1 = 20; constexpr uint32_t dataPsnTxtStartY1 = 60; constexpr bool allow_multiple_lines = true; - platform.data_psn->set_text_color(COLOR_GREEN); + hal_lcd_set_text_color(COLOR_GREEN); info("Final results:\n"); info("Total number of inferences: %zu\n", results.size()); @@ -243,7 +238,7 @@ namespace app { /* Get the decoded result for the combined result. */ std::string finalResultStr = audio::asr::DecodeOutput(combinedResults); - platform.data_psn->present_data_text( + hal_lcd_display_text( finalResultStr.c_str(), finalResultStr.size(), dataPsnTxtStartX1, dataPsnTxtStartY1, allow_multiple_lines); -- cgit v1.2.1