summaryrefslogtreecommitdiffstats
path: root/low-can-binding/can/message/message.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'low-can-binding/can/message/message.cpp')
-rw-r--r--low-can-binding/can/message/message.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/low-can-binding/can/message/message.cpp b/low-can-binding/can/message/message.cpp
index 22887c9a..56e9379f 100644
--- a/low-can-binding/can/message/message.cpp
+++ b/low-can-binding/can/message/message.cpp
@@ -177,3 +177,14 @@ void message_t::set_length(uint32_t length)
{
length_ = length;
}
+
+void message_t::frame_swap()
+{
+ int i;
+ uint8_t *temp = (uint8_t*)alloca(length_);
+
+ for(i = 0; i < length_; i++)
+ temp[i] = data_[length_ - i - 1];
+
+ memcpy(data_.data(), temp, length_);
+}