-
Notifications
You must be signed in to change notification settings - Fork 6
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: param_server: Updating the implementation #136
- Loading branch information
Showing
3 changed files
with
30 additions
and
27 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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
/* | ||
* param_server.h | ||
* | ||
* Copyright (C) 2021, SpaceLab. | ||
* Copyright The EPS 2.0 Contributors. | ||
* | ||
* This file is part of EPS 2.0. | ||
* | ||
|
@@ -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 EPS 2.0. If not, see <http://www.gnu.org/licenses/>. | ||
* along with EPS 2.0. If not, see <http:/\/www.gnu.org/licenses/>. | ||
* | ||
*/ | ||
|
||
|
@@ -26,7 +26,7 @@ | |
* \author Gabriel Mariano Marcelino <[email protected]> | ||
* \author André M. P. de Mattos <[email protected]> | ||
* | ||
* \version 0.2.30 | ||
* \version 0.2.41 | ||
* | ||
* \date 2021/07/24 | ||
* | ||
|
@@ -37,6 +37,8 @@ | |
#include <system/sys_log/sys_log.h> | ||
#include <structs/eps2_data.h> | ||
|
||
#include <drivers/i2c_slave/i2c_slave.h> | ||
|
||
#include <devices/ttc/ttc.h> | ||
#include <devices/obdh/obdh.h> | ||
|
||
|
@@ -47,24 +49,24 @@ xTaskHandle xTaskParamServerHandle; | |
|
||
void vTaskParamServer(void *pvParameters) | ||
{ | ||
BaseType_t xResult; | ||
uint32_t ulNotifiedValue; | ||
|
||
uint8_t adr = 0; | ||
uint32_t val = 0; | ||
uint8_t cmd = 0; | ||
BaseType_t result; | ||
uint32_t notified_value; | ||
|
||
/* Wait startup task to finish */ | ||
xEventGroupWaitBits(task_startup_status, TASK_STARTUP_DONE, pdFALSE, pdTRUE, pdMS_TO_TICKS(TASK_PARAM_SERVER_INIT_TIMEOUT_MS)); | ||
|
||
while(1) | ||
{ | ||
xResult = xTaskNotifyWait(0UL, 0xFFFFFFFFUL, &ulNotifiedValue, pdMS_TO_TICKS(TASK_PARAM_SERVER_MAX_BLOCK_TIME_MS)); | ||
result = xTaskNotifyWait(0UL, 0xFFFFFFFFUL, ¬ified_value, pdMS_TO_TICKS(TASK_PARAM_SERVER_MAX_BLOCK_TIME_MS)); | ||
|
||
uint8_t adr = 0; | ||
uint32_t val = 0; | ||
uint8_t cmd = 0; | ||
|
||
if (xResult == pdPASS) | ||
if (result == pdPASS) | ||
{ | ||
/* Process interrupt from UART ISR. */ | ||
if ( (ulNotifiedValue & NOTIFICATION_VALUE_FROM_I2C_ISR) != 0) | ||
/* Process interrupt from I2C ISR. */ | ||
if ((notified_value & I2C_SLAVE_NOTI_VAL_TO_I2C_RX_ISR) != 0) | ||
{ | ||
if (obdh_decode(&adr, &val, &cmd) == 0) | ||
{ | ||
|
@@ -81,21 +83,23 @@ void vTaskParamServer(void *pvParameters) | |
sys_log_print_event_from_module(SYS_LOG_ERROR, TASK_PARAM_SERVER_NAME, "OBDH write command has failed to complete!"); | ||
sys_log_new_line(); | ||
} | ||
|
||
break; | ||
case OBDH_COMMAND_READ: | ||
if (eps_buffer_read(adr, &val) != 0) | ||
{ | ||
sys_log_print_event_from_module(SYS_LOG_ERROR, TASK_PARAM_SERVER_NAME, "OBDH read command has failed to complete (buffer)!"); | ||
sys_log_new_line(); | ||
} | ||
else | ||
if (eps_buffer_read(adr, &val) == 0) | ||
{ | ||
if (obdh_answer(adr, val) != 0) | ||
if (obdh_write_output_buffer(adr, val) != 0) | ||
{ | ||
sys_log_print_event_from_module(SYS_LOG_ERROR, TASK_PARAM_SERVER_NAME, "OBDH read command has failed to complete (answer)!"); | ||
sys_log_new_line(); | ||
} | ||
} | ||
else | ||
{ | ||
sys_log_print_event_from_module(SYS_LOG_ERROR, TASK_PARAM_SERVER_NAME, "OBDH read command has failed to complete (buffer)!"); | ||
sys_log_new_line(); | ||
} | ||
|
||
break; | ||
default: | ||
break; | ||
|
@@ -107,9 +111,7 @@ void vTaskParamServer(void *pvParameters) | |
sys_log_new_line(); | ||
} | ||
} | ||
|
||
/* Process interrupt from UART ISR. */ | ||
if ( (ulNotifiedValue & NOTIFICATION_VALUE_FROM_UART_ISR) != 0) | ||
else if ((notified_value & NOTIFICATION_VALUE_FROM_UART_ISR) != 0) | ||
{ | ||
if (ttc_decode(&adr, &val, &cmd) == 0) | ||
{ | ||
|
@@ -126,6 +128,7 @@ void vTaskParamServer(void *pvParameters) | |
sys_log_print_event_from_module(SYS_LOG_ERROR, TASK_PARAM_SERVER_NAME, "TTC write command has failed to complete!"); | ||
sys_log_new_line(); | ||
} | ||
|
||
break; | ||
case TTC_COMMAND_READ: | ||
if (eps_buffer_read(adr, &val) != 0) | ||
|
@@ -141,6 +144,7 @@ void vTaskParamServer(void *pvParameters) | |
sys_log_new_line(); | ||
} | ||
} | ||
|
||
break; | ||
default: | ||
break; | ||
|
@@ -159,8 +163,6 @@ void vTaskParamServer(void *pvParameters) | |
sys_log_print_event_from_module(SYS_LOG_WARNING, TASK_PARAM_SERVER_NAME, "Any command request received in the last minute"); | ||
sys_log_new_line(); | ||
} | ||
|
||
|
||
} | ||
} | ||
|
||
|
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
# OBDH Device |
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.2.40 | ||
* \version 0.2.41 | ||
* | ||
* \date 2020/10/21 | ||
* | ||
|
@@ -36,7 +36,7 @@ | |
#ifndef VERSION_H_ | ||
#define VERSION_H_ | ||
|
||
#define FIRMWARE_VERSION "0.2.40" | ||
#define FIRMWARE_VERSION "0.2.41" | ||
|
||
#define FIRMWARE_STATUS "Development" | ||
|
||
|