summaryrefslogtreecommitdiff
path: root/source/hal/source
diff options
context:
space:
mode:
Diffstat (limited to 'source/hal/source')
-rw-r--r--source/hal/source/data_acq.c61
-rw-r--r--source/hal/source/data_psn.c46
-rw-r--r--source/hal/source/hal.c44
3 files changed, 13 insertions, 138 deletions
diff --git a/source/hal/source/data_acq.c b/source/hal/source/data_acq.c
deleted file mode 100644
index ec6c725..0000000
--- a/source/hal/source/data_acq.c
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright (c) 2022 Arm Limited. All rights reserved.
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "data_acq.h"
-
-#include "log_macros.h"
-#include "platform_drivers.h"
-
-#include <assert.h>
-#include <stdlib.h>
-#include <string.h>
-
-/**
- * @brief Get the user input from USART.
- * @param[out] user_input String read from the UART block.
- * @param[in] size String read length.
- * @return 0 if successful, error code otherwise.
- **/
-static int get_uart_user_input(char* user_input, int size)
-{
- if (1 != GetLine(user_input, size - 1)) {
- return 1;
- }
- return 0;
-}
-
-int data_acq_channel_init(data_acq_module* module)
-{
- assert(module);
-
- /* UART should have been initialised with low level initialisation
- * routines. */
- module->system_init = NULL;
-
- strncpy(module->system_name, "UART", sizeof(module->system_name));
- module->get_input = get_uart_user_input;
- module->inited = 1;
-
- return !(module->inited);
-}
-
-int data_acq_channel_release(data_acq_module* module)
-{
- assert(module);
- module->inited = 0;
- module->get_input = NULL;
- return 0;
-}
diff --git a/source/hal/source/data_psn.c b/source/hal/source/data_psn.c
deleted file mode 100644
index de088d7..0000000
--- a/source/hal/source/data_psn.c
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (c) 2022 Arm Limited. All rights reserved.
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "data_psn.h"
-
-#include "lcd_img.h"
-#include "platform_drivers.h"
-
-#include <assert.h>
-#include <string.h>
-
-int data_psn_system_init(data_psn_module* module)
-{
- assert(module);
-
- /* LCD output supported. */
- module->system_init = lcd_init;
- module->present_data_image = lcd_display_image;
- module->present_data_text = lcd_display_text;
- module->present_box = lcd_display_box;
- module->set_text_color = lcd_set_text_color;
- module->clear = lcd_clear;
- strncpy(module->system_name, "lcd", sizeof(module->system_name));
- module->inited = !module->system_init();
- return !module->inited;
-}
-
-int data_psn_system_release(data_psn_module* module)
-{
- assert(module);
- module->inited = 0;
- return 0;
-}
diff --git a/source/hal/source/hal.c b/source/hal/source/hal.c
index 2715a17..d6028e7 100644
--- a/source/hal/source/hal.c
+++ b/source/hal/source/hal.c
@@ -23,13 +23,8 @@
#include <assert.h>
#include <string.h>
-int hal_init(hal_platform* platform, data_acq_module* data_acq,
- data_psn_module* data_psn, platform_timer* timer)
+int hal_init(hal_platform* platform, platform_timer* timer)
{
- assert(platform && data_acq && data_psn);
-
- platform->data_acq = data_acq;
- platform->data_psn = data_psn;
platform->timer = timer;
platform->platform_init = platform_init;
platform->platform_release = platform_release;
@@ -59,46 +54,33 @@ int hal_platform_init(hal_platform* platform)
return state;
}
- /* Initialise the data acquisition module */
- if (0 != (state = data_acq_channel_init(platform->data_acq))) {
- if (!platform->data_acq->inited) {
- printf_err("Failed to initialise data acq module: %s\n",
- platform->data_acq->system_name);
- }
- hal_platform_release(platform);
+ /* Initialise LCD */
+ if (0 != (state = hal_lcd_init())) {
+ printf_err("hal_lcd_init failed\n");
return state;
}
- /* Initialise the presentation module */
- if (0 != (state = data_psn_system_init(platform->data_psn))) {
- printf_err("Failed to initialise data psn module: %s\n",
- platform->data_psn->system_name);
- data_acq_channel_release(platform->data_acq);
- hal_platform_release(platform);
- return state;
- }
-
- /* Followed by the timer module */
+ /* Initialise the timer module */
init_timer(platform->timer);
info("%s platform initialised\n", platform->plat_name);
- debug("Using %s module for data acquisition\n",
- platform->data_acq->system_name);
- debug("Using %s module for data presentation\n",
- platform->data_psn->system_name);
-
platform->inited = !state;
-
return state;
}
void hal_platform_release(hal_platform *platform)
{
assert(platform && platform->platform_release);
- data_acq_channel_release(platform->data_acq);
- data_psn_system_release(platform->data_psn);
hal_platform_clear(platform);
info("Releasing platform %s\n", platform->plat_name);
platform->platform_release();
}
+
+bool hal_get_user_input(char* user_input, int size)
+{
+ if (1 != GetLine(user_input, size - 1)) {
+ return true;
+ }
+ return false;
+}