-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
firmware: app: tasks: Syncing the implementation of the main function…
… with the OBDH 2.0 repository
- Loading branch information
Showing
22 changed files
with
233 additions
and
136 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,7 @@ | |
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with TTC 2.0. If not, see <http://www.gnu.org/licenses/>. | ||
* along with TTC 2.0. If not, see <http:/\/www.gnu.org/licenses/>. | ||
* | ||
*/ | ||
|
||
|
@@ -25,7 +25,7 @@ | |
* | ||
* \author Gabriel Mariano Marcelino <[email protected]> | ||
* | ||
* \version 0.0.9 | ||
* \version 0.1.10 | ||
* | ||
* \date 2019/10/27 | ||
* | ||
|
@@ -42,7 +42,7 @@ | |
|
||
xTaskHandle xTaskBeaconHandle; | ||
|
||
void vTaskBeacon(void *pvParameters) | ||
void vTaskBeacon(void) | ||
{ | ||
/* Wait startup task to finish */ | ||
xEventGroupWaitBits(task_startup_status, TASK_STARTUP_DONE, pdFALSE, pdTRUE, pdMS_TO_TICKS(TASK_BEACON_INIT_TIMEOUT_MS)); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,7 +25,7 @@ | |
* | ||
* \author Gabriel Mariano Marcelino <[email protected]> | ||
* | ||
* \version 0.0.9 | ||
* \version 0.1.10 | ||
* | ||
* \date 2019/10/27 | ||
* | ||
|
@@ -55,11 +55,9 @@ extern xTaskHandle xTaskBeaconHandle; | |
/** | ||
* \brief Beacon task. | ||
* | ||
* \param[in] pvParameters is a value that will passed as the task's parameter. | ||
* | ||
* \return None. | ||
*/ | ||
void vTaskBeacon(void *pvParameters); | ||
void vTaskBeacon(void); | ||
|
||
#endif /* BEACON_H_ */ | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,7 @@ | |
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with TTC 2.0. If not, see <http://www.gnu.org/licenses/>. | ||
* along with TTC 2.0. If not, see <http:/\/www.gnu.org/licenses/>. | ||
* | ||
*/ | ||
|
||
|
@@ -25,7 +25,7 @@ | |
* | ||
* \author Gabriel Mariano Marcelino <[email protected]> | ||
* | ||
* \version 0.0.9 | ||
* \version 0.1.10 | ||
* | ||
* \date 2020/04/04 | ||
* | ||
|
@@ -42,7 +42,7 @@ | |
|
||
xTaskHandle xTaskCSPServerHandle; | ||
|
||
void vTaskCSPServer(void *pvParameters) | ||
void vTaskCSPServer(void) | ||
{ | ||
/* Wait startup task to finish */ | ||
xEventGroupWaitBits(task_startup_status, TASK_STARTUP_DONE, pdFALSE, pdTRUE, pdMS_TO_TICKS(TASK_CSP_SERVER_INIT_TIMEOUT_MS)); | ||
|
@@ -63,18 +63,24 @@ void vTaskCSPServer(void *pvParameters) | |
while(1) | ||
{ | ||
/* Wait for connection until reach timeout */ | ||
if ((conn = csp_accept(sock, CONFIG_CSP_WAIT_CONN_TIMEOUT_MS)) == NULL) | ||
conn = csp_accept(sock, CONFIG_CSP_WAIT_CONN_TIMEOUT_MS); | ||
if (conn == NULL) | ||
{ | ||
continue; | ||
} | ||
|
||
/* Read packets until reach timeout */ | ||
while((packet = csp_read(conn, CONFIG_CSP_READ_PKT_TIMEOUT_MS)) != NULL) | ||
packet = csp_read(conn, CONFIG_CSP_READ_PKT_TIMEOUT_MS); | ||
while(packet != NULL) | ||
{ | ||
switch(csp_conn_dport(conn)) | ||
{ | ||
case CONFIG_CSP_PORT: | ||
case CONFIG_CSP_PRIMARY_PORT: | ||
/* TODO: Process packet here */ | ||
break; | ||
case CONFIG_CSP_SECONDARY_PORT: | ||
/* TODO: Process packet here */ | ||
break; | ||
default: | ||
/* Let the service handler reply pings, buffer use, etc. */ | ||
csp_service_handler(conn, packet); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,7 +25,7 @@ | |
* | ||
* \author Gabriel Mariano Marcelino <[email protected]> | ||
* | ||
* \version 0.0.9 | ||
* \version 0.1.10 | ||
* | ||
* \date 2020/04/04 | ||
* | ||
|
@@ -54,11 +54,9 @@ extern xTaskHandle xTaskCSPServerHandle; | |
/** | ||
* \brief CSP server task. | ||
* | ||
* \param[in] pvParameters is a value that will passed as the task's parameter. | ||
* | ||
* \return None. | ||
*/ | ||
void vTaskCSPServer(void *pvParameters); | ||
void vTaskCSPServer(void); | ||
|
||
#endif /* CSP_SERVER_H_ */ | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,7 @@ | |
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with TTC 2.0. If not, see <http://www.gnu.org/licenses/>. | ||
* along with TTC 2.0. If not, see <http:/\/www.gnu.org/licenses/>. | ||
* | ||
*/ | ||
|
||
|
@@ -25,7 +25,7 @@ | |
* | ||
* \author Gabriel Mariano Marcelino <[email protected]> | ||
* | ||
* \version 0.0.9 | ||
* \version 0.1.10 | ||
* | ||
* \date 2020/01/20 | ||
* | ||
|
@@ -40,7 +40,7 @@ | |
|
||
xTaskHandle xTaskHeartbeatHandle; | ||
|
||
void vTaskHeartbeat(void *pvParameters) | ||
void vTaskHeartbeat(void) | ||
{ | ||
/* Wait startup task to finish */ | ||
xEventGroupWaitBits(task_startup_status, TASK_STARTUP_DONE, pdFALSE, pdTRUE, pdMS_TO_TICKS(TASK_HEARTBEAT_INIT_TIMEOUT_MS)); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,7 +25,7 @@ | |
* | ||
* \author Gabriel Mariano Marcelino <[email protected]> | ||
* | ||
* \version 0.0.9 | ||
* \version 0.1.10 | ||
* | ||
* \date 2020/01/20 | ||
* | ||
|
@@ -41,7 +41,7 @@ | |
#include <task.h> | ||
|
||
#define TASK_HEARTBEAT_NAME "Heartbeat" /**< Task name. */ | ||
#define TASK_HEARTBEAT_STACK_SIZE 128 /**< Memory stack size in bytes. */ | ||
#define TASK_HEARTBEAT_STACK_SIZE 160 /**< Memory stack size in bytes. */ | ||
#define TASK_HEARTBEAT_PRIORITY 1 /**< Priority. */ | ||
#define TASK_HEARTBEAT_PERIOD_MS 500 /**< Period in milliseconds. */ | ||
#define TASK_HEARTBEAT_INIT_TIMEOUT_MS 2000 /**< Wait time to initialize the task in milliseconds. */ | ||
|
@@ -54,11 +54,9 @@ extern xTaskHandle xTaskHeartbeatHandle; | |
/** | ||
* \brief System heartbeat task. | ||
* | ||
* \param[in] pvParameters is a value that will passed as the task's parameter. | ||
* | ||
* \return None. | ||
*/ | ||
void vTaskHeartbeat(void *pvParameters); | ||
void vTaskHeartbeat(void); | ||
|
||
#endif /* HEARTBEAT_H_ */ | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,7 @@ | |
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with TTC 2.0. If not, see <http://www.gnu.org/licenses/>. | ||
* along with TTC 2.0. If not, see <http:/\/www.gnu.org/licenses/>. | ||
* | ||
*/ | ||
|
||
|
@@ -25,7 +25,7 @@ | |
* | ||
* \author Gabriel Mariano Marcelino <[email protected]> | ||
* | ||
* \version 0.0.9 | ||
* \version 0.1.10 | ||
* | ||
* \date 2020/01/29 | ||
* | ||
|
@@ -37,7 +37,7 @@ | |
|
||
xTaskHandle xTaskRadioResetHandle; | ||
|
||
void vTaskRadioReset(void *pvParameters) | ||
void vTaskRadioReset(void) | ||
{ | ||
/* Delay before the first cycle */ | ||
vTaskDelay(pdMS_TO_TICKS(TASK_RADIO_RESET_INITIAL_DELAY_MS)); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,7 @@ | |
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with TTC 2.0. If not, see <http://www.gnu.org/licenses/>. | ||
* along with TTC 2.0. If not, see <http:/\/www.gnu.org/licenses/>. | ||
* | ||
*/ | ||
|
||
|
@@ -25,7 +25,7 @@ | |
* | ||
* \author Gabriel Mariano Marcelino <[email protected]> | ||
* | ||
* \version 0.0.9 | ||
* \version 0.1.10 | ||
* | ||
* \date 2020/01/29 | ||
* | ||
|
@@ -54,11 +54,9 @@ extern xTaskHandle xTaskRadioResetHandle; | |
/** | ||
* \brief Periodic radio reset task. | ||
* | ||
* \param[in] pvParameters is a value that will passed as the task's parameter. | ||
* | ||
* \return None. | ||
*/ | ||
void vTaskRadioReset(void *pvParameters); | ||
void vTaskRadioReset(void); | ||
|
||
#endif /* RADIO_RESET_H_ */ | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,7 @@ | |
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with TTC 2.0. If not, see <http://www.gnu.org/licenses/>. | ||
* along with TTC 2.0. If not, see <http:/\/www.gnu.org/licenses/>. | ||
* | ||
*/ | ||
|
||
|
@@ -25,7 +25,7 @@ | |
* | ||
* \author Gabriel Mariano Marcelino <[email protected]> | ||
* | ||
* \version 0.0.25 | ||
* \version 0.1.10 | ||
* | ||
* \date 2020/07/12 | ||
* | ||
|
@@ -43,7 +43,7 @@ | |
|
||
xTaskHandle xTaskReadSensorsHandle; | ||
|
||
void vTaskReadSensors(void *pvParameters) | ||
void vTaskReadSensors(void) | ||
{ | ||
/* Wait startup task to finish */ | ||
xEventGroupWaitBits(task_startup_status, TASK_STARTUP_DONE, pdFALSE, pdTRUE, pdMS_TO_TICKS(TASK_READ_SENSORS_INIT_TIMEOUT_MS)); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,7 +25,7 @@ | |
* | ||
* \author Gabriel Mariano Marcelino <[email protected]> | ||
* | ||
* \version 0.0.9 | ||
* \version 0.1.10 | ||
* | ||
* \date 2020/07/12 | ||
* | ||
|
@@ -54,11 +54,9 @@ extern xTaskHandle xTaskReadSensorsHandle; | |
/** | ||
* \brief Read onboard sensors task. | ||
* | ||
* \param[in] pvParameters is a value that will passed as the task's parameter. | ||
* | ||
* \return None. | ||
*/ | ||
void vTaskReadSensors(void *pvParameters); | ||
void vTaskReadSensors(void); | ||
|
||
#endif /* READ_SENSORS_H_ */ | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,7 @@ | |
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with TTC 2.0. If not, see <http://www.gnu.org/licenses/>. | ||
* along with TTC 2.0. If not, see <http:/\/www.gnu.org/licenses/>. | ||
* | ||
*/ | ||
|
||
|
@@ -25,7 +25,7 @@ | |
* | ||
* \author Gabriel Mariano Marcelino <[email protected]> | ||
* | ||
* \version 0.0.9 | ||
* \version 0.1.10 | ||
* | ||
* \date 2019/12/04 | ||
* | ||
|
@@ -59,7 +59,7 @@ xTaskHandle xTaskStartupHandle; | |
|
||
EventGroupHandle_t task_startup_status; | ||
|
||
void vTaskStartup(void *pvParameters) | ||
void vTaskStartup(void) | ||
{ | ||
unsigned int error_counter = 0; | ||
|
||
|
@@ -144,7 +144,7 @@ void vTaskStartup(void *pvParameters) | |
error_counter++; | ||
} | ||
|
||
if (error_counter > 0) | ||
if (error_counter > 0U) | ||
{ | ||
sys_log_print_event_from_module(SYS_LOG_ERROR, TASK_STARTUP_NAME, "Boot completed with "); | ||
sys_log_print_uint(error_counter); | ||
|
@@ -167,38 +167,37 @@ void vTaskStartup(void *pvParameters) | |
vTaskSuspend(xTaskStartupHandle); | ||
} | ||
|
||
int startup_init_csp() | ||
int startup_init_csp(void) | ||
{ | ||
#if CONFIG_CSP_ENABLED == 1 | ||
/* CSP initialization */ | ||
if (csp_init(CONFIG_CSP_MY_ADDRESS) != CSP_ERR_NONE) | ||
{ | ||
return -1; /* Error during CSP initialization */ | ||
} | ||
#if defined(CONFIG_CSP_ENABLED) && (CONFIG_CSP_ENABLED == 1) | ||
int err = CSP_ERR_NONE; | ||
|
||
/* Buffer initialization */ | ||
if (csp_buffer_init(CONFIG_CSP_BUFFER_MAX_PKTS, CONFIG_CSP_BUFFER_MAX_SIZE) != CSP_ERR_NONE) | ||
{ | ||
return -1; /* Error during the CSP buffer initialization */ | ||
} | ||
|
||
if (csp_route_set(CONFIG_CSP_TTC_ADDRESS, &csp_if_spi, CSP_NODE_MAC) != CSP_ERR_NONE) | ||
{ | ||
return -1; | ||
} | ||
|
||
if (csp_route_set(CONFIG_CSP_EPS_ADDRESS, &csp_if_i2c, CSP_NODE_MAC) != CSP_ERR_NONE) | ||
{ | ||
return -1; | ||
} | ||
/* CSP initialization */ | ||
err = csp_init(CONFIG_CSP_MY_ADDRESS); | ||
|
||
/* CSP router task initialization */ | ||
if (csp_route_start_task(CONFIG_CSP_ROUTER_WORD_STACK, CONFIG_CSP_ROUTER_TASK_PRIORITY) != CSP_ERR_NONE) | ||
if (err == CSP_ERR_NONE) | ||
{ | ||
return -1; /* Error during CSP router task initialization! */ | ||
/* Buffer initialization */ | ||
err = csp_buffer_init(CONFIG_CSP_BUFFER_MAX_PKTS, CONFIG_CSP_BUFFER_MAX_SIZE); | ||
|
||
if (err == CSP_ERR_NONE) | ||
{ | ||
err = csp_route_set(CONFIG_CSP_TTC_ADDRESS, &csp_if_spi, CSP_NODE_MAC); | ||
|
||
if (err == CSP_ERR_NONE) | ||
{ | ||
err = csp_route_set(CONFIG_CSP_EPS_ADDRESS, &csp_if_i2c, CSP_NODE_MAC); | ||
|
||
if (err == CSP_ERR_NONE) | ||
{ | ||
/* CSP router task initialization */ | ||
err = csp_route_start_task(CONFIG_CSP_ROUTER_WORD_STACK, CONFIG_CSP_ROUTER_TASK_PRIORITY); | ||
} | ||
} | ||
} | ||
} | ||
|
||
return CSP_ERR_NONE; | ||
return err; | ||
#else | ||
sys_log_print_event_from_module(SYS_LOG_WARNING, TASK_STARTUP_NAME, "libcsp disabled!"); | ||
sys_log_new_line(); | ||
|
Oops, something went wrong.