Formula Student Electronics & Software
The code for the embedded software
Loading...
Searching...
No Matches
utils.hpp
Go to the documentation of this file.
1
2#include <Arduino.h>
4
8void create_left_wheel_msg(uint8_t *msg, double value) {
9 value /= WHEEL_PRECISION; // take precision off to send integer value
10 if (value < 0) value = 0;
11
13 // Copy the bytes of the double value to msg[1] to msg[4]
14 for (int i = 0; i < 4; i++)
15 msg[i + 1] = static_cast<int>(value) >> (8*i); // shift 8(byte) to msb each time
16}
constexpr auto LEFT_WHEEL_MSG
constexpr auto WHEEL_PRECISION
CAN_message_t msg
void create_left_wheel_msg(uint8_t *msg, double value)
Function to create left wheel msg.
Definition utils.hpp:8