diff options
author | Kshitij Sisodia <kshitij.sisodia@arm.com> | 2022-04-06 13:03:20 +0100 |
---|---|---|
committer | Kshitij Sisodia <kshitij.sisodia@arm.com> | 2022-04-06 16:03:23 +0100 |
commit | 68fdd119f38c37ab28066474086b0e352d991baf (patch) | |
tree | cedb897ff9128f7d07e54c5c53ff8eb6be6b2bb1 /source/use_case/ad | |
parent | da2ec067da418d3d80b2829b111df25bd901eb5c (diff) | |
download | ml-embedded-evaluation-kit-68fdd119f38c37ab28066474086b0e352d991baf.tar.gz |
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 <kshitij.sisodia@arm.com>
Diffstat (limited to 'source/use_case/ad')
-rw-r--r-- | source/use_case/ad/src/MainLoop.cc | 4 | ||||
-rw-r--r-- | source/use_case/ad/src/UseCaseHandler.cc | 18 |
2 files changed, 10 insertions, 12 deletions
diff --git a/source/use_case/ad/src/MainLoop.cc b/source/use_case/ad/src/MainLoop.cc index 5a289bf..e858320 100644 --- a/source/use_case/ad/src/MainLoop.cc +++ b/source/use_case/ad/src/MainLoop.cc @@ -78,7 +78,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) { @@ -93,7 +93,7 @@ void main_loop(hal_platform& platform) NUMBER_OF_FILES-1); fflush(stdout); auto audioIndex = static_cast<uint32_t>( - arm::app::ReadUserInputAsInt(platform)); + arm::app::ReadUserInputAsInt()); executionSuccessful = ClassifyVibrationHandler(caseContext, audioIndex, false); diff --git a/source/use_case/ad/src/UseCaseHandler.cc b/source/use_case/ad/src/UseCaseHandler.cc index 853ab08..5585f36 100644 --- a/source/use_case/ad/src/UseCaseHandler.cc +++ b/source/use_case/ad/src/UseCaseHandler.cc @@ -33,12 +33,11 @@ namespace app { /** * @brief Presents inference results using the data presentation * object. - * @param[in] platform reference to the hal platform object * @param[in] result average sum of classification results * @param[in] threshold if larger than this value we have an anomaly * @return true if successful, false otherwise **/ - static bool PresentInferenceResult(hal_platform& platform, float result, float threshold); + static bool PresentInferenceResult(float result, float threshold); /** * @brief Returns a function to perform feature calculation and populates input tensor data with @@ -64,7 +63,6 @@ namespace app { /* Vibration classification handler */ bool ClassifyVibrationHandler(ApplicationContext& ctx, uint32_t clipIndex, bool runAll) { - auto& platform = ctx.Get<hal_platform&>("platform"); auto& profiler = ctx.Get<Profiler&>("profiler"); constexpr uint32_t dataPsnTxtInfStartX = 20; @@ -114,7 +112,7 @@ namespace app { auto audioDataStride = nMelSpecVectorsInAudioStride * frameStride; do { - platform.data_psn->clear(COLOR_BLACK); + hal_lcd_clear(COLOR_BLACK); auto currentIndex = ctx.Get<uint32_t>("clipIndex"); @@ -153,7 +151,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); info("Running inference on audio clip %" PRIu32 " => %s\n", currentIndex, get_filename(currentIndex)); @@ -202,12 +200,12 @@ 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<float>("result", result); - if (!PresentInferenceResult(platform, result, scoreThreshold)) { + if (!PresentInferenceResult(result, scoreThreshold)) { return false; } @@ -221,13 +219,13 @@ namespace app { } - static bool PresentInferenceResult(hal_platform& platform, float result, float threshold) + static bool PresentInferenceResult(float result, float threshold) { constexpr uint32_t dataPsnTxtStartX1 = 20; constexpr uint32_t dataPsnTxtStartY1 = 30; constexpr uint32_t dataPsnTxtYIncr = 16; /* Row index increment */ - platform.data_psn->set_text_color(COLOR_GREEN); + hal_lcd_set_text_color(COLOR_GREEN); /* Display each result */ uint32_t rowIdx1 = dataPsnTxtStartY1 + 2 * dataPsnTxtYIncr; @@ -242,7 +240,7 @@ namespace app { anomalyResult += std::string("Everything fine, no anomaly detected!"); } - platform.data_psn->present_data_text( + hal_lcd_display_text( anomalyScore.c_str(), anomalyScore.size(), dataPsnTxtStartX1, rowIdx1, false); |