Skip to content

Commit

Permalink
firmware: app: tasks: Initial structure of the parameter server task #…
Browse files Browse the repository at this point in the history
  • Loading branch information
mgm8 committed Jul 1, 2021
1 parent 231465b commit 0033d35
Show file tree
Hide file tree
Showing 5 changed files with 138 additions and 6 deletions.
55 changes: 55 additions & 0 deletions firmware/app/tasks/param_server.c
Original file line number Diff line number Diff line change
@@ -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 <http://www.gnu.org/licenses/>.
*
*/

/**
* \brief Parameter server task implementation.
*
* \author Gabriel Mariano Marcelino <[email protected]>
*
* \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 */
65 changes: 65 additions & 0 deletions firmware/app/tasks/param_server.h
Original file line number Diff line number Diff line change
@@ -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 <http://www.gnu.org/licenses/>.
*
*/

/**
* \brief Parameter server task definition.
*
* \author Gabriel Mariano Marcelino <[email protected]>
*
* \version 0.2.1
*
* \date 2021/06/30
*
* \defgroup param_server Parameter server
* \ingroup tasks
* \{
*/

#ifndef PARAM_SERVER_H_
#define PARAM_SERVER_H_

#include <FreeRTOS.h>
#include <task.h>

#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 */
12 changes: 11 additions & 1 deletion firmware/app/tasks/tasks.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
*
* \author Gabriel Mariano Marcelino <[email protected]>
*
* \version 0.2.0
* \version 0.2.1
*
* \date 2021/04/09
*
Expand All @@ -44,6 +44,7 @@
#include "watchdog_reset.h"
#include "system_reset.h"
#include "read_sensors.h"
#include "param_server.h"

void create_tasks()
{
Expand Down Expand Up @@ -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();
}

Expand Down
8 changes: 5 additions & 3 deletions firmware/config/config.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* config.h
*
* Copyright (C) 2020, SpaceLab.
* Copyright (C) 2021, SpaceLab.
*
* This file is part of EPS 2.0.
*
Expand All @@ -23,9 +23,10 @@
/**
* \brief Configuration parameters definition.
*
* \author Gabriel Mariano Marcelino <[email protected]> and Augusto Cezar Boldori Vassoler <[email protected]>
* \author Gabriel Mariano Marcelino <[email protected]>
* \author Augusto Cezar Boldori Vassoler <[email protected]>
*
* \version 0.2.0
* \version 0.2.1
*
* \date 2021/01/25
*
Expand All @@ -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

Expand Down
4 changes: 2 additions & 2 deletions firmware/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
*
* \author Gabriel Mariano Marcelino <[email protected]>
*
* \version 0.2.0
* \version 0.2.1
*
* \date 2020/10/21
*
Expand All @@ -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"

Expand Down

0 comments on commit 0033d35

Please sign in to comment.