Parse CAN messges

This commit is contained in:
2023-03-18 21:44:01 +01:00
parent 148ab2b69c
commit 5fe5d509a4
16 changed files with 269 additions and 74 deletions

View File

@ -67,6 +67,7 @@ TX_THREAD app_thread;
TX_THREAD ui_thread;
TX_THREAD vehicle_thread;
TX_QUEUE gui_button_queue;
TX_QUEUE vehicle_update_queue;
/* USER CODE END PV */
/* Private function prototypes -----------------------------------------------*/
@ -181,10 +182,23 @@ VOID tx_application_define(VOID *first_unused_memory) {
Error_Handler();
}
void *vehicle_update_queue_start = mem;
ULONG vehicle_update_msg_size = sizeof(VehicleUpdate) / sizeof(ULONG);
if (sizeof(VehicleUpdate) % sizeof(ULONG) != 0) {
vehicle_update_msg_size++;
}
mem += VEHICLE_UPDATE_QUEUE_SIZE * vehicle_update_msg_size;
if (tx_queue_create(&vehicle_update_queue, "Vehicle Update Queue",
vehicle_update_msg_size, vehicle_update_queue_start,
VEHICLE_UPDATE_QUEUE_SIZE * vehicle_update_msg_size) !=
TX_SUCCESS) {
Error_Handler();
}
void *vehicle_thread_stack = mem;
mem += THREAD_STACK_SIZE;
ULONG hfdcan_addr = (ULONG)&hfdcan1;
if (tx_thread_create(&vehicle_thread, "Vehicle Thread", vehicle_thread_entry,
&hfdcan1, vehicle_thread_stack, THREAD_STACK_SIZE,
hfdcan_addr, vehicle_thread_stack, THREAD_STACK_SIZE,
THREAD_PRIO_VEHICLE, THREAD_PRIO_VEHICLE, 0,
TX_AUTO_START) != TX_SUCCESS) {
Error_Handler();

View File

@ -47,6 +47,7 @@ extern "C" {
#define THREAD_PRIO_UI 6
#define THREAD_PRIO_VEHICLE 7
#define UI_QUEUE_SIZE 10
#define VEHICLE_UPDATE_QUEUE_SIZE 100
/* USER CODE END EC */
/* Exported macro ------------------------------------------------------------*/