summaryrefslogtreecommitdiff
path: root/source/application/main
diff options
context:
space:
mode:
Diffstat (limited to 'source/application/main')
-rw-r--r--source/application/main/Main.cc4
-rw-r--r--source/application/main/UseCaseCommonUtils.cc24
-rw-r--r--source/application/main/include/UseCaseCommonUtils.hpp7
3 files changed, 12 insertions, 23 deletions
diff --git a/source/application/main/Main.cc b/source/application/main/Main.cc
index 8ed9c5a..e27d5b5 100644
--- a/source/application/main/Main.cc
+++ b/source/application/main/Main.cc
@@ -42,12 +42,10 @@ static void print_application_intro()
int main ()
{
hal_platform platform;
- data_acq_module dataAcq;
- data_psn_module dataPsn;
platform_timer timer;
/* Initialise the HAL and platform. */
- hal_init(&platform, &dataAcq, &dataPsn, &timer);
+ hal_init(&platform, &timer);
if (0 == hal_platform_init(&platform)) {
/* Application information, UART should have been initialised. */
diff --git a/source/application/main/UseCaseCommonUtils.cc b/source/application/main/UseCaseCommonUtils.cc
index d439446..340a767 100644
--- a/source/application/main/UseCaseCommonUtils.cc
+++ b/source/application/main/UseCaseCommonUtils.cc
@@ -36,12 +36,7 @@ void DisplayCommonMenu()
fflush(stdout);
}
-
-
-
-bool PresentInferenceResult(
- hal_platform &platform,
- const std::vector<arm::app::ClassificationResult> &results)
+bool PresentInferenceResult(const std::vector<arm::app::ClassificationResult> &results)
{
constexpr uint32_t dataPsnTxtStartX1 = 150;
constexpr uint32_t dataPsnTxtStartY1 = 30;
@@ -51,7 +46,7 @@ bool PresentInferenceResult(
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;
@@ -66,13 +61,13 @@ bool PresentInferenceResult(
std::to_string(results[i].m_labelIdx) +
" (" + std::to_string(results[i].m_normalisedVal) + ")";
- platform.data_psn->present_data_text(
+ hal_lcd_display_text(
resultStr.c_str(), resultStr.size(),
dataPsnTxtStartX1, rowIdx1, false);
rowIdx1 += dataPsnTxtYIncr;
resultStr = std::to_string(i + 1) + ") " + results[i].m_label;
- platform.data_psn->present_data_text(
+ hal_lcd_display_text(
resultStr.c_str(), resultStr.size(),
dataPsnTxtStartX2, rowIdx2, 0);
rowIdx2 += dataPsnTxtYIncr;
@@ -134,12 +129,12 @@ bool RunInference(arm::app::Model& model, Profiler& profiler)
return runInf;
}
-int ReadUserInputAsInt(hal_platform& platform)
+int ReadUserInputAsInt()
{
char chInput[128];
memset(chInput, 0, sizeof(chInput));
- platform.data_acq->get_input(chInput, sizeof(chInput));
+ hal_get_user_input(chInput, sizeof(chInput));
return atoi(chInput);
}
@@ -181,7 +176,6 @@ void DumpTensor(const TfLiteTensor* tensor, const size_t lineBreakForNumElements
bool ListFilesHandler(ApplicationContext& ctx)
{
auto& model = ctx.Get<Model&>("model");
- auto& platform = ctx.Get<hal_platform&>("platform");
constexpr uint32_t dataPsnTxtStartX = 20;
constexpr uint32_t dataPsnTxtStartY = 40;
@@ -192,12 +186,12 @@ bool ListFilesHandler(ApplicationContext& ctx)
}
/* Clear the LCD */
- platform.data_psn->clear(COLOR_BLACK);
+ hal_lcd_clear(COLOR_BLACK);
/* Show the total number of embedded files. */
std::string strNumFiles = std::string{"Total Number of Files: "} +
std::to_string(NUMBER_OF_FILES);
- platform.data_psn->present_data_text(strNumFiles.c_str(),
+ hal_lcd_display_text(strNumFiles.c_str(),
strNumFiles.size(),
dataPsnTxtStartX,
dataPsnTxtStartY,
@@ -210,7 +204,7 @@ bool ListFilesHandler(ApplicationContext& ctx)
for (uint32_t i = 0; i < NUMBER_OF_FILES; ++i, yVal += dataPsnTxtYIncr) {
std::string currentFilename{get_filename(i)};
- platform.data_psn->present_data_text(currentFilename.c_str(),
+ hal_lcd_display_text(currentFilename.c_str(),
currentFilename.size(),
dataPsnTxtStartX, yVal, false);
diff --git a/source/application/main/include/UseCaseCommonUtils.hpp b/source/application/main/include/UseCaseCommonUtils.hpp
index 7f5dde6..9b6d550 100644
--- a/source/application/main/include/UseCaseCommonUtils.hpp
+++ b/source/application/main/include/UseCaseCommonUtils.hpp
@@ -31,12 +31,10 @@ void DisplayCommonMenu();
/**
* @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.
**/
-bool PresentInferenceResult(hal_platform& platform,
- const std::vector<arm::app::ClassificationResult>& results);
+bool PresentInferenceResult(const std::vector<arm::app::ClassificationResult>& results);
/**
@@ -82,10 +80,9 @@ namespace app {
/**
* @brief Read input and return as an integer.
- * @param[in] platform Reference to the hal platform object.
* @return Integer value corresponding to the user input.
**/
- int ReadUserInputAsInt(hal_platform& platform);
+ int ReadUserInputAsInt();
#if VERIFY_TEST_OUTPUT
/**