diff --git a/firmware/app/tasks/param_server.c b/firmware/app/tasks/param_server.c new file mode 100644 index 0000000..3200e98 --- /dev/null +++ b/firmware/app/tasks/param_server.c @@ -0,0 +1,55 @@ +/* + * param_server.h + * + * Copyright (C) 2021, SpaceLab. + * + * This file is part of EPS 2.0. + * + * EPS 2.0 is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * EPS 2.0 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with EPS 2.0. If not, see . + * + */ + +/** + * \brief Parameter server task implementation. + * + * \author Gabriel Mariano Marcelino + * + * \version 0.2.1 + * + * \date 2021/06/30 + * + * \addtogroup param_server + * \{ + */ + +#include "param_server.h" + +xTaskHandle xTaskParamServerHandle; + +void vTaskParamServer(void *pvParameters) +{ + /* Delay before the first cycle */ + vTaskDelay(pdMS_TO_TICKS(TASK_PARAM_SERVER_INITIAL_DELAY_MS)); + + while(1) + { + TickType_t last_cycle = xTaskGetTickCount(); + + /* TODO */ + + vTaskDelayUntil(&last_cycle, pdMS_TO_TICKS(TASK_PARAM_SERVER_PERIOD_MS)); + } +} + +/** \} End of param_server group */ diff --git a/firmware/app/tasks/param_server.h b/firmware/app/tasks/param_server.h new file mode 100644 index 0000000..208ede9 --- /dev/null +++ b/firmware/app/tasks/param_server.h @@ -0,0 +1,65 @@ +/* + * param_server.c + * + * Copyright (C) 2021, SpaceLab. + * + * This file is part of EPS 2.0. + * + * EPS 2.0 is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * EPS 2.0 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with EPS 2.0. If not, see . + * + */ + +/** + * \brief Parameter server task definition. + * + * \author Gabriel Mariano Marcelino + * + * \version 0.2.1 + * + * \date 2021/06/30 + * + * \defgroup param_server Parameter server + * \ingroup tasks + * \{ + */ + +#ifndef PARAM_SERVER_H_ +#define PARAM_SERVER_H_ + +#include +#include + +#define TASK_PARAM_SERVER_NAME "Param Server" /**< Task name. */ +#define TASK_PARAM_SERVER_STACK_SIZE 300 /**< Stack size in bytes. */ +#define TASK_PARAM_SERVER_PRIORITY 4 /**< Task priority. */ +#define TASK_PARAM_SERVER_PERIOD_MS 50 /**< Task period in milliseconds. */ +#define TASK_PARAM_SERVER_INITIAL_DELAY_MS 1000 /**< Delay, in milliseconds, before the first execution. */ + +/** + * \brief Parameter server handle. + */ +extern xTaskHandle xTaskParamServerHandle; + +/** + * \brief Parameter server task. + * + * \param[in] pvParameters is a value that will passed as the task's parameter. + * + * \return None. + */ +void vTaskParamServer(void *pvParameters); + +#endif /* PARAM_SERVER_H_ */ + +/** \} End of param_server group */ diff --git a/firmware/app/tasks/tasks.c b/firmware/app/tasks/tasks.c index 26c0b65..791898a 100644 --- a/firmware/app/tasks/tasks.c +++ b/firmware/app/tasks/tasks.c @@ -25,7 +25,7 @@ * * \author Gabriel Mariano Marcelino * - * \version 0.2.0 + * \version 0.2.1 * * \date 2021/04/09 * @@ -44,6 +44,7 @@ #include "watchdog_reset.h" #include "system_reset.h" #include "read_sensors.h" +#include "param_server.h" void create_tasks() { @@ -96,6 +97,15 @@ void create_tasks() } #endif /* CONFIG_TASK_READ_SENSORS_ENABLED */ +#if CONFIG_TASK_PARAM_SERVER_ENABLED == 1 + xTaskCreate(vTaskParamServer, TASK_PARAM_SERVER_NAME, TASK_PARAM_SERVER_STACK_SIZE, NULL, TASK_PARAM_SERVER_PRIORITY, &xTaskParamServerHandle); + + if (xTaskParamServerHandle == NULL) + { + /* Error creating the parameter server task */ + } +#endif /* CONFIG_TASK_PARAM_SERVER_ENABLED */ + create_event_groups(); } diff --git a/firmware/config/config.h b/firmware/config/config.h index 423adb5..37106ad 100644 --- a/firmware/config/config.h +++ b/firmware/config/config.h @@ -1,7 +1,7 @@ /* * config.h * - * Copyright (C) 2020, SpaceLab. + * Copyright (C) 2021, SpaceLab. * * This file is part of EPS 2.0. * @@ -23,9 +23,10 @@ /** * \brief Configuration parameters definition. * - * \author Gabriel Mariano Marcelino and Augusto Cezar Boldori Vassoler + * \author Gabriel Mariano Marcelino + * \author Augusto Cezar Boldori Vassoler * - * \version 0.2.0 + * \version 0.2.1 * * \date 2021/01/25 * @@ -42,6 +43,7 @@ #define CONFIG_TASK_HEARTBEAT_ENABLED 1 #define CONFIG_TASK_SYSTEM_RESET_ENABLED 0 #define CONFIG_TASK_READ_SENSORS_ENABLED 1 +#define CONFIG_TASK_PARAM_SERVER_ENABLED 1 #define CONFIG_DRIVERS_DEBUG_ENABLED 0 diff --git a/firmware/version.h b/firmware/version.h index a658d96..05e2b94 100644 --- a/firmware/version.h +++ b/firmware/version.h @@ -25,7 +25,7 @@ * * \author Gabriel Mariano Marcelino * - * \version 0.2.0 + * \version 0.2.1 * * \date 2020/10/21 * @@ -36,7 +36,7 @@ #ifndef VERSION_H_ #define VERSION_H_ -#define FIRMWARE_VERSION "0.2.0" +#define FIRMWARE_VERSION "0.2.1" #define FIRMWARE_STATUS "Development"