Skip to content

Commit

Permalink
Merge pull request #725 from ut-issl/main
Browse files Browse the repository at this point in the history
Main merge to develop for v8.0.3 update
  • Loading branch information
200km authored Dec 13, 2024
2 parents 8361399 + a413790 commit ed863e6
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 26 deletions.
4 changes: 0 additions & 4 deletions src/components/real/cdh/c2a_communication.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
#ifndef C2A_COMMUNICATION_H_
#define C2A_COMMUNICATION_H_

namespace s2e::components {

// If the character encoding of C2A is UTF-8, the following functions are not necessary,
// and users can directory use SendFromObc_C2A and ReceivedByObc_C2A UART
// TODO: Delete these functions since C2A is changed to use UTF-8
Expand All @@ -25,6 +23,4 @@ int OBC_C2A_I2cReadRegister(int port_id, const unsigned char i2c_address, unsign
int OBC_C2A_GpioWrite(int port_id, const bool is_high);
bool OBC_C2A_GpioRead(int port_id); // return false when the port_id is not used

} // namespace s2e::components

#endif // C2A_COMMUNICATION_H_
45 changes: 23 additions & 22 deletions src/components/real/cdh/on_board_computer_with_c2a.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,15 +133,6 @@ int ObcWithC2a::ReceivedByObc_C2A(int port_id, unsigned char* buffer, int offset
return port->ReadRx(buffer, offset, length);
}

// If the character encoding of C2A is UTF-8, these functions are not necessary,
// and users can directory use SendFromObc_C2A and ReceivedByObc_C2A
int OBC_C2A_SendFromObc(int port_id, unsigned char* buffer, int offset, int length) {
return ObcWithC2a::SendFromObc_C2A(port_id, buffer, offset, length);
}
int OBC_C2A_ReceivedByObc(int port_id, unsigned char* buffer, int offset, int length) {
return ObcWithC2a::ReceivedByObc_C2A(port_id, buffer, offset, length);
}

int ObcWithC2a::I2cConnectPort(int port_id, const unsigned char i2c_address) {
if (i2c_com_ports_c2a_[port_id] != nullptr) {
// Port already used
Expand Down Expand Up @@ -212,16 +203,6 @@ int ObcWithC2a::I2cComponentReadCommand(int port_id, const unsigned char i2c_add
return 0;
}

int OBC_C2A_I2cWriteCommand(int port_id, const unsigned char i2c_address, const unsigned char* data, const unsigned char length) {
return ObcWithC2a::I2cWriteCommand(port_id, i2c_address, data, length);
}
int OBC_C2A_I2cWriteRegister(int port_id, const unsigned char i2c_address, const unsigned char* data, const unsigned char length) {
return ObcWithC2a::I2cWriteRegister(port_id, i2c_address, data, length);
}
int OBC_C2A_I2cReadRegister(int port_id, const unsigned char i2c_address, unsigned char* data, const unsigned char length) {
return ObcWithC2a::I2cReadRegister(port_id, i2c_address, data, length);
}

int ObcWithC2a::GpioConnectPort(int port_id) {
if (gpio_ports_c2a_[port_id] != nullptr) {
// Port already used
Expand Down Expand Up @@ -255,8 +236,28 @@ bool ObcWithC2a::GpioRead_C2A(int port_id) {
return port->DigitalRead();
}

int OBC_C2A_GpioWrite(int port_id, const bool is_high) { return ObcWithC2a::GpioWrite_C2A(port_id, is_high); }
} // namespace s2e::components

bool OBC_C2A_GpioRead(int port_id) { return ObcWithC2a::GpioRead_C2A(port_id); }
// C2A用
// If the character encoding of C2A is UTF-8, these functions are not necessary,
// and users can directory use SendFromObc_C2A and ReceivedByObc_C2A
int OBC_C2A_SendFromObc(int port_id, unsigned char* buffer, int offset, int length) {
return s2e::components::ObcWithC2a::SendFromObc_C2A(port_id, buffer, offset, length);
}
int OBC_C2A_ReceivedByObc(int port_id, unsigned char* buffer, int offset, int length) {
return s2e::components::ObcWithC2a::ReceivedByObc_C2A(port_id, buffer, offset, length);
}

} // namespace s2e::components
int OBC_C2A_I2cWriteCommand(int port_id, const unsigned char i2c_address, const unsigned char* data, const unsigned char length) {
return s2e::components::ObcWithC2a::I2cWriteCommand(port_id, i2c_address, data, length);
}
int OBC_C2A_I2cWriteRegister(int port_id, const unsigned char i2c_address, const unsigned char* data, const unsigned char length) {
return s2e::components::ObcWithC2a::I2cWriteRegister(port_id, i2c_address, data, length);
}
int OBC_C2A_I2cReadRegister(int port_id, const unsigned char i2c_address, unsigned char* data, const unsigned char length) {
return s2e::components::ObcWithC2a::I2cReadRegister(port_id, i2c_address, data, length);
}

int OBC_C2A_GpioWrite(int port_id, const bool is_high) { return s2e::components::ObcWithC2a::GpioWrite_C2A(port_id, is_high); }

bool OBC_C2A_GpioRead(int port_id) { return s2e::components::ObcWithC2a::GpioRead_C2A(port_id); }

0 comments on commit ed863e6

Please sign in to comment.