Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
10 years, 7 months ago.
RawSerial should add one function of as WriteBytes(const uint8_t* buf, int len)
I thought that RawSerial should add one function like WriteBytes(const uint8_t* buf, int len), it will be usefull. BTW, can the printf change implementation method without using vsnprintf(NULL, 0...), 'Cos it didn't support by most of MCUs.
Question relating to:
2 Answers
10 years, 6 months ago.
I would recommend the signatures:
write(const void* source_buffer, size_t length); read(void* destination_buffer, size_t length);
This allows arbitrary data structures to be sent or received without any casting, eg:
struct MyDataPacket {
// My Data Packet Fields
uint32_t field1;
int64_t field2;
// More fields as needed
}
// Fill MyDataPacket
MyDataPacket data;
data.field1 = value;
data.field2 = othervalue;
// etc...
// Send MyDataPacket
rawserial.write(&data, sizeof(data));
10 years, 6 months ago.
Hello,
any contribution is more than welcome, send a pull request to mbed github repository (link below) with proposed changes, where we can review, test and merge ,plus discuss the implementation.
mbed SDK https://github.com/mbedmicro/mbed
Regards,
0xc0170