diff --git a/obc/drivers/rm46/obc_sci_io.c b/obc/drivers/rm46/obc_sci_io.c index 5d487a11b..a84376200 100644 --- a/obc/drivers/rm46/obc_sci_io.c +++ b/obc/drivers/rm46/obc_sci_io.c @@ -95,7 +95,7 @@ obc_error_code_t sciReadBytes(uint8_t *buf, size_t numBytes, TickType_t uartMute return errCode; } -obc_error_code_t sciSendBytes(uint8_t *buf, size_t numBytes, TickType_t uartMutexTimeoutTicks, +obc_error_code_t sciSendBytes(uint8_t *buf, size_t numBytes, TickType_t uartMutexTimeoutTicks, size_t transferCompleteTimeoutTicks, sciBASE_t *sciReg) { obc_error_code_t errCode; if (!(sciReg == scilinREG || sciReg == sciREG)) { @@ -135,7 +135,7 @@ obc_error_code_t sciSendBytes(uint8_t *buf, size_t numBytes, TickType_t uartMute } xSemaphoreGive(mutex); - return OBC_ERR_CODE_SUCCESS; + return errCode; } void sciNotification(sciBASE_t *sci, uint32 flags) { diff --git a/obc/drivers/vn100/vn100.c b/obc/drivers/vn100/vn100.c index 2b7e3063d..d6bec7895 100644 --- a/obc/drivers/vn100/vn100.c +++ b/obc/drivers/vn100/vn100.c @@ -50,7 +50,8 @@ void initVn100(void) { obc_error_code_t vn100ResetModule(void) { obc_error_code_t errCode; unsigned char buf[] = "$VNRST*4D\r\n"; - RETURN_IF_ERROR_CODE(sciSendBytes(buf, (sizeof(buf) - 1), MUTEX_TIMEOUT, pdMS_TO_TICKS(SCI_SEMAPHORE_TIMEOUT_MS), UART_VN100_REG)); + RETURN_IF_ERROR_CODE( + sciSendBytes(buf, (sizeof(buf) - 1), MUTEX_TIMEOUT, pdMS_TO_TICKS(SCI_SEMAPHORE_TIMEOUT_MS), UART_VN100_REG)); return OBC_ERR_CODE_SUCCESS; } @@ -99,7 +100,8 @@ obc_error_code_t vn100SetBaudrate(uint32_t baudrate) { size_t numBytes = headerLength + baudrateLength + checksumLength; - RETURN_IF_ERROR_CODE(sciSendBytes(buf, numBytes, MUTEX_TIMEOUT, pdMS_TO_TICKS(SCI_SEMAPHORE_TIMEOUT_MS), UART_VN100_REG)); + RETURN_IF_ERROR_CODE( + sciSendBytes(buf, numBytes, MUTEX_TIMEOUT, pdMS_TO_TICKS(SCI_SEMAPHORE_TIMEOUT_MS), UART_VN100_REG)); sciSetBaudrate(UART_VN100_REG, baudrate); return OBC_ERR_CODE_SUCCESS; } @@ -127,7 +129,8 @@ obc_error_code_t vn100SetOutputRate(uint32_t outputRateHz) { size_t numBytes = headerLength + freqLength + checksumLength; - RETURN_IF_ERROR_CODE(sciSendBytes(buf, numBytes, MUTEX_TIMEOUT, pdMS_TO_TICKS(SCI_SEMAPHORE_TIMEOUT_MS), UART_VN100_REG)); + RETURN_IF_ERROR_CODE( + sciSendBytes(buf, numBytes, MUTEX_TIMEOUT, pdMS_TO_TICKS(SCI_SEMAPHORE_TIMEOUT_MS), UART_VN100_REG)); return OBC_ERR_CODE_SUCCESS; } @@ -136,14 +139,14 @@ obc_error_code_t vn100StartBinaryOutputs(void) { Initialized to start with an output rate of 10Hz */ obc_error_code_t errCode; RETURN_IF_ERROR_CODE(sciSendBytes((unsigned char*)(START_BINARY_OUTPUTS), (sizeof(START_BINARY_OUTPUTS) - 1), - portMAX_DELAY, pdMS_TO_TICKS(SCI_SEMAPHORE_TIMEOUT_MS), UART_VN100_REG)); + portMAX_DELAY, pdMS_TO_TICKS(SCI_SEMAPHORE_TIMEOUT_MS), UART_VN100_REG)); return OBC_ERR_CODE_SUCCESS; } obc_error_code_t vn100StopBinaryOutputs(void) { obc_error_code_t errCode; RETURN_IF_ERROR_CODE(sciSendBytes((unsigned char*)(STOP_BINARY_OUTPUTS), (sizeof(STOP_BINARY_OUTPUTS) - 1), - portMAX_DELAY, pdMS_TO_TICKS(SCI_SEMAPHORE_TIMEOUT_MS), UART_VN100_REG)); + portMAX_DELAY, pdMS_TO_TICKS(SCI_SEMAPHORE_TIMEOUT_MS), UART_VN100_REG)); return OBC_ERR_CODE_SUCCESS; } @@ -164,13 +167,15 @@ obc_error_code_t vn100ReadBinaryOutputs(vn100_binary_packet_t* parsedPacket) { obc_error_code_t vn100PauseAsync(void) { obc_error_code_t errCode; unsigned char command[] = "$VNASY,0*XX\r\n"; - RETURN_IF_ERROR_CODE(sciSendBytes(command, (sizeof(command) - 1), MUTEX_TIMEOUT, pdMS_TO_TICKS(SCI_SEMAPHORE_TIMEOUT_MS), UART_VN100_REG)); + RETURN_IF_ERROR_CODE(sciSendBytes(command, (sizeof(command) - 1), MUTEX_TIMEOUT, + pdMS_TO_TICKS(SCI_SEMAPHORE_TIMEOUT_MS), UART_VN100_REG)); return OBC_ERR_CODE_SUCCESS; } obc_error_code_t vn100ResumeAsync(void) { obc_error_code_t errCode; unsigned char command[] = "$VNASY,1*XX\r\n"; - RETURN_IF_ERROR_CODE(sciSendBytes(command, (sizeof(command) - 1), MUTEX_TIMEOUT, pdMS_TO_TICKS(SCI_SEMAPHORE_TIMEOUT_MS), UART_VN100_REG)); + RETURN_IF_ERROR_CODE(sciSendBytes(command, (sizeof(command) - 1), MUTEX_TIMEOUT, + pdMS_TO_TICKS(SCI_SEMAPHORE_TIMEOUT_MS), UART_VN100_REG)); return OBC_ERR_CODE_SUCCESS; } diff --git a/obc/modules/comms_link_mgr/comms_manager.c b/obc/modules/comms_link_mgr/comms_manager.c index d074f3f52..40f40a589 100644 --- a/obc/modules/comms_link_mgr/comms_manager.c +++ b/obc/modules/comms_link_mgr/comms_manager.c @@ -391,7 +391,8 @@ static obc_error_code_t handleSendingConnState(void) { } obc_error_code_t errCode; #if COMMS_PHY == COMMS_PHY_UART - RETURN_IF_ERROR_CODE(sciSendBytes(connCmdPkt.data, (uint32_t)connCmdPkt.length, portMAX_DELAY, pdMS_TO_TICKS(100), UART_PRINT_REG)); + RETURN_IF_ERROR_CODE( + sciSendBytes(connCmdPkt.data, (uint32_t)connCmdPkt.length, portMAX_DELAY, pdMS_TO_TICKS(100), UART_PRINT_REG)); #else RETURN_IF_ERROR_CODE(rffm6404ActivateTx(RFFM6404_VAPC_REGULAR_POWER_VAL)); RETURN_IF_ERROR_CODE( @@ -410,7 +411,8 @@ static obc_error_code_t handleSendingDiscState(void) { } obc_error_code_t errCode; #if COMMS_PHY == COMMS_PHY_UART - RETURN_IF_ERROR_CODE(sciSendBytes(discCmdPkt.data, discCmdPkt.length, portMAX_DELAY, pdMS_TO_TICKS(100), UART_PRINT_REG)); + RETURN_IF_ERROR_CODE( + sciSendBytes(discCmdPkt.data, discCmdPkt.length, portMAX_DELAY, pdMS_TO_TICKS(100), UART_PRINT_REG)); #else RETURN_IF_ERROR_CODE(rffm6404ActivateTx(RFFM6404_VAPC_REGULAR_POWER_VAL)); RETURN_IF_ERROR_CODE(cc1120Send(discCmdPkt.data, discCmdPkt.length, CC1120_TX_FIFO_EMPTY_SEMAPHORE_TIMEOUT)); @@ -429,7 +431,8 @@ static obc_error_code_t handleSendingAckState(void) { obc_error_code_t errCode; #if COMMS_PHY == COMMS_PHY_UART - RETURN_IF_ERROR_CODE(sciSendBytes(ackCmdPkt.data, ackCmdPkt.length, portMAX_DELAY, pdMS_TO_TICKS(100), UART_PRINT_REG)); + RETURN_IF_ERROR_CODE( + sciSendBytes(ackCmdPkt.data, ackCmdPkt.length, portMAX_DELAY, pdMS_TO_TICKS(100), UART_PRINT_REG)); #else RETURN_IF_ERROR_CODE(rffm6404ActivateTx(RFFM6404_VAPC_REGULAR_POWER_VAL)); RETURN_IF_ERROR_CODE(cc1120Send(ackCmdPkt.data, ackCmdPkt.length, CC1120_TX_FIFO_EMPTY_SEMAPHORE_TIMEOUT));