Skip to content

Commit

Permalink
Run pre-commit formatting.
Browse files Browse the repository at this point in the history
  • Loading branch information
twilkhoo committed Feb 1, 2024
1 parent b78e8ff commit 9c04f4f
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 12 deletions.
4 changes: 2 additions & 2 deletions obc/drivers/rm46/obc_sci_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down Expand Up @@ -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) {
Expand Down
19 changes: 12 additions & 7 deletions obc/drivers/vn100/vn100.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}

Expand All @@ -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;
}

Expand All @@ -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;
}
9 changes: 6 additions & 3 deletions obc/modules/comms_link_mgr/comms_manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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));
Expand All @@ -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));
Expand Down

0 comments on commit 9c04f4f

Please sign in to comment.