5#include "DashboardInterface.h"
11 uint8_t* bytePtr = (uint8_t*)ptr;
12 for (
size_t i = 0; i < length; ++i) {
13 if (bytePtr[i] < 0x10) {
16 Serial.print(bytePtr[i], HEX);
28 for (
int i = 0; i < (1 << 10); ++i) {
29 DASHBOARD_STATE_t current_state;
30 current_state.start_button = (uint8_t)((i & (1 << 9)) >> 9);
31 current_state.mark_button = (uint8_t)((i & (1 << 8)) >> 8);
32 current_state.mode_button = (uint8_t)((i & (1 << 7)) >> 7);
33 current_state.motor_controller_cycle_button = (uint8_t)((i & (1 << 6)) >> 6);
34 current_state.launch_ctrl_button = (uint8_t)((i & (1 << 5)) >> 5);
35 current_state.torque_mode_button = (uint8_t)((i & (1 << 4)) >> 4);
36 current_state.led_dimmer_button = (uint8_t)((i & (1 << 3)) >> 3);
37 current_state.left_shifter_button = (uint8_t)((i & (1 << 2)) >> 2);
38 current_state.right_shifter_button = (uint8_t)((i & (1 << 1)) >> 1);
39 current_state.shutdown_h_above_threshold = (uint8_t)(i & 1);
42 msg.id= Pack_DASHBOARD_STATE_hytech(¤t_state,
msg.buf, &
msg.len, (uint8_t*) &
msg.flags.extended);
110 CAN_message_t packed_message = dash_interface.
write();
112 uint8_t buffer[
sizeof(CAN_message_t)];
113 dash_CAN_buffer_2.pop_front(buffer,
sizeof(CAN_message_t));
117 Serial.println(
"Printing packed message:");
119 Serial.println(
"Printing popped message");
123 memmove(&
msg, buffer,
sizeof(CAN_message_t));
125 Serial.println(
"Printing moved message:");
128 TEST_ASSERT_EQUAL_MEMORY(&packed_message, &
msg,
sizeof(CAN_message_t));
130 DASHBOARD_MCU_STATE_t mcu_state;
132 Unpack_DASHBOARD_MCU_STATE_hytech(&mcu_state,
msg.buf, NULL);
Circular_Buffer< uint8_t,(uint32_t) 128, sizeof(CAN_message_t)> CANBufferType
bool launchControlButtonPressed()
void read(const CAN_message_t &can_msg)
bool rightShifterButtonPressed()
void setLED(DashLED_e led, LEDColors_e color)
bool torqueModeButtonPressed()
bool nightModeButtonPressed()
bool inverterResetButtonPressed()
bool specialButtonPressed()
bool startButtonPressed()
bool torqueLoadingButtonPressed()
bool shutdownHAboveThreshold()
bool leftShifterButtonPressed()
void test_dashboard_circular_buffer(void)
void printMemoryHex(void *ptr, size_t length)
CANBufferType dash_CAN_buffer
void test_dashboard_unpacking_can_message(void)