Sending struct through queue

63 Views Asked by At

Can someone help me figure out why this struct isn't being properly received over a queue in FreeRTOS I've looked through almost every post on this topic and can't get it to work.

typedef struct {
int id;
char* name;
} message;

void Start_Init(void *argument)
{
  /* init code for USB_DEVICE */
  MX_USB_DEVICE_Init();
  message mes;
  /* USER CODE BEGIN 5 */
  /* Infinite loop */
  for(;;)
  {
    Screen HOME;
    mes.id=77;
    mes.name = "test";
    SCREEN_INIT(&HOME,7,6,(char**)HOME_SCREEN,HOME_DATLOC,HOME_SEL);
    vTaskSuspend(ReadCardHandle);
    vTaskSuspend(WriteCardHandle);
    vTaskSuspend(HomeHandle);
    MFRC_INIT();
    MFRC_ANTOFF();
    OLED_INIT();
    OLED_Print(TC);
    while(HAL_GPIO_ReadPin(GPIOA, GPIO_PIN_1)!=0);
    xQueueSend(DisplayDataHandle,&mes,portMAX_DELAY); //sending test message here
    osDelay(100);
    vTaskSuspend(NULL);
  }
  /* USER CODE END 5 */

  void StartUpdateDisplay(void *argument)
{
  /* USER CODE BEGIN StartUpdateDisplay */
    message rec;
  /* Infinite loop */
  for(;;)
  {
    xQueueReceive(DisplayDataHandle, &rec, portMAX_DELAY); //Receive from queue here
    osDelay(1);
  }
  /* USER CODE END StartUpdateDisplay */
}
}

In debugging this is the state of rec:

enter image description here

0

There are 0 best solutions below